Refureku v2.2.0
C++17 runtime reflection library.
|
Public Member Functions | |
Entity (Entity const &)=delete | |
RFK_NODISCARD REFUREKU_API Property const * | getPropertyAt (std::size_t propertyIndex) const noexcept |
Retrieve the property at the given index. If propertyIndex is greater or equal to the properties count, the behaviour is undefined. More... | |
template<typename PropertyType , typename = std::enable_if_t<std::is_base_of_v<Property, PropertyType> && !std::is_same_v<PropertyType, Property>>> | |
RFK_NODISCARD PropertyType const * | getProperty (bool isChildClassValid=true) const noexcept |
Retrieve a property of a given type from this entity. More... | |
RFK_NODISCARD REFUREKU_API Property const * | getProperty (Struct const &archetype, bool isChildClassValid=true) const noexcept |
Retrieve the first property matching with the provided archetype. More... | |
RFK_NODISCARD REFUREKU_API Property const * | getPropertyByName (char const *name) const noexcept |
Retrieve the first property named with the provided name. More... | |
RFK_NODISCARD REFUREKU_API Property const * | getPropertyByPredicate (Predicate< Property > predicate, void *userData) const |
Retrieve a property matching with a predicate. More... | |
template<typename PropertyType , typename = std::enable_if_t<std::is_base_of_v<Property, PropertyType> && !std::is_same_v<PropertyType, Property>>> | |
RFK_NODISCARD Vector< PropertyType const * > | getProperties (bool isChildClassValid=true) const noexcept |
Retrieve all properties matching with the provided archetype. If PropertyType uses multiple inheritance, its first inherited type must be rfk::Property or derived. More... | |
RFK_NODISCARD REFUREKU_API Vector< Property const * > | getProperties (Struct const &archetype, bool isChildClassValid=true) const noexcept |
Retrieve all properties matching with the provided archetype. More... | |
RFK_NODISCARD REFUREKU_API Vector< Property const * > | getPropertiesByName (char const *name) const noexcept |
Retrieve all properties named with the provided name. More... | |
RFK_NODISCARD REFUREKU_API Vector< Property const * > | getPropertiesByPredicate (Predicate< Property > predicate, void *userData) const |
Retrieve all properties matching with a predicate in this entity. More... | |
RFK_NODISCARD REFUREKU_API std::size_t | getPropertiesCount () const noexcept |
Get the number of properties attached to this entity. More... | |
REFUREKU_API bool | foreachProperty (Visitor< Property > visitor, void *userData) const |
Execute the given visitor on all properties attached to this entity. More... | |
RFK_NODISCARD REFUREKU_API char const * | getName () const noexcept |
Get the name of the entity. More... | |
RFK_NODISCARD REFUREKU_API bool | hasSameName (char const *name) const noexcept |
Check that this entity has the same name as the provided string. More... | |
RFK_NODISCARD REFUREKU_API std::size_t | getId () const noexcept |
Get the program-unique id of the entity. More... | |
RFK_NODISCARD REFUREKU_API EEntityKind | getKind () const noexcept |
Get the kind of the entity. Knowing the kind allows to safely cast to child classes. Check the EEntityKind documentation for more information. More... | |
RFK_NODISCARD REFUREKU_API Entity const * | getOuterEntity () const noexcept |
Get the outer entity of the entity. It basically corresponds to the entity this entity was declared in from a source-code point of view. A nullptr outer entity means the entity was declared at file level. More... | |
REFUREKU_API bool | addProperty (Property const &property) noexcept |
Add a property to this entity. More... | |
REFUREKU_API void | setOuterEntity (Entity const *outerEntity) noexcept |
Setter for the field _outerEntity. More... | |
REFUREKU_API void | setPropertiesCapacity (std::size_t capacity) noexcept |
Set the number of properties for this entity. Useful to avoid reallocations when adding a lot of properties. If the number of properties is already >= to the provided capacity, this method has no effect. More... | |
Entity & | operator= (Entity const &)=delete |
Entity & | operator= (Entity &&)=delete |
RFK_NODISCARD REFUREKU_API bool | operator== (Entity const &other) const noexcept |
RFK_NODISCARD REFUREKU_API bool | operator!= (Entity const &other) const noexcept |
Protected Member Functions | |
REFUREKU_INTERNAL | Entity (Entity &&) noexcept |
REFUREKU_INTERNAL | Entity (EntityImpl *implementation) noexcept |
|
noexcept |
Add a property to this entity.
property | The property to add. |
REFUREKU_API bool rfk::Entity::foreachProperty | ( | Visitor< Property > | visitor, |
void * | userData | ||
) | const |
Execute the given visitor on all properties attached to this entity.
visitor | Visitor function to call. Return false to abort the foreach loop. |
userData | Optional user data forwarded to the visitor. |
Any | exception potentially thrown from the provided visitor. |
|
noexcept |
Get the program-unique id of the entity.
|
noexcept |
Get the kind of the entity. Knowing the kind allows to safely cast to child classes. Check the EEntityKind documentation for more information.
|
noexcept |
Get the name of the entity.
|
noexcept |
Get the outer entity of the entity. It basically corresponds to the entity this entity was declared in from a source-code point of view. A nullptr outer entity means the entity was declared at file level.
|
noexcept |
Retrieve all properties matching with the provided archetype. If PropertyType uses multiple inheritance, its first inherited type must be rfk::Property or derived.
PropertyType | Type of the properties to retrieve. It must inherit from rfk::Property. |
isChildClassValid | If true, consider properties inheriting from the provided property type valid. |
|
noexcept |
Retrieve all properties matching with the provided archetype.
archetype | Archetype of the properties to look for. |
isChildClassValid | If true, all properties inheriting from the provided archetype will be included in the result. |
|
noexcept |
Retrieve all properties named with the provided name.
name | Name of the properties to retrieve. |
RFK_NODISCARD REFUREKU_API Vector< Property const * > rfk::Entity::getPropertiesByPredicate | ( | Predicate< Property > | predicate, |
void * | userData | ||
) | const |
Retrieve all properties matching with a predicate in this entity.
predicate | Predicate returning true for any matching property. |
userData | Optional data forwarded to the predicate. |
Any | exception potentially thrown from the provided predicate. |
|
noexcept |
Get the number of properties attached to this entity.
|
noexcept |
Retrieve a property of a given type from this entity.
PropertyType | Type of the property to retrieve. It must inherit from rfk::Property. If PropertyType uses multiple inheritance, its first inherited type must be rfk::Property or derived. |
isChildClassValid | If true, consider properties inheriting from the provided property type valid. |
|
noexcept |
Retrieve the first property matching with the provided archetype.
archetype | Archetype of the property to look for. |
isChildClassValid | If true, consider properties inheriting from the provided archetype valid. |
|
noexcept |
Retrieve the property at the given index. If propertyIndex is greater or equal to the properties count, the behaviour is undefined.
propertyIndex | Index of the property to retrieve in this entity. |
|
noexcept |
Retrieve the first property named with the provided name.
name | Name of the property to retrieve. |
RFK_NODISCARD REFUREKU_API Property const * rfk::Entity::getPropertyByPredicate | ( | Predicate< Property > | predicate, |
void * | userData | ||
) | const |
Retrieve a property matching with a predicate.
predicate | Predicate returning true for any matching property. |
userData | Optional data forwarded to the predicate. |
Any | exception potentially thrown from the provided predicate. |
|
noexcept |
Check that this entity has the same name as the provided string.
|
noexcept |
Setter for the field _outerEntity.
outerEntity | The outer entity to set. |
|
noexcept |
Set the number of properties for this entity. Useful to avoid reallocations when adding a lot of properties. If the number of properties is already >= to the provided capacity, this method has no effect.
capacity | The number of properties of this entity. |