KarmaEngine
Game Engine for practical learning and research purposes
|
Template to allow TClassType's to be passed around with type safety. More...
#include <SubClassOf.h>
Public Types | |
typedef TChooseClass< TIsDerivedFrom< TClass, FField >::IsDerived, FFieldClass, UClass >::Result | TClassType |
Since I don't think I understand the purpose of this typedef, I may attempt to parse the code. Seems like if TClass is derived from FField then TClassType is FFieldClass, else, UClass (for most scenarios). The pointer variable is of this type, i.e TClassType. | |
typedef TChooseClass< TIsDerivedFrom< TClass, FField >::IsDerived, FField, UObject >::Result | TBaseType |
Again, on parsing, I understand the meaning to be, if TClass is derived from FField then TBaseType is FField else UObject (for most scenarios). The return type of GetDefaultObject() is of this type, again UObject for majority of the cases. | |
Public Member Functions | |
TSubclassOf () | |
TSubclassOf (TClassType *From) | |
template<typename U, std::enable_if_t<!TIsTSubclassOf< std::decay_t< U > >::Value, decltype(ImplicitConv< TClassType * >(std::declval< U >())) > * = nullptr> | |
TSubclassOf (U &&From) | |
Constructor that takes a UClass and does a runtime check to make sure this is a compatible class. | |
template<class TClassA, class = decltype(ImplicitConv<TClass*>((TClassA*)nullptr))> | |
TSubclassOf (const TSubclassOf< TClassA > &From) | |
template<class TClassA, class = decltype(ImplicitConv<TClass*>((TClassA*)nullptr))> | |
TSubclassOf & | operator= (const TSubclassOf< TClassA > &From) |
TSubclassOf & | operator= (TClassType *From) |
template<typename U, std::enable_if_t< !TIsTSubclassOf< std::decay_t< U > >::Value, decltype(ImplicitConv< TClassType * >(std::declval< U >())) > * = nullptr> | |
TSubclassOf & | operator= (U &&From) |
TClassType * | operator* () const |
TClassType * | Get () const |
TClassType * | operator-> () const |
operator TClassType * () const | |
TClass * | GetDefaultObject () const |
Template to allow TClassType's to be passed around with type safety.
|
inline |
Default Constructor, defaults to null
|
inline |
|
inline |
Constructor that takes a UClass and does a runtime check to make sure this is a compatible class.
Understanding by-parts
std::declval: Converts any type U to a reference type, allowing the use of class (struct) functions of U without actually initializing an object (simillar to that of static functions, in the sense no object is needed). For instance:
Note the usage of foo() function without creating the object
std::enable_if_t: Consider the following statement
then, If B is true, std::enable_if has a public member typedef type, equal to T; otherwise, there is no member typedef.
From | A (mostly) UClass pointer with runtime check (which I don't practically understand) |
|
inline |
Copy Constructor, will only compile if types are compatible
From | A derived TClassA |
|
inline |
Dereference back into a UClass
|
inline |
Get the CDO if we are referencing a valid class
|
inline |
Implicit conversion to UClass
|
inline |
Dereference back into a UClass, does runtime type checking
|
inline |
Dereference back into a UClass
|
inline |
Assignment operator, will only compile if types are compatible
From | The object to copy from |
|
inline |
Assignment operator from UClass, the type is checked on get not on set
From | The object to copy from |
|
inline |
Assignment operator from UClass, the type is checked on get not on set
From | Object to copy from |