Flecs: include/flecs/addons/cpp/utils/enum.hpp File Reference
Description: A fast entity component system (ECS) for C & C++

| Flecs v4.1 A fast entity component system (ECS) for C & C++

Loading...
Searching...
No Matches
enum.hpp File Reference

Compile-time enum reflection utilities. More...

`#include <limits>`
Include dependency graph for enum.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes
struct | flecs::enum_last< E >
| Trait to define the last valid enum value for reflection. More...
struct | flecs::_::enum_reflection< E, Handler >
| Provide utilities for enum reflection. More...
struct | flecs::_::enum_constant< T >
| Enumeration constant data. 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)
#define | FLECS_ENUM_MAX_COUNT (FLECS_ENUM_MAX(int) + 1)
#define | FLECS_CPP_ENUM_REFLECTION_SUPPORT 1
#define | flecs_enum_cast(T, v)
#define | FLECS_ENUM_LAST(T, Last)
#define | ECS_SIZE_T_STR "constexpr size_t; size_t = long unsigned int"

## Functions
template<size_t N>
constexpr size_t | flecs::_::enum_template_arg_separator (const char(&func_name)[N], size_t pos, size_t end, size_t depth=0)
| Test if a value is valid for an enumeration.
template<typename E, E C>
constexpr bool | flecs::_::enum_constant_is_valid ()
template<typename E>
enum_data< E > | flecs::enum_type (flecs::world_t *world)
| Convenience function for getting enum reflection data.

## Variables
template<typename E, underlying_type_t< E > Value>
constexpr E | flecs::_::to_constant< E, Value >::value

## Detailed Description

Compile-time enum reflection utilities.

Discover at compile time the 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 101 of file enum.hpp.

## ◆ FLECS_CPP_ENUM_REFLECTION_SUPPORT

#define FLECS_CPP_ENUM_REFLECTION_SUPPORT 1

Definition at line 30 of file enum.hpp.

## ◆ flecs_enum_cast

#define flecs_enum_cast | ( |  | T,
|  |  | v )

Value:
static_cast<T>(v)

Definition at line 40 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 78 of file enum.hpp.

## ◆ FLECS_ENUM_MAX

#define FLECS_ENUM_MAX | ( |  | T | ) |

Value:
_::to_constant<T, 126>::value

Definition at line 13 of file enum.hpp.

## ◆ FLECS_ENUM_MAX_COUNT

#define FLECS_ENUM_MAX_COUNT (FLECS_ENUM_MAX(int) + 1)

Definition at line 14 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.

Get enum reflection data for an enum type.

Convenience function for getting enum reflection data.

Template Parameters

  E | The enum type.

Parameters

  world | The world.

Returns
  Enum data wrapper.

Definition at line 616 of file enum.hpp.