Flecs v3.2
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
enum.hpp File Reference

Compile time enum reflection utilities. More...

#include <string.h>

Go to the source code of this file.

Classes

struct  flecs::_::to_constant< E, Value >
 
struct  flecs::enum_last< E >
 
struct  flecs::_::enum_is_valid< E, C >
 
struct  flecs::_::enum_constant_data
 Enumeration constant data. More...
 
struct  flecs::_::enum_data_impl
 Enumeration type data. More...
 
struct  flecs::_::enum_type< E >
 Class that scans an enum for constants, extracts names & creates entities. More...
 
struct  flecs::enum_data< E >
 Convenience type with enum reflection data. More...
 

Namespaces

namespace  flecs::_
 Int to enum.
 

Macros

#define FLECS_ENUM_MAX(T)   _::to_constant<T, 128>::value
 
#define FLECS_ENUM_MAX_COUNT   (FLECS_ENUM_MAX(int) + 1)
 
#define FLECS_CPP_ENUM_REFLECTION_SUPPORT   1
 
#define FLECS_ENUM_LAST(T, Last)
 
#define ECS_SIZE_T_STR   "constexpr size_t; size_t = long unsigned int"
 

Functions

template<typename E >
constexpr size_t flecs::_::enum_type_len ()
 
template<typename E , E C>
constexpr bool flecs::_::enum_constant_is_valid ()
 Test if value is valid for enumeration.
 
template<typename E >
enum_data< E > flecs::enum_type (flecs::world_t *world)
 Convenience function for getting enum reflection data.
 

Detailed Description

Compile time enum reflection utilities.

Discover at compile time valid enumeration constants for an enumeration type and their names. This is used to automatically register enum constants.

Definition in file enum.hpp.

Macro Definition Documentation

◆ ECS_SIZE_T_STR

#define ECS_SIZE_T_STR   "constexpr size_t; size_t = long unsigned int"

Definition at line 75 of file enum.hpp.

◆ FLECS_CPP_ENUM_REFLECTION_SUPPORT

#define FLECS_CPP_ENUM_REFLECTION_SUPPORT   1

Definition at line 22 of file enum.hpp.

◆ FLECS_ENUM_LAST

#define FLECS_ENUM_LAST (   T,
  Last 
)
Value:
namespace flecs {\
template<>\
struct enum_last<T> {\
static constexpr T value = Last;\
};\
}

Definition at line 57 of file enum.hpp.

◆ FLECS_ENUM_MAX

#define FLECS_ENUM_MAX (   T)    _::to_constant<T, 128>::value

Definition at line 11 of file enum.hpp.

◆ FLECS_ENUM_MAX_COUNT

#define FLECS_ENUM_MAX_COUNT   (FLECS_ENUM_MAX(int) + 1)

Definition at line 12 of file enum.hpp.

Function Documentation

◆ enum_type()

template<typename E >
enum_data< E > flecs::enum_type ( flecs::world_t *  world)

Convenience function for getting enum reflection data.

Definition at line 267 of file enum.hpp.