CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
reflection_seprt.h
1
3
#ifndef _ReflectionSeprt_h_
4
#define _ReflectionSeprt_h_
5
6
//------------------------------------------------
7
// definition RTTI methonds outside a class dclaration
9
#define __ThisTypeInfo_Compiletime_Decl() \
10
struct ThisTypeInfo : System::TypeInfoPtr { ThisTypeInfo(); };
11
12
// thisType mast be full name with all namespaces
15
#define __ThisTypeInfo_Compiletime_Impl(thisType, hash) \
16
thisType::ThisTypeInfo::ThisTypeInfo() \
17
: System::TypeInfoPtr(ASPOSE_T(#thisType), hash) {
18
21
#define __ThisTypeInfo_Compiletime_Named_Impl(thisType, name, hash) \
22
thisType::ThisTypeInfo::ThisTypeInfo() \
23
: System::TypeInfoPtr(ASPOSE_T(name), hash) {
24
26
#define __ThisTypeInfo_Runtime_Decl() \
27
struct ThisTypeInfo : System::TypeInfoPtr { \
28
ThisTypeInfo(); \
29
};
30
31
#define __ThisTypeInfo_SetBaseType_Impl(baseTypes) \
32
ptr->SetBaseType(&baseTypes::Type::Type);
33
34
37
#define __ThisTypeInfo_Runtime_Impl(thisType) \
38
thisType::ThisTypeInfo::ThisTypeInfo() \
39
: System::TypeInfoPtr(typeid(thisType)) {
40
42
#define __RTTI_INFO_METHODS_DECL() \
43
public: \
44
static const System::TypeInfo& Type(); \
45
virtual const System::TypeInfo& GetType() const override; \
46
virtual bool Is(const System::TypeInfo &target) const override;\
47
private:
48
50
#define __RTTI_INFO_METHODS_DECL_EX(keyword) \
51
public: \
52
static keyword const System::TypeInfo& Type(); \
53
virtual keyword const System::TypeInfo& GetType() const override; \
54
virtual keyword bool Is(const System::TypeInfo &target) const override;\
55
private:
56
58
#define __RTTI_INFO_METHODS_IMPL(thisType, baseTypes) \
59
const System::TypeInfo& thisType::Type() { \
60
return *System::static_holder<ThisTypeInfo>(); \
61
} \
62
const System::TypeInfo& thisType::GetType() const { \
63
return thisType::Type(); \
64
} \
65
bool thisType::Is(const System::TypeInfo &target) const { \
66
const System::TypeInfo& thisis = thisType::Type(); \
67
return (thisis == target) ? true : baseTypes::CallIsForAll(this, target); \
68
}
69
71
#define RTTI_INFO_IMPL_END() }
72
76
#define RTTI_INFO_DECL() \
77
__RTTI_INFO_METHODS_DECL() \
78
__ThisTypeInfo_Compiletime_Decl()
79
83
#define RTTI_INFO_DECL_EX(keyword) \
84
__RTTI_INFO_METHODS_DECL_EX(keyword) \
85
__ThisTypeInfo_Compiletime_Decl()
86
90
#define RTTI_INFO_DECL_RT() \
91
__RTTI_INFO_METHODS_DECL() \
92
__ThisTypeInfo_Runtime_Decl()
93
94
95
// thisType mast be full name with all namespaces
96
// baseTypes: (TypeA)(TypeB)(TypeC)
98
#define RTTI_INFO_IMPL(thisType, baseTypes) \
99
__RTTI_INFO_METHODS_IMPL(thisType, baseTypes) \
100
__ThisTypeInfo_Compiletime_Impl(thisType, 0) \
101
__ThisTypeInfo_SetBaseType_Impl(baseTypes) \
102
RTTI_INFO_IMPL_END()
103
104
// baseTypes: (TypeA)(TypeB)(TypeC)
106
#define RTTI_INFO_IMPL_RT(thisType, baseTypes) \
107
__RTTI_INFO_METHODS_IMPL(thisType, baseTypes) \
108
__ThisTypeInfo_Runtime_Impl(thisType) \
109
__ThisTypeInfo_SetBaseType_Impl(baseTypes) \
110
RTTI_INFO_IMPL_END()
111
112
// thisType mast be full name with all namespaces
113
// baseTypes: (TypeA)(TypeB)(TypeC)
116
#define RTTI_INFO_IMPL_HASH(hash, thisType, baseTypes) \
117
__RTTI_INFO_METHODS_IMPL(thisType, baseTypes) \
118
__ThisTypeInfo_Compiletime_Impl(thisType, hash) \
119
__ThisTypeInfo_SetBaseType_Impl(baseTypes) \
120
RTTI_INFO_IMPL_END()
121
125
#define RTTI_INFO_IMPL_HASH_NAMED(hash, thisType, name, baseTypes) \
126
__RTTI_INFO_METHODS_IMPL(thisType, baseTypes) \
127
__ThisTypeInfo_Compiletime_Named_Impl(thisType, name, hash) \
128
RTTI_INFO_IMPL_END()
129
130
// for class with attributes
131
132
// baseTypes: (TypeA)(TypeB)(TypeC)
136
#define RTTI_INFO_IMPL_BEGIN(thisType, baseTypes) \
137
__RTTI_INFO_METHODS_IMPL(thisType, baseTypes) \
138
__ThisTypeInfo_Compiletime_Impl(thisType, 0)
139
140
// baseTypes: (TypeA)(TypeB)(TypeC)
144
#define RTTI_INFO_IMPL_HASH_BEGIN(hash, thisType, baseTypes) \
145
__RTTI_INFO_METHODS_IMPL(thisType, baseTypes) \
146
__ThisTypeInfo_Compiletime_Impl(thisType, hash)
147
148
#endif
// _ReflectionSeprt_h_
include
system
reflection_seprt.h
Generated by
1.9.4