JAULA::Value Class Reference
[JAULA: JSON Values containers]

Base class for handling values. More...

#include <jaula_value.h>

Inheritance diagram for JAULA::Value:

Inheritance graph
[legend]

Public Types

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

ValueType getType (void) const
 Retrieves the value type for the instance.
Valueoperator= (Value const &orig) throw (Bad_Data_Type)
 Assignment operator.
virtual void repr (std::ostream &ostr) const=0
 Represents the instance in a stream.
virtual void set (Value const &origin) throw (Bad_Data_Type)
 Copies the contents of one instance into anothe.
virtual ~Value ()
 Destructor.

Static Public Member Functions

static Valueduplicate (Value const &orig)
 Creates a duplicate of a value.

Protected Member Functions

 Value (ValueType Type)
 Constructor.

Private Attributes

ValueType Type_
 Container for error code.

Detailed Description

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 <morongo666@gmail.com>


Member Enumeration Documentation

enum JAULA::Value::ValueType

Enumeration of available value types.

Enumerator:
TYPE_NULL  JSON Null value
TYPE_BOOLEAN  JSON Boolean value
TYPE_STRING  JSON String value
TYPE_NUMBER  JSON Number value
TYPE_NUMBER_INT  JSON Number value adapted to hold integer quantities
TYPE_ARRAY  JSON Array of values
TYPE_OBJECT  JSON Object


Constructor & Destructor Documentation

JAULA::Value::~Value (  )  [virtual]

Destructor.

JAULA::Value::Value ( ValueType  Type  )  [protected]

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.


Member Function Documentation

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.

Value::ValueType JAULA::Value::getType ( void   )  const

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.

Value & JAULA::Value::operator= ( Value const &  orig  )  throw (Bad_Data_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.

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

Represents the instance in a stream.

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

Implemented in JAULA::Value_Array, JAULA::Value_Boolean, JAULA::Value_Null, JAULA::Value_Number, JAULA::Value_Number_Int, JAULA::Value_Object, and JAULA::Value_String.

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

Copies the contents of one instance into anothe.

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_Array, JAULA::Value_Boolean, JAULA::Value_Null, JAULA::Value_Number, JAULA::Value_Number_Int, JAULA::Value_Object, and JAULA::Value_String.


Field Documentation

ValueType JAULA::Value::Type_ [private]

Container for error code.


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


Back to JAULA Project Documentation Page.

Go to JAULA Project Home Page.


Copyright (c) 2007 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".

API Reference Generated for jaula by

doxygen

jaula project hosted by

SourceForge.net Logo