Struct meta_base
Synopsis
#include <src/entt/meta/meta.hpp>
struct meta_base
Description
Opaque wrapper for meta base classes.
Mentioned in
- Runtime Reflection System / Enjoy the runtime
Methods
meta_base | Constructs an instance from a given node. | |
cast | Casts an instance from a parent type to a base type. | |
operator bool | Returns true if a meta object is valid, false otherwise. | |
parent | Returns the meta type to which a meta object belongs. | |
type | Returns the meta type of the underlying object. |
Source
Lines 666-703 in src/entt/meta/meta.hpp.
struct meta_base {
/*! @brief Node type. */
using node_type = internal::meta_base_node;
/*! @copydoc meta_prop::meta_prop */
meta_base(const node_type *curr = nullptr) ENTT_NOEXCEPT
: node{curr}
{}
/**
* @brief Returns the meta type to which a meta object belongs.
* @return The meta type to which the meta object belongs.
*/
[[nodiscard]] inline meta_type parent() const ENTT_NOEXCEPT;
/*! @copydoc meta_any::type */
[[nodiscard]] inline meta_type type() const ENTT_NOEXCEPT;
/**
* @brief Casts an instance from a parent type to a base type.
* @param instance The instance to cast.
* @return An opaque pointer to the base type.
*/
[[nodiscard]] const void * cast(const void *instance) const ENTT_NOEXCEPT {
return node->cast(instance);
}
/**
* @brief Returns true if a meta object is valid, false otherwise.
* @return True if the meta object is valid, false otherwise.
*/
[[nodiscard]] explicit operator bool() const ENTT_NOEXCEPT {
return !(node == nullptr);
}
private:
const node_type *node;
};