KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
GFrameworkMacros.h
Go to the documentation of this file.
1
10
11#pragma once
12
13#include "krpch.h"
14
15enum EInternal {EC_InternalUseOnlyConstructor};
16typedef void (*ClassConstructorType) (const Karma::FObjectInitializer&);
17
23#define DEFINE_DEFAULT_CONSTRUCTOR_CALL(TClass) \
24 static void __DefaultConstructor(const FObjectInitializer& X) { new((EInternal*)X.GetObj())TClass; }
25
26#define DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL(TClass) \
27 static void __DefaultConstructor(const FObjectInitializer& X) { new((EInternal*)X.GetObj())TClass(X); }
28
29/*-----------------------------------------------------------------------------
30 Class declaration macros.
31-----------------------------------------------------------------------------*/
32
44#define DECLARE_KARMA_CLASS(TClass, TSuperClass) \
45public: \
46 DEFINE_DEFAULT_CONSTRUCTOR_CALL(TClass) \
47 \
48 typedef TSuperClass Super;\
49 \
50 static UClass* StaticClass() \
51 { \
52 UClass* returnClass_##TClass = nullptr; \
53 if(strcmp(#TClass, #TSuperClass) != 0) \
54 { \
55 GetPrivateStaticClassBody( \
56 "GeneralPackage", \
57 #TClass, \
58 returnClass_##TClass, \
59 sizeof(TClass), \
60 alignof(TClass), \
61 (ClassConstructorType)InternalConstructor<TClass>, \
62 &TClass::Super::StaticClass \
63 ); \
64 } \
65 else \
66 { \
67 GetPrivateStaticClassBody( \
68 "GeneralPackage", \
69 "UObject", \
70 returnClass_##TClass, \
71 sizeof(UObject), \
72 alignof(UObject), \
73 (ClassConstructorType)InternalConstructor<TClass>, \
74 &TClass::Super::NullClass \
75 ); \
76 } \
77 return returnClass_##TClass; \
78 } \
79 inline static UClass* NullClass() \
80 { \
81 return nullptr; \
82 }
Internal class to finalize UObject creation (initialize properties) after the real C++ constructor is...
Definition UObjectGlobals.h:921