BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions
BeeeOn::Enum< Base, RawType, NamesMapInitializer > Class Template Reference

#include <Enum.h>

Inheritance diagram for BeeeOn::Enum< Base, RawType, NamesMapInitializer >:

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 ()
 

Detailed Description

template<typename Base, typename RawType = typename Base::Raw, typename NamesMapInitializer = EnumNamesInitializer<RawType>>
class BeeeOn::Enum< Base, RawType, NamesMapInitializer >

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.


The documentation for this class was generated from the following file: