A bidirectional mapping between enum values and static string constants. More...
#include <EnumTraits.h++>

Public Member Functions | |
| EnumMap () | |
| Constructor. | |
| ~EnumMap () | |
| Destructor. | |
| EnumMap & | add (E value, const char *str) |
| Add a mapping. | |
| E | valueForString (const char *str) const |
| Map a string to its enum value. | |
| const char * | stringForValue (E value) const |
| Map an enum value to its string. | |
A bidirectional mapping between enum values and static string constants.
An EnumMap can be constructed as follows:
enum FileType { TypeFile, TypeDirectory, TypeSymLink }; EnumMap<FileType> fileTypeMap;
fileTypeMap.add(TypeFile, "file")
.add(TypeDirectory, "directory")
.add(TypeSymLink, "symlink");
| EnumMap | ( | ) | [inline] |
Constructor.
| ~EnumMap | ( | ) | [inline] |
Destructor.
| EnumMap& add | ( | E | value, | |
| const char * | str | |||
| ) | [inline] |
Add a mapping.
| const char* stringForValue | ( | E | value | ) | const [inline] |
Map an enum value to its string.
| value | The enum value to map. |
| E valueForString | ( | const char * | str | ) | const [inline] |
Map a string to its enum value.
| str | The string to map. |
1.6.3