Struct meta_conv

Synopsis

#include <src/entt/meta/meta.hpp>

struct meta_conv

Description

Opaque wrapper for meta conversion functions.

Mentioned in

Methods

meta_convConstructs an instance from a given node.
convertConverts an instance to the underlying type.
operator boolReturns true if a meta object is valid, false otherwise.
parentReturns the meta type to which a meta object belongs.
typeReturns the meta type of the underlying object.

Source

Lines 660-694 in src/entt/meta/meta.hpp.

struct meta_conv {
    /*! @brief Node type. */
    using node_type = internal::meta_conv_node;

    /*! @copydoc meta_prop::meta_prop */
    meta_conv(const node_type *curr = nullptr) ENTT_NOEXCEPT
        : node{curr}
    {}

    /*! @copydoc meta_base::parent */
    [[nodiscard]] inline meta_type parent() const ENTT_NOEXCEPT;

    /*! @copydoc meta_any::type */
    [[nodiscard]] inline meta_type type() const ENTT_NOEXCEPT;

    /**
     * @brief Converts an instance to the underlying type.
     * @param instance The instance to convert.
     * @return An opaque pointer to the instance to convert.
     */
    [[nodiscard]] meta_any convert(const void *instance) const {
        return node->conv(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;
};





Add Discussion

Log in to comment