23 #ifndef __ccxx_EnumTraits_hxx 24 #define __ccxx_EnumTraits_hxx 70 return static_cast<E
>(val);
91 return static_cast<E
>(val);
112 :
private std::vector<std::pair<E, const char *> >
125 this->push_back(make_pair(value, str));
138 for(
typename Entries::const_iterator iter = this->begin();
142 if(std::strcmp(str, this->second))
158 for(
typename Entries::const_iterator iter = this->begin();
162 if(value == iter->first)
163 return(this->second);
171 typedef std::vector<std::pair<E, const char*> > Entries;
176 #endif // __ccxx_EnumTraits_hxx EnumMap()
Constructor.
Definition: EnumTraits.h++:117
EnumMap & add(E value, const char *str)
Add a mapping.
Definition: EnumTraits.h++:123
E enum_cast(T val)
Safe enumeration cast.
Definition: EnumTraits.h++:66
~EnumMap()
Destructor.
Definition: EnumTraits.h++:120
static E defval()
Get the default enumeration value.
const char * stringForValue(E value) const
Map an enum value to its string.
Definition: EnumTraits.h++:156
E valueForString(const char *str) const
Map a string to its enum value.
Definition: EnumTraits.h++:136
A class of functions that describe traits of an enumeration.
Definition: EnumTraits.h++:41
static E max()
Get the maximum enumeration value.
Definition: AllocationMap.c++:25
static E min()
Get the minimum enumeration value.
A bidirectional mapping between enum values and static string constants.
Definition: EnumTraits.h++:111