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 / ASSOC.H < prev    next >
C/C++ Source or Header  |  1990-09-26  |  3KB  |  109 lines

  1. #ifndef __ASSOC_H
  2. #define __ASSOC_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. //         Association
  18. //         Association::Association
  19. //         Association::Association                    copy constructor
  20. //
  21. // Description
  22. //
  23. //         Defines the class Association, which is an object that can
  24. //         be stored in a Dictionary.  An Association contains references
  25. //         to two Objects, a Key and a Value.
  26. //
  27. // End ---------------------------------------------------------------------
  28.  
  29. // Interface Dependencies ---------------------------------------------------
  30.  
  31. #ifndef __IOSTREAM_H
  32. #include <iostream.h>
  33. #define __IOSTREAM_H
  34. #endif
  35.  
  36. #ifndef __CLSTYPES_H
  37. #include <clstypes.h>
  38. #define __CLSTYPES_H
  39. #endif
  40.  
  41. #ifndef __OBJECT_H
  42. #include <object.h>
  43. #define __OBJECT_H
  44. #endif
  45.  
  46. // End Interface Dependencies ------------------------------------------------
  47.  
  48. // Class //
  49.  
  50. class Association : public Object
  51. {
  52. public:
  53.             Association( Object& k, Object& v ) : aKey( k ), aValue( v ) {}
  54.             Association( const Association& a ) :
  55.                                     aKey( a.key() ), aValue( a.value() ) {}
  56.     virtual ~Association();
  57.  
  58.             Object&         key() const { return aKey; }
  59.             Object&         value() const { return aValue; }
  60.  
  61.     virtual classType       isA() const;
  62.     virtual char           *nameOf() const;
  63.     virtual hashValueType   hashValue() const;
  64.     virtual int             isEqual( const Object& ) const;
  65.     virtual int             isAssociation() const;
  66.     virtual void            printOn( ostream& ) const;
  67.  
  68. private:
  69.             Object&            aKey;
  70.             Object&            aValue;
  71. };
  72.  
  73. // Description -------------------------------------------------------------
  74. //
  75. //         Defines an association class.  An association keeps two objects
  76. //         together and treats them as a single object.
  77. //
  78. // Constructors
  79. //
  80. //         Association( Object& k, Object& v )
  81. //
  82. //         Constructor from two objects.
  83. //
  84. //         Association( Association& a )
  85. //
  86. //         Copy constructor.
  87. //
  88. // Public Members
  89. //
  90. //         key
  91. //
  92. //         Returns a reference to the key
  93. //
  94. //         value
  95. //
  96. //         Returns a reference to the value of the association.
  97. //
  98. // Private Members
  99. //
  100. //      aKey
  101. //
  102. //      aValue
  103. //
  104. // End ---------------------------------------------------------------------
  105.  
  106.  
  107. #endif // ifndef __ASSOC_H //
  108.  
  109.