#include <typemodel.hh>
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 Type * | do_merge (Registry ®istry, RecursionStack &stack) const |
Private Attributes | |
integral_type | m_last_value |
ValueMap | m_values |
Enums are defined as name => integer static mappings
Definition at line 236 of file typemodel.hh.
typedef int Typelib::Enum::integral_type |
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.
Typelib::Enum::Enum | ( | const std::string & | name, |
Enum::integral_type | initial_value = 0 |
||
) |
Definition at line 340 of file typemodel.cc.
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
SymbolNotFound | if 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
ValueNotFound | if 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.
Enum::ValueMap const & Typelib::Enum::values | ( | ) | const |
The name => value map
Definition at line 343 of file typemodel.cc.
integral_type Typelib::Enum::m_last_value [private] |
Definition at line 282 of file typemodel.hh.
ValueMap Typelib::Enum::m_values [private] |
Definition at line 283 of file typemodel.hh.