Files
envi-code/SourceCode/Code2026/inc/define_class_xdata_key.h
T
2026-09-28 15:28:50 +08:00

52 lines
830 B
C

#pragma once
#define DEF_XDATA_KEY(key) static const CString key
#define IMP_XDATA_KEY(cls,key) const CString cls::key=_T(#key)
#define DEF_XDATA_FUN(func,type,key)\
bool Set##func(const type &v)\
{\
AssertWriteEnabled();\
return m_mapSpecXData.SetAt(key, v) == TRUE ? true : false;\
}\
##type Get##func() const\
{\
assertReadEnabled();\
type v;\
m_mapSpecXData.GetAt(key, v);\
return v;\
}
#define DEF_XDATA_KEY_FUN(func,type,key)\
private:\
DEF_XDATA_KEY(key);\
public:\
DEF_XDATA_FUN(func, type, key)
#define DECLARE_ENUM(E) \
struct E \
{ \
public: \
E(int value = 0) : _value((__Enum)value) { \
} \
E& operator=(int value) { \
this->_value = (__Enum)value; \
return *this; \
} \
operator int() const { \
return this->_value; \
} \
\
enum __Enum {
#define END_ENUM() \
}; \
\
private: \
__Enum _value; \
};