|
CeresEngine 0.2.0
A game development framework
|
Represents a reflected C++ type. Can be used to get metadata from a C++ type. More...
#include <CeresEngine/Reflection/Type.hpp>
Public Member Functions | |
| Type () noexcept=default | |
| Type (const TypeInfo &typeInfo) | |
| Type (StringView name) noexcept | |
| Finds a type by it's name. | |
| Type (TypeID typeID) noexcept | |
| Finds a type by it's id. | |
| TypeID | getTypeID () const noexcept |
| Gets the type ID. | |
| StringView | getTypeName () const noexcept |
| StringView | getName () const noexcept |
| std::size_t | getTypeSize () const noexcept |
| std::align_val_t | getTypeAlignment () const noexcept |
| TypeIdentityHash | getIdentityHash () const noexcept |
| Gets the type identity hash. | |
| bool | isDecayed () const noexcept |
Determines if the type is decayed, that is, this->getDecayedType() == this. | |
| Type | getDecayType () const noexcept |
| Gets the decayed type. | |
| TypeID | getDecayTypeID () const noexcept |
| Gets the decayed type. | |
| Type | getUnderlyingType () const noexcept |
If an enum, gets the underlying type of the enum. | |
| TypeID | getUnderlyingTypeID () const noexcept |
If an enum, gets the underlying type of the enum. | |
| bool | isConst () const noexcept |
| Returns true if the type is const, false otherwise. | |
| bool | isLvalueReference () const noexcept |
| Returns true if the type is an lvalue reference, false otherwise. | |
| bool | isRvalueReference () const noexcept |
| Returns true if the type is an rvalue reference, false otherwise. | |
| bool | isReference () const noexcept |
| Returns true if the type is a reference (lvalue or rvalue), false otherwise. | |
| bool | isClass () const noexcept |
| Returns true if the type is a class, false otherwise. | |
| bool | isPointer () const noexcept |
| Returns true if the type is a pointer, false otherwise. | |
| bool | isVoidPtr () const noexcept |
| Returns true if the type is a void pointer, false otherwise. | |
| bool | isClassPtr () const noexcept |
| Returns true if the type is a class pointer, false otherwise. | |
| bool | isFunctionPtr () const noexcept |
| Returns true if the type is a function pointer, false otherwise. | |
| bool | isArray () const noexcept |
| Returns true if the type is an array, false otherwise. | |
| uint16_t | getPointerArity () const noexcept |
| Returns the pointer arity of the type. Returns 0 if the type is not a pointer. | |
| template<typename T > | |
| bool | is () const |
| template<typename T > | |
| const T * | as () const |
| const Class * | getClass () const noexcept |
Gets the Class instance associated with the type. | |
| const Enum * | getMetaEnum () const noexcept |
Gets the MetaEnum instance associated with the type. | |
| bool | compatible (const Type &other) const noexcept |
Determines if the fromType is compatible with the toType. | |
| template<typename T > | |
| bool | compatible () const noexcept |
Determines if the fromType is compatible with the toType. | |
| Box | construct () const |
| Constructs a new value from the type, if default constructible. | |
| void | destruct (void *instance) const |
| Destroys an instance of the type. Calls the C++ destructor. | |
| bool | isValid () const noexcept |
Determines if the Type object points to a valid type or not. | |
| operator bool () const noexcept | |
Determines if the Type object points to a valid type or not. | |
Static Public Member Functions | |
| static Type | fromName (StringView name) noexcept |
| Finds a type by it's name. | |
| static Type | fromID (TypeID id) noexcept |
| Finds a type by it's id. | |
| static bool | compatible (Type fromType, Type toType) noexcept |
Determines if the fromType is compatible with the toType. | |
| static bool | hasConverter (Type fromType, Type toType) noexcept |
Determines if there is a converter available to convert a value from fromType to toType. | |
| static bool | hasConverter (TypeID fromTypeID, TypeID toTypeID) noexcept |
Determines if there is a converter available to convert a value from fromType to toType. | |
| template<typename From , typename To > | |
| static bool | hasConverter () noexcept |
Determines if there is a converter available to convert a value from From to To. | |
| template<typename From , typename To , typename Func > | |
| static bool | registerConverter (Func &&func) |
| template<typename From , typename To > | |
| static bool | registerConverter (To(*func)(From)) |
| template<typename From , typename To > | |
| static bool | registerConverter () |
| template<typename From , typename To > | |
| static bool | registerConverter (To(From::*func)() const) |
| template<typename From , typename To > | |
| static bool | registerConverter (To(From::*func)(bool &) const) |
| static void | unregisterConverter (TypeID fromTypeID, TypeID toTypeID) |
| template<typename From , typename To > | |
| static void | unregisterConverter () |
Private Member Functions | |
| void * | allocate () const |
| void | deallocate (void *ptr) const |
| void | defaultConstruct (void *where) const |
| void | copyConstruct (const void *source, void *where) const |
| void | moveConstruct (void *source, void *where) const |
| void | moveOrCopy (void *source, void *where) const |
| void | destroy (void *ptr) const noexcept |
| bool | compareEquality (const void *lhs, const void *rhs) const |
Static Private Member Functions | |
| template<typename From , typename To , typename Func > | |
| static bool | registerConverterInternal (Func &&func) |
| template<typename From , typename To > | |
| static bool | registerConverterInternal (To(From::*func)() const) |
| template<typename From , typename To > | |
| static bool | registerConverterInternal (To(From::*func)(bool &) const) |
| static bool | registerConverter (TypeID fromTypeID, TypeID toTypeID, const internal::ConvertFunctionBase &converter) |
| template<typename From , typename To > | |
| static bool | registerConverterInternalNonChecked () |
| static bool | registerConverterInternalNonChecked (TypeID fromTypeID, TypeID toTypeID, const internal::ConvertFunctionBase &converter) |
| static bool | convert (const void *from, Type fromType, void *to, Type toType) |
| static bool | convert (const void *from, TypeID fromTypeID, void *to, TypeID toTypeID) |
Private Attributes | |
| const TypeInfo * | mTypeInfo = nullptr |
The TypeInfo structure that describes the reflected type. | |
Friends | |
| class | Class |
| class | Enum |
| class | Box |
| bool | operator== (const Type &type, std::nullptr_t) noexcept |
Determines if the Type object points to a valid type or not. | |
| bool | operator!= (const Type &type, std::nullptr_t) noexcept |
Determines if the Type object points to a valid type or not. | |
| bool | operator== (std::nullptr_t, const Type &type) noexcept |
Determines if the Type object points to a valid type or not. | |
| bool | operator!= (std::nullptr_t, const Type &type) noexcept |
Determines if the Type object points to a valid type or not. | |
| bool | operator== (const Type &lhs, const Type &rhs) noexcept |
| bool | operator!= (const Type &lhs, const Type &rhs) noexcept |
| bool | operator< (const Type &lhs, const Type &rhs) noexcept |
| bool | operator<= (const Type &lhs, const Type &rhs) noexcept |
| bool | operator> (const Type &lhs, const Type &rhs) noexcept |
| bool | operator>= (const Type &lhs, const Type &rhs) noexcept |
Represents a reflected C++ type. Can be used to get metadata from a C++ type.
|
defaultnoexcept |
|
explicitnoexcept |
Finds a type by it's name.
If the type is not found, the returned Type::isValid method retuns false.
|
explicitnoexcept |
Finds a type by it's id.
If the type is not found, the returned Type::isValid method retuns false.
|
private |
Determines if the fromType is compatible with the toType.
Compatibility is defined as the types are either the same, toType is a base class of fromType or there is a converter from fromType to toType available.
Determines if the fromType is compatible with the toType.
Compatibility is defined as the types are either the same, toType is a base class of fromType or there is a converter from fromType to toType available.
Determines if the fromType is compatible with the toType.
Compatibility is defined as the types are either the same, toType is a base class of fromType or there is a converter from fromType to toType available.
| Box CeresEngine::Type::construct | ( | ) | const |
Constructs a new value from the type, if default constructible.
MetaValue that contains the newly constructed type.
|
staticprivate |
|
staticprivate |
Destroys an instance of the type. Calls the C++ destructor.
Finds a type by it's id.
If the type is not found, the returned Type::isValid method retuns false.
|
staticnoexcept |
Finds a type by it's name.
If the type is not found, the returned Type::isValid method retuns false.
Gets the Class instance associated with the type.
Can be nullptr if there is not class definition associated to the type.
|
noexcept |
Gets the decayed type.
Decayed is defined as std::decay, being: "Applies lvalue-to-rvalue, array-to-pointer, and function-to-pointer
implicit conversions to the type T, removes cv-qualifiers."
|
noexcept |
Gets the decayed type.
Decayed is defined as std::decay, being: "Applies lvalue-to-rvalue, array-to-pointer, and function-to-pointer
implicit conversions to the type T, removes cv-qualifiers."
|
noexcept |
Gets the type identity hash.
Can be used to implement a switch-case statement by using the values returned by Type::getIdentityHash<T>().
Gets the MetaEnum instance associated with the type.
Can be nullptr if there is not enum definition associated to the type.
|
inlinenoexcept |
|
noexcept |
Returns the pointer arity of the type. Returns 0 if the type is not a pointer.
|
noexcept |
|
noexcept |
Gets the type ID.
The type ID is a small integer value that can be used to quickly check a type for equality. This value is not a constant though and may vary betwee runs or instances of an app, but is guaranteed to be constant for a single run of the app.
|
noexcept |
|
noexcept |
|
noexcept |
If an enum, gets the underlying type of the enum.
|
noexcept |
If an enum, gets the underlying type of the enum.
|
inlinestaticnoexcept |
Determines if there is a converter available to convert a value from From to To.
Determines if there is a converter available to convert a value from fromType to toType.
Determines if there is a converter available to convert a value from fromType to toType.
|
noexcept |
Returns true if the type is an array, false otherwise.
|
noexcept |
Returns true if the type is a class, false otherwise.
|
noexcept |
Returns true if the type is a class pointer, false otherwise.
|
noexcept |
Returns true if the type is const, false otherwise.
|
inlinenoexcept |
Determines if the type is decayed, that is, this->getDecayedType() == this.
|
noexcept |
Returns true if the type is a function pointer, false otherwise.
|
noexcept |
Returns true if the type is an lvalue reference, false otherwise.
|
noexcept |
Returns true if the type is a pointer, false otherwise.
|
noexcept |
Returns true if the type is a reference (lvalue or rvalue), false otherwise.
|
noexcept |
Returns true if the type is an rvalue reference, false otherwise.
|
inlinenoexcept |
Determines if the Type object points to a valid type or not.
|
noexcept |
Returns true if the type is a void pointer, false otherwise.
|
inlineexplicitnoexcept |
Determines if the Type object points to a valid type or not.
|
staticprivate |
|
inlinestaticprivate |
|
inlinestaticprivate |
|
staticprivate |
Determines if the Type object points to a valid type or not.
Determines if the Type object points to a valid type or not.
Determines if the Type object points to a valid type or not.
Determines if the Type object points to a valid type or not.
The TypeInfo structure that describes the reflected type.