13#include "Refureku/Config.h"
14#include "Refureku/Misc/Pimpl.h"
15#include "Refureku/Misc/GetPimplMacro.h"
16#include "Refureku/TypeInfo/Entity/EEntityKind.h"
17#include "Refureku/Properties/Property.h"
18#include "Refureku/Misc/Visitor.h"
19#include "Refureku/Misc/Predicate.h"
20#include "Refureku/Containers/Vector.h"
41 RFK_NODISCARD REFUREKU_API
54 template <
typename PropertyType,
typename = std::enable_if_t<std::is_base_of_v<Property, PropertyType> && !std::is_same_v<PropertyType, Property>>>
56 PropertyType
const*
getProperty(
bool isChildClassValid =
true) const noexcept;
66 RFK_NODISCARD REFUREKU_API
68 bool isChildClassValid = true) const noexcept;
77 RFK_NODISCARD REFUREKU_API
90 RFK_NODISCARD REFUREKU_API
92 void* userData) const;
104 template <typename PropertyType, typename = std::enable_if_t<std::is_base_of_v<
Property, PropertyType> && !std::is_same_v<PropertyType,
Property>>>
116 RFK_NODISCARD REFUREKU_API
118 bool isChildClassValid = true) const noexcept;
127 RFK_NODISCARD REFUREKU_API
140 RFK_NODISCARD REFUREKU_API
142 void* userData) const;
149 RFK_NODISCARD REFUREKU_API
164 void* userData) const;
171 RFK_NODISCARD REFUREKU_API
180 RFK_NODISCARD REFUREKU_API
188 RFK_NODISCARD REFUREKU_API
198 RFK_NODISCARD REFUREKU_API
208 RFK_NODISCARD REFUREKU_API
241 RFK_NODISCARD REFUREKU_API
bool operator==(
Entity const& other) const noexcept;
242 RFK_NODISCARD REFUREKU_API
bool operator!=(
Entity const& other) const noexcept;
249 REFUREKU_INTERNAL
Entity(EntityImpl* implementation) noexcept;
250 REFUREKU_INTERNAL ~
Entity() noexcept;
252 RFK_GEN_GET_PIMPL(EntityImpl, _pimpl.get())
256 Pimpl<EntityImpl> _pimpl;
261 #include "Refureku/TypeInfo/Entity/Entity.inl"
RFK_NODISCARD PropertyType const * getProperty(bool isChildClassValid=true) const noexcept
Retrieve a property of a given type from this entity.
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 coun...
REFUREKU_API void setOuterEntity(Entity const *outerEntity) noexcept
Setter for the field _outerEntity.
RFK_NODISCARD REFUREKU_API Property const * getPropertyByName(char const *name) const noexcept
Retrieve the first property named with the provided name.
RFK_NODISCARD REFUREKU_API char const * getName() const noexcept
Get the name of the entity.
REFUREKU_API bool foreachProperty(Visitor< Property > visitor, void *userData) const
Execute the given visitor on all properties attached to this entity.
RFK_NODISCARD REFUREKU_API Vector< Property const * > getPropertiesByName(char const *name) const noexcept
Retrieve all properties named with the provided name.
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 i...
RFK_NODISCARD Vector< PropertyType const * > getProperties(bool isChildClassValid=true) const noexcept
Retrieve all properties matching with the provided archetype. If PropertyType uses multiple inheritan...
RFK_NODISCARD REFUREKU_API Vector< Property const * > getPropertiesByPredicate(Predicate< Property > predicate, void *userData) const
Retrieve all properties matching with a predicate in this entity.
RFK_NODISCARD REFUREKU_API bool hasSameName(char const *name) const noexcept
Check that this entity has the same name as the provided string.
REFUREKU_API bool addProperty(Property const &property) noexcept
Add a property to this entity.
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 prop...
RFK_NODISCARD REFUREKU_API Property const * getPropertyByPredicate(Predicate< Property > predicate, void *userData) const
Retrieve a property matching with a predicate.
RFK_NODISCARD REFUREKU_API std::size_t getId() const noexcept
Get the program-unique id of the entity.
RFK_NODISCARD REFUREKU_API std::size_t getPropertiesCount() const noexcept
Get the number of properties attached to this entity.
RFK_NODISCARD REFUREKU_API EEntityKind getKind() const noexcept
Get the kind of the entity. Knowing the kind allows to safely cast to child classes....
Base class to inherit from to define new properties.
Definition: Property.h:23
Definition: Allocator.h:16
bool(*)(T const &value, void *userData) Predicate
Predicate defining if a value is valid or not.
Definition: Predicate.h:21
bool(*)(T const &value, void *userData) Visitor
Visitor function.
Definition: Visitor.h:21
EEntityKind
Definition: EEntityKind.h:20