#include <Object.h>
Public Types | |
typedef long | IntType |
typedef double | FloatType |
typedef std::string | StringType |
typedef std::map< std::string, Object > | MapType |
typedef std::vector< Object > | ListType |
enum | Type { TYPE_NONE, TYPE_INT, TYPE_FLOAT, TYPE_STRING, TYPE_MAP, TYPE_LIST } |
Public Member Functions | |
Object () | |
Construct an empty object. | |
void | clear () |
Clear all values. | |
Object (const Object &obj) | |
Copy an existing object. | |
Object (int v) | |
Set type to int, and value to v. | |
Object (bool v) | |
Set type to int, and value to v. | |
Object (IntType v) | |
Set type to int, and value to v. | |
Object (float v) | |
Set type to double, and value to v. | |
Object (FloatType v) | |
Set type to double, and value to v. | |
Object (const char *v) | |
Set type to std::string, and value to v. | |
Object (const StringType &v) | |
Set type to std::string, and value to v. | |
Object (const MapType &v) | |
Set type to MapType, and value to v. | |
Object (const ListType &v) | |
Set type to ListType, and value to v. | |
Object & | operator= (const Object &obj) |
overload assignment operator ! | |
bool | operator== (const Object &o) const |
Check for equality with another Object. | |
bool | operator!= (const Object m) const |
Check for inequality with another Object. | |
bool | operator== (IntType v) const |
Check for equality with a int. | |
bool | operator!= (IntType v) const |
Check for inequality with a int. | |
bool | operator== (FloatType v) const |
Check for equality with a double. | |
bool | operator!= (FloatType v) const |
Check for inequality with a double. | |
bool | operator== (const StringType &v) const |
Check for equality with a std::string. | |
bool | operator!= (const StringType &v) const |
Check for inequality with a std::string. | |
bool | operator== (const MapType &v) const |
Check for equality with a MapType. | |
bool | operator!= (const MapType &v) const |
Check for inequality with a MapType. | |
bool | operator== (const ListType &v) const |
Check for equality with a ListType. | |
bool | operator!= (const ListType &v) const |
Check for inequality with a ListType. | |
Type | GetType () const |
Get the current type. | |
bool | IsNone () const |
Check whether the current type is nothing. | |
bool | IsInt () const |
Check whether the current type is int. | |
bool | IsFloat () const |
Check whether the current type is double. | |
bool | IsNum () const |
Check whether the current type is numeric. | |
bool | IsString () const |
Check whether the current type is std::string. | |
bool | IsMap () const |
Check whether the current type is MapType. | |
bool | IsList () const |
Check whether the current type is ListType. | |
long | AsInt () const throw (WrongTypeException) |
Retrieve the current value as a int. | |
FloatType | AsFloat () const throw (WrongTypeException) |
Retrieve the current value as a double. | |
FloatType | AsNum () const throw (WrongTypeException) |
Retrieve the current value as a number. | |
const std::string & | AsString () const throw (WrongTypeException) |
Retrieve the current value as a const std::string reference. | |
std::string & | AsString () throw (WrongTypeException) |
Retrieve the current value as a non-const std::string reference. | |
const MapType & | AsMap () const throw (WrongTypeException) |
Retrieve the current value as a const MapType reference. | |
MapType & | AsMap () throw (WrongTypeException) |
Retrieve the current value as a non-const MapType reference. | |
const ListType & | AsList () const throw (WrongTypeException) |
Retrieve the current value as a const ListType reference. | |
ListType & | AsList () throw (WrongTypeException) |
Retrieve the current value as a non-const ListType reference. | |
Protected Attributes | |
Type | t |
FIXME: Document this
2000/08/05 Karsten-O. Laux <klaux@rhrk.uni-kl.de> Changed the members to pointers which only get created when really needed. This is a major speedup for passing Object as parameter or when copying it. Because copying of unused members is omitted. All pointers are stored as a union, so we save memory ! Changed IntType to long and added convinience Constructors for float, int and bool
Copyright 2000 the respective authors.
This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.