Meta data object.
More...
#include <meta.hpp>
|
| data () noexcept |
| Default constructor.
|
|
meta::type | parent () const noexcept |
| Returns the meta type to which a meta data belongs. More...
|
|
bool | is_const () const noexcept |
| Indicates whether a given meta data is constant or not. More...
|
|
bool | is_static () const noexcept |
| Indicates whether a given meta data is static or not. More...
|
|
meta::type | type () const noexcept |
| Returns the meta type of a given meta data. More...
|
|
template<typename Type > |
bool | set (handle handle, Type &&value) const |
| Sets the value of the variable enclosed by a given meta type. More...
|
|
template<typename Type > |
bool | set (handle handle, std::size_t index, Type &&value) const |
| Sets the i-th element of an array enclosed by a given meta type. More...
|
|
any | get (handle handle) const noexcept |
| Gets the value of the variable enclosed by a given meta type. More...
|
|
any | get (handle handle, std::size_t index) const noexcept |
| Gets the i-th element of an array enclosed by a given meta type. More...
|
|
template<typename Op > |
std::enable_if_t< std::is_invocable_v< Op, meta::prop >, void > | prop (Op op) const noexcept |
| Iterates all the properties assigned to a meta data. More...
|
|
template<typename Key > |
std::enable_if_t<!std::is_invocable_v< Key, meta::prop >, meta::prop > | prop (Key &&key) const noexcept |
| Returns the property associated with a given key. More...
|
|
| operator bool () const noexcept |
| Returns true if a meta object is valid, false otherwise. More...
|
|
bool | operator== (const data &other) const noexcept |
| Checks if two meta objects refer to the same node. More...
|
|
|
template<typename > |
class | factory |
| A meta factory is allowed to create meta objects.
|
|
Meta data object.
A meta data is an opaque container for a data member associated with a given type.
Definition at line 1180 of file meta.hpp.
◆ get() [1/2]
Gets the value of the variable enclosed by a given meta type.
It must be possible to cast the instance to the parent type of the meta data. Otherwise, invoking the getter results in an undefined behavior.
- Parameters
-
handle | An opaque pointer to an instance of the underlying type. |
- Returns
- A meta any containing the value of the underlying variable.
Definition at line 1275 of file meta.hpp.
◆ get() [2/2]
any meta::data::get |
( |
handle |
handle, |
|
|
std::size_t |
index |
|
) |
| const |
|
inlinenoexcept |
Gets the i-th element of an array enclosed by a given meta type.
It must be possible to cast the instance to the parent type of the meta data. Otherwise, invoking the getter results in an undefined behavior.
- Parameters
-
handle | An opaque pointer to an instance of the underlying type. |
index | Position of the underlying element to get. |
- Returns
- A meta any containing the value of the underlying element.
Definition at line 1289 of file meta.hpp.
◆ is_const()
bool meta::data::is_const |
( |
| ) |
const |
|
inlinenoexcept |
Indicates whether a given meta data is constant or not.
- Returns
- True if the meta data is constant, false otherwise.
Definition at line 1204 of file meta.hpp.
◆ is_static()
bool meta::data::is_static |
( |
| ) |
const |
|
inlinenoexcept |
Indicates whether a given meta data is static or not.
A static meta data is such that it can be accessed using a null pointer as an instance.
- Returns
- True if the meta data is static, false otherwise.
Definition at line 1216 of file meta.hpp.
◆ operator bool()
meta::data::operator bool |
( |
| ) |
const |
|
inlineexplicitnoexcept |
Returns true if a meta object is valid, false otherwise.
- Returns
- True if the meta object is valid, false otherwise.
Definition at line 1327 of file meta.hpp.
◆ operator==()
bool meta::data::operator== |
( |
const data & |
other | ) |
const |
|
inlinenoexcept |
Checks if two meta objects refer to the same node.
- Parameters
-
other | The meta object with which to compare. |
- Returns
- True if the two meta objects refer to the same node, false otherwise.
Definition at line 1337 of file meta.hpp.
◆ parent()
Returns the meta type to which a meta data belongs.
- Returns
- The meta type to which the meta data belongs.
Definition at line 1995 of file meta.hpp.
◆ prop() [1/2]
template<typename Op >
std::enable_if_t<std::is_invocable_v<Op, meta::prop>, void> meta::data::prop |
( |
Op |
op | ) |
const |
|
inlinenoexcept |
Iterates all the properties assigned to a meta data.
- Template Parameters
-
Op | Type of the function object to invoke. |
- Parameters
-
op | A valid function object. |
Definition at line 1301 of file meta.hpp.
◆ prop() [2/2]
template<typename Key >
std::enable_if_t<!std::is_invocable_v<Key, meta::prop>, meta::prop> meta::data::prop |
( |
Key && |
key | ) |
const |
|
inlinenoexcept |
Returns the property associated with a given key.
- Template Parameters
-
Key | Type of key to use to search for a property. |
- Parameters
-
key | The key to use to search for a property. |
- Returns
- The property associated with the given key, if any.
Definition at line 1315 of file meta.hpp.
◆ set() [1/2]
template<typename Type >
bool meta::data::set |
( |
handle |
handle, |
|
|
Type && |
value |
|
) |
| const |
|
inline |
Sets the value of the variable enclosed by a given meta type.
It must be possible to cast the instance to the parent type of the meta data. Otherwise, invoking the setter results in an undefined behavior.
The type of the value must coincide exactly with that of the variable enclosed by the meta data. Otherwise, invoking the setter does nothing.
- Template Parameters
-
Type | Type of value to assign. |
- Parameters
-
handle | An opaque pointer to an instance of the underlying type. |
value | Parameter to use to set the underlying variable. |
- Returns
- True in case of success, false otherwise.
Definition at line 1241 of file meta.hpp.
◆ set() [2/2]
template<typename Type >
bool meta::data::set |
( |
handle |
handle, |
|
|
std::size_t |
index, |
|
|
Type && |
value |
|
) |
| const |
|
inline |
Sets the i-th element of an array enclosed by a given meta type.
It must be possible to cast the instance to the parent type of the meta data. Otherwise, invoking the setter results in an undefined behavior.
The type of the value must coincide exactly with that of the array type enclosed by the meta data. Otherwise, invoking the setter does nothing.
- Template Parameters
-
Type | Type of value to assign. |
- Parameters
-
handle | An opaque pointer to an instance of the underlying type. |
index | Position of the underlying element to set. |
value | Parameter to use to set the underlying element. |
- Returns
- True in case of success, false otherwise.
Definition at line 1261 of file meta.hpp.
◆ type()
Returns the meta type of a given meta data.
- Returns
- The meta type of the meta data.
Definition at line 2000 of file meta.hpp.
The documentation for this class was generated from the following file: