jaula API Reference version 1.4.0
|
Class for handling object values. More...
#include <jaula_value_object.h>
Public Types | |
typedef std::map< std::string, Value * > | dataType |
Data type for value contents. | |
![]() | |
enum | ValueType { TYPE_NULL , TYPE_BOOLEAN , TYPE_STRING , TYPE_NUMBER , TYPE_NUMBER_INT , TYPE_ARRAY , TYPE_OBJECT } |
Enumeration of available value types. More... | |
Public Member Functions | |
virtual void | clear (void) |
Empties the contents of an instance. | |
virtual bool | empty (void) const |
True if the instance is empty. | |
dataType const & | getData (void) const |
Retrieves the map of values contained by the instance. | |
void | insertItem (std::string const &name, Value const &item) throw (Name_Duplicated) |
Inserts one item to the object. | |
virtual void | repr (std::ostream &ostr) const |
Represents the instance in a stream. | |
void | set (dataType const &data) |
Establishes the contents of the instance. | |
virtual void | set (Value const &origin) throw (Bad_Data_Type) |
Copies the contents of one instance into another. | |
virtual size_t | size (void) const |
Number of elements contained. | |
Value_Object (dataType const &data) | |
Data Constructor. | |
Value_Object (void) | |
Default Constructor. | |
virtual | ~Value_Object () |
Destructor. | |
![]() | |
virtual | ~Value_Complex () |
Destructor. | |
![]() | |
ValueType | getType (void) const |
Retrieves the value type for the instance. | |
Value & | operator= (Value const &orig) throw (Bad_Data_Type) |
Assignment operator. | |
virtual | ~Value () |
Destructor. | |
Private Attributes | |
dataType | data_ |
Container to hold the value itself. | |
Additional Inherited Members | |
![]() | |
static Value * | duplicate (Value const &orig) |
Creates a duplicate of a value. | |
![]() | |
Value_Complex (ValueType Type) | |
Constructor. | |
![]() | |
Value (ValueType Type) | |
Constructor. | |
Class for handling object values.
typedef std::map<std::string, Value *> JAULA::Value_Object::dataType |
Data type for value contents.
JAULA::Value_Object::Value_Object | ( | void | ) |
Default Constructor.
JAULA::Value_Object::Value_Object | ( | Value_Object::dataType const & | data | ) |
Data Constructor.
data | Reference to the data to be copied |
References data_, and JAULA::Value::duplicate().
|
virtual |
Destructor.
References clear().
|
virtual |
Empties the contents of an instance.
Implements JAULA::Value_Complex.
References data_.
Referenced by set(), and ~Value_Object().
|
virtual |
True if the instance is empty.
Implements JAULA::Value_Complex.
References data_.
Value_Object::dataType const & JAULA::Value_Object::getData | ( | void | ) | const |
Retrieves the map of values contained by the instance.
References data_.
Referenced by JAULA::Value::duplicate(), and set().
void JAULA::Value_Object::insertItem | ( | std::string const & | name, |
Value const & | item | ||
) | |||
throw | ( | Name_Duplicated | |
) |
Inserts one item to the object.
name | Name for the property to insert |
item | Item value to be inserted |
Name_Duplicated | This exception is thrown in case the object already has a property with the same name as the one to insert. |
|
virtual |
Represents the instance in a stream.
ostr | Stream where the instance is to be represented. |
Implements JAULA::Value.
References data_.
void JAULA::Value_Object::set | ( | dataType const & | data | ) |
Establishes the contents of the instance.
data | map of values to assign to the instance |
References clear(), data_, and JAULA::Value::duplicate().
|
virtual |
Copies the contents of one instance into another.
origin | Reference to the value to be copied. |
Bad_Data_Type | This exception is launched in case that origin and destination value types are different. |
Reimplemented from JAULA::Value.
References JAULA::Exception::addOrigin(), getData(), and JAULA::Value::set().
|
virtual |
Number of elements contained.
Implements JAULA::Value_Complex.
References data_.
|
private |
Copyright (c) 2007, 2008, 2009 Kombo Morongo.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 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".
jaula project hosted by