Typelib::Enum Class Reference

#include <typelib/typemodel.hh>

Inheritance diagram for Typelib::Enum:

Inheritance graph
[legend]
Collaboration diagram for Typelib::Enum:

Collaboration graph
[legend]

List of all members.

Public Types

typedef int integral_type
typedef std::map< std::string,
int > 
ValueMap

Public Member Functions

 Enum (const std::string &name, Enum::integral_type initial_value=0)
void add (std::string const &name, int value)
integral_type get (std::string const &name) const
std::string get (integral_type value) const
std::list< std::string > names () const
ValueMap const & values () const
virtual std::set< Type const * > dependsOn () const
Enum::integral_type getNextValue () const

Classes

class  AlreadyExists
class  SymbolNotFound
class  ValueNotFound


Detailed Description

Enums are defined as name => integer static mappings

Member Typedef Documentation

typedef std::map<std::string, int> Typelib::Enum::ValueMap


Constructor & Destructor Documentation

Typelib::Enum::Enum ( const std::string &  name,
Enum::integral_type  initial_value = 0 
)


Member Function Documentation

void Typelib::Enum::add ( std::string const &  name,
int  value 
)

Add a new definition

Enum::integral_type Typelib::Enum::get ( std::string const &  name  )  const

Gets the value for name

Exceptions:
SymbolNotFound if name is not defined

std::string Typelib::Enum::get ( Enum::integral_type  value  )  const

Gets the name for value

Exceptions:
ValueNotFound if value is not defined in this enum

std::list< std::string > Typelib::Enum::names (  )  const

The list of all names

Enum::ValueMap const & Typelib::Enum::values (  )  const

The name => value map

virtual std::set<Type const*> Typelib::Enum::dependsOn (  )  const [inline, virtual]

The set of types this type depends upon

Implements Typelib::Type.

Enum::integral_type Typelib::Enum::getNextValue (  )  const

Returns the value the next inserted element should have (it is last_inserted_value + 1)


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

Generated on Thu Jan 22 16:38:02 2009 for typeLib by doxygen 1.5.6
SourceForge.net Project Page