Base class for handling values.
More...
#include <jaula_value.h>
Base class for handling values.
- This class is the abstract base for all the containers for values according to the JSON specification.
- Author
- Kombo Morongo moron.nosp@m.go66.nosp@m.6@gma.nosp@m.il.c.nosp@m.om
Constructor.
- Parameters
-
Type | Type of value to be contained by the instance |
- Description
- This method construct a new instance by specifying its type.
- Note
- A ValueType for the instance is immutable during all the life cycle, this is the only method that permits specifying the value type.
Value * JAULA::Value::duplicate |
( |
Value const & |
orig | ) |
|
|
static |
Creates a duplicate of a value.
- Parameters
-
orig | Original instance to duplicate. |
- Returns
- a pointer to memory taken from the heap (by means of the new operator) and containing a deep copy of the original value.
- Warning
- As this method returns a pointer to memory allocated from the heap, it is up to the caller to release once it is no longer needed in order to avoid leaks.
References JAULA::Exception::addOrigin(), JAULA::Value_String::getData(), JAULA::Value_Number::getData(), JAULA::Value_Boolean::getData(), JAULA::Value_Number_Int::getData(), JAULA::Value_Array::getData(), and JAULA::Value_Object::getData().
Referenced by JAULA::Value_Array::addItem(), JAULA::Value_Array::set(), JAULA::Value_Object::set(), JAULA::Value_Array::Value_Array(), and JAULA::Value_Object::Value_Object().
Retrieves the value type for the instance.
- Note
- Value types are immutable during instance's life cycle and can only be specified at construction time.
References Type_.
Assignment operator.
- Parameters
-
orig | Original instance to copy |
- Returns
- a reference to the destination instance
- Exceptions
-
Bad_Data_Type | This exception is launched in case that origin and destination value types are different. |
- Description
- Copies the contents of the original instance in the destination.
- Note
- This method controls if destination and origin instances are the same so there is no trouble in a = a asignments.
References JAULA::Exception::addOrigin().
virtual void JAULA::Value::repr |
( |
std::ostream & |
ostr | ) |
const |
|
pure virtual |
Copies the contents of one instance into another.
- Parameters
-
origin | Reference to the value to be copied. |
- Exceptions
-
Bad_Data_Type | This exception is launched in case that origin and destination value types are different. |
Reimplemented in JAULA::Value_Object, JAULA::Value_Array, JAULA::Value_Number_Int, JAULA::Value_Boolean, JAULA::Value_Number, JAULA::Value_String, and JAULA::Value_Null.
Referenced by JAULA::Value_Null::set(), JAULA::Value_String::set(), JAULA::Value_Number::set(), JAULA::Value_Boolean::set(), JAULA::Value_Number_Int::set(), JAULA::Value_Array::set(), and JAULA::Value_Object::set().
Container for error code.
Referenced by getType().
The documentation for this class was generated from the following files: