44 virtual const std::string&
string()
const = 0;
51#define SMART_ENUM(Clazz, Type, Length) \
52 static constexpr std::size_t _size = Length; \
54 Clazz() : _idx(0) {} \
55 Clazz(Type t) { _idx = static_cast<Type>(t); } \
58 int index() const { return _idx; } \
59 Type value() const { return Type(_idx); } \
60 const char* string() const { return Clazz::Value(_idx); } \
61 void set(const Type& t) { _idx = static_cast<int>(t); } \
63 Type operator++() { if (_idx != (_size - 1)) _idx++; return Type(_idx); } \
64 Type operator++(int) { if (_idx != (_size - 1)) _idx++; return Type(_idx); } \
65 bool operator==(Clazz const& rhs) { return _idx == rhs._idx; } \
66 bool operator!=(Clazz const& rhs) { return _idx != rhs._idx; } \
Definition: SmartEnum.h:42
virtual int index() const =0
virtual const std::string & string() const =0
Definition: SmartEnum.h:36
static char const * values[]
Definition: SmartEnum.h:37