#include <SimData/Namespace.h>
#include <SimData/BaseType.h>
#include <SimData/Ref.h>
#include <SimData/Exception.h>
#include <string>
#include <vector>
#include <map>
#include <cstdio>
#include <iostream>
#include <sstream>
Go to the source code of this file.
Compounds | |
| class | Enum |
| Represents an element in a specified Enumeration set. More... | |
| class | Enumeration |
| Class representing an enumeration set. More... | |
| class | EnumerationCore |
| Enumeration set (internal). More... | |
| class | EnumLink |
| Represents an element in an Enumeration set. More... | |
Functions | |
| SIMDATA_EXCEPTION (EnumError) | |
| Base class for Enum exceptions. | |
| SIMDATA_SUBEXCEPTION (EnumIndexError, EnumError) | |
| Enum exception for values not defined in the associated enumeration set. | |
Variables | |
| NAMESPACE_SIMDATA class | EnumLink |
Examples:
// C++ example ///////////////////////////////////////////////////// #include <SimData/Enum.h> class Foo { public: static const simdata::Enumeration Items; simdata::Enum<Items> m_Snack; void eat(); Foo(): m_Snack("cherry") { ... } ... }; // in the corresponding .cpp file: simdata::Enumeration Foo::Items("apple orange=2 cherry"); void Foo::eat() { std::cout << "Eating one " << m_Snack.getToken() << std::endl; if (m_Snack == "cherry") { std::cout << "yummy!\n"; assert(m_Snack == 3); } m_Snack.cycle(); } # Sample code using Enumerations in Python ######################### import SimData items = SimData.Enumeration("apple=0 orange=2 cherry=4") x = items.apple print x, x.next() assert(x == items.cherry.previous(2)) for item in items.each(): print item.getToken() assert(x.getToken() == items.eachString()[0]) assert(items.first() == items.last().getValue() - 4) assert(items.orange >= 2) assert(items.cherry == "cherry") assert(items.cherry > "orange")
|
|
Base class for Enum exceptions.
|
|
||||||||||||
|
Enum exception for values not defined in the associated enumeration set.
|
|
|
|
|
SimData version pre-0.4.0. For more information on SimData, visit the SimData Homepage. Generated on Tue Oct 14 12:06:39 2003, using Doxygen 1.2.18. |