Skip to content
Flecs v4.1
flecs::enum_data< E > Struct Template Reference

Convenience type with enum reflection data. More...

#include <enum.hpp>

Public Types

using U = underlying_type_t<E>

Public Member Functions

 enum_data (flecs::world_t *world, _::enum_type< E > &impl)
 Construct enum_data from a world and an enum_type implementation.
bool is_valid (U value)
 Check if a given integral value is a valid enum value.
bool is_valid (E value)
 Check if a given enum value is valid.
int index_by_value (U value) const
 Find the index into the constants array for a value, if one exists.
int index_by_value (E value) const
 Find the index into the constants array for an enum value, if one exists.
int first () const
 Return the index of the first constant.
int last () const
 Return the index of the last constant.
int next (int cur) const
 Return the next constant index after the given one.
flecs::entity entity () const
 Get entity for the enum type.
flecs::entity entity (U value) const
 Get entity for a given underlying enum value.
flecs::entity entity (E value) const
 Get entity for a given enum value.

Public Attributes

flecs::world_tworld_
 Manually register a constant for an enum.
_::enum_type< E > & impl_

Detailed Description

template<typename E>
struct flecs::enum_data< E >

Convenience type with enum reflection data.

Enumeration type data wrapper with world pointer.

Definition at line 343 of file enum.hpp.

Member Typedef Documentation

◆ U

template<typename E>
using flecs::enum_data< E >::U = underlying_type_t<E>

Definition at line 344 of file enum.hpp.

Constructor & Destructor Documentation

◆ enum_data()

template<typename E>
flecs::enum_data< E >::enum_data ( flecs::world_t * world,
_::enum_type< E > & impl )
inline

Construct enum_data from a world and an enum_type implementation.

Definition at line 347 of file enum.hpp.

Member Function Documentation

◆ entity() [1/3]

template<typename E>
flecs::entity flecs::enum_data< E >::entity ( ) const
inline

Get entity for the enum type.

Get the entity for an enum type.

Definition at line 183 of file world.hpp.

◆ entity() [2/3]

template<typename E>
flecs::entity flecs::enum_data< E >::entity ( E value) const
inline

Get entity for a given enum value.

Get the entity for an enum constant.

Definition at line 210 of file world.hpp.

◆ entity() [3/3]

template<typename E>
flecs::entity flecs::enum_data< E >::entity ( U value) const
inline

Get entity for a given underlying enum value.

Get the entity for an enum constant by underlying_type value.

Definition at line 189 of file world.hpp.

◆ first()

template<typename E>
int flecs::enum_data< E >::first ( ) const
inline

Return the index of the first constant.

Definition at line 398 of file enum.hpp.

◆ index_by_value() [1/2]

template<typename E>
int flecs::enum_data< E >::index_by_value ( E value) const
inline

Find the index into the constants array for an enum value, if one exists.

Parameters
valueThe enum value.
Returns
int The index of the enum value.

Definition at line 393 of file enum.hpp.

◆ index_by_value() [2/2]

template<typename E>
int flecs::enum_data< E >::index_by_value ( U value) const
inline

Find the index into the constants array for a value, if one exists.

Parameters
valueThe underlying integral value.
Returns
int The index of the enum value.

Definition at line 383 of file enum.hpp.

◆ is_valid() [1/2]

template<typename E>
bool flecs::enum_data< E >::is_valid ( E value)
inline

Check if a given enum value is valid.

Parameters
valueThe enum value.
Returns
true If the value is valid.
false If the value is not valid.

Definition at line 373 of file enum.hpp.

◆ is_valid() [2/2]

template<typename E>
bool flecs::enum_data< E >::is_valid ( U value)
inline

Check if a given integral value is a valid enum value.

Parameters
valueThe integral value.
Returns
true If the value is a valid enum value.
false If the value is not a valid enum value.

Definition at line 358 of file enum.hpp.

◆ last()

template<typename E>
int flecs::enum_data< E >::last ( ) const
inline

Return the index of the last constant.

Definition at line 403 of file enum.hpp.

◆ next()

template<typename E>
int flecs::enum_data< E >::next ( int cur) const
inline

Return the next constant index after the given one.

Definition at line 408 of file enum.hpp.

Member Data Documentation

◆ impl_

template<typename E>
_::enum_type<E>& flecs::enum_data< E >::impl_

Definition at line 452 of file enum.hpp.

◆ world_

template<typename E>
flecs::world_t* flecs::enum_data< E >::world_

Manually register a constant for an enum.

If automatic enum reflection is not supported, provide a method for manually registering a constant.

Definition at line 451 of file enum.hpp.


The documentation for this struct was generated from the following files: