Siena
C++ API documentation (v. 0.4.1)
Main Page Class Hierarchy Compound List File List Compound Members Examples
AttributeValue Class Reference
#include <Siena.h>
List of all members.
Detailed Description
value of an attribute in a notification
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;
Constructor & Destructor Documentation
AttributeValue::AttributeValue (
|
)
|
|
AttributeValue::AttributeValue (
|
const AttributeValue & v )
|
|
AttributeValue::AttributeValue (
|
const string & )
|
|
AttributeValue::AttributeValue (
|
const char * )
|
|
|
construct from a C-style string |
AttributeValue::AttributeValue (
|
int )
|
|
AttributeValue::AttributeValue (
|
short )
|
|
AttributeValue::AttributeValue (
|
long )
|
|
AttributeValue::AttributeValue (
|
bool )
|
|
AttributeValue::AttributeValue (
|
double )
|
|
AttributeValue::~AttributeValue (
|
)
|
|
Member Function Documentation
const bool & AttributeValue::bool_value (
|
) const
|
|
|
returns a copy of the value as a boolean -
Exceptions:
-
BadType
|
exception is generated when type() != SX_bool |
|
bool & AttributeValue::bool_value (
|
)
|
|
|
returns a reference to the value as a boolean -
Exceptions:
-
BadType
|
exception is generated when type() != SX_bool |
|
const double & AttributeValue::double_value (
|
) const
|
|
|
returns a copy of the value as a double -
Exceptions:
-
BadType
|
exception is generated when type() != SX_double |
|
double & AttributeValue::double_value (
|
)
|
|
|
returns a reference to the value as a double -
Exceptions:
-
BadType
|
exception is generated when type() != SX_double |
|
const int32_t & AttributeValue::int_value (
|
) const
|
|
|
returns a reference to the value as an integer -
Exceptions:
-
BadType
|
exception is generated when type() != SX_integer |
|
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();
-
Exceptions:
-
BadType
|
exception is generated when type() != SX_integer |
|
AttributeValue::operator bool (
|
) const
|
|
|
conversion operator to bool -
Exceptions:
-
BadType
|
exception is generated when type() != SX_bool
|
@doc conversion operator to bool |
AttributeValue::operator double (
|
) const
|
|
|
conversion operator to double -
Exceptions:
-
BadType
|
exception is generated when type() != SX_double
|
@doc conversion operator to double |
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;
-
Exceptions:
-
BadType
|
exception is generated when type() != SX_int |
|
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;
-
Exceptions:
-
BadType
|
exception is generated when type() != SX_int |
|
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;
-
Exceptions:
-
BadType
|
exception is generated when type() != SX_int |
|
AttributeValue::operator string (
|
) const
|
|
|
conversion operator to string -
Exceptions:
-
BadType
|
exception is generated when type() != SX_string
|
@doc
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;
|
bool AttributeValue::operator< (
|
const AttributeValue & ) const
|
|
AttributeValue & AttributeValue::operator= (
|
double )
|
|
AttributeValue & AttributeValue::operator= (
|
bool )
|
|
AttributeValue & AttributeValue::operator= (
|
long )
|
|
AttributeValue & AttributeValue::operator= (
|
short )
|
|
AttributeValue & AttributeValue::operator= (
|
int )
|
|
AttributeValue & AttributeValue::operator= (
|
const char * )
|
|
AttributeValue & AttributeValue::operator= (
|
const string & )
|
|
AttributeValue & AttributeValue::operator= (
|
const AttributeValue & )
|
|
bool AttributeValue::operator== (
|
const AttributeValue & ) const
|
|
const string & AttributeValue::string_value (
|
) const
|
|
|
returns a copy of the value as a string -
Exceptions:
-
BadType
|
exception is generated when type() != SX_string |
|
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();
-
Exceptions:
-
BadType
|
exception is generated when type() != SX_string |
|
SXType AttributeValue::type (
|
) const
|
|
|
returns the actual type of this value |
The documentation for this class was generated from the following file:
Copyright © 2001 University of Colorado.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.1 or any later version published by the Free Software
Foundation; with no Invariant Sections, no Front-Cover Texts and no
Back-Cover Texts. A copy of the license is included in the section
entitled "GNU Free Documentation License".
This documentation is authored and maintained by
Antonio
Carzaniga