Struct meta_prop
Synopsis
#include <src/entt/meta/meta.hpp>
struct meta_prop
Description
Opaque wrapper for properties of any type.
Methods
meta_prop | Constructs an instance from a given node. | |
key | Returns the stored key as a const reference. | |
operator bool | Returns true if an object is valid, false otherwise. | |
value | Returns the stored value by copy. |
Source
Lines 674-711 in src/entt/meta/meta.hpp.
struct meta_prop {
/*! @brief Node type. */
using node_type = internal::meta_prop_node;
/**
* @brief Constructs an instance from a given node.
* @param curr The underlying node with which to construct the instance.
*/
meta_prop(const node_type *curr = nullptr) ENTT_NOEXCEPT
: node{curr} {}
/**
* @brief Returns the stored key as a const reference.
* @return A wrapper containing the key stored with the property.
*/
[[nodiscard]] meta_any key() const {
return node->id.as_ref();
}
/**
* @brief Returns the stored value by copy.
* @return A wrapper containing the value stored with the property.
*/
[[nodiscard]] meta_any value() const {
return node->value;
}
/**
* @brief Returns true if an object is valid, false otherwise.
* @return True if the object is valid, false otherwise.
*/
[[nodiscard]] explicit operator bool() const ENTT_NOEXCEPT {
return !(node == nullptr);
}
private:
const node_type *node;
};