Template Class EnumSymbols

Nested Relationships

Nested Types

Class Documentation

template<class Enum>
class EnumSymbols

A simple (proxy) container for the value-name pairs of an enum type. Uses linear search for finds; this could be improved for time-critical code.

Public Types

using const_iterator = Sym const*

Public Functions

template<size_t N>
inline EnumSymbols(Sym const (&p)[N])
inline size_t size() const
inline bool empty() const
inline Sym const *get(Enum v) const
inline Sym const *get(const char *s) const
inline Sym const *get(const char *s, size_t len) const
Sym const *find(Enum v) const

Find a symbol by value. Returns nullptr when none is found

Sym const *find(const char *s) const

Find a symbol by name. Returns nullptr when none is found

Sym const *find(const char *s, size_t len) const

Find a symbol by name. Returns nullptr when none is found

inline Sym const &operator[](size_t i) const
inline Sym const *begin() const
inline Sym const *end() const
struct Sym

Public Functions

bool cmp(const char *s) const
bool cmp(const char *s, size_t len) const
const char *name_offs(EnumOffsetType t) const

Public Members

Enum value
const char *name