123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376 |
- #if !defined(AFX_GLOBALMACRO_H__DD58A78D_C125_410F_B4C8_F0067B797121__INCLUDED_)
- #define AFX_GLOBALMACRO_H__DD58A78D_C125_410F_B4C8_F0067B797121__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif
- #define PARRAYSIZE(array) ((sizeof(array)/sizeof(array[0])))
- #define CLASSINFO(cls, par) \
- public: \
- static const char * Class() \
- { return #cls; } \
- virtual const char * GetClass(unsigned ancestor = 0) const \
- { return ancestor > 0 ? par::GetClass(ancestor-1) : cls::Class()
- virtual BOOL IsClass(const char * clsName) const \
- { return strcmp(clsName, cls::Class()) == 0
- virtual BOOL IsDescendant(const char * clsName) const \
- { return strcmp(clsName, cls::Class()) == 0 || \
- par::IsDescendant(clsName)
- #define CLASSINFO_BASE(cls) \
- public: \
- static const char * Class() \
- { return #cls; } \
- virtual const char * GetClass(unsigned ancestor = 0) const \
- { return cls::Class()
- virtual BOOL IsClass(const char * clsName) const \
- { return strcmp(clsName, cls::Class()) == 0
- virtual BOOL IsDescendant(const char * clsName) const \
- { return strcmp(clsName, cls::Class()) == 0
- #ifdef OK
- #undef OK
- #endif
- #ifndef OK
- #define OK (0)
- #endif
- #ifdef FAILURE
- #undef FAILURE
- #endif
- #ifndef FAILURE
- #define FAILURE (-1)
- #endif
- #ifndef DELETEA
- #define DELETEA(ptr) \
- if(NULL != ptr) \
- { \
- delete[] ptr
- ptr = NULL
- }
- #endif
- #ifndef FREEP
- #define FREEP(ptr) \
- if(NULL != ptr) \
- { \
- free(ptr)
- ptr = NULL
- }
- #endif
- #define DELETEP(ptr) \
- if(NULL != (ptr)) \
- { \
- delete (ptr)
- (ptr) = NULL
- }
- #define DELETEOBJECT(ptr) \
- if(NULL != (ptr)) \
- { \
- ::DeleteObject (ptr)
- (ptr) = NULL
- }
- #define DESTROYWINDOW(hWnd) \
- if (IsWindow(hWnd)) \
- { \
- DestroyWindow(hWnd)
- }
- #undef FREEP
- #define FREEP(ptr) \
- if(NULL != ptr) \
- { \
- free(ptr)
- ptr = NULL
- }
- #define DELETE_TYPE_P(Type, ptrEvent) \
- {\
- Type *ptrEventLocal = (Type *)ptrEvent
- DELETEP(ptrEventLocal)
- ptrEvent = NULL
- }
- #define PAssert_ReturnWithValue(condition, return_value) \
- { \
- if (!(condition)) \
- { \
- return (return_value)
- } \
- }
- #define PAssert_Return(condition) \
- { \
- if (!(condition)) \
- { \
- return
- } \
- }
- #ifndef VOS_DELETE_SEM
- #define VOS_DELETE_SEM(semId) \
- if (NULL != semId) \
- { \
- VOS_DeleteSem(semId)
- semId = NULL
- }
- #endif
- #define PAssert_Statement_ReturnWithValue(condition, statement, return_value) \
- { \
- if (!(condition)) \
- { \
- statement
- return (return_value)
- } \
- }
- #define PAssert_Statement_Return(condition, statement) \
- { \
- if (!(condition)) \
- { \
- statement
- return
- } \
- }
- #define PAssertNotNull_Statement_ReturnWithValue(ptr, statement, return_value) \
- { \
- if( (ptr) == NULL) \
- { \
- statement
- return (return_value)
- } \
- }
- #define PAssertNotNull_Statement_Return(ptr, statement) \
- { \
- if( (ptr) == NULL) \
- { \
- statement
- return
- } \
- }
- #define PAssertNotNull_ReturnWithValue(ptr, return_value) \
- { \
- if( (ptr) == NULL) \
- { \
- return (return_value)
- } \
- }
- #define PAssertNotNull_Return(ptr) \
- { \
- if( (ptr) == NULL) \
- { \
- return
- } \
- }
- #define PStatement_Return(statement, return_value) \
- { \
- statement
- return return_value
- }
- #define PAssert_Break(condition) \
- { \
- if (!(condition)) \
- { \
- break
- } \
- }
- #define PStatement_Break(statement) \
- { \
- statement
- break
- }
- #define PAssert_Statement_Break(condition, statement) \
- { \
- if (!(condition)) \
- { \
- statement
- break
- } \
- }
- #define NULL_OPERATION
- #define PARRAYSIZE(array) ((sizeof(array)/sizeof(array[0])))
- #define CLASSINFO(cls, par) \
- public: \
- static const char * Class() \
- { return #cls; } \
- virtual const char * GetClass(unsigned ancestor = 0) const \
- { return ancestor > 0 ? par::GetClass(ancestor-1) : cls::Class()
- virtual BOOL IsClass(const char * clsName) const \
- { return strcmp(clsName, cls::Class()) == 0
- virtual BOOL IsDescendant(const char * clsName) const \
- { return strcmp(clsName, cls::Class()) == 0 || \
- par::IsDescendant(clsName)
- #ifndef MEMSET_CONSTRUCTOR
- #define MEMSET_CONSTRUCTOR(ClassType) \
- ClassType() \
- { \
- memset(this, 0, sizeof(ClassType))
- }
- #endif
- #if 0
- #ifdef __cplusplus
- #ifndef DELETE_ARRAY_TEMPLATE
- #define DELETE_ARRAY_TEMPLATE
- template <class classType>
- void DeleteArray(void *&ptr)
- {
- classType *ptrClassType = (classType *)ptr
- DELETEA(ptrClassType)
- ptr = NULL
- }
- #endif
- #ifndef DELETE_TEMPLATE
- #define DELETE_TEMPLATE
- template <class classType>
- void Delete(void *&ptr)
- {
- classType *ptrClassType = (classType *)ptr
- DELETEP(ptrClassType)
- ptr = NULL
- }
- #endif
- #endif
- #endif
- #endif
|