OpenLexocad  27.1
entt::meta_data Struct Reference

Opaque container for meta data. More...

#include <entt.hpp>

Public Member Functions

 meta_data (const internal::meta_data_node *curr=nullptr) ENTT_NOEXCEPT
 Constructs an instance from a given node. More...
 
ENTT_ID_TYPE identifier () const ENTT_NOEXCEPT
 Returns the identifier assigned to a given meta object. More...
 
meta_type parent () const ENTT_NOEXCEPT
 Returns the meta type to which a meta object belongs. More...
 
bool is_const () const ENTT_NOEXCEPT
 Indicates whether a given meta data is constant or not. More...
 
bool is_static () const ENTT_NOEXCEPT
 Indicates whether a given meta data is static or not. More...
 
meta_type type () const ENTT_NOEXCEPT
 Returns the meta type of the underlying object. More...
 
template<typename Type >
bool set (meta_handle handle, Type &&value) const
 Sets the value of the variable enclosed by a given meta type. More...
 
template<typename Type >
bool set (meta_handle handle, std::size_t index, Type &&value) const
 Sets the i-th element of an array enclosed by a given meta type. More...
 
meta_any get (meta_handle handle) const ENTT_NOEXCEPT
 Gets the value of the variable enclosed by a given meta type. More...
 
meta_any get (meta_handle handle, std::size_t index) const ENTT_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 ENTT_NOEXCEPT
 Iterates all the properties assigned to a meta data. More...
 
meta_prop prop (meta_any key) const ENTT_NOEXCEPT
 Returns the property associated with a given key. More...
 
 operator bool () const ENTT_NOEXCEPT
 Returns true if a meta object is valid, false otherwise. More...
 
bool operator== (const meta_data &other) const ENTT_NOEXCEPT
 Checks if two meta objects refer to the same node. More...
 

Detailed Description

Opaque container for meta data.

Constructor & Destructor Documentation

◆ meta_data()

entt::meta_data::meta_data ( const internal::meta_data_node *  curr = nullptr)
inline

Constructs an instance from a given node.

Parameters
currThe underlying node with which to construct the instance.

Member Function Documentation

◆ get() [1/2]

meta_any entt::meta_data::get ( meta_handle  handle) const
inline

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
handleAn opaque pointer to an instance of the underlying type.
Returns
A meta any containing the value of the underlying variable.

◆ get() [2/2]

meta_any entt::meta_data::get ( meta_handle  handle,
std::size_t  index 
) const
inline

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
handleAn opaque pointer to an instance of the underlying type.
indexPosition of the underlying element to get.
Returns
A meta any containing the value of the underlying element.

◆ identifier()

ENTT_ID_TYPE entt::meta_data::identifier ( ) const
inline

Returns the identifier assigned to a given meta object.

Returns
The identifier assigned to the meta object.

◆ is_const()

bool entt::meta_data::is_const ( ) const
inline

Indicates whether a given meta data is constant or not.

Returns
True if the meta data is constant, false otherwise.

◆ is_static()

bool entt::meta_data::is_static ( ) const
inline

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.

◆ operator bool()

entt::meta_data::operator bool ( ) const
inlineexplicit

Returns true if a meta object is valid, false otherwise.

Returns
True if the meta object is valid, false otherwise.

◆ operator==()

bool entt::meta_data::operator== ( const meta_data other) const
inline

Checks if two meta objects refer to the same node.

Parameters
otherThe meta object with which to compare.
Returns
True if the two meta objects refer to the same node, false otherwise.

◆ parent()

meta_type entt::meta_data::parent ( ) const
inline

Returns the meta type to which a meta object belongs.

Returns
The meta type to which the meta object belongs.

◆ prop() [1/2]

template<typename Op >
std::enable_if_t<std::is_invocable_v<Op, meta_prop>, void> entt::meta_data::prop ( Op  op) const
inline

Iterates all the properties assigned to a meta data.

Template Parameters
OpType of the function object to invoke.
Parameters
opA valid function object.

◆ prop() [2/2]

meta_prop entt::meta_data::prop ( meta_any  key) const
inline

Returns the property associated with a given key.

Parameters
keyThe key to use to search for a property.
Returns
The property associated with the given key, if any.

◆ set() [1/2]

template<typename Type >
bool entt::meta_data::set ( meta_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
TypeType of value to assign.
Parameters
handleAn opaque pointer to an instance of the underlying type.
valueParameter to use to set the underlying variable.
Returns
True in case of success, false otherwise.

◆ set() [2/2]

template<typename Type >
bool entt::meta_data::set ( meta_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
TypeType of value to assign.
Parameters
handleAn opaque pointer to an instance of the underlying type.
indexPosition of the underlying element to set.
valueParameter to use to set the underlying element.
Returns
True in case of success, false otherwise.

◆ type()

meta_type entt::meta_data::type ( ) const
inline

Returns the meta type of the underlying object.

Returns
The meta type of the underlying object, if any.

The documentation for this struct was generated from the following file: