home *** CD-ROM | disk | FTP | other *** search
- #ifndef _DTTYPED_HPP
- #define _DTTYPED_HPP
-
- #include <stddef.h>
- #include "dttype.hpp"
-
- #define TYPE_ALIAS( _base, _alias ) \
- typedef DT ## _base DT ## _alias;
-
- /*************
- *** WBool ***
- *************/
-
- typedef DTBoolType DTType_WBool;
- typedef DTBoolType DTType_const_WBool;
-
- /********************
- *** String Types ***
- ********************/
-
- class METAEXPORTCLASSDEF DTType_Impl_String : public DTType {
- public:
- DTType_Impl_String( const MMType * imp );
-
- virtual WBool Textify( WString &, DT_Textify ) const;
- virtual WBool DeTextify( const WString &, DT_Textify );
-
- virtual WBool operator==( const DTType & o );
-
- virtual WBool Set( const WChar * val );
- virtual const WString & Get() const;
-
- static DTType * Instantiate( const MMType * );
-
- protected:
- WString _value;
- };
- typedef DTType_Impl_String DTType_WString;
-
- class METAEXPORTCLASSDEF DTType_WFilePath : public DTType_Impl_String {
- public:
- DTType_WFilePath( const MMType * imp );
-
- virtual WBool Browse( WWindow * parent, DTObject * obj );
- virtual WBool Textify( WString &, DT_Textify ) const;
- virtual WBool DeTextify( const WString &, DT_Textify );
-
- static DTType * Instantiate( const MMType * );
- };
-
- class METAEXPORTCLASSDEF DTType_Anything : public DTType_Impl_String {
- public:
- DTType_Anything( const MMType * imp );
-
- virtual WBool Textify( WString &, DT_Textify ) const;
- static DTType * Instantiate( const MMType * );
- };
-
- class METAEXPORTCLASSDEF DTType_Identifier : public DTType_Anything {
- public:
- DTType_Identifier( const MMType * imp, WBool allowNull );
-
- virtual WBool DeTextify( const WString &, DT_Textify );
-
- static DTType * Instantiate( const MMType * );
-
- private:
- WBool _allowNull;
- };
-
- class METAEXPORTCLASSDEF DTType_NullOrIdentifier : public DTType_Identifier {
- public:
- DTType_NullOrIdentifier( const MMType * imp );
- static DTType * Instantiate( const MMType * );
- };
-
- class METAEXPORTCLASSDEF DTType_IntegerOrIdentifier : public DTType_Anything {
- public:
- DTType_IntegerOrIdentifier( const MMType * imp, WBool allowNull );
-
- virtual WBool DeTextify( const WString &, DT_Textify );
-
- static DTType * Instantiate( const MMType * );
-
- private:
- WBool _allowNull;
- };
-
- class METAEXPORTCLASSDEF DTType_NullOrIntegerOrIdentifier : public DTType_IntegerOrIdentifier {
- public:
- DTType_NullOrIntegerOrIdentifier( const MMType * mm );
- static DTType * Instantiate( const MMType * mm );
- };
-
- TYPE_ALIAS( Type_Impl_String, Type_WString );
- TYPE_ALIAS( Type_Impl_String, Type_const_WString__ref_ );
- TYPE_ALIAS( Type_Impl_String, Type_const_WChar__ptr_ );
-
- TYPE_ALIAS( Type_Anything, Type_WObject__ptr_ );
-
- /******************
- *** Color Type ***
- ******************/
-
- class METAEXPORTCLASSDEF DTType_WColor : public DTType {
- public:
- DTType_WColor( const MMType * imp );
-
- virtual WBool Textify( WString &, DT_Textify ) const;
- virtual WBool DeTextify( const WString &, DT_Textify );
-
- virtual WBool operator==( const DTType & o );
-
- virtual WBool Set( const WColor & val );
- virtual const WColor & Get() const;
-
- virtual WBool Browse( WWindow * parent, DTObject * obj );
-
- virtual WUInt GetNumValues();
- virtual WString GetValue( WUInt i );
-
- static DTType * Instantiate( const MMType * );
-
- private:
- WColor _c_value;
- };
-
-
- TYPE_ALIAS( Type_WColor, Type_const_WColor__ref_ );
-
- /******************
- *** WFont Type ***
- ******************/
-
- class METAEXPORTCLASSDEF DTType_WFont : public DTType {
- public:
- DTType_WFont( const MMType * imp );
-
- virtual WBool Textify( WString &, DT_Textify ) const;
- virtual WBool DeTextify( const WString &, DT_Textify );
-
- virtual WBool operator==( const DTType & o );
-
- virtual WBool Set( const WFont & val );
- virtual const WFont & Get() const;
-
- virtual WBool Browse( WWindow * parent, DTObject * obj );
-
- static DTType * Instantiate( const MMType * );
- private:
- WFont _value;
- };
-
- TYPE_ALIAS( Type_WFont, Type_const_WFont__ref_ );
-
- /******************
- *** WRect Type ***
- ******************/
-
- class METAEXPORTCLASSDEF DTType_WRect : public DTType {
- public:
- DTType_WRect( const MMType * imp );
-
- virtual WBool Textify( WString &, DT_Textify ) const;
- virtual WBool DeTextify( const WString &, DT_Textify );
-
- virtual WBool operator==( const DTType & o );
-
- virtual WBool Set( const WRect & val );
- virtual const WRect & Get() const;
-
- static DTType * Instantiate( const MMType * );
-
- private:
- WRect _value;
- };
-
- TYPE_ALIAS( Type_WRect, Type_const_WRect__ref_ );
-
- /*******************
- *** WPoint Type ***
- *******************/
-
- class METAEXPORTCLASSDEF DTType_WPoint : public DTType {
- public:
- DTType_WPoint( const MMType * imp );
-
- virtual WBool Textify( WString &, DT_Textify ) const;
- virtual WBool DeTextify( const WString &, DT_Textify );
-
- virtual WBool operator==( const DTType & o );
-
- virtual WBool Set( const WPoint & val );
- virtual const WPoint & Get() const;
-
- static DTType * Instantiate( const MMType * );
-
- private:
- WPoint _value;
- };
-
- TYPE_ALIAS( Type_WPoint, Type_const_WPoint__ref_ );
-
- /*******************
- *** WSize Type ***
- *******************/
-
- class METAEXPORTCLASSDEF DTType_WSize : public DTType {
- public:
- DTType_WSize( const MMType * imp );
-
- virtual WBool Textify( WString &, DT_Textify ) const;
- virtual WBool DeTextify( const WString &, DT_Textify );
-
- virtual WBool operator==( const DTType & o );
-
- virtual WBool Set( const WSize & val );
- virtual const WSize & Get() const;
-
- static DTType * Instantiate( const MMType * );
-
- private:
- WSize _value;
- };
-
-
- /*******************
- *** WRange Type ***
- *******************/
-
- class METAEXPORTCLASSDEF DTType_WRange : public DTType {
- public:
- DTType_WRange( const MMType * imp );
-
- virtual WBool Textify( WString &, DT_Textify ) const;
- virtual WBool DeTextify( const WString &, DT_Textify );
-
- virtual WBool operator==( const DTType & o );
-
- virtual WBool Set( const WRange & val );
- virtual const WRange & Get() const;
-
- static DTType * Instantiate( const MMType * );
-
- private:
- WRange _value;
- };
-
- TYPE_ALIAS( Type_WRange, Type_const_WRange__ref_ );
-
- /**********************
- *** Integral Types ***
- **********************/
-
- class METAEXPORTCLASSDEF DTType_Impl_Integral : public DTType {
- public:
- DTType_Impl_Integral( const MMType * imp,
- WBool sign, size_t bytes );
-
- virtual WBool Textify( WString &, DT_Textify ) const;
- virtual WBool DeTextify( const WString &, DT_Textify );
-
- virtual WBool operator==( const DTType & o );
-
- virtual WBool Set( long val );
- virtual WLong GetVal() const;
-
- private:
- WBool _sign;
- size_t _bytes;
- WLong _value;
- };
-
- /*
- * SIGNED is a macro used to determine if a data type is signed or not.
- */
-
- #define SIGNED( __type ) ( static_cast< __type >(-1) <= 0 )
-
- #define MAKE_INTEGRAL( __type, __name ) \
- class METAEXPORTCLASSDEF DTType_ ## __name : public DTType_Impl_Integral { \
- public: \
- DTType_ ## __name( const MMType * imp ) \
- : DTType_Impl_Integral( imp, SIGNED( __type ), sizeof( __type ) ){} \
- \
- virtual __type Get() const { \
- WTraceMember(); \
- return (__type)DTType_Impl_Integral::GetVal(); \
- } \
- \
- static DTType * Instantiate( const MMType * tp ) { \
- WTraceFunction(); \
- return new DTType_ ## __name( tp ); \
- } \
- }
-
- MAKE_INTEGRAL( WInt, WInt );
- MAKE_INTEGRAL( WUInt, WUInt );
- MAKE_INTEGRAL( WShort, WShort );
- MAKE_INTEGRAL( WUShort, WUShort );
- MAKE_INTEGRAL( WLong, WLong );
- MAKE_INTEGRAL( WULong, WULong );
- MAKE_INTEGRAL( WChar, WChar_Base );
- MAKE_INTEGRAL( WUChar, WUChar );
-
- TYPE_ALIAS( Type_WUShort, Type_const_WUShort );
- TYPE_ALIAS( Type_WULong, Type_WButtonState );
-
- MAKE_INTEGRAL( int, signed_int );
- MAKE_INTEGRAL( unsigned int, unsigned_int );
- MAKE_INTEGRAL( short, signed_short );
- MAKE_INTEGRAL( unsigned short, unsigned_short );
- MAKE_INTEGRAL( long, signed_long );
- MAKE_INTEGRAL( unsigned long, unsigned_long );
- MAKE_INTEGRAL( char, char );
- MAKE_INTEGRAL( unsigned char, unsigned_char );
-
- class METAEXPORTCLASSDEF DTType_WChar : public DTType_WChar_Base {
- public:
- DTType_WChar( const MMType * imp )
- : DTType_WChar_Base( imp ){}
- virtual WBool Textify( WString &, DT_Textify ) const;
- virtual WBool DeTextify( const WString &, DT_Textify );
-
- static DTType * Instantiate( const MMType * tp ) {
- WTraceFunction();
- return new DTType_WChar( tp );
- }
- };
-
- #endif // _DTTYPED_HPP
-