|
CeresEngine 0.2.0
A game development framework
|
#include <CeresEngine/Reflection/MetaItem.hpp>
Public Types | |
| using | EnumerateFunction = FunctionView< bool(const Box &) const > |
| A function that enumerates attributes of an item. | |
Public Member Functions | |
| template<typename T > | |
| bool | has () const |
| Checks if the item has the given attribute type. | |
| bool | has (const Type &type) const |
| Checks if the item has the given attribute type. | |
| template<typename T > | |
| const T & | get () const |
| Gets an item attribute by type. | |
| const Box & | get (const Type &type) const |
| Gets an item attribute by type. | |
| template<typename T > | |
| const T * | getIf () const |
| Gets an item attribute if it exists. | |
| void | set (const Type &type, Box &&value) |
| Sets the attribute for the given type. | |
| void | set (Box &&value) |
| Sets the attribute for the given type. | |
| void | forEach (const EnumerateFunction &func) const |
Calls the func function for each attribute present on the item. | |
Private Attributes | |
| HashMap< TypeID, Box > | mAttributes |
| The underlying storage of the attributes. | |
| using CeresEngine::ReflectionAttributeContainer::EnumerateFunction = FunctionView<bool(const Box&) const> |
A function that enumerates attributes of an item.
| void CeresEngine::ReflectionAttributeContainer::forEach | ( | const EnumerateFunction & | func | ) | const |
Calls the func function for each attribute present on the item.
| func | The function to be called for each of the attributes in the item. |
Gets an item attribute by type.
| T | The type of the attribute to be retrieved. |
Gets an item attribute by type.
| type | The type of the attribute to be retrieved. |
Gets an item attribute if it exists.
| T | The type of the attribute to be retrieved. |
nullptr if not present. Checks if the item has the given attribute type.
| T | The type of attribute to be checked if present. |
T is present; false otherwise. Checks if the item has the given attribute type.
| type | The type of attribute to be checked if present. |
typeID is present; false otherwise. Sets the attribute for the given type.
Sets the attribute for the given type.
The underlying storage of the attributes.