home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c081_11 / 1.ddi / CLASSINC.ZIP / DICT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-13  |  3.2 KB  |  151 lines

  1. // Borland C++ - (C) Copyright 1991 by Borland International
  2.  
  3. // Contents ----------------------------------------------------------------
  4. //
  5. //         Dictionary
  6. //
  7. // Description
  8. //
  9. //         Defines the class Dictionary.  Dictionary holds a set of objects
  10. //         of type Association, which each contain a key and a value.
  11. //         Dictionary uses the key to look up the associated value.
  12. //
  13. // End ---------------------------------------------------------------------
  14.  
  15. // Interface Dependencies ---------------------------------------------------
  16.  
  17. #ifndef __DICT_H
  18. #define __DICT_H
  19.  
  20. #ifndef __STDLIB_H
  21. #include <stdlib.h>
  22. #define __STDLIB_H
  23. #endif
  24.  
  25. #ifndef __IOSTREAM_H
  26. #include <iostream.h>
  27. #define __IOSTREAM_H
  28. #endif
  29.  
  30. #ifndef __CLSTYPES_H
  31. #include <clstypes.h>
  32. #endif
  33.  
  34. #ifndef __CLSDEFS_H
  35. #include <clsdefs.h>
  36. #endif
  37.  
  38. #ifndef __OBJECT_H
  39. #include <object.h>
  40. #endif
  41.  
  42. #ifndef __ASSOC_H
  43. #include <assoc.h>
  44. #endif
  45.  
  46. #ifndef __SET_H
  47. #include <set.h>
  48. #endif
  49.  
  50. // End Interface Dependencies ------------------------------------------------
  51.  
  52.  
  53. // Class //
  54.  
  55. class Dictionary : public Set
  56. {
  57. public:
  58.             Dictionary() {}
  59.             Dictionary( Dictionary& );
  60.     virtual ~Dictionary();
  61.  
  62.     virtual void            add( Object& );
  63.             Association&    lookup( const Object& ) const;
  64.  
  65.     virtual classType       isA() const;
  66.     virtual char           *nameOf() const;
  67. };
  68.  
  69. // Description -------------------------------------------------------------
  70. //
  71. //         Defines the class Dictionary.  Dictionary holds a set of objects
  72. //         of type Association, which each contain a key and a value.
  73. //         Dictionary uses the key to look up the associated value.
  74. //
  75. // Constructor
  76. //
  77. //         Dictionary
  78. //
  79. //         Default constructor.
  80. //
  81. // Destructor
  82. //
  83. //         ~Dictionary
  84. //
  85. // Public Members
  86. //
  87. //      add
  88. //
  89. //      Adds an object to the collection.
  90. //
  91. //         lookup
  92. //
  93. //         Converts an object to an association with no value, then finds
  94. //         that association in the dictionary.
  95. //
  96. //         isA
  97. //
  98. //         Returns the class type of dictionary.
  99. //
  100. //         nameOf
  101. //
  102. //         Returns a character pointer to the string "Dictionary."
  103. //
  104. //         hashValue
  105. //
  106. //         Inherited from Object.
  107. //
  108. // Inherited Members
  109. //
  110. //      destroy
  111. //
  112. //      Removes an object reference from the collection and
  113. //      destroys the object.
  114. //
  115. //         detach
  116. //
  117. //         Removes all references to the object in the collection.
  118. //      Does not delete the object.  Use this function when the collection
  119. //      elements are not owned by the collection.
  120. //
  121. //         lookup
  122. //
  123. //         Inherited from HashTable.
  124. //
  125. //      hasMember
  126. //
  127. //         Test whether an object is part of the collection.  Returns 1 if
  128. //      the object reference is found in the array.
  129. //
  130. //         initIterator
  131. //
  132. //         Inherited from HashTable.
  133. //
  134. //         isEmpty
  135. //
  136. //         Returns a 1 if the collection has no members.  Returns a 0
  137. //         otherwise.
  138. //
  139. //      firstThat
  140. //
  141. //      Returns the first object that satisfies the given condition.
  142. //
  143. //      lastThat
  144. //
  145. //      Returns the last object that satisfies the given condition.
  146. //
  147. // End ---------------------------------------------------------------------
  148.  
  149.  
  150. #endif // ifndef __DICT_H //
  151.