home *** CD-ROM | disk | FTP | other *** search
- #ifndef _INC_CPPBIND_HPP
- #define _INC_CPPBIND_HPP
- class TC_CPsClassMgr;
- class TC_CPsCollectMgr;
-
- class TC_CPsBuffer;
- class TC_CPsObject;
- class TC_CPsClassInfo;
- class TC_CPsAttribInfo;
-
- template <class T> class TC_TPsClass;
- template <class T> class TC_TPsAttribute;
-
- class TC_CPsCollection;
- template <class T> class TC_TPsArray;
- template <class T> class TC_TPsSortedArray;
-
- class TC_CPsAttribUIData;
- typedef TC_TPsClass<TC_CPsObject> TCPsClass;
- typedef TC_TPsAttribute<TC_CPsObject> TCPsAttribute;
- typedef void *(*TCPsCastFunc)(void *);
- typedef void *(TC_CPsObject::*PtrGetMethod)(void);
- typedef void (TC_CPsObject::*PtrSetMethod)(void*);
- typedef TCPsClass* TCPsHClass;
- typedef TCPsAttribute* TCPsHAttrib;
- typedef TC_TArrayPTR <TCPsClass> TCPsHClassCollect;
- TC_CPsCollection * tcPsGetCollection (char * name) ;
- TCPsHClass tcPsGetClass (ULONG cid) ;
- TCPsHClass tcPsGetClass (char * name) ;
- #define TC_PS_AT_UNDEF 0
- #define TC_PS_AT_SHORT 1
- #define TC_PS_AT_USHORT 2
- #define TC_PS_AT_LONG 3
- #define TC_PS_AT_ULONG 4
- #define TC_PS_AT_FLOAT 5
- #define TC_PS_AT_DOUBLE 6
- #define TC_PS_AT_BOOL 7
- #define TC_PS_AT_BYTE 8
- #define TC_PS_AT_CHARARR 9
- #define TC_PS_AT_STRING 10
- #define TC_PS_AT_DATE 11
- #define TC_PS_AT_TIME 12
- #define TC_PS_AT_BCD 13
- #define TC_PS_AT_BINARY 14
- #define TC_PS_AT_BLOB 15
- #define TC_PS_AT_OBJECT 16
- #define TC_PS_AT_MAX 17
- #define TC_PS_AF_OBJECT 0x00000001L
- #define TC_PS_AF_COLLECTION 0x00000002L
- #define TC_PS_AF_OPTIONAL 0x00000004L
- #define TC_PS_AF_DEMANDREF 0x00000008L
- #define TC_PS_AF_DEPENDENT 0x00000010L
- #define TC_PS_AF_TRANSIENT 0x00000020L
- #define TC_PS_CF_TABLE 0x00000001L
- #define TC_PS_CF_COLLECTION 0x00000002L
- #define TC_PS_CF_TRANSIENT 0x00000004L
- enum TCPsClassScope {
- ClassScope_Proper,
- ClassScope_Domain,
- };
- #define TC_PS_PRLEN_UNDEF 0
- #define TC_PS_PRLEN_SHORT 6
- #define TC_PS_PRLEN_LONG 11
- #define TC_PS_PRLEN_FLOAT 20
- #define TC_PS_PRLEN_DOUBLE 20
- #define TC_PS_PRLEN_BOOL 11
- #define TC_PS_PRLEN_BYTE 3
- #define TC_PS_PRLEN_CHARARR 256 // max
- #define TC_PS_PRLEN_STRING 256 // max
- #define TC_PS_PRLEN_DATE 27
- #define TC_PS_PRLEN_TIME 27
- #define TC_PS_PRLEN_OBJECT TC_PS_PRLEN_LONG // OID
-
- // **********************************************************************
- class TC_PS_EXPORT TC_CPsClassMgr
- {
- public: TC_CPsClassMgr () ;
- public: static TC_TArrayPTR<TCPsClass> m_Classes ;
- public: static BOOL IsRegistered (ULONG cid, const char * name) ;
- public: static void Register (TCPsHClass cl) ;
- public: static void UnregisterAll () ;
- public: static TCPsHClass GetClass (ULONG cid) ;
- public: static TCPsHClass GetClass (const char * name ) ;
- public: static void GetBaseClasses (TCPsHClassCollect & cl_cltn) ;
- public: static TCPsRetCode CheckIntegrity () TC_PS_THROW_FUNC ;
-
- }; // end of class TC_CPsClassMgr
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_PS_EXPORT TC_CPsCollectMgr
- {
-
- // **********************************************************************
- public:
- class TC_PS_EXPORT PsCltn
- {
- public: TC_CPsCollection * m_Cltn ;
- public: char * m_Name ;
- public: PsCltn (TC_CPsCollection * cltn, const char * name) ;
-
- }; // end of class PsCltn
-
- // **********************************************************************
- public:
- typedef TC_TArrayPTR <PsCltn> PsCltns;
- public: static TC_CPsCollectMgr::PsCltns m_Cltns ;
- public: TC_CPsCollectMgr () ;
- public: static BOOL IsRegistered (const char * name) ;
- public: static void Register (TC_CPsCollection * cltn, const char * name) ;
- public: static void UnregisterAll () ;
- public: static TC_CPsCollection * GetCollection (const char * name) ;
- public: static char * GetName (TC_CPsCollection * cltn) ;
-
- }; // end of class TC_CPsCollectMgr
-
- // **********************************************************************
- // Name alterability of class and attributes fields
- #define m_hClassInCltn m_cid // TC_TPsClass::m_cid
- #define m_hRelClass m_Type // TC_TPsAttribute::m_Type
- #define m_FKNameForCltn m_ColName // TC_TPsAttribute::m_ColName
-
- // **********************************************************************
- class TC_PS_EXPORT TC_CPsBuffer
- : public TC_CBuffer
- {
- public: TC_CPsBuffer () ;
- public: TC_CPsBuffer (short val)
- : TC_CBuffer(val)
- {
- } // end of func
- // **********************************************************************
-
- public: TC_CPsBuffer (unsigned short val)
- : TC_CBuffer(val)
- {
- } // end of func
- // **********************************************************************
-
- public: TC_CPsBuffer (int val)
- : TC_CBuffer(val)
- {
- } // end of func
- // **********************************************************************
-
- public: TC_CPsBuffer (unsigned int val)
- : TC_CBuffer(val)
- {
- } // end of func
- // **********************************************************************
-
- public: TC_CPsBuffer (long val)
- : TC_CBuffer(val)
- {
- } // end of func
- // **********************************************************************
-
- public: TC_CPsBuffer (unsigned long val)
- : TC_CBuffer(val)
- {
- } // end of func
- // **********************************************************************
-
- public: TC_CPsBuffer (TC_CDate & dt)
- : TC_CBuffer(dt)
- {
- } // end of func
- // **********************************************************************
-
- public: TC_CPsBuffer (TC_CTime & tm)
- : TC_CBuffer(tm)
- {
- } // end of func
- // **********************************************************************
-
- public: TC_CPsBuffer (char val)
- : TC_CBuffer(val)
- {
- } // end of func
- // **********************************************************************
-
- public: TC_CPsBuffer (unsigned char val)
- : TC_CBuffer(val)
- {
- } // end of func
- // **********************************************************************
-
- public: TC_CPsBuffer (float val)
- : TC_CBuffer(val)
- {
- } // end of func
- // **********************************************************************
-
- public: TC_CPsBuffer (double val)
- : TC_CBuffer(val)
- {
- } // end of func
- // **********************************************************************
-
- public: TC_CPsBuffer (const char * val)
- : TC_CBuffer(val)
- {
- } // end of func
- // **********************************************************************
-
- public: TC_CPsBuffer (TC_CString &val)
- : TC_CBuffer(val)
- {
- } // end of func
- // **********************************************************************
-
- public: TC_CPsBuffer (TC_CBCD & bcd)
- : TC_CBuffer(bcd)
- {
- } // end of func
- // **********************************************************************
-
- public: TC_CPsBuffer (const unsigned char * val, int size) ;
- public: TC_CPsBuffer (TC_CPsBuffer &val) ;
- public: TC_CPsBuffer (TC_CPsObject * obj, TC_CPsAttribInfo & atInfo) ;
- public: TC_CPsBuffer & operator = (const TC_CPsBuffer & psbuf) ;
- public: int operator == (TC_CPsBuffer & ps_buf) ;
- public: virtual void GetStr (TC_CString & str) ;
-
- }; // end of class TC_CPsBuffer
-
- // **********************************************************************
-
- // **********************************************************************
- template <class T>
- class TC_TPsClass
- {
- public: char * m_Name ;
- public: char * m_TblName ;
- public: long m_cid ;
- public: long m_Flags ;
- public: T*(* m_CreateObj )(void);
- public: void (* m_DeleteObj )(T*);
- public: int m_AttribCount ;
- public: TC_TPsAttribute<T>* m_Attributes ;
- public: int m_DescCount ;
- public: TCPsClass ** m_Descendants ;
- public: TCPsClass* m_Ancestor ;
- public: TCPsCastFunc m_CastFunc ;
- public: char * m_Label ;
- public: long m_UserFlags ;
- public: void * m_UserData ;
-
- }; // end of class TC_TPsClass
-
- // **********************************************************************
-
- // **********************************************************************
- template <class T>
- class TC_TPsAttribute
- {
- public: char * m_Name ;
- public: char * m_ColName ;
- public: long m_Type ;
- public: long m_Flags ;
- public: long m_Size ;
- public: void (T::* m_GetMethod )();
- public: void (T::* m_SetMethod )();
- public: char * m_Label ;
- public: TC_CPsAttribUIData * m_UIData ;
- public: long m_UserFlags ;
- public: void * m_UserData ;
- public: void Set (TC_CPsObject * obj, void * data) ;
- public: void * Get (TC_CPsObject * obj, ULONG opt=0) ;
-
- }; // end of class TC_TPsAttribute
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_PS_EXPORT TC_CPsClassInfo
- {
- private: TCPsHClass m_hClass ;
- public: TC_CPsClassInfo (TCPsHClass cl) ;
- public: TC_CPsClassInfo (ULONG cid) ;
- public: BOOL IsValid () ;
- public: operator TCPsHClass () ;
- public: TCPsHClass HClass () ;
- public: char * Name () ;
- public: char * Label () ;
- public: ULONG GetCID () ;
- public: BOOL IsDerivedFrom (TCPsHClass hClass) ;
- public: BOOL IsAncestorOf (TCPsHClass hClass) ;
- public: BOOL IsInstance (TC_CPsObject * obj) ;
- public: BOOL IsTransient () ;
- public: TC_CPsClassInfo GetAncestor () ;
- public: BOOL HasAncestor () ;
- public: BOOL HasDescendants () ;
- private: void GetNextDescs (TCPsHClass hClass, TCPsHClassCollect & class_collect) ;
- public: BOOL GetAllDescendants (TCPsHClassCollect & class_collect) ;
- public: TC_CPsClassInfo GetBase () ;
- public: BOOL IsBase () ;
- public: BOOL IsAlone () ;
- public: BOOL IsA (TC_CPsObject * obj) ;
- public: BOOL IsA (TCPsHClass hClass) ;
- public: BOOL IsCollectionClass () ;
- public: TC_CPsClassInfo GetClassInCltn () ;
- public: int AttribCount () ;
- public: BOOL HasRelated (TCPsClassScope cl_scope = ClassScope_Proper) ;
- public: BOOL HasDependents (TCPsClassScope cl_scope = ClassScope_Proper) ;
- public: TC_CPsAttribInfo GetAttribInfo (int idx) ;
- public: TC_CPsAttribInfo GetAttribInfo (const char * name, TCPsClassScope cl_scope = ClassScope_Proper) ;
- public: TC_CPsAttribInfo GetFKForCltnAttrib (TC_CPsAttribInfo &atInfoCltn, TCPsClassScope cl_scope) ;
- public: TC_CPsClassInfo GetClassOfAttrib (TCPsHAttrib hAttrib) ;
- public: int operator == (TC_CPsClassInfo & clInfo) ;
- public: int operator == (TCPsHClass hClass) ;
- public: TC_CPsAttribInfo operator [] (int idx) ;
- public: void * UserData () ;
-
- }; // end of class TC_CPsClassInfo
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_PS_EXPORT TC_CPsAttribInfo
- {
- private: TCPsHClass m_hClass ;
- private: TCPsHAttrib m_hAttrib ;
- public: TC_CPsAttribInfo (TCPsHClass hClass, TCPsHAttrib hAttrib)
- {
- m_hClass = hClass;
- m_hAttrib = hAttrib;
- } // end of func
- // **********************************************************************
-
- public: TC_CPsAttribInfo ()
- {
- m_hClass = 0;
- m_hAttrib = 0;
- } // end of func
- // **********************************************************************
-
- public: BOOL IsValid ()
- {
- return (m_hAttrib != 0);
- } // end of func
- // **********************************************************************
-
- public: int operator == (TC_CPsAttribInfo &atInfo) ;
- public: operator BOOL ()
- {
- return IsValid();
- } // end of func
- // **********************************************************************
-
- public: operator TCPsHAttrib ()
- {
- return m_hAttrib;
- } // end of func
- // **********************************************************************
-
- public: TCPsHAttrib operator -> ()
- {
- return m_hAttrib;
- } // end of func
- // **********************************************************************
-
- public: TCPsHAttrib HAttrib ()
- {
- return m_hAttrib;
- } // end of func
- // **********************************************************************
-
- public: TCPsHClass HClass ()
- {
- return m_hClass;
- } // end of func
- // **********************************************************************
-
- public: char * Name () ;
- public: char * Label () ;
- public: char * ColName () ;
- public: int Size () ;
- public: int RawSize () ;
- public: long Type () ;
- public: TC_CPsAttribUIData * UIData () ;
- public: BOOL IsTransient () ;
- public: BOOL IsObject () ;
- public: BOOL IsCollection () ;
- public: BOOL IsOptional () ;
- public: BOOL IsDependent () ;
- public: BOOL IsDemandRef () ;
- public: TC_CPsClassInfo RelatedTo () ;
- public: TC_CPsCollection * GetCollection (TCPsHClass * class_in_cltn = 0) ;
- public: TC_CPsClassInfo GetClassInCltn () ;
- public: TC_CPsAttribInfo GetFK (TCPsClassScope cl_scope) ;
- public: BOOL SetValue (TC_CPsObject * obj, void * data) ;
- public: BOOL GetValue (TC_CPsObject * obj, void *data) ;
- public: TC_CString InfoStr () ;
- public: int PrLength () ;
- public: void * UserData () ;
-
- }; // end of class TC_CPsAttribInfo
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_PS_EXPORT TC_CPsClassIter
- {
- private: TCPsHClass m_hClass ;
- private: int * m_Stack ;
- private: int m_sp ;
- private: int m_StackSize ;
- public: TC_CPsClassIter (TCPsHClass cl, int stack_size=20) ;
- public: ~TC_CPsClassIter () ;
- public: BOOL IsLeaf () ;
- public: void Set (TCPsHClass cl) ;
- public: TCPsHClass Next () ;
- public: TCPsHClass Prev () ;
- public: TCPsHClass Current () ;
- public: void BeginReverse () ;
- public: TCPsHClass Reverse () ;
- public: TCPsHClass operator * () ;
- public: TCPsHClass operator ++ (int) ;
- public: TCPsHClass operator ++ () ;
- public: TCPsHClass operator -- (int) ;
- public: TCPsHClass operator -- () ;
-
- }; // end of class TC_CPsClassIter
-
- // **********************************************************************
-
- // **********************************************************************
- class TC_PS_EXPORT TC_CPsAttribIter
- {
- private: TCPsHClass m_hClass ;
- private: int m_CurrAttr ;
- private: TCPsHClass m_hCurrClass ;
- private: long m_Filter ;
- private: TC_CPsClassIter m_ci ;
- private: int m_ClassScope ;
- public: TC_CPsAttribIter (TCPsHClass hClass, TCPsClassScope cl_scope = ClassScope_Domain, long filter = 0) ;
- public: void Reset () ;
- public: TC_CPsAttribInfo Next () ;
- public: TC_CPsAttribInfo Current () ;
- public: TC_CPsAttribInfo operator ++ (int) ;
-
- }; // end of class TC_CPsAttribIter
-
- // **********************************************************************
-
- #endif // _INC_CPPBIND_HPP
-