jaula API Reference  version 1.4.0
JAULA::Value_Array Class Reference

Class for handling array values. More...

#include <jaula_value_array.h>

Inheritance diagram for JAULA::Value_Array:
JAULA::Value_Complex JAULA::Value

Public Types

typedef std::list< Value * > dataType
 Data type for value contents.

Public Member Functions

void addItem (Value const &item)
 Appends one item to the array.
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 array of values contained by the instance.
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_Array (void)
 Default Constructor.
 Value_Array (dataType const &data)
 Data Constructor.
virtual ~Value_Array ()
 Destructor.

Private Attributes

dataType data_
 Container to hold the value itself.

Detailed Description

Class for handling array values.

This class is a container for JSON arrays
Author:
Kombo Morongo <morongo666@gmail.com>

Member Typedef Documentation

typedef std::list<Value *> JAULA::Value_Array::dataType

Data type for value contents.

Description
Definition for the data container internal structure.

This data type defines a list of pointers to any kind of values (including arrays).


Constructor & Destructor Documentation

Default Constructor.

Description
The default constructor initializes an empty array.

Data Constructor.

Parameters:
dataReference to the data to be copied
Description
This constructor generates a new instance by making a deep copy of the original data.

References data_, and JAULA::Value::duplicate().

Destructor.

Note:
The destruction process releases all the memory associated to the data structure so any reference to the array or any element in it will be void.

References clear().


Member Function Documentation

void JAULA::Value_Array::addItem ( Value const &  item)

Appends one item to the array.

Parameters:
itemItem to be appended
Description
Appends a deep copy of the item value at the end of the array.

References data_, and JAULA::Value::duplicate().

void JAULA::Value_Array::clear ( void  ) [virtual]

Empties the contents of an instance.

Description
Erases the contained array.
Note:
As the array is destroyed by the process, any references to it or to any of its elements will be void.

Implements JAULA::Value_Complex.

References data_.

Referenced by set(), and ~Value_Array().

bool JAULA::Value_Array::empty ( void  ) const [virtual]

True if the instance is empty.

Returns:
true if there are no elements contained in the array and false otherwise.

Implements JAULA::Value_Complex.

References data_.

Retrieves the array of values contained by the instance.

References data_.

Referenced by JAULA::Value::duplicate(), and set().

void JAULA::Value_Array::repr ( std::ostream &  ostr) const [virtual]

Represents the instance in a stream.

Parameters:
ostrStream where the instance is to be represented.
Description
writes the instance content in JSON notation in a stream.

Implements JAULA::Value.

References data_.

void JAULA::Value_Array::set ( dataType const &  data)

Establishes the contents of the instance.

Parameters:
dataArray to assign to the instance
Note:
The destination array is destroyed during the asignment process so, any references to it or to its former elements will be void.

References clear(), data_, and JAULA::Value::duplicate().

void JAULA::Value_Array::set ( Value const &  origin) throw (Bad_Data_Type) [virtual]

Copies the contents of one instance into another.

Parameters:
originReference to the value to be copied.
Exceptions:
Bad_Data_TypeThis exception is launched in case that origin and destination value types are different.
Note:
The destination array is destroyed during the asignment process so, any references to it or to its former elements will be void.

Reimplemented from JAULA::Value.

References JAULA::Exception::addOrigin(), getData(), and JAULA::Value::set().

size_t JAULA::Value_Array::size ( void  ) const [virtual]

Number of elements contained.

Returns:
the number of elements contained in the array.

Implements JAULA::Value_Complex.

References data_.


Field Documentation

Container to hold the value itself.

Referenced by addItem(), clear(), empty(), getData(), repr(), set(), size(), and Value_Array().


The documentation for this class was generated from the following files: