home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD 24 / PCPLUS115.iso / pcplus / tclite / include / collect.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-28  |  1.6 KB  |  51 lines

  1. #ifndef    COLLECTION_H
  2. #define    COLLECTION_H
  3.  
  4. #include "object.h"
  5.  
  6.     // default initial collection capacity
  7. const unsigned CLTN_DEFAULT_CAPACITY    = 16;
  8.     // collection (OrderedCltn) expansion increment
  9. const unsigned CLTN_EXPANSION_INCREMENT = 32;
  10.     // collection (Set,Bag,Dictionary) expansion factor
  11. const unsigned CLTN_EXPANSION_FACTOR = 2;
  12.  
  13. class ArrayOb;
  14. class Bag;
  15. class Iterator;
  16. class OrderedCltn;
  17. class Set;
  18. class SortedCltn;
  19.  
  20. extern const Class class_Collection;
  21.  
  22. class Collection: public Object {    // abstract class 
  23. protected:
  24.     Collection() {}
  25. public:
  26.     ArrayOb asArrayOb() const;
  27.     Bag                 asBag() const;
  28.     OrderedCltn   asOrderedCltn() const;
  29.     Set                 asSet() const;
  30.     SortedCltn    asSortedCltn() const;
  31.     virtual Object*     add(const Object&);
  32.     virtual const Collection& addAll(const Collection&);
  33.     virtual Collection& addContentsTo(Collection&) const;
  34.     virtual Object*&    at(int) const;
  35.     virtual void        deepenShallowCopy();
  36.     virtual Object*     doNext(Iterator& pos) const;
  37.     virtual void        doReset(Iterator& pos) const;
  38.     virtual bool        includes(const Object&) const;
  39.     virtual const Class*    isA() const const;
  40.     virtual bool        isEmpty() const;
  41.     virtual unsigned    occurrencesOf(const Object&) const;
  42.     virtual Object*     remove(const Object&);
  43.     virtual const Collection& removeAll(const Collection&);
  44.     virtual Object*     shallowCopy() const;      // shouldNotImplement
  45.     virtual unsigned    size() const;
  46. };
  47.  
  48. #include "Iterator.h"
  49.  
  50. #endif
  51.