home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 2.ddi / CLASSINC.ZIP / ASSOC.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  2.2 KB  |  98 lines

  1. /*------------------------------------------------------------------------*/
  2. /*                                                                        */
  3. /*  ASSOC.H                                                               */
  4. /*                                                                        */
  5. /*  Copyright Borland International 1991, 1992                            */
  6. /*  All Rights Reserved                                                   */
  7. /*                                                                        */
  8. /*------------------------------------------------------------------------*/
  9.  
  10. #if !defined( __ASSOC_H )
  11. #define __ASSOC_H
  12.  
  13. #if !defined( __CLSTYPES_H )
  14. #include <ClsTypes.h>
  15. #endif  // __CLSTYPES_H
  16.  
  17. #if !defined( __OBJECT_H )
  18. #include <Object.h>
  19. #endif  // __OBJECT_H
  20.  
  21. #if !defined( __SHDDEL_H )
  22. #include <ShdDel.h>
  23. #endif  // __SHDDEL_H
  24.  
  25. #pragma option -Vo-
  26. #if defined( __BCOPT__ ) && !defined( _ALLOW_po )
  27. #pragma option -po-
  28. #endif
  29.  
  30. _CLASSDEF(ostream)
  31. _CLASSDEF(Association)
  32.  
  33. class _CLASSTYPE Association : public Object, public virtual TShouldDelete
  34. {
  35.  
  36. public:
  37.  
  38.     Association( Object _FAR & k, Object _FAR & v ) :
  39.         aKey( k ),
  40.         aValue( v )
  41.         {
  42.         }
  43.  
  44.     Association( const Association _FAR & a ) :
  45.         aKey(a.aKey),
  46.         aValue(a.aValue)
  47.         {
  48.         }
  49.  
  50.     virtual ~Association();
  51.  
  52.     Object _FAR & key() const
  53.         {
  54.         return aKey;
  55.         }
  56.  
  57.     Object _FAR & value() const
  58.         {
  59.         return aValue;
  60.         }
  61.  
  62.     virtual classType isA() const
  63.         {
  64.         return associationClass;
  65.         }
  66.  
  67.     virtual char _FAR *nameOf() const
  68.         {
  69.         return "Association";
  70.         }
  71.  
  72.     virtual hashValueType hashValue() const
  73.         {
  74.         return aKey.hashValue();
  75.         }
  76.  
  77.     virtual int isEqual( const Object _FAR & ) const;
  78.     virtual int isAssociation() const
  79.         {
  80.         return 1;
  81.         }
  82.  
  83.     virtual void printOn( ostream _FAR & ) const;
  84.  
  85. private:
  86.  
  87.     Object _FAR & aKey;
  88.     Object _FAR & aValue;
  89.  
  90. };
  91.  
  92. #if defined( __BCOPT__ ) && !defined( _ALLOW_po )
  93. #pragma option -po.
  94. #endif
  95. #pragma option -Vo.
  96.  
  97. #endif
  98.