Public Member Functions | Static Private Member Functions | Private Attributes
EnumName Class Reference

#include <Enum.h>

List of all members.

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

Detailed Description

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.

Definition at line 24 of file Enum.h.


Constructor & Destructor Documentation

EnumName::EnumName ( const std::string &  enums,
size_t  numOfEnums 
)

Constructor.

Parameters:
enumsA 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.
numOfEnumsThe number of enums in the string. Reassignments do not count, i.e. in the example above, this parameter had to be 4.

Definition at line 21 of file Enum.cpp.


Member Function Documentation

const char* EnumName::getName ( size_t  e) [inline]

The method returns the name of an enum element.

Parameters:
indexThe index of the enum element.
Returns:
Its name.

Definition at line 56 of file Enum.h.

std::string EnumName::trim ( const std::string &  s) [static, private]

A method that trims a string, i.e. removes spaces from its beginning and end.

Parameters:
sThe string that is trimmed.
Returns:
The string without spaces at the beginning and at its end.

Definition at line 12 of file Enum.cpp.


Member Data Documentation

std::vector<std::string> EnumName::names [private]

The vector of enum names.

Definition at line 26 of file Enum.h.


The documentation for this class was generated from the following files:


bwi_tools
Author(s): Piyush Khandelwal
autogenerated on Thu Jun 6 2019 17:57:26