Struct meta_conv

Synopsis

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

struct meta_conv

Description

Opaque container for meta conversion functions.

Mentioned in

Methods

meta_convConstructs an instance from a given node.
convertConverts an instance to a given 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 766-797 in src/entt/meta/meta.hpp.

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

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

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

    /**
     * @brief Converts an instance to a given type.
     * @param instance The instance to convert.
     * @return An opaque pointer to the instance to convert.
     */
    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.
     */
    explicit operator bool() const ENTT_NOEXCEPT {
        return !(node == nullptr);
    }

private:
    const internal::meta_conv_node *node;
};





Add Discussion

Log in to comment