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 METADEF 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 * MakeDTWString( const MMType * );
-
- protected:
- WString _value;
- };
-
- class METADEF DTType_WFilePath : public DTType_Impl_String {
- public:
- DTType_WFilePath( const MMType * imp );
-
- virtual WBool Browse( WWindow * parent, DTWObject * obj );
- virtual WBool Textify( WString &, DT_Textify ) const;
- virtual WBool DeTextify( const WString &, DT_Textify );
-
- static DTType * MakeDTWFilePath( const MMType * );
- };
-
- class METADEF DTType_Anything : public DTType_Impl_String {
- public:
- DTType_Anything( const MMType * imp );
-
- virtual WBool Textify( WString &, DT_Textify ) const;
- static DTType * MakeDTWObject__ptr_( const MMType * );
- };
-
- 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 METADEF 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, DTWObject * obj );
-
- virtual WUInt GetNumValues();
- virtual WString GetValue( WUInt i );
-
- static DTType * MakeDTWColor( const MMType * );
-
- private:
- WColor _c_value;
- };
-
-
- TYPE_ALIAS( Type_WColor, Type_const_WColor__ref_ );
-
- /******************
- *** WFont Type ***
- ******************/
-
- class METADEF 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, DTWObject * obj );
-
- static DTType * MakeDTWFont( const MMType * );
- private:
- WFont _value;
- };
-
- TYPE_ALIAS( Type_WFont, Type_const_WFont__ref_ );
-
- /******************
- *** WRect Type ***
- ******************/
-
- class METADEF 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 * MakeDTWRect( const MMType * );
-
- private:
- WRect _value;
- };
-
- TYPE_ALIAS( Type_WRect, Type_const_WRect__ref_ );
-
- /*******************
- *** WPoint Type ***
- *******************/
-
- class METADEF 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 * MakeDTWPoint( const MMType * );
-
- private:
- WPoint _value;
- };
-
- TYPE_ALIAS( Type_WPoint, Type_const_WPoint__ref_ );
-
- /*******************
- *** WSize Type ***
- *******************/
-
- class METADEF 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 * MakeDTWSize( const MMType * );
-
- private:
- WSize _value;
- };
-
-
- /*******************
- *** WRange Type ***
- *******************/
-
- class METADEF 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 * MakeDTWRange( const MMType * );
-
- private:
- WRange _value;
- };
-
- TYPE_ALIAS( Type_WRange, Type_const_WRange__ref_ );
-
- /**********************
- *** Integral Types ***
- **********************/
-
- class METADEF 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;
- };
-
- /*
- * I know, this is wretched, isn't it? I hope to use templates to clean it
- * up.
- */
-
- #pragma warning 355 9 // unsigned or pointer expression is never < 0
-
- #define SIGNED( __type ) ((__type)(~0) < (__type)(0))
-
- #define MAKE_INTEGRAL( __type, __name ) \
- class METADEF DTType_ ## __name : public DTType_Impl_Integral { \
- public: \
- DTType_ ## __name( const MMType * imp ) \
- : DTType_Impl_Integral( imp, SIGNED( __type ), sizeof( __type ) ){} \
- \
- virtual __type Get() const { \
- return (__type)DTType_Impl_Integral::GetVal(); \
- } \
- \
- static DTType * MakeDT ## __name( const MMType * tp ) { \
- 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 );
- 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 );
-
- #pragma warning 355 1 // unsigned or pointer expression is never < 0
-
- #endif // _DTTYPED_HPP
-