#include <Enum.h>
Public Member Functions | |
EnumName (const std::string &enums, size_t numOfEnums) | |
const char * | getName (size_t e) |
Static Private Member Functions | |
static std::string | trim (const std::string &s) |
Private Attributes | |
std::vector< std::string > | names |
The class converts a single comma-separated string of enum names into single entries that can be accessed in constant time. It is the worker class for the templated version below.
EnumName::EnumName | ( | const std::string & | enums, |
size_t | numOfEnums | ||
) |
Constructor.
enums | A string that contains a comma-separated list of enum elements. It is allowed that an element is initialized with the value of its predecessor. Any other initializations are forbidden. "a, b, numOfLettersBeforeC, c = numOfLettersBeforeC, d" would be a legal parameter. |
numOfEnums | The number of enums in the string. Reassignments do not count, i.e. in the example above, this parameter had to be 4. |
const char* EnumName::getName | ( | size_t | e | ) | [inline] |
std::string EnumName::trim | ( | const std::string & | s | ) | [static, private] |
std::vector<std::string> EnumName::names [private] |