32 #ifndef DRAIN_ENUM_FLAGS
33 #define DRAIN_ENUM_FLAGS
65 template <
class E,
class OWNER=E>
88 const std::string &
str(
const E & value){
128 E
getValue(
const std::string &key,
bool lenient=
true){
153 #define DRAIN_ENUM_ENTRY(nspace, key) {#key, nspace::key}
155 #define DRAIN_ENUM_OSTREAM(enumtype) inline std::ostream & operator<<(std::ostream &ostr, const enumtype & e){return ostr << drain::EnumDict<enumtype>::dict.getKey(e);}
195 typedef typename F::value_t value_t;
196 typedef typename F::storage_t storage_t;
197 typedef typename F::dict_t dict_t;
198 typedef FlagResolver::ivalue_t ivalue_t;
218 template <
typename ... T>
272 this->set(flagger.value);
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
Flagger accepting values of enum type E.
Definition: EnumFlags.h:190
EnumFlagger(const storage_t &v)
Constructor with initial value.
Definition: EnumFlags.h:207
EnumFlagger< F > & operator=(const EnumFlagger< F > &flagger)
Definition: EnumFlags.h:271
EnumFlagger()
Default constructor.
Definition: EnumFlags.h:202
static ivalue_t getValueNEW(const std::string &key)
Returns the static dictionary created for this value_t .
Definition: EnumFlags.h:246
Definition: DataSelector.cpp:1277
Wrapper for unique (static) dictionary of enum values.
Definition: EnumFlags.h:66
static E getValue(const char *key, bool lenient=true)
Convenience for object.set(...) like commands.
Definition: EnumFlags.h:138
static E getValue(const E &value, bool lenient=true)
Convenience for object.set(...) like commands.
Definition: EnumFlags.h:118
static bool setValue(const std::string &key, E &value)
Convenience function for leniently setting string values to separate enum lists.
Definition: EnumFlags.h:100
static const std::string & str(const E &value)
Convenience.
Definition: EnumFlags.h:88
static E getValue(const std::string &key, bool lenient=true)
Convenience for object.set(...) like commands.
Definition: EnumFlags.h:128