Karma Engine
Loading...
Searching...
No Matches
Object.h
Go to the documentation of this file.
1
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
105 class KARMA_API UObject : public UObjectBase
106 {
107 // In UE, this is done in ObjectMacros.h, #define DECLARE_CLASS
108 DECLARE_KARMA_CLASS(UObject, UObject)
109
110 private:
111 //UClass* m_StaticClass;
112
113 public:
123 UObject();
124
128 static const char* StaticConfigName()
129 {
130 return "Engine";
131 }
132
141 virtual void FinishDestroy();
142
149 virtual const std::string& GetDesc() { static std::string someString = ""; return someString; }
150
151 public:
159 virtual class UWorld* GetWorld() const;
160
169 bool IsValidChecked(const UObject* Test);
170
178 virtual void BeginDestroy();
179
191#if WITH_EDITOR
192 virtual bool Modify(bool bAlwaysMarkDirty = true);
193
195 bool CanModify() const;
196#else
197 FORCEINLINE bool Modify(bool bAlwaysMarkDirty = true) { return false; }
198#endif
199
208 bool IsSelected() const;
209 };
210
217 FORCEINLINE bool TentativeFlagChecks(const UObject* Test)
218 {
219 KR_CORE_ASSERT(GUObjectStore.IndexToObject(Test->GetInterIndex())->HasAnyFlags(EInternalObjectFlags(int32_t(EInternalObjectFlags::PendingKill) | int32_t(EInternalObjectFlags::Garbage))) == Test->HasAnyFlags(EObjectFlags(RF_PendingKill | RF_Garbage)), "");
220
221 return !Test->HasAnyFlags(EObjectFlags(RF_PendingKill | RF_Garbage));
222 }
223
232 FORCEINLINE bool IsValid(const UObject* Test)
233 {
234 return Test && /*FInternalUObjectBaseUtilityIsValidFlagsChecker::CheckObjectValidBasedOnItsFlags(Test)*/ TentativeFlagChecks(Test);
235 }
236}
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:232
FORCEINLINE bool TentativeFlagChecks(const UObject *Test)
Note the name. Need to understand UE's take upon the subject.
Definition Object.h:217
FORCEINLINE BuildingBlock & IndexToObject(int32_t Index)
Definition KarmaTypes.h:308
Definition UObjectGlobals.h:738
Definition Class.h:99
Low level implementation of UObject, should not be used directly in game code Taken from UE's UObject...
Definition UObjectBase.h:34
FORCEINLINE bool HasAnyFlags(EObjectFlags FlagsToCheck) const
Definition UObjectBase.h:256
The base class of all the game code relevant objects.
Definition Object.h:106
FORCEINLINE bool Modify(bool bAlwaysMarkDirty=true)
Definition Object.h:197
static const char * StaticConfigName()
Definition Object.h:128
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:149
Definition World.h:108