Template Class EnumDef#

Inheritance Relationships#

Base Type#

  • public ReflectionDefBase

Class Documentation#

template<typename EnumClsObj, typename = std::enable_if_t<std::is_base_of_v<EnumObj, EnumClsObj>>>
class EnumDef : public ReflectionDefBase#

Register one enum singleton and its canonical indices.

Public Functions

inline explicit EnumDef(const char *str_index)#

Register an enum singleton with an automatically assigned integer index.

The integer index is assigned from the singleton’s registration order.

Parameters:

str_index – The canonical string index.

inline EnumDef(const char *str_index, int64_t int_index)#

Register an integer enum singleton with explicit canonical indices.

Parameters:
  • str_index – The canonical string index.

  • int_index – The canonical integer index.

template<typename T>
inline EnumDef &set_attr(const char *attr_name, T value)#

Set an extensible attribute on the registered enum singleton.

Template Parameters:

T – The attribute value type.

Parameters:
  • attr_name – The attribute name.

  • value – The attribute value.

Returns:

Reference to this builder for method chaining.

template<typename T, typename Value>
inline EnumDef &set_attr(AttrKey<T> key, Value &&value)#

Set an enum attribute using its key’s declared value type.

template<auto Fn, typename T>
inline EnumDef &set_native_fn_attr(AttrKey<T> key)#

Set a named native callback using its key’s declared adapter.

Public Static Functions

static inline bool IsDefined(const String &name)#

Check whether a canonical name is defined without registering enum state or entries.

Parameters:

name – The canonical string index.

Returns:

Whether the name is defined for this enum type.