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

  1. /*------------------------------------------------------------------------*/
  2. /*                                                                        */
  3. /*  SET.H                                                                 */
  4. /*                                                                        */
  5. /*  Copyright Borland International 1991, 1992                            */
  6. /*  All Rights Reserved                                                   */
  7. /*                                                                        */
  8. /*------------------------------------------------------------------------*/
  9.  
  10. #if !defined( __SET_H )
  11. #define __SET_H
  12.  
  13. #if defined( TEMPLATES )
  14.  
  15.     #if !defined( __SETS_H )
  16.     #include <Sets.h>
  17.     #endif  // __SETS_H
  18.  
  19.     #pragma option -Vo-
  20.     #if defined( __BCOPT__ ) && !defined( _ALLOW_po )
  21.     #pragma option -po-
  22.     #endif
  23.  
  24.     #define Set   BI_TCSetAsVector
  25.     #define PSet  PBI_TCSetAsVector
  26.     #define RSet  RBI_TCSetAsVector
  27.     #define RPSet RPBI_TCSetAsVector
  28.     #define PCSet PCBI_TCSetAsVector
  29.     #define RCSet RCBI_TCSetAsVector
  30.  
  31.     _CLASSDEF( BI_TCSetAsVector )
  32.  
  33.     #define SetIterator   BI_TCSetAsVectorIterator
  34.     #define PSetIterator  PBI_TCSetAsVectorIterator
  35.     #define RSetIterator  RBI_TCSetAsVectorIterator
  36.     #define RPSetIterator RPBI_TCSetAsVectorIterator
  37.     #define PCSetIterator PCBI_TCSetAsVectorIterator
  38.     #define RCSetIterator RCBI_TCSetAsVectorIterator
  39.  
  40.     _CLASSDEF( BI_TCSetAsVectorIterator )
  41.  
  42. #else   // TEMPLATES
  43.  
  44.     #if !defined( __RESOURCE_H )
  45.     #include <Resource.h>
  46.     #endif  // __RESOURCE_H
  47.  
  48.     #if !defined( __CLSTYPES_H )
  49.     #include <ClsTypes.h>
  50.     #endif  // __CLSTYPES_H
  51.  
  52.     #if !defined( __BAG_H )
  53.     #include <Bag.h>
  54.     #endif  // __BAG_H
  55.  
  56.     _CLASSDEF(Set)
  57.  
  58.     class _CLASSTYPE Set : public Bag
  59.     {
  60.  
  61.     public:
  62.  
  63.         Set( sizeType setSize = DEFAULT_SET_SIZE ) :
  64.             Bag( setSize )
  65.             {
  66.             }
  67.  
  68.         virtual void add( Object _FAR & toAdd )
  69.             {
  70.             if( !(Bag::hasMember( toAdd )) )
  71.                 {
  72.                 Bag::add( toAdd );
  73.                 }
  74.             }
  75.         virtual classType isA() const
  76.             {
  77.             return setClass;
  78.             }
  79.  
  80.         virtual char _FAR *nameOf() const
  81.             {
  82.             return "Set";
  83.             }
  84.  
  85.     };
  86.  
  87. #endif  // TEMPLATES
  88.  
  89. #if defined( __BCOPT__ ) && !defined( _ALLOW_po )
  90. #pragma option -po.
  91. #endif
  92. #pragma option -Vo.
  93.  
  94. #endif  // __SET_H
  95.  
  96.