KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Object.h
Go to the documentation of this file.
1
10
11#pragma once
12
13#include "UObjectBase.h"
14#include "GFrameworkMacros.h"
15
16namespace Karma
17{
18 class UClass;
19
25 typedef UClass* (*StaticClassFunctionType)();
26
32 template<class T>
34 {
35 T::__DefaultConstructor(X);
36 }
37
64 KARMA_API void GetPrivateStaticClassBody(
65 const std::string& PackageName,
66 const std::string& Name,
67 UClass*& ReturnClass,
68 /*void(*RegisterNativeFunc)(),*/
69 size_t InSize,
70 size_t InAlignment,
71 /*EClassFlags InClassFlags,
72 EClassCastFlags InClassCastFlags,
73 const TCHAR* InConfigName,*/
74 ClassConstructorType InClassConstructor,
75 /*UClass::ClassVTableHelperCtorCallerType InClassVTableHelperCtorCaller,
76 FUObjectCppClassStaticFunctions&& InCppClassStaticFunctions,*/
77 StaticClassFunctionType InSuperClassFn
78 /*UClass::StaticClassFunctionType InWithinClassFn*/);
79
89 KARMA_API void InitializePrivateStaticClass(
90 class UClass* TClass_Super_StaticClass,
91 class UClass* TClass_PrivateStaticClass,
92 class UClass* TClass_WithinClass_StaticClass,
93 const std::string& PackageName,
94 const std::string& Name
95 );
96
106 {
107 /*
108 * Declaration shaped for Karma's game code
109 *
110 * Contains reference to default constructor (defined in this file) and definition
111 * for "Super", the base class and StaticClass()
112 *
113 * Note: UObject's base class is UObject
114 */
116
117 private:
118 //UClass* m_StaticClass;
119
120 public:
130 UObject();
131
135 static const char* StaticConfigName()
136 {
137 return "Engine";
138 }
139
148 virtual void FinishDestroy();
149
156 virtual const std::string& GetDesc() { static std::string someString = ""; return someString; }
157
158 public:
166 virtual class UWorld* GetWorld() const;
167
176 bool IsValidChecked(const UObject* Test);
177
185 virtual void BeginDestroy();
186
198#if WITH_EDITOR
199 virtual bool Modify(bool bAlwaysMarkDirty = true);
200
202 bool CanModify() const;
203#else
204 FORCEINLINE bool Modify(bool bAlwaysMarkDirty = true) { return false; }
205#endif
206
215 bool IsSelected() const;
216 };
217
223
225 {
226 KR_CORE_ASSERT(GUObjectStore.IndexToObject(Test->GetInternalIndex())->HasAnyFlags(EInternalObjectFlags(int32_t(EInternalObjectFlags::PendingKill) | int32_t(EInternalObjectFlags::Garbage))) == Test->HasAnyFlags(EObjectFlags(RF_PendingKill | RF_Garbage)), "");
227
229 }
230
239 FORCEINLINE bool IsValid(const UObject* Test)
240 {
241 return Test && /*FInternalUObjectBaseUtilityIsValidFlagsChecker::CheckObjectValidBasedOnItsFlags(Test)*/ TentativeFlagChecks(Test);
242 }
243}
#define KARMA_API
Defining Karma's API macro for storage class information.
Definition Core.h:41
#define FORCEINLINE
Typical inlining macro for clarity.
Definition Core.h:157
This file contains some commonly used game code macros.
#define DECLARE_KARMA_CLASS(TClass, TSuperClass)
Karma's gamecode object class declaration.
Definition GFrameworkMacros.h:44
void InternalConstructor(const FObjectInitializer &X)
Helper template to call the default constructor for a class.
Definition Object.h:33
FORCEINLINE bool IsValid(const UObject *Test)
Test validity of object.
Definition Object.h:239
FORCEINLINE bool TentativeFlagChecks(const UObject *Test)
Note the name. Need to understand UE's take upon the subject.
Definition Object.h:224
This file contains the class UObjectBase class.
EObjectFlags
Flags describing an object instance.
Definition UObjectGlobals.h:183
@ RF_PendingKill
Objects that are pending destruction (invalid for gameplay but valid objects). This flag is mirrored ...
Definition UObjectGlobals.h:231
@ RF_Garbage
Garbage from logical point of view and should not be referenced. This flag is mirrored in EInternalOb...
Definition UObjectGlobals.h:232
EInternalObjectFlags
Objects flags for internal use (GC, low level UObject code)
Definition UObjectGlobals.h:243
@ PendingKill
Objects that are pending destruction (invalid for gameplay but valid objects). This flag is mirrored ...
Definition UObjectGlobals.h:255
@ Garbage
Garbage from logical point of view and should not be referenced. This flag is mirrored in EObjectFlag...
Definition UObjectGlobals.h:247
Internal class to finalize UObject creation (initialize properties) after the real C++ constructor is...
Definition UObjectGlobals.h:921
An object class.
Definition Class.h:158
FORCEINLINE uint32_t GetInternalIndex() const
Definition UObjectBase.h:110
FORCEINLINE bool HasAnyFlags(EObjectFlags FlagsToCheck) const
Definition UObjectBase.h:363
UObjectBase()
Providing a default constructor.
Definition UObjectBase.cpp:15
The base class of all the game code relevant objects.
Definition Object.h:106
FORCEINLINE bool Modify(bool bAlwaysMarkDirty=true)
Definition Object.h:204
static const char * StaticConfigName()
Definition Object.h:135
virtual const std::string & GetDesc()
Return a one line description of an object for viewing in the thumbnail view of the generic browser.
Definition Object.h:156
UObject()
Definition Object.cpp:10
The World is the top level object representing a map or a sandbox in which Actors and Components will...
Definition World.h:150