BeeeOn Gateway
v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
|
#include <Enum.h>
Public Types | |
typedef RawType | Raw |
typedef Enum< Base, RawType, NamesMapInitializer > | ThisEnum |
typedef EnumHelper< Raw >::ValueMap | ValueMap |
typedef EnumHelper< Raw >::Value | Value |
Public Member Functions | |
Enum (const Raw &raw) | |
Raw | raw () const |
const std::string & | toString () const |
operator Raw () const | |
bool | operator== (const Enum &other) const |
bool | operator== (const Enum::Raw &other) const |
bool | operator!= (const Enum &other) const |
bool | operator!= (const Enum::Raw &other) const |
bool | operator< (const Enum &other) const |
bool | operator< (const Enum::Raw &other) const |
bool | operator> (const Enum &other) const |
bool | operator> (const Enum::Raw &other) const |
bool | operator<= (const Enum &other) const |
bool | operator<= (const Enum::Raw &other) const |
bool | operator>= (const Enum &other) const |
bool | operator>= (const Enum::Raw &other) const |
Static Public Member Functions | |
static const Iterable & | all () |
static ThisEnum | parse (const std::string &input) |
static ThisEnum | fromRaw (const Raw &raw) |
static ThisEnum | random () |
static ThisEnum | fromRaw (const unsigned int raw) |
Static Protected Member Functions | |
static EnumHelper< Raw >::RawMap & | rawMap () |
static const EnumHelper< Raw > ::NamesMap & | namesMap () |
Abstract Enum type to simplify defining "clever" enums. A "clever" enum can be deserialized (parsed) from string and serialized back (toString).
Base is the user defined class containing an embedded enum called Raw. Example:
class TestEnum { public: enum Raw { TEST_X0, TEST_X1, ... } };
typedef Enum<TestEnum> Test;
Use Test class as the target enum's type.