home *** CD-ROM | disk | FTP | other *** search
- #ifndef _INC_FRMIFACE_HPP
- #define _INC_FRMIFACE_HPP
-
- // **********************************************************************
- class TC_COREEX_EXPORT TC_CIDataType
- {
- protected: int m_TypeID ;
- public: TC_CIDataType () ;
- public: virtual ~TC_CIDataType () ;
- public: virtual BOOL IsCompatible (TC_CIDataType * other) =0 ;
- public: virtual int Validate (const char * str, char * fmt = 0) =0 ;
- public: virtual int FromString (const char * str, char * fmt = 0) =0 ;
- public: virtual int FromNative (const void * val) =0 ;
- public: virtual int FromAnother (const TC_CIDataType * dtype) =0 ;
- public: virtual int FromRawData (char * data, int sz=0) =0 ;
- public: virtual int ToString (char * dest, int size, char * fmt = 0) =0 ;
- public: virtual int ToString (TC_CString & str, char * fmt=0) =0 ;
- public: virtual int ToNative (void * dest) =0 ;
- public: virtual int ToAnother (TC_CIDataType * dtype) =0 ;
- public: virtual int ToRawData (char * data, int sz=0) =0 ;
- public: virtual TC_CIDataType * Copy () =0 ;
- public: virtual char * DefaultFmt () =0 ;
- public: virtual BOOL IsNull () =0 ;
- public: virtual int Compare (TC_CIDataType * other) =0 ;
- public: virtual void SetNull () ;
- public: virtual int RawSize () =0 ;
- public: virtual void * Ptr () =0 ;
- public: virtual BOOL IsFmtValid (const char * fmt) ;
- public: int TypeID () const ;
-
- }; // end of class TC_CIDataType
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_COREEX_EXPORT TC_CIDate
- : public TC_CIDataType
- {
- private: TC_CDate m_Date ;
- public: TC_CIDate () ;
- public: TC_CIDate (TC_CDate & dt) ;
- public: TC_CIDate (TC_CIDate & dt) ;
- public: BOOL IsCompatible (TC_CIDataType * dtype) ;
- public: int Validate (const char * str, char * fmt=0) ;
- public: int FromString (const char * str, char * fmt = 0) ;
- public: int FromNative (const void * val) ;
- public: int FromAnother (const TC_CIDataType * dtype) ;
- public: int FromRawData (char * data, int sz=0) ;
- public: int ToString (char * dest, int size, char * fmt = 0) ;
- public: int ToString (TC_CString & str, char * fmt=0) ;
- public: int ToNative (void * dest) ;
- public: int ToAnother (TC_CIDataType * dtype) ;
- public: int ToRawData (char * data, int sz=0) ;
- public: TC_CIDataType * Copy () ;
- public: char * DefaultFmt () ;
- public: int Compare (TC_CIDataType * dtype) ;
- public: BOOL IsNull () ;
- public: int RawSize () ;
- public: void * Ptr () ;
- public: BOOL IsFmtValid (const char * fmt) ;
- public: operator TC_CDate () ;
- public: operator TC_CTime () ;
-
- }; // end of class TC_CIDate
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_COREEX_EXPORT TC_CITime
- : public TC_CIDataType
- {
- private: TC_CTime m_Time ;
- public: TC_CITime () ;
- public: TC_CITime (TC_CTime & tm) ;
- public: TC_CITime (TC_CITime & tm) ;
- public: BOOL IsCompatible (TC_CIDataType * dtype) ;
- public: int Validate (const char * str, char * fmt=0) ;
- public: int FromString (const char * str, char * fmt=0) ;
- public: int FromNative (const void * val) ;
- public: int FromAnother (const TC_CIDataType * dtype) ;
- public: int FromRawData (char * data, int sz=0) ;
- public: int ToString (char * dest, int size, char * fmt = 0) ;
- public: int ToString (TC_CString & str, char * fmt=0) ;
- public: int ToNative (void * dest) ;
- public: int ToAnother (TC_CIDataType * dtype) ;
- public: int ToRawData (char * data, int sz=0) ;
- public: TC_CIDataType * Copy () ;
- public: char * DefaultFmt () ;
- public: int Compare (TC_CIDataType * dtype) ;
- public: BOOL IsNull () ;
- public: int RawSize () ;
- public: void * Ptr () ;
- public: BOOL IsFmtValid (const char * fmt) ;
- public: operator TC_CTime () ;
- public: operator TC_CDate () ;
-
- }; // end of class TC_CITime
-
- // **********************************************************************
- #define STRFMT_ALL 0x00000001L // %X all printable characters (default)
- #define STRFMT_NUMBER 0x00000002L // %9 numbers (0-9)
- #define STRFMT_CHAR 0x00000004L // %A characters (a-z)
- #define STRFMT_UPPER 0x00000008L // %! to upper case
- #define STRFMT_LOWER 0x00000010L // %~ to lower case
- #define STRFMT_EXCLUDE 0x00000020L // %E exclude specified characters: +string
-
- // **********************************************************************
- class TC_COREEX_EXPORT TC_CIStringType
- : public TC_CIDataType
- {
- protected: int ParseFmt (const char* str, char * fmt, BOOL is_test ) ;
- protected: virtual void AssignParsed (const char * str) =0 ;
- public: int Validate (const char * str, char * fmt=0) ;
- public: int FromString (const char * str, char * fmt = 0) ;
- public: BOOL IsFmtValid (const char * fmt) ;
-
- }; // end of class TC_CIStringType
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_COREEX_EXPORT TC_CIString
- : public TC_CIStringType
- {
- protected: TC_CString m_Str ;
- protected: void AssignParsed (const char * str) ;
- public: TC_CIString () ;
- public: BOOL IsCompatible (TC_CIDataType * dtype) ;
- public: int FromNative (const void * val) ;
- public: int FromAnother (const TC_CIDataType * dtype) ;
- public: int FromRawData (char * data, int sz=0) ;
- public: int ToString (char * dest, int size, char * fmt = 0) ;
- public: int ToString (TC_CString & str, char * fmt=0) ;
- public: int ToNative (void * dest) ;
- public: int ToAnother (TC_CIDataType * dtype) ;
- public: int ToRawData (char * data, int sz=0) ;
- public: TC_CIDataType * Copy () ;
- public: char * DefaultFmt () ;
- public: int Compare (TC_CIDataType * dtype) ;
- public: int RawSize () ;
- public: void * Ptr () ;
- public: BOOL IsNull () ;
-
- }; // end of class TC_CIString
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_COREEX_EXPORT TC_CICharArr
- : public TC_CIString
- {
- public: TC_CICharArr () ;
- public: BOOL IsCompatible (TC_CIDataType * dtype) ;
- public: int FromNative (const void * val) ;
- public: int ToNative (void * dest) ;
- public: TC_CIDataType * Copy () ;
- public: void * Ptr () ;
-
- }; // end of class TC_CICharArr
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_COREEX_EXPORT TC_CIByte
- : public TC_CIStringType
- {
- protected: unsigned char m_Byte ;
- protected: void AssignParsed (const char * str) ;
- public: TC_CIByte () ;
- public: BOOL IsCompatible (TC_CIDataType * dtype) ;
- public: int FromNative (const void * val) ;
- public: int FromAnother (const TC_CIDataType * dtype) ;
- public: int FromRawData (char * data, int sz=0) ;
- public: int ToString (char * dest, int size, char * fmt = 0) ;
- public: int ToString (TC_CString & str, char * fmt=0) ;
- public: int ToNative (void * dest) ;
- public: int ToAnother (TC_CIDataType * dtype) ;
- public: int ToRawData (char * data, int sz=0) ;
- public: TC_CIDataType * Copy () ;
- public: char * DefaultFmt () ;
- public: int Compare (TC_CIDataType * dtype) ;
- public: int RawSize () ;
- public: void * Ptr () ;
- public: BOOL IsNull () ;
-
- }; // end of class TC_CIByte
-
- // **********************************************************************
- #define INTFMT_RADIX 0x00000001L // %b base radix; +number: 2-36
- #define INTFMT_WIDTH 0x00000002L // %w zero pad to width n: +number: 0 - 128
- #define INTFMT_SIGN 0x00000004L // %+ always show sign
- #define INTFMT_THOUSANDS 0x00000008L // %, comma separate thousands if radix = 10
- #define INTFMT_THOUSAND_SEP 0x00000010L // %T, thousand separator if radix = 10; +string
-
- // **********************************************************************
- class TC_COREEX_EXPORT TC_CIInteger
- : public TC_CIDataType
- {
- protected: int ParseFmt (const char* str, char * fmt, long * val, int flag ) ;
- protected: int Format (long val, TC_CString & str, char * fmt, int flag) ;
- public: int Validate (const char * str, char * fmt=0) ;
- public: BOOL IsFmtValid (const char * fmt) ;
-
- }; // end of class TC_CIInteger
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_COREEX_EXPORT TC_CIShort
- : public TC_CIInteger
- {
- protected: short m_Val ;
- public: TC_CIShort () ;
- public: TC_CIShort (short val) ;
- public: BOOL IsCompatible (TC_CIDataType * dtype) ;
- public: int FromString (const char * str, char * fmt = 0) ;
- public: int FromNative (const void * val) ;
- public: int FromAnother (const TC_CIDataType * dtype) ;
- public: int FromRawData (char * data, int sz=0) ;
- public: int ToString (char * dest, int size, char * fmt = 0) ;
- public: int ToString (TC_CString & str, char * fmt=0) ;
- public: int ToNative (void * dest) ;
- public: int ToAnother (TC_CIDataType * dtype) ;
- public: int ToRawData (char * data, int sz=0) ;
- public: TC_CIDataType * Copy () ;
- public: char * DefaultFmt () ;
- public: int Compare (TC_CIDataType * dtype) ;
- public: BOOL IsNull () ;
- public: int RawSize () ;
- public: void * Ptr () ;
- public: operator short ()
- {
- return m_Val;
- } // end of func
- // **********************************************************************
-
- public: short operator = (short val) ;
-
- }; // end of class TC_CIShort
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_COREEX_EXPORT TC_CIUShort
- : public TC_CIShort
- {
- public: TC_CIUShort () ;
- public: TC_CIUShort (unsigned short val) ;
- public: int FromString (const char * str, char * fmt = 0) ;
- public: int ToString (TC_CString & str, char * fmt=0) ;
- public: int Compare (TC_CIDataType * dtype) ;
- public: operator unsigned short ()
- {
- return (unsigned short)(short)(*this);
- } // end of func
- // **********************************************************************
-
- public: unsigned short operator = (unsigned short val) ;
-
- }; // end of class TC_CIUShort
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_COREEX_EXPORT TC_CILong
- : public TC_CIInteger
- {
- protected: long m_Val ;
- public: TC_CILong () ;
- public: TC_CILong (long val) ;
- public: BOOL IsCompatible (TC_CIDataType * dtype) ;
- public: int FromString (const char * str, char * fmt = 0) ;
- public: int FromNative (const void * val) ;
- public: int FromAnother (const TC_CIDataType * dtype) ;
- public: int FromRawData (char * data, int sz=0) ;
- public: int ToString (char * dest, int size, char * fmt = 0) ;
- public: int ToString (TC_CString & str, char * fmt=0) ;
- public: int ToNative (void * dest) ;
- public: int ToAnother (TC_CIDataType * dtype) ;
- public: int ToRawData (char * data, int sz=0) ;
- public: TC_CIDataType * Copy () ;
- public: char * DefaultFmt () ;
- public: int Compare (TC_CIDataType * dtype) ;
- public: BOOL IsNull () ;
- public: int RawSize () ;
- public: void * Ptr () ;
- public: operator long ()
- {
- return m_Val;
- } // end of func
- // **********************************************************************
-
- public: long operator = (long val) ;
-
- }; // end of class TC_CILong
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_COREEX_EXPORT TC_CIULong
- : public TC_CILong
- {
- public: TC_CIULong () ;
- public: TC_CIULong (unsigned long val) ;
- public: int FromString (const char * str, char * fmt = 0) ;
- public: int ToString (TC_CString & str, char * fmt=0) ;
- public: int Compare (TC_CIDataType * dtype) ;
- public: operator unsigned long ()
- {
- return (unsigned long)(long)(*this);
- } // end of func
- // **********************************************************************
-
- public: unsigned long operator = (unsigned long val) ;
-
- }; // end of class TC_CIULong
-
- // **********************************************************************
- #define DBLFMT_CRNCY BCDFMT_CRNCY // %$ use currency format
- #define DBLFMT_CRNCY_NAME BCDFMT_CRNCY_NAME // %C currency name; +string
- #define DBLFMT_CRNCY_POS BCDFMT_CRNCY_POS // %P currency name position; +number: 0 left, 1 right, 2 at decimal pos
- #define DBLFMT_CRNCY_SPACES BCDFMT_CRNCY_SPACES // %S currency space separators; +number
- #define DBLFMT_SIGN BCDFMT_SIGN // %+ include sign
- #define DBLFMT_THOUSANDS BCDFMT_THOUSANDS // %, separate thousands
- #define DBLFMT_PARENTH_NEG BCDFMT_PARENTH_NEG // %( negative in parenteses
- #define DBLFMT_DEC_SEP BCDFMT_DEC_SEP // %D decimal separator; +string
- #define DBLFMT_THOUSAND_SEP BCDFMT_THOUSAND_SEP // %T thousands separator; +string
- #define DBLFMT_DEC_NUM BCDFMT_DEC_NUM // %d number of digits after decimal point
-
- // **********************************************************************
- class TC_COREEX_EXPORT TC_CIDouble
- : public TC_CIDataType
- {
- private: double m_Val ;
- public: TC_CIDouble () ;
- public: TC_CIDouble (double val) ;
- public: BOOL IsCompatible (TC_CIDataType * dtype) ;
- public: int Validate (const char * str, char * fmt=0) ;
- public: int FromString (const char * str, char * fmt = 0) ;
- public: int FromNative (const void * val) ;
- public: int FromAnother (const TC_CIDataType * dtype) ;
- public: int FromRawData (char * data, int sz=0) ;
- public: int ToString (char * dest, int size, char * fmt = 0) ;
- public: int ToString (TC_CString & s, char * fmt=0) ;
- public: int ToNative (void * dest) ;
- public: int ToAnother (TC_CIDataType * dtype) ;
- public: int ToRawData (char * data, int sz=0) ;
- public: TC_CIDataType * Copy () ;
- public: char * DefaultFmt () ;
- public: int Compare (TC_CIDataType * dtype) ;
- public: BOOL IsNull () ;
- public: int RawSize () ;
- public: void * Ptr () ;
- public: BOOL IsFmtValid (const char * fmt) ;
- public: operator double ()
- {
- return m_Val;
- } // end of func
- // **********************************************************************
-
- public: double operator = (double val) ;
-
- }; // end of class TC_CIDouble
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_COREEX_EXPORT TC_CIFloat
- : public TC_CIDataType
- {
- private: float m_Val ;
- public: TC_CIFloat () ;
- public: TC_CIFloat (float val) ;
- public: BOOL IsCompatible (TC_CIDataType * dtype) ;
- public: int Validate (const char * str, char * fmt=0) ;
- public: int FromString (const char * str, char * fmt = 0) ;
- public: int FromNative (const void * val) ;
- public: int FromAnother (const TC_CIDataType * dtype) ;
- public: int FromRawData (char * data, int sz=0) ;
- public: int ToString (char * dest, int size, char * fmt = 0) ;
- public: int ToString (TC_CString & s, char * fmt=0) ;
- public: int ToNative (void * dest) ;
- public: int ToAnother (TC_CIDataType * dtype) ;
- public: int ToRawData (char * data, int sz=0) ;
- public: TC_CIDataType * Copy () ;
- public: char * DefaultFmt () ;
- public: int Compare (TC_CIDataType * dtype) ;
- public: BOOL IsNull () ;
- public: int RawSize () ;
- public: void * Ptr () ;
- public: BOOL IsFmtValid (const char * fmt) ;
- public: operator float ()
- {
- return m_Val;
- } // end of func
- // **********************************************************************
-
- public: float operator = (float val) ;
-
- }; // end of class TC_CIFloat
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_COREEX_EXPORT TC_CIBCD
- : public TC_CIDataType
- {
- private: TC_CBCD m_Val ;
- public: TC_CIBCD () ;
- public: TC_CIBCD (TC_CBCD & bcd) ;
- public: TC_CIBCD (unsigned char P, signed char S) ;
- public: BOOL IsCompatible (TC_CIDataType * dtype) ;
- public: int Validate (const char * str, char * fmt=0) ;
- public: int FromString (const char * str, char * fmt = 0) ;
- public: int FromNative (const void * val) ;
- public: int FromAnother (const TC_CIDataType * dtype) ;
- public: int FromRawData (char * data, int sz=0) ;
- public: int ToString (char * dest, int size, char * fmt = 0) ;
- public: int ToString (TC_CString & s, char * fmt=0) ;
- public: int ToNative (void * dest) ;
- public: int ToAnother (TC_CIDataType * dtype) ;
- public: int ToRawData (char * data, int sz=0) ;
- public: TC_CIDataType * Copy () ;
- public: char * DefaultFmt () ;
- public: int Compare (TC_CIDataType * dtype) ;
- public: BOOL IsNull () ;
- public: void * Ptr () ;
- public: BOOL IsFmtValid (const char * fmt) ;
- public: int RawSize () ;
-
- }; // end of class TC_CIBCD
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_COREEX_EXPORT TC_CIBinArray
- : public TC_CIDataType
- {
- private: TC_CBinArray m_Arr ;
- public: TC_CIBinArray () ;
- public: TC_CIBinArray (const unsigned char * arr, ULONG size) ;
- public: TC_CIBinArray (ULONG size) ;
- public: TC_CIBinArray (const TC_CBinArray & arr) ;
- public: BOOL IsCompatible (TC_CIDataType * dtype) ;
- public: int Validate (const char * str, char * fmt=0) ;
- public: int FromString (const char * str, char * fmt = 0) ;
- public: int FromNative (const void * val) ;
- public: int FromAnother (const TC_CIDataType * dtype) ;
- public: int FromRawData (char * data, int sz=0) ;
- public: int ToString (char * dest, int size, char * fmt = 0) ;
- public: int ToString (TC_CString & s, char * fmt=0) ;
- public: int ToNative (void * dest) ;
- public: int ToAnother (TC_CIDataType * dtype) ;
- public: int ToRawData (char * data, int sz=0) ;
- public: TC_CIDataType * Copy () ;
- public: char * DefaultFmt () ;
- public: int Compare (TC_CIDataType * dtype) ;
- public: BOOL IsNull () ;
- public: void * Ptr () ;
- public: BOOL IsFmtValid (const char * fmt) ;
- public: int RawSize () ;
-
- }; // end of class TC_CIBinArray
-
- // **********************************************************************
-
- #endif // _INC_FRMIFACE_HPP
-