25 struct ConvertFunctionBase;
284 auto from =
static_cast<const From*
>(
in);
305 auto from =
static_cast<const From*
>(
in);
326 auto from =
static_cast<const From*
>(
in);
348 auto from =
static_cast<const From*
>(
in);
367 if constexpr(std::is_invocable_r_v<To, Func, From, bool&>) {
453 #define CE_META_CONCAT_IMPL(A, B) A##B
454 #define CE_META_CONCAT(A, B) CE_META_CONCAT_IMPL(A, B)
456#define CE_META_TYPE_AUTO_REGISTRATION_NAME(T) CE_META_CONCAT(gTypeAutoRegistrator, __COUNTER__)
457#define CE_META_TYPE_AUTO_REGISTRATION(T) static const ::CeresEngine::TypeAutoRegistration<T> CE_META_TYPE_AUTO_REGISTRATION_NAME(T)
464 [[nodiscard]]
size_t operator()(
const Type& value)
const {
return CeresEngine::hash(value.getTypeID().raw); }
A value type that can hold any alongside it's type information.
Definition Box.hpp:40
Represents a reflected enum from C++.
Definition Enum.hpp:26
Represents a reflected C++ type. Can be used to get metadata from a C++ type.
Definition Type.hpp:32
bool isVoidPtr() const noexcept
Returns true if the type is a void pointer, false otherwise.
bool isValid() const noexcept
Determines if the Type object points to a valid type or not.
Definition Type.hpp:194
static Type fromID(TypeID id) noexcept
Finds a type by it's id.
bool isClassPtr() const noexcept
Returns true if the type is a class pointer, false otherwise.
static bool registerConverter()
Definition Type.hpp:387
friend bool operator!=(const Type &type, std::nullptr_t) noexcept
Determines if the Type object points to a valid type or not.
Definition Type.hpp:203
StringView getName() const noexcept
Definition Type.hpp:67
friend bool operator>(const Type &lhs, const Type &rhs) noexcept
Definition Type.hpp:216
static bool convert(const void *from, TypeID fromTypeID, void *to, TypeID toTypeID)
bool isPointer() const noexcept
Returns true if the type is a pointer, false otherwise.
static bool registerConverter(TypeID fromTypeID, TypeID toTypeID, const internal::ConvertFunctionBase &converter)
uint16_t getPointerArity() const noexcept
Returns the pointer arity of the type. Returns 0 if the type is not a pointer.
void deallocate(void *ptr) const
TypeID getTypeID() const noexcept
Gets the type ID.
TypeID getDecayTypeID() const noexcept
Gets the decayed type.
bool compatible() const noexcept
Determines if the fromType is compatible with the toType.
Definition Type.hpp:437
static void unregisterConverter()
Definition Type.hpp:420
const TypeInfo * mTypeInfo
The TypeInfo structure that describes the reflected type.
Definition Type.hpp:35
static bool hasConverter() noexcept
Determines if there is a converter available to convert a value from From to To.
Definition Type.hpp:360
void moveOrCopy(void *source, void *where) const
Type getDecayType() const noexcept
Gets the decayed type.
Type(TypeID typeID) noexcept
Finds a type by it's id.
bool isFunctionPtr() const noexcept
Returns true if the type is a function pointer, false otherwise.
TypeIdentityHash getIdentityHash() const noexcept
Gets the type identity hash.
static bool registerConverterInternal(Func &&func)
Definition Type.hpp:364
TypeID getUnderlyingTypeID() const noexcept
If an enum, gets the underlying type of the enum.
StringView getTypeName() const noexcept
bool compareEquality(const void *lhs, const void *rhs) const
friend bool operator<(const Type &lhs, const Type &rhs) noexcept
Definition Type.hpp:214
friend bool operator!=(const Type &lhs, const Type &rhs) noexcept
Definition Type.hpp:212
friend bool operator!=(std::nullptr_t, const Type &type) noexcept
Determines if the Type object points to a valid type or not.
Definition Type.hpp:209
bool isRvalueReference() const noexcept
Returns true if the type is an rvalue reference, false otherwise.
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.
Definition Type.hpp:160
bool isClass() const noexcept
Returns true if the type is a class, false otherwise.
void copyConstruct(const void *source, void *where) const
void destruct(void *instance) const
Destroys an instance of the type. Calls the C++ destructor.
void defaultConstruct(void *where) const
bool isDecayed() const noexcept
Determines if the type is decayed, that is, this->getDecayedType() == this.
Definition Type.hpp:84
void moveConstruct(void *source, void *where) const
static Type fromName(StringView name) noexcept
Finds a type by it's name.
bool is() const
Definition Type.hpp:429
friend bool operator==(const Type &type, std::nullptr_t) noexcept
Determines if the Type object points to a valid type or not.
Definition Type.hpp:200
static bool registerConverterInternalNonChecked()
Definition Type.hpp:389
bool isLvalueReference() const noexcept
Returns true if the type is an lvalue reference, false otherwise.
bool isReference() const noexcept
Returns true if the type is a reference (lvalue or rvalue), false otherwise.
static bool registerConverterInternalNonChecked(TypeID fromTypeID, TypeID toTypeID, const internal::ConvertFunctionBase &converter)
friend bool operator==(std::nullptr_t, const Type &type) noexcept
Determines if the Type object points to a valid type or not.
Definition Type.hpp:206
std::size_t getTypeSize() const noexcept
bool isArray() const noexcept
Returns true if the type is an array, false otherwise.
bool isConst() const noexcept
Returns true if the type is const, false otherwise.
friend bool operator==(const Type &lhs, const Type &rhs) noexcept
Definition Type.hpp:211
Type(StringView name) noexcept
Finds a type by it's name.
std::align_val_t getTypeAlignment() const noexcept
void destroy(void *ptr) const noexcept
const Class * getClass() const noexcept
Gets the Class instance associated with the type.
Type getUnderlyingType() const noexcept
If an enum, gets the underlying type of the enum.
Box construct() const
Constructs a new value from the type, if default constructible.
friend bool operator>=(const Type &lhs, const Type &rhs) noexcept
Definition Type.hpp:217
const T * as() const
Definition Type.hpp:430
friend bool operator<=(const Type &lhs, const Type &rhs) noexcept
Definition Type.hpp:215
static bool convert(const void *from, Type fromType, void *to, Type toType)
Definition TypeInfo.hpp:36
bool is() const noexcept
Definition TypeInfo.hpp:60
const T * as() const noexcept
Definition TypeInfo.hpp:61
To defaultConvert(const From &value)
Definition Type.hpp:255
Definition Application.hpp:19
std::uint64_t UInt64
Definition DataTypes.hpp:26
UInt64 TypeIdentityHash
A type that represents a Type hash value.
Definition Type.hpp:29
TypedID< internal::TypeTag, UInt64 > TypeID
Definition Forward.hpp:45
remove_all_cv< std::decay_t< T > > full_decay
Definition TypeTraits.hpp:97
decltype(auto) get(BezierPath::Element &element) noexcept
Decomposes a bezier path element.
Definition BezierPath.hpp:723
constexpr Byte operator<<(const Byte arg, const _IntType shift) noexcept
Definition DataTypes.hpp:44
CE_FLATTEN_INLINE Type getType()
Definition Type.hpp:248
auto move(Vector3 position)
Moves a entity to the given position.
Definition Helpers.hpp:22
CE_FLATTEN_INLINE TypeID getTypeID< void >()
Definition Type.hpp:247
constexpr TypeID getTypeID()
Definition Type.hpp:425
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition Forward.hpp:34
TypeAutoRegistrationBase(const TypeInfo &type)
~TypeAutoRegistrationBase()
const TypeInfo & type
Definition Type.hpp:442
TypeAutoRegistration()
Definition Type.hpp:448
bool invoke(const void *in, void *out) const
Definition Type.hpp:268
ConvertFunctionBase(ConvertFunctionBase &&)=delete
converter_t mConverter
Definition Type.hpp:271
ConvertFunctionBase(const converter_t converter)
Definition Type.hpp:266
ConvertFunctionBase & operator=(const ConvertFunctionBase &)=delete
ConvertFunctionBase(const ConvertFunctionBase &)=delete
ConvertFunctionBase()=delete
bool(*)(const ConvertFunctionBase &, const void *, void *) converter_t
Definition Type.hpp:258
ConvertFunctionBase & operator=(ConvertFunctionBase &&)=delete
~ConvertFunctor()
Definition Type.hpp:279
F const mFunc
Definition Type.hpp:293
static bool convert(const ConvertFunctionBase &self, const void *in, void *out)
Definition Type.hpp:281
ConvertFunctor(F &&func)
Definition Type.hpp:278
ConvertFunctor(const F &func)
Definition Type.hpp:277
~ConvertFunctorOk()
Definition Type.hpp:301
static bool convert(const ConvertFunctionBase &self, const void *in, void *out)
Definition Type.hpp:303
F const mFunc
Definition Type.hpp:312
ConvertFunctorOk(const F &func)
Definition Type.hpp:299
ConvertFunctorOk(F &&func)
Definition Type.hpp:300
static bool convert(const ConvertFunctionBase &self, const void *in, void *out)
Definition Type.hpp:323
To(From::*)() const func_t
Definition Type.hpp:317
~ConvertMethod()
Definition Type.hpp:321
ConvertMethod(const func_t func)
Definition Type.hpp:319
func_t const mFunc
Definition Type.hpp:335
~ConvertMethodOk()
Definition Type.hpp:344
ConvertMethodOk(const func_t func)
Definition Type.hpp:342
static bool convert(const ConvertFunctionBase &self, const void *in, void *out)
Definition Type.hpp:346
func_t const mFunc
Definition Type.hpp:355
To(From::*)(bool &) const func_t
Definition Type.hpp:340