KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma::UClass Class Reference

An object class. More...

#include <Class.h>

Inheritance diagram for Karma::UClass:
Collaboration diagram for Karma::UClass:

Public Member Functions

 UClass ()
 Default constructor.
 
 UClass (const std::string &name)
 Overloaded constructor.
 
 UClass (const std::string &name, size_t size, size_t alignment, ClassConstructorType inClassConstructor)
 
virtual const std::string & GetDesc () override
 
FORCEINLINE bool HasAnyClassFlags (EClassFlags FlagsToCheck) const
 
virtual void SetupObjectInitializer (FObjectInitializer &ObjectInitializer) const
 
UObjectGetDefaultObject (bool bCreateIfNeeded=true) const
 
template<class T>
T * GetDefaultObject () const
 
UClassGetSuperClass () const
 
FORCEINLINE size_t GetMinAlignment () const
 
virtual void SetSuperStruct (UStruct *NewSuperStruct) override
 
virtual void InitPropertiesFromCustomList (uint8_t *DataPtr, const uint8_t *DefaultDataPtr)
 
- Public Member Functions inherited from Karma::UStruct
bool IsChildOf (const UStruct *SomeBase) const
 
UStructGetSuperStruct () const
 
FORCEINLINE size_t GetPropertiesSize () const
 Total size of all UProperties, the allocated structure may be larger due to alignment.
 
- Public Member Functions inherited from Karma::UObject
 UObject ()
 
virtual void FinishDestroy ()
 
virtual class UWorldGetWorld () const
 Returns what UWorld this object is contained within.
 
bool IsValidChecked (const UObject *Test)
 
virtual void BeginDestroy ()
 Called before destroying the object. This is called immediately upon deciding to destroy the object, to allow the object to begin an asynchronous cleanup process.
 
FORCEINLINE bool Modify (bool bAlwaysMarkDirty=true)
 
bool IsSelected () const
 Test the selection state of a UObject.
 
- Public Member Functions inherited from Karma::UObjectBase
 UObjectBase (UClass *inClass, EObjectFlags inFlags, EInternalObjectFlags inInternalFlags, UObject *inOuter, const std::string &inName)
 
UPackageGetPackage () const
 
UPackageGetExternalPackage () const
 
bool IsUnreachable () const
 
FORCEINLINE void SetInternalIndex (uint32_t StoreIndex)
 
FORCEINLINE uint32_t GetInternalIndex () const
 
void MarkAsGarbage ()
 
void ClearGarbage ()
 
FORCEINLINE const std::string & GetName () const
 
FORCEINLINE void SetObjectName (const std::string &aName)
 
FORCEINLINE UObjectGetOuter () const
 
UObjectGetTypedOuter (UClass *Target) const
 
template<typename T>
T * GetTypedOuter () const
 
bool IsValidLowLevel () const
 
template<typename OtherClassType>
FORCEINLINE bool IsA (OtherClassType SomeBase) const
 
FORCEINLINE UClassGetClass () const
 
FORCEINLINE EObjectFlags GetFlags () const
 
FORCEINLINE void SetFlags (EObjectFlags NewFlags)
 
FORCEINLINE void ClearFlags (EObjectFlags FlagsToClear)
 
FORCEINLINE bool HasAnyFlags (EObjectFlags FlagsToCheck) const
 
FORCEINLINE bool HasAnyInternalFlags (EInternalObjectFlags FlagsToCheck) const
 
FORCEINLINE void SetInternalFlags (EInternalObjectFlags FlagsToSet) const
 
FORCEINLINE void AddToRoot ()
 

Public Attributes

ClassConstructorType m_ClassConstructor
 
EClassFlags m_ClassFlags
 
- Public Attributes inherited from Karma::UStruct
size_t m_PropertiesSize
 
size_t m_MinAlignment
 

Protected Member Functions

virtual UObjectCreateDefaultObject ()
 
- Protected Member Functions inherited from Karma::UObjectBase
 UObjectBase ()
 Providing a default constructor.
 
FORCEINLINE void SetFlagsTo (EObjectFlags NewFlags)
 

Additional Inherited Members

- Static Public Member Functions inherited from Karma::UObject
static const char * StaticConfigName ()
 
- Static Public Member Functions inherited from Karma::UObjectBase
static FORCEINLINE EInternalObjectFlags FixGarbageOrPendingKillInternalObjectFlags (const EInternalObjectFlags InFlags)
 

Detailed Description

An object class.

An UObject derived object with class identification including size, description, class flags and all that

Constructor & Destructor Documentation

◆ UClass() [1/3]

Karma::UClass::UClass ( )

Default constructor.

Since
Karma 1.0.0

◆ UClass() [2/3]

Karma::UClass::UClass ( const std::string & name)

Overloaded constructor.

