home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / OTHERUTI / TCPP10-8.ZIP / CLASSINC.ZIP / COLLECT.H < prev    next >
C/C++ Source or Header  |  1990-09-26  |  4KB  |  154 lines

  1. #ifndef __COLLECT_H
  2. #define __COLLECT_H
  3.  
  4. //
  5. // This file contains proprietary information of Borland International.
  6. // Copying or reproduction without prior written approval is prohibited.
  7. //
  8. // Copyright (c) 1990
  9. // Borland International
  10. // 1800 Scotts Valley Dr.
  11. // Scotts Valley, CA 95066
  12. // (408) 438-8400
  13. //
  14.  
  15. // Contents ----------------------------------------------------------------
  16. //
  17. //      Collection
  18. //
  19. // Description
  20. //
  21. //      Defines the abstract class Collection.  Collections group objects
  22. //      together and specify operations.
  23. //
  24. // End ---------------------------------------------------------------------
  25.  
  26. // Interface Dependencies ---------------------------------------------------
  27.  
  28. #ifndef __IOSTREAM_H
  29. #include <iostream.h>
  30. #define __IOSTREAM_H
  31. #endif
  32.  
  33. #ifndef __CLSTYPES_H
  34. #include <clstypes.h>
  35. #endif
  36.  
  37. #ifndef __OBJECT_H
  38. #include <object.h>
  39. #endif
  40.  
  41. #ifndef __CONTAIN_H
  42. #include <contain.h>
  43. #endif
  44.  
  45. // End Interface Dependencies ------------------------------------------------
  46.  
  47. // Class //
  48.  
  49. class Collection:  public Container
  50. {
  51. public:
  52.     virtual ~Collection();
  53.  
  54.     virtual void            add( Object& ) = 0;
  55.     virtual void            detach( const Object&, int = 0 ) = 0;
  56.     virtual int             hasMember( const Object& ) const;
  57.     virtual Object&         findMember( const Object& ) const;
  58.     virtual ContainerIterator& initIterator() const = 0;
  59.  
  60.             void            destroy( const Object& o ) { detach( o, 1 ); }
  61.  
  62.     virtual classType       isA() const = 0;
  63.     virtual char           *nameOf() const = 0;
  64.     virtual hashValueType   hashValue() const = 0;
  65. };
  66.  
  67. // Description -------------------------------------------------------------
  68. //
  69. //         Defines the abstract class Collection.  A Collection is a 
  70. //      grouping of objects on which addition and deletion of objects
  71. //      may occur.  In addition, a Collection supports a membership test.
  72. //      
  73. // Public Members
  74. //
  75. //      add
  76. //
  77. //      Adds an object to the collection.
  78. //
  79. //      destroy
  80. //
  81. //      Removes an object reference from the collection and
  82. //      destroys the object.
  83. //
  84. //         detach
  85. //
  86. //         Removes all references to the object in the collection.
  87. //      Does not delete the object.  Use this function when the collection
  88. //      elements are not owned by the collection.
  89. //
  90. //      hasMember
  91. //
  92. //         Test whether an object is part of the collection.  Returns 1 if
  93. //      the object reference is found in the array.
  94. //
  95. //      findMember
  96. //
  97. //         Test whether an object is part of the collection.  Returns a
  98. //         reference to the object in the collection if the object is found.
  99. //
  100. //         initIterator
  101. //
  102. //         Iterator initializer.  Redeclared as pure virtual.
  103. //
  104. //         isA
  105. //
  106. //         Redeclared as pure virtual.
  107. //
  108. //         nameOf
  109. //
  110. //         Redeclared as pure virtual.
  111. //     
  112. //         hashValue
  113. //
  114. //         Redeclared as pure virtual.
  115. //
  116. //  Inherited Members
  117. //
  118. //         isEmpty
  119. //
  120. //         Inherited from Container.
  121. //
  122. //         forEach
  123. //
  124. //         Inherited from Container.
  125. //
  126. //      firstThat
  127. //
  128. //         Inherited from Container.
  129. //
  130. //      lastThat
  131. //
  132. //         Inherited from Container.
  133. //
  134. //         printOn
  135. //
  136. //         Inherited from Container.
  137. //
  138. //      isEqual
  139. //
  140. //         Inherited from Container.
  141. //
  142. //         isSortable
  143. //
  144. //         Inherited from Object.
  145. //
  146. //         isAssociation
  147. //
  148. //         Inherited from Object.
  149. //
  150. // End ---------------------------------------------------------------------
  151.  
  152.  
  153. #endif // ifndef __COLLECT_H //
  154.