Class meta_sequence_container

Synopsis

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

class meta_sequence_container

Description

Proxy object for sequence containers.

Mentioned in

Classes

meta_iteratorOpaque iterator for meta sequence containers.

Methods

meta_sequence_container OverloadDefault constructor.
meta_sequence_container OverloadConstruct a proxy object for sequence containers.
beginReturns a meta iterator to the first element of the wrapped container.
clearClears the content of the wrapped container.
endReturns a meta iterator that is past the last element of the wrapped container.
eraseRemoves the specified element from the wrapped container.
insertInserts an element at a specified location of the wrapped container.
operator boolReturns false if a proxy is invalid, true otherwise.
operator[]Returns a reference to the element at a specified location of the wrapped container (no bounds checking is performed).
resizeResizes the wrapped container to contain a given number of elements.
sizeReturns the size of the wrapped container.
value_typeReturns the value meta type of the wrapped container type.

Source

Lines 30-88 in src/entt/meta/meta.hpp.

class meta_sequence_container {
    template<typename>
    struct meta_sequence_container_proxy;

    class meta_iterator;

public:
    /*! @brief Unsigned integer type. */
    using size_type = std::size_t;
    /*! @brief Meta iterator type. */
    using iterator = meta_iterator;

    /*! @brief Default constructor. */
    meta_sequence_container() ENTT_NOEXCEPT
        : instance{nullptr}
    {}

    /**
     * @brief Construct a proxy object for sequence containers.
     * @tparam Type Type of container to wrap.
     * @param container The container to wrap.
     */
    template<typename Type>
    meta_sequence_container(Type *container) ENTT_NOEXCEPT
        : value_type_fn{&meta_sequence_container_proxy<Type>::value_type},
          size_fn{&meta_sequence_container_proxy<Type>::size},
          resize_fn{&meta_sequence_container_proxy<Type>::resize},
          clear_fn{&meta_sequence_container_proxy<Type>::clear},
          begin_fn{&meta_sequence_container_proxy<Type>::begin},
          end_fn{&meta_sequence_container_proxy<Type>::end},
          insert_fn{&meta_sequence_container_proxy<Type>::insert},
          erase_fn{&meta_sequence_container_proxy<Type>::erase},
          get_fn{&meta_sequence_container_proxy<Type>::get},
          instance{container}
    {}

    [[nodiscard]] inline meta_type value_type() const ENTT_NOEXCEPT;
    [[nodiscard]] inline size_type size() const ENTT_NOEXCEPT;
    inline bool resize(size_type) const;
    inline bool clear();
    [[nodiscard]] inline iterator begin();
    [[nodiscard]] inline iterator end();
    inline std::pair<iterator, bool> insert(iterator, meta_any);
    inline std::pair<iterator, bool> erase(iterator);
    [[nodiscard]] inline meta_any operator[](size_type);
    [[nodiscard]] inline explicit operator bool() const ENTT_NOEXCEPT;

private:
    meta_type(* value_type_fn)() ENTT_NOEXCEPT;
    size_type(* size_fn)(const void *) ENTT_NOEXCEPT;
    bool(* resize_fn)(void *, size_type);
    bool(* clear_fn)(void *);
    iterator(* begin_fn)(void *);
    iterator(* end_fn)(void *);
    std::pair<iterator, bool>(* insert_fn)(void *, iterator, meta_any);
    std::pair<iterator, bool>(* erase_fn)(void *, iterator);
    meta_any(* get_fn)(void *, size_type);
    void *instance;
};





Add Discussion

Log in to comment