Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
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 std::map< std::string,
int > 
ValueMap

Public Member Functions

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

Private Member Functions

virtual bool do_compare (Type const &other, bool equality, 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 236 of file typemodel.hh.


Member Typedef Documentation

Definition at line 239 of file typemodel.hh.

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

Definition at line 240 of file 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.


Member Function Documentation

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 273 of file typemodel.hh.

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

Definition at line 344 of file typemodel.cc.

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.

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

Gets the value for name

Exceptions:
SymbolNotFoundif name is not defined

Definition at line 378 of file typemodel.cc.

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

Gets the name for value

Exceptions:
ValueNotFoundif value is not defined in this enum

Definition at line 386 of file typemodel.cc.

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

Definition at line 396 of file typemodel.cc.

The name => value map

Definition at line 343 of file typemodel.cc.


Member Data Documentation

Definition at line 282 of file typemodel.hh.

Definition at line 283 of file typemodel.hh.


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


typelib
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Thu Jan 2 2014 11:38:41