Struct enum_data

Synopsis

#include <include/flecs/addons/cpp/utils/enum.hpp>

template <typename E>
struct enum_data

Description

Convenience type with enum reflection data

Enumeration type data wrapper with world pointer

Methods

enum_data
entity overload
first
is_valid
last
next

Source

Lines 212-240 in include/flecs/addons/cpp/utils/enum.hpp.

template <typename E>
struct enum_data {
    enum_data(flecs::world_t *world, _::enum_data_impl& impl) 
        : world_(world)
        , impl_(impl) { }

    bool is_valid(int value) {
        return impl_.constants[value].id != 0;
    }

    int first() const {
        return impl_.min;
    }

    int last() const {
        return impl_.max;
    }

    int next(int cur) const {
        return impl_.constants[cur].next;
    }

    flecs::entity entity() const;
    flecs::entity entity(int value) const;
    flecs::entity entity(E value) const;

    flecs::world_t *world_;
    _::enum_data_impl& impl_;
};