Parameters
nameSet the m_NamePrivate of the UClass UObject that is class name of the UObject of UClass
Since
Karma 1.0.0

◆ UClass() [3/3]

Karma::UClass::UClass ( const std::string & name,
size_t size,
size_t alignment,
ClassConstructorType inClassConstructor )

A useful constructor for StaticClass initialization

Parameters
nameSet the m_NamePrivate of the UClass UObject that is class name of the UObject of UClass
sizeThe size (in bytes) of the UObject this object is UClass of
alignmentAlignment of UObject, this object is UClass of, in memory. The UObject will be at least this large
inClassConstructorThe custom constructor (InternalConstructor<TClass>) to be called after UObject allocation and during UObject initialization. Calls placement new with specified UObject class constructor. See InClass->m_ClassConstructor line in the routine StaticConstructObject_Internal(const FStaticConstructObjectParameters&)
See also
GetPrivateStaticClassBody in Object.cpp
Since
Karma 1.0.0

Member Function Documentation

◆ CreateDefaultObject()

UObject * Karma::UClass::CreateDefaultObject ( )
protectedvirtual

Get the default object from the class, creating it if missing, if requested or under a few other circumstances

Returns
the CDO for this class
Since
Karma 1.0.0

Get the default object from the class, creating it if missing, if requested or under a few other circumstances

Returns
the CDO for this class

◆ GetDefaultObject() [1/2]

template<class T>
T * Karma::UClass::GetDefaultObject ( ) const
inline

Get the default object from the class and cast to a particular type

Returns
the CDO for this class
Since
Karma 1.0.0

◆ GetDefaultObject() [2/2]

UObject * Karma::UClass::GetDefaultObject ( bool bCreateIfNeeded = true) const
inline

Get the default object from the class

Parameters
bCreateIfNeededIf true (default) then the CDO is created if it is null
Returns
the CDO for this class
Todo
Will be completely written once the scope of defaultobject is needed
Since
Karma 1.0.0

◆ GetDesc()

const std::string & Karma::UClass::GetDesc ( )
overridevirtual

Fetch a human readable description for the UClass

Remarks
Gets the m_NamePrivate of the UClass UObject which is the name of the UClass of a UObject
Since
Karma 1.0.0

Reimplemented from Karma::UObject.

◆ GetMinAlignment()

FORCEINLINE size_t Karma::UClass::GetMinAlignment ( ) const
inline

Alignment of structure in memory, structure will be at least this large

Since
Karma 1.0.0

◆ GetSuperClass()

UClass * Karma::UClass::GetSuperClass ( ) const
inline

Returns parent class, the parent of a Class is always another class

Since
Karma 1.0.0

◆ HasAnyClassFlags()

FORCEINLINE bool Karma::UClass::HasAnyClassFlags ( EClassFlags FlagsToCheck) const
inline

Used to safely check whether the passed in flag is set.

Parameters
FlagsToCheckClass flag(s) to check for
Returns
true if the passed in flag is set, false otherwise (including no flag passed in, unless the FlagsToCheck is CLASS_AllFlags)
Since
Karma 1.0.0

◆ InitPropertiesFromCustomList()

virtual void Karma::UClass::InitPropertiesFromCustomList ( uint8_t * DataPtr,
const uint8_t * DefaultDataPtr )
inlinevirtual

Helper method to assist with initializing object properties from an explicit list.

Parameters
InStructthe current scope for which the given property list applies
DataPtrdestination address (where to start copying values to)
DefaultDataPtrsource address (where to start copying the defaults data from)
Since
Karma 1.0.0

◆ SetSuperStruct()

void Karma::UClass::SetSuperStruct ( UStruct * NewSuperStruct)
overridevirtual

Sets the super struct pointer.

See also
InitializePrivateStaticClass() in Object.cpp
Note
that this is not sufficient to actually reparent a struct, it simply sets a pointer.
Since
Karma 1.0.0

Reimplemented from Karma::UStruct.

◆ SetupObjectInitializer()

virtual void Karma::UClass::SetupObjectInitializer ( FObjectInitializer & ObjectInitializer) const
inlinevirtual

Allows class to provide data to the object initializer that can affect how native class subobjects are created.

Todo
Placeholder for the moment.
Since
Karma 1.0.0

Member Data Documentation

◆ m_ClassConstructor

ClassConstructorType Karma::UClass::m_ClassConstructor

A custom constructor for the UObject object this class is UClass of

Remarks
This member is public because we explicitly call this member after UObjectAllocation in StaticConstructObject_Internal(const FStaticConstructObjectParameters&)
Since
Karma 1.0.0

◆ m_ClassFlags

EClassFlags Karma::UClass::m_ClassFlags

Class flags; See Karma::EClassFlags for more information

Since
Karma 1.0.0

The documentation for this class was generated from the following files: