Karma Engine
Loading...
Searching...
No Matches
GFrameworkMacros.h
1
11#pragma once
12
13#include "krpch.h"
14
15enum EInternal {EC_InternalUseOnlyConstructor};
16typedef void (*ClassConstructorType) (const Karma::FObjectInitializer&);
17
18#define DEFINE_DEFAULT_CONSTRUCTOR_CALL(TClass) \
19 static void __DefaultConstructor(const FObjectInitializer& X) { new((EInternal*)X.GetObj())TClass; }
20
21#define DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL(TClass) \
22 static void __DefaultConstructor(const FObjectInitializer& X) { new((EInternal*)X.GetObj())TClass(X); }
23
24/*-----------------------------------------------------------------------------
25 Class declaration macros.
26-----------------------------------------------------------------------------*/
27
28#define DECLARE_KARMA_CLASS(TClass, TSuperClass) \
29public: \
30 DEFINE_DEFAULT_CONSTRUCTOR_CALL(TClass) \
31 \
32 typedef TSuperClass Super;\
33 \
34 static UClass* StaticClass() \
35 { \
36 UClass* returnClass_##TClass = nullptr; \
37 if(strcmp(#TClass, #TSuperClass) != 0) \
38 { \
39 GetPrivateStaticClassBody( \
40 "GeneralPackage", \
41 #TClass, \
42 returnClass_##TClass, \
43 sizeof(TClass), \
44 alignof(TClass), \
45 (ClassConstructorType)InternalConstructor<TClass>, \
46 &TClass::Super::StaticClass \
47 ); \
48 } \
49 else \
50 { \
51 GetPrivateStaticClassBody( \
52 "GeneralPackage", \
53 "UObject", \
54 returnClass_##TClass, \
55 sizeof(UObject), \
56 alignof(UObject), \
57 (ClassConstructorType)InternalConstructor<TClass>, \
58 &TClass::Super::NullClass \
59 ); \
60 } \
61 return returnClass_##TClass; \
62 } \
63 inline static UClass* NullClass() \
64 { \
65 return nullptr; \
66 }
Definition UObjectGlobals.h:738