152 using MetaItem::MetaItem;
213 return get(std::ref(target));
235 set(std::ref(target), std::ref(value));
239 template<
typename T,
typename V>
requires(!std::is_same_v<std::decay_t<T>,
Box> && !std::is_same_v<std::decay_t<V>,
Box>)
240 void set(
T& target,
V& value)
const {
241 set(std::ref(target), std::ref(value));
245 template<
typename T,
typename V>
requires(!std::is_same_v<std::decay_t<T>,
Box> && !std::is_same_v<std::decay_t<V>,
Box>)
246 void set(
T& target,
V&& value)
const {
247 set(std::ref(target), std::forward<V>(value));
258 template<
typename V>
requires(!std::is_same_v<std::decay_t<V>,
Box>)
259 void set(
const V& value)
const {
260 set(
nullptr, std::ref(value));
264 template<
typename V>
requires(!std::is_same_v<std::decay_t<V>,
Box>)
266 set(
nullptr, std::ref(value));
270 template<
typename V>
requires(!std::is_same_v<std::decay_t<V>,
Box>)
272 set(
nullptr, std::forward<V>(value));
A value type that can hold any alongside it's type information.
Definition Box.hpp:40
static constexpr MetaCategory kCategory
Definition Class.hpp:164
auto invoke(Args &&... args) const
Definition Class.hpp:172
virtual Box invoke(const MetaValues &arguments) const =0
ReflectionAttributeContainer attributes
Definition Class.hpp:158
MetaCategory getCategory() const override
Gets the category of the item.
Definition Class.hpp:165
Span< const Type > getParameterTypes() const
ClassConstructor(Class &owner, StringView name)
String name
Definition Class.hpp:157
virtual Span< const TypeID > getParameterTypeIDs() const =0
void forEachProperty(const MemberIteratorFunc< ClassProperty > &func) const
Enumerates over all properties in the class.
Definition Class.hpp:98
Generator< const Class > forEachBase() const
const ClassConstructor * getCopyConstructor() const
bool inheritedFrom(const Class *base) const
static const Class * find(StringView name)
Finds a Class by it's fully qualified name.
const ClassProperty * getProperty(StringView name) const
const ClassMethod * getMethodInternal(StringView name) const
MemberIterator< ClassProperty > forEachProperty(MetaMemberIterationFlags flags=MetaMemberIterationFlag::Default) const
Enumerates over all properties in the class.
const ClassConstructor * getConstructor(StringView oldSignature) const
void * cast(const Class *base, void *instance) const
static const Class * find(TypeID typeID)
Finds a Class by it's type ID.
ReflectionAttributeContainer attributes
Definition Class.hpp:54
void addBaseClass(TypeID typeID, CastFunctionType caster)
Generator< const Class > forEachDirectBase() const
const ClassConstructor * getDefaultConstructor() const
const ClassMethod * getMethod(StringView name) const
void forEachConstructor(const MemberIteratorFunc< ClassConstructor > &func) const
Enumerates over all constructors in the class.
const ClassConstructor * getConstructor() const
void forEachMethod(const MetaMemberIterationFlags &flags, const MemberIteratorFunc< ClassMethod > &func) const
Enumerates over all methods in the class.
void forEachMethod(const MemberIteratorFunc< ClassMethod > &func) const
Enumerates over all methods in the class.
Definition Class.hpp:114
FunctionView< bool(const T &) const > MemberIteratorFunc
Definition Class.hpp:50
HashMap< TypeID, CastFunctionType > mBaseClasses
Definition Class.hpp:57
const StringView name
Definition Class.hpp:53
const ClassConstructor * getMoveConstructor() const
const ClassProperty * getPropertyInternal(StringView name) const
const void *(*)(const void *) CastFunctionType
Definition Class.hpp:48
MemberIterator< ClassConstructor > forEachConstructor() const
Enumerates over all constructors in the class.
const void * cast(const Class *base, const void *instance) const
Class(const StringView name)
Definition Class.hpp:60
void forEachProperty(const MetaMemberIterationFlags &flags, const MemberIteratorFunc< ClassProperty > &func) const
Enumerates over all properties in the class.
~Class() override=default
MemberIterator< ClassMethod > forEachMethod(MetaMemberIterationFlags flags=MetaMemberIterationFlag::Default) const
Enumerates over all methods in the class.
ClassMethod(Class &owner, StringView name)
virtual Box invoke(const MetaValues &arguments) const =0
virtual TypeID getReturnTypeID() const noexcept=0
Type getReturnType() const
StringView name
Definition Class.hpp:278
Vector< Type > mParameterTypes
Definition Class.hpp:282
virtual bool isStatic() const noexcept=0
Returns true if the method is static.
ReflectionAttributeContainer attributes
Definition Class.hpp:279
MetaCategory getCategory() const override
Gets the category of the item.
Definition Class.hpp:292
Span< const Type > getParameterTypes() const
virtual Span< const TypeID > getParameterTypeIDs() const =0
static constexpr MetaCategory kCategory
Gets the category of the item.
Definition Class.hpp:289
Represents a reflected property from metadata defined by the class.
Definition Class.hpp:176
ReflectionAttributeContainer attributes
Definition Class.hpp:179
MetaCategory getCategory() const final
Gets the category of the item.
Definition Class.hpp:190
virtual TypeID getSetterParameterTypeID() const noexcept=0
void set(const Box &value) const
Sets the property value.
void set(const V &value) const
Definition Class.hpp:259
virtual TypeID getGetterReturnTypeID() const noexcept=0
virtual bool isReadOnly() const noexcept=0
Determines if the property is read-only and cannot be set.
ClassProperty(Class &owner, StringView name)
virtual void set(const Box &target, const Box &value) const =0
Sets the property value.
Type getSetterParameterType() const
TypeID getTypeID() const noexcept
void set(V &value) const
Definition Class.hpp:265
void set(T &target, V &value) const
Definition Class.hpp:240
void set(Box &&value) const
~ClassProperty() noexcept override
Box get() const
Gets the value of a static property.
static constexpr MetaCategory kCategory
Gets the category of the item.
Definition Class.hpp:187
void set(T &target, V &&value) const
Definition Class.hpp:246
StringView name
Definition Class.hpp:178
Type getGetterReturnType() const
void set(V &&value) const
Definition Class.hpp:271
virtual bool isStatic() const noexcept=0
Determines if the property is static or not.
A generator represents a coroutine type that produces a sequence of values of type T,...
Definition Generator.hpp:50
virtual ClassInfo getClassInfo(const void *target) const =0
virtual ClassInfo getClassInfo(void *target) const =0
virtual ~ReflectableClassTypeTrait()=default
Definition MetaItem.hpp:43
Represents a reflected C++ type. Can be used to get metadata from a C++ type.
Definition Type.hpp:32
Definition Application.hpp:19
SmallVector< Box, 4 > MetaValues
Definition Class.hpp:29
MetaCategory
The category of a MetaItem.
Definition MetaItem.hpp:23
@ Method
Indicates that the item is a method.
@ Property
Indicates that the item is a property.
@ Constructor
Indicates that the item is a constructor.
std::vector< T, ScopedAllocatorAdaptor< StdAllocator< T, RawAllocator > > > Vector
Vector is a sequence container that encapsulates dynamic size arrays.
Definition Vector.hpp:17
const Class * getClass()
Gets a pointer to the Class object that contains reflection metadata for the given class type T.
Definition Class.hpp:148
std::unordered_map< Key, T, Hash, KeyEqual, ScopedAllocatorAdaptor< StdAllocator< Pair< const Key, T >, RawAllocator > > > HashMap
HashMap is an associative container that contains key-value pairs with unique keys.
Definition Map.hpp:33
FunctionBase< false, true, fu2::capacity_default, true, false, Signatures... > FunctionView
A non owning copyable function wrapper for arbitrary callable types.
Definition Function.hpp:64
MetaMemberIterationFlag
A set of flags that control the iteration of class members.
Definition Class.hpp:32
@ IncludeFromBase
If set, will include members from base classes.
@ Default
The default value for member iteration properties.
sfl::small_vector< T, N, ScopedAllocatorAdaptor< StdAllocator< T, RawAllocator > > > SmallVector
SmallVector is a sequence container similar to Vector.
Definition SmallVector.hpp:31
tcb ::span< T, Extent > Span
Span describes an object that can refer to a contiguous sequence of objects with the first element of...
Definition Span.hpp:708
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
A structure that contains type information for a class.
Definition IReflectable.hpp:15
Wrapper around an enum that allows simple use of bitwise logic operations.
Definition Flags.hpp:19