home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / DTTYPE.HPP < prev    next >
C/C++ Source or Header  |  1996-11-21  |  3KB  |  111 lines

  1. #ifndef _DTTYPE_HPP
  2. #define _DTTYPE_HPP
  3.  
  4. struct MMTypeData;
  5. class  SaveSource;
  6. class  SaveItem;
  7. class  MMBoolType;
  8.  
  9. enum DT_Textify {
  10.     DTT_SaveFile  = 0,
  11.     DTT_PropSheet = 1,
  12.     DTT_GenCode   = 2,
  13. };
  14.  
  15. class DTObject;
  16.  
  17. class METACLASSDEF DTType : public WObject {
  18.     WDeclareSubclass( DTType, WObject );
  19.  
  20.     public:
  21.         DTType( const MMType * imp );
  22.         virtual ~DTType() = 0;
  23.  
  24.         virtual WBool       MakeVariable( const WString & varname,
  25.                                           WString & out );
  26.     
  27.         virtual WBool       Textify( WString &, DT_Textify vbl ) const = 0;
  28.         virtual WBool       DeTextify( const WString &, DT_Textify vbl ) = 0;
  29.  
  30.         virtual WBool       Save( const char *, SaveSource & save ) const;
  31.         virtual WBool       Load( SaveItem * item );
  32.  
  33.         virtual WBool       operator==( const DTType & o ) = 0;
  34.         virtual WBool       Browse( WWindow * parent, DTObject * obj );
  35.  
  36.         virtual WUInt       GetNumValues();
  37.         virtual WString     GetValue( WUInt i );
  38.  
  39.         virtual const MMType *  GetData() const;
  40.  
  41.     private:
  42.         const MMType *  _data;
  43.  
  44. #ifdef _DEBUG
  45.     public:
  46.         static unsigned     GetNumAllocs();
  47.     private:
  48.         static unsigned     _NumAllocs;
  49. #endif
  50. };
  51.  
  52. class METACLASSDEF DTBoolType : public DTType {
  53.     WDeclareSubclass( DTBoolType, DTType );
  54.  
  55.     public:
  56.         DTBoolType( const MMType * imp );
  57.         ~DTBoolType();
  58.  
  59.         virtual WBool       MakeVariable( const WString & varname,
  60.                                           WString & out );
  61.     
  62.         virtual WBool       Textify( WString &, DT_Textify ) const;
  63.         virtual WBool       DeTextify( const WString &, DT_Textify );
  64.  
  65.         virtual WBool       operator==( const DTType & o );
  66.  
  67.         virtual WBool       Set( WBool val );
  68.         virtual WBool       Get() const;
  69.  
  70.         static DTType *     MakeDTBool( const MMType * );
  71.         static DTType *     Instantiate( const MMType * mm ) { return MakeDTBool( mm ); }
  72.  
  73.         virtual MMType * GetData() const;
  74.  
  75.         virtual WUInt       GetNumValues();
  76.         virtual WString     GetValue( WUInt i );
  77.  
  78.     private:
  79.         const MMBoolType *      _data;
  80.         WBool                   _value;
  81. };
  82.  
  83. class METAEXPORTCLASSDEF DTEnumType : public DTType {
  84.     WDeclareSubclass( DTEnumType, DTType );
  85.  
  86.     public:
  87.         DTEnumType( const MMType * imp );
  88.  
  89.         virtual WBool       MakeVariable( const WString & varname,
  90.                                           WString & out );
  91.     
  92.         virtual WBool       Textify( WString &, DT_Textify ) const;
  93.         virtual WBool       DeTextify( const WString &, DT_Textify );
  94.  
  95.         virtual WBool       operator==( const DTType & o );
  96.  
  97.         virtual WBool       Set( long val );
  98.         virtual WLong       Get() const;
  99.  
  100.         virtual WUInt       GetNumValues();
  101.         virtual WString     GetValue( WUInt i );
  102.  
  103.         static DTType *     MakeDTEnumType( const MMType * );
  104.         static DTType *     Instantiate( const MMType * mm ) { return MakeDTEnumType( mm ); }
  105.  
  106.     private:
  107.         long                    _value;
  108. };
  109.  
  110. #endif // _DTTYPE_HPP
  111.