YGP::MetaEnum Class Reference

Class to handle enumerations; in counterpart to C-style enums those values can be accessed by number and name. More...

List of all members.

Public Types

typedef std::pair< int,
std::string > 
typePair
typedef std::map< int,
std::string > 
typeEnum
typedef typeEnum::iterator iterator
typedef typeEnum::const_iterator const_iterator

Public Member Functions

void insert (const typePair &value)
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
Check for existence
bool exists (int value) const
bool exists (const std::string &value) const
Accessing values (which must exist)
std::string operator[] (int value) const throw (std::out_of_range)
int operator[] (const std::string &value) const throw (std::out_of_range)

Protected Member Functions

virtual ~MetaEnum ()


Detailed Description

Class to handle enumerations; in counterpart to C-style enums those values can be accessed by number and name.

Constructor & Destructor Documentation

YGP::MetaEnum::~MetaEnum (  )  [protected, virtual]

Destructor.


Member Function Documentation

const_iterator YGP::MetaEnum::begin (  )  const [inline]

Returns an iterator to the first element of the enumeration.

Returns:
Iterator to the first element

iterator YGP::MetaEnum::begin (  )  [inline]

Returns an iterator to the first element of the enumeration.

Returns:
Iterator to the first element

const_iterator YGP::MetaEnum::end (  )  const [inline]

Returns an iterator after the last element of the enumeration.

Returns:
Iterator after the last element

iterator YGP::MetaEnum::end (  )  [inline]

Returns an iterator after the last element of the enumeration.

Returns:
Iterator after the last element

bool YGP::MetaEnum::exists ( const std::string &  value  )  const

Checks if the passed string-value exists within the enum.

Parameters:
value Value to check for
Returns:
bool
Remarks:
value must exist within the enum

bool YGP::MetaEnum::exists ( int  value  )  const [inline]

Checks if the integer value exists.

Parameters:
value Value to check for
Returns:
bool True if the value exists

void YGP::MetaEnum::insert ( const typePair &  value  )  [inline]

Inserts a new item into the object.

Parameters:
value Value to insert; create with std::make_pair

int YGP::MetaEnum::operator[] ( const std::string &  value  )  const throw (std::out_of_range)

Returns the numeric value of the passed string.

Parameters:
value String Value to return numeric
Returns:
int Numeric value
Remarks:
value must exist within the enum

std::string YGP::MetaEnum::operator[] ( int  value  )  const throw (std::out_of_range)

Returns the string-value of the passed value.

Parameters:
value Value to return as string
Returns:
std::string Value as string
Remarks:
value must exist within the enum
Exceptions:
std::out_of_range 


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

YGP Version 0.9.31 - Generated on Wed Nov 18 11:25:27 2009 by doxygen 1.5.8