Typelib::Enum Class Reference

#include <typemodel.hh>

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

List of all members.

Classes

class  AlreadyExists
class  SymbolNotFound
class  ValueNotFound

Public Types

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

Public Member Functions

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

Private Member Functions

virtual bool do_compare (Type const &other, bool equality, RecursionStack &stack) const
virtual bool do_compare (Type const &other, bool equality, RecursionStack &stack) const
virtual Typedo_merge (Registry &registry, RecursionStack &stack) const
virtual Typedo_merge (Registry &registry, RecursionStack &stack) const

Private Attributes

integral_type m_last_value
ValueMap m_values

Detailed Description

Enums are defined as name => integer static mappings

Definition at line 241 of file install/include/typelib/typemodel.hh.


Member Typedef Documentation

Definition at line 244 of file typelib/typemodel.hh.

Definition at line 244 of file install/include/typelib/typemodel.hh.

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

Definition at line 245 of file typelib/typemodel.hh.

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

Definition at line 245 of file install/include/typelib/typemodel.hh.


Constructor & Destructor Documentation

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

Definition at line 340 of file typemodel.cc.

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

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

Add a new definition

Definition at line 370 of file typemodel.cc.

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

The set of types this type depends upon

This method returns the set of types that are directly depended-upon by this type

Implements Typelib::Type.

Definition at line 278 of file typelib/typemodel.hh.

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

The set of types this type depends upon

This method returns the set of types that are directly depended-upon by this type

Implements Typelib::Type.

Definition at line 278 of file install/include/typelib/typemodel.hh.

virtual bool Typelib::Enum::do_compare ( Type const &  other,
bool  equality,
RecursionStack stack 
) const [private, virtual]
bool Typelib::Enum::do_compare ( Type const &  other,
bool  equality,
RecursionStack stack 
) const [private, virtual]

Definition at line 344 of file typemodel.cc.

virtual Type* Typelib::Enum::do_merge ( Registry registry,
RecursionStack stack 
) const [private, virtual]

Called by Type::merge when the type does not exist in registry already. This method has to create a new type in registry that matches the type definition of *this.

All types referenced by *this must be moved to their equivalent in registry.

Implements Typelib::Type.

Type * Typelib::Enum::do_merge ( Registry registry,
RecursionStack stack 
) const [private, virtual]

Called by Type::merge when the type does not exist in registry already. This method has to create a new type in registry that matches the type definition of *this.

All types referenced by *this must be moved to their equivalent in registry.

Implements Typelib::Type.

Definition at line 404 of file typemodel.cc.

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

Gets the name for value

Exceptions:
ValueNotFound if value is not defined in this 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

Definition at line 386 of file typemodel.cc.

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

Gets the value for name

Exceptions:
SymbolNotFound if name is not defined

Definition at line 378 of file typemodel.cc.

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

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

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

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

Definition at line 369 of file typemodel.cc.

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

The list of all names

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

The list of all names

Definition at line 396 of file typemodel.cc.

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

The name => value map

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

The name => value map

Definition at line 343 of file typemodel.cc.


Member Data Documentation

Definition at line 287 of file install/include/typelib/typemodel.hh.

Definition at line 288 of file install/include/typelib/typemodel.hh.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


typelib
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Fri Jan 11 09:37:01 2013