#include <Siena.h>
Public Member Functions | |
AttributeValue () | |
AttributeValue (const AttributeValue &v) | |
AttributeValue (const string &) | |
AttributeValue (const char *) | |
AttributeValue (int) | |
AttributeValue (short) | |
AttributeValue (long) | |
AttributeValue (bool) | |
AttributeValue (double) | |
~AttributeValue () | |
SXType | type () const |
int32_t & | int_value () |
bool & | bool_value () |
string & | string_value () |
double & | double_value () |
const int32_t & | int_value () const |
const bool & | bool_value () const |
const string & | string_value () const |
const double & | double_value () const |
operator long () const | |
operator int () const | |
operator short () const | |
operator string () const | |
operator bool () const | |
operator double () const | |
AttributeValue & | operator= (const AttributeValue &) |
AttributeValue & | operator= (const string &) |
AttributeValue & | operator= (const char *) |
AttributeValue & | operator= (int) |
AttributeValue & | operator= (short) |
AttributeValue & | operator= (long) |
AttributeValue & | operator= (bool) |
AttributeValue & | operator= (double) |
bool | operator== (const AttributeValue &) const |
bool | operator< (const AttributeValue &) const |
Protected Attributes | |
SXType | sxtype |
union { | |
string * str | |
int32_t num | |
bool bln | |
double dbl | |
}; |
An AttributeValue
stores the value of an attribute. Attributes can be of a pre-defined set of types (SXType). AttributeValue
provides methods for accessing and assigning values in the form of C++ types. In particular, an AttributeValue
of type SX_integer
can be assigned to and from an int
, an AttributeValue
of type SX_string
can be assigned to and from a C++ standard string
, etc.
Example:
AttributeValue x, y; // // now x.type() == y.type() == SX_null // x = true; y = x; // // now x.type() == y.type() == SX_bool // int i = 10; if (x.bool_value()) y = i + 10; x = i + 20; cout << x.int_value() + y.int_value() << endl; i = x; y = "ciao"; cout << y.string_value() << endl;
AttributeValue::AttributeValue | ( | ) |
constructs a null value
AttributeValue::AttributeValue | ( | const AttributeValue & | v | ) |
copy constructor
AttributeValue::AttributeValue | ( | const string & | ) |
construct from a string
AttributeValue::AttributeValue | ( | const char * | ) |
construct from a C-style string
AttributeValue::AttributeValue | ( | int | ) |
construct from an int
AttributeValue::AttributeValue | ( | short | ) |
construct from an short
AttributeValue::AttributeValue | ( | long | ) |
construct from an long
AttributeValue::AttributeValue | ( | bool | ) |
construct from a bool
AttributeValue::AttributeValue | ( | double | ) |
construct from a double
AttributeValue::~AttributeValue | ( | ) |
construct from a Date
SXType AttributeValue::type | ( | ) | const |
returns the actual type of this value
int32_t& AttributeValue::int_value | ( | ) |
returns a reference to the value as an integer
returns a reference to the value as an integer
Example:
AttributeValue x = 20; cout << x.int_value(); x.int_value()++; cout << x.int_value();
bool& AttributeValue::bool_value | ( | ) |
string& AttributeValue::string_value | ( | ) |
returns a reference to the value as a string
Example:
AttributeValue x = "ciao"; cout << x.string_value(); x.string_value() += " ciao"; cout << x.string_value();
double& AttributeValue::double_value | ( | ) |
const int32_t& AttributeValue::int_value | ( | ) | const |
const bool& AttributeValue::bool_value | ( | ) | const |
const string& AttributeValue::string_value | ( | ) | const |
const double& AttributeValue::double_value | ( | ) | const |
AttributeValue::operator long | ( | ) | const |
conversion operator to long
returns a copy of the value as an integer whenever the AttributeValue
is used in place of an int
.
Example:
AttributeValue x = 20; long l = x;
AttributeValue::operator int | ( | ) | const |
conversion operator to int
returns a copy of the value as an integer whenever the AttributeValue
is used in place of an int
.
Example:
AttributeValue x = 20; int i = x;
AttributeValue::operator short | ( | ) | const |
conversion operator to short
returns a copy of the value as an integer whenever the AttributeValue
is used in place of an int
.
Example:
AttributeValue x = 20; short s = x;
AttributeValue::operator string | ( | ) | const |
conversion operator to string
returns a copy of the value as a string whenever the AttributeValue
is used in place of a string
.
Example:
AttributeValue x = "Siena"; string s = x;
AttributeValue::operator bool | ( | ) | const |
AttributeValue::operator double | ( | ) | const |
AttributeValue& AttributeValue::operator= | ( | const AttributeValue & | ) |
copy assignment
AttributeValue& AttributeValue::operator= | ( | const string & | ) |
from string
AttributeValue& AttributeValue::operator= | ( | const char * | ) |
from C-style string
AttributeValue& AttributeValue::operator= | ( | int | ) |
from int
AttributeValue& AttributeValue::operator= | ( | short | ) |
from short
AttributeValue& AttributeValue::operator= | ( | long | ) |
from long
AttributeValue& AttributeValue::operator= | ( | bool | ) |
from bool
AttributeValue& AttributeValue::operator= | ( | double | ) |
from double
bool AttributeValue::operator== | ( | const AttributeValue & | ) | const |
equality relation
bool AttributeValue::operator< | ( | const AttributeValue & | ) | const |
ordering relation