32#ifndef DRAIN_ENUM_FLAGS
33#define DRAIN_ENUM_FLAGS
68template <
class E,
class OWNER=E>
86 const std::string &
str(
const E & value){
96 bool setValue(
const std::string & key, E & value){
124 E
getValue(
const std::string &key,
bool lenient=
true){
162 const std::string &
getKey(
const std::string & s,
bool lenient=
true){
167 const char *
getKey(
const char * s,
bool lenient=
true){
172 const std::string &
getKey(
const E & value,
bool lenient=
true){
173 return dict.
getKey(value, lenient);
252 typedef typename F::value_t value_t;
253 typedef typename F::storage_t storage_t;
254 typedef typename F::dict_t dict_t;
255 typedef FlagResolver::ivalue_t ivalue_t;
275 template <
typename ... T>
329 this->set(flagger.value);
345#define DRAIN_ENUM_DICT(enumtype) template <> const drain::EnumDict<enumtype>::dict_t drain::EnumDict<enumtype>::dict
347#define DRAIN_ENUM_ENTRY(nspace, key) {#key, nspace::key}
349#define DRAIN_ENUM_OSTREAM(enumtype) inline std::ostream & operator<<(std::ostream &ostr, const enumtype & e){return ostr << drain::EnumDict<enumtype>::dict.getKey(e);}
Two-way mapping between strings and objects of template class T.
Definition Dictionary.h:63
const K & getKey(const V &value, bool lenient=true) const
Identity mapping useful for type deduction of template arguments in functions.
Definition Dictionary.h:172
const V & getValue(const K &key, bool lenient=true) const
Given a key, return the first value associated with it.
Definition Dictionary.h:149
Default default value...
Definition EnumFlags.h:247
EnumFlagger(const storage_t &v)
Constructor with initial value.
Definition EnumFlags.h:264
EnumFlagger()
Default constructor.
Definition EnumFlags.h:259
EnumFlagger< F > & operator=(const EnumFlagger< F > &flagger)
Definition EnumFlags.h:328
static ivalue_t getValueNEW(const std::string &key)
Returns the static dictionary created for this value_t .
Definition EnumFlags.h:303
Definition DataSelector.cpp:1277
A container for a static dictionary of enumeration values.
Definition EnumFlags.h:69
static E getValue(const char *key, bool lenient=true)
Convenience for object.set(...) like commands.
Definition EnumFlags.h:134
static const std::string & str(const E &value)
Convenience.
Definition EnumFlags.h:86
static E getValue(const E &value, bool lenient=true)
Convenience for object.set(...) like commands.
Definition EnumFlags.h:114
static bool setValue(const std::string &key, E &value)
Assign string values to an enumeration type.
Definition EnumFlags.h:96
static const std::string & getKey(const std::string &s, bool lenient=true)
Convenience for object.set(...) like commands.
Definition EnumFlags.h:162
static E getValue(const std::string &key, bool lenient=true)
Convenience for object.set(...) like commands.
Definition EnumFlags.h:124