11#include <system/details/demangle.h>
12#include "system/reflection_seprt.h"
31template <
typename ...BaseTypes>
class BaseTypesInfo;
36template <
typename ...AllTypes>
struct AnyTypesMatch;
42template <
typename FirstType,
typename SecondType,
typename ...OtherTypes>
43struct AnyTypesMatch<FirstType, SecondType, OtherTypes...>
46 static constexpr bool value =
47 std::is_same<FirstType, SecondType>::value ||
48 AnyTypesMatch<FirstType, OtherTypes...>::value ||
49 AnyTypesMatch<SecondType, OtherTypes...>::value;
54template <
typename LastType>
55struct AnyTypesMatch<LastType>
58 static constexpr bool value =
false;
65template <
typename FirstType,
typename ...BaseTypes>
66class BaseTypesInfo<FirstType, BaseTypes...>
68 static_assert(!AnyTypesMatch<FirstType, BaseTypes...>::value,
"Two or more of the direct basic types match");
70 typedef FirstType
Type;
77 inline static bool CallIsForAll(T *
object,
const TypeInfo &typeInfo)
79 return object->FirstType::Is(typeInfo) || BaseTypesInfo<BaseTypes...>::CallIsForAll(
object, typeInfo);
90 inline static bool CallIsForAll(T*,
const TypeInfo&)
106#define __ThisTypeInfo_Compiletime(thisType, hash) \
107 struct ThisTypeInfo : System::TypeInfoPtr { \
108 ThisTypeInfo() : System::TypeInfoPtr(ASPOSE_T(#thisType), hash) {
112#define __ThisTypeInfo_Compiletime_Named(thisType, name, hash) \
113 struct ThisTypeInfo : System::TypeInfoPtr { \
114 ThisTypeInfo() : System::TypeInfoPtr(ASPOSE_T(name), hash) {
119#define __ThisTypeInfo_Compiletime_Named_Declare_Exported(method_api, thisType, name, hash) \
120 struct ThisTypeInfo : System::TypeInfoPtr { \
121 method_api ThisTypeInfo();
125#define __ThisTypeInfo_Runtime(thisType) \
126 struct ThisTypeInfo : System::TypeInfoPtr { \
127 ThisTypeInfo() : System::TypeInfoPtr(typeid(thisType)) {
130#define __RTTI_INFO_METHODS(thisType, baseTypes) \
134 static const System::TypeInfo& Type() { \
135 return *System::static_holder<ThisTypeInfo>(); \
138 const System::TypeInfo& GetType() const override { \
139 return thisType::Type(); \
144 bool Is(const System::TypeInfo &target) const override { \
145 const System::TypeInfo& thisis = thisType::Type(); \
146 return (thisis == target) ? true : baseTypes::CallIsForAll(this, target); \
151#define __RTTI_INFO_METHODS_EXPORTED(method_api, thisType, baseTypes) \
155 static method_api const System::TypeInfo& Type(); \
157 method_api const System::TypeInfo& GetType() const override; \
161 method_api bool Is(const System::TypeInfo &target) const override; \
164#define __RTTI_INFO_METHODS_BOXED(thisType, baseTypes) \
166 static const System::TypeInfo& Type() { \
167 return *System::static_holder<ThisTypeInfo>(); \
169 bool Is(const System::TypeInfo &target) const override { \
170 const System::TypeInfo& thisis = thisType::GetType(); \
171 return (thisis == target) ? true : baseTypes::CallIsForAll(this, target); \
177#define RTTI_INFO_END() } };
187#define RTTI_INFO(thisType, baseTypes) \
188 __RTTI_INFO_METHODS(thisType, baseTypes) \
189 __ThisTypeInfo_Compiletime(thisType, 0) \
195#define RTTI_INFO_NAMED(thisType, name, baseTypes) \
196 __RTTI_INFO_METHODS(thisType, baseTypes) \
197 __ThisTypeInfo_Compiletime_Named(thisType, name, 0) \
203#define RTTI_INFO_NAMED_DECLARE_EXPORTED(method_api, thisType, name, baseTypes) \
204 __RTTI_INFO_METHODS_EXPORTED(method_api, thisType, baseTypes) \
205 __ThisTypeInfo_Compiletime_Named_Declare_Exported(method_api, thisType, name, 0) \
213#define RTTI_INFO_HASH(hash, thisType, baseTypes) \
214 __RTTI_INFO_METHODS(thisType, baseTypes) \
215 __ThisTypeInfo_Compiletime(thisType, hash) \
218#define __ThisTypeInfo_SetBaseType(baseTypes) \
219 ptr->SetBaseType(&baseTypes::Type::Type);
221#define __ThisTypeInfo_SetTemplParamType(templParamType) \
222 ptr->SetTemplParamType(System::ObjectExt::GetType<templParamType>());
224#define __ThisTypeInfo_SetDefaultConstructor(elementType) \
225 ptr->AddDefaultConstructor<elementType>();
228#define RTTI_INFO_TEMPLATE_CLASS_REFL(thisType, baseTypes, templParamType) \
229 __RTTI_INFO_METHODS(thisType, baseTypes) \
230 __ThisTypeInfo_Runtime(thisType) \
231 __ThisTypeInfo_SetBaseType(baseTypes) \
232 __ThisTypeInfo_SetDefaultConstructor(thisType) \
233 __ThisTypeInfo_SetTemplParamType(templParamType) \
241#define RTTI_INFO_TEMPLATE_CLASS(thisType, baseTypes) \
242 __RTTI_INFO_METHODS(thisType, baseTypes) \
243 __ThisTypeInfo_Runtime(thisType) \
244 __ThisTypeInfo_SetBaseType(baseTypes) \
250#define RTTI_INFO_CUSTOM(thisType, baseTypes) \
251 __RTTI_INFO_METHODS(thisType, baseTypes)
257#define RTTI_INFO_BOXED_CUSTOM(thisType, baseTypes) \
258 __RTTI_INFO_METHODS_BOXED(thisType, baseTypes)
260#define RTTI_INFO_BOXED(thisType, baseTypes) \
261 __RTTI_INFO_METHODS_BOXED(thisType, baseTypes) \
262 __ThisTypeInfo_Runtime(thisType) \
263 __ThisTypeInfo_SetBaseType(baseTypes) \
273#define RTTI_INFO_BEGIN(thisType, baseTypes) \
274 __RTTI_INFO_METHODS(thisType, baseTypes) \
275 __ThisTypeInfo_Compiletime(thisType, 0)
280#define RTTI_INFO_HASH_BEGIN(hash, thisType, baseTypes) \
281 __RTTI_INFO_METHODS(hash, thisType, baseTypes)
284#define RTTI_ATTRIBUTE(type, params) \
285 ptr->AddAttribute( System::static_pointer_cast<System::Object>( System::MakeObject<type> (params) ) );
291#define RTTI_INFO_VALUE_TYPE(thisType) \
293 static const System::TypeInfo& Type() { \
294 return *System::static_holder<ThisTypeInfo>(); \
296 const System::TypeInfo& GetType() const { \
297 return thisType::Type(); \
300 __ThisTypeInfo_Compiletime(thisType, 0) \
301 ptr->SetBaseType(&System::Object::Type); \
@ Type
Returns a socket type.
@ TypeInfo
Specifies that the member is a type.
Definition: db_command.h:9