My Project
 All Classes Functions Variables Pages
Public Member Functions | Friends | List of all members
JsonObject Class Reference

A JSON object. More...

#include <JSON.h>

Public Member Functions

JsonArray getArray (std::string name)
 
bool getBoolean (std::string name)
 Get the named boolean value from the object. More...
 
double getDouble (std::string name)
 Get the named double value from the object. More...
 
int getInt (std::string name)
 Get the named int value from the object. More...
 
JsonObject getObject (std::string name)
 Get the named object value from the object. More...
 
std::string getString (std::string name)
 Get the named string value from the object. More...
 
bool hasItem (std::string name)
 Determine if the object has the specified item. More...
 
bool isValid ()
 Determine if this represents a valid JSON node. More...
 
void setArray (std::string name, JsonArray array)
 Set the named array property. More...
 
void setBoolean (std::string name, bool value)
 Set the named boolean property. More...
 
void setDouble (std::string name, double value)
 Set the named double property. More...
 
void setInt (std::string name, int value)
 Set the named int property. More...
 
void setObject (std::string name, JsonObject value)
 Set the named object property. More...
 
void setString (std::string name, std::string value)
 Set the named string property. More...
 
std::string toString ()
 Convert the JSON object to a string. More...
 
std::string toStringUnformatted ()
 Build an unformatted string representation. More...
 

Friends

class JSON
 
class JsonArray
 

Detailed Description

A JSON object.

Member Function Documentation

bool JsonObject::getBoolean ( std::string  name)

Get the named boolean value from the object.

Parameters
[in]nameThe name of the object property.
Returns
The boolean value from the object.
double JsonObject::getDouble ( std::string  name)

Get the named double value from the object.

Parameters
[in]nameThe name of the object property.
Returns
The double value from the object.
int JsonObject::getInt ( std::string  name)

Get the named int value from the object.

Parameters
[in]nameThe name of the object property.
Returns
The int value from the object.
JsonObject JsonObject::getObject ( std::string  name)

Get the named object value from the object.

Parameters
[in]nameThe name of the object property.
Returns
The object value from the object.
std::string JsonObject::getString ( std::string  name)

Get the named string value from the object.

Parameters
[in]nameThe name of the object property.
Returns
The string value from the object. A zero length string is returned when the object is not present.
bool JsonObject::hasItem ( std::string  name)

Determine if the object has the specified item.

Parameters
[in]nameThe name of the property to check for presence.
Returns
True if the object contains this property.
bool JsonObject::isValid ( )

Determine if this represents a valid JSON node.

Returns
True if this is a valid node and false otherwise.
void JsonObject::setArray ( std::string  name,
JsonArray  array 
)

Set the named array property.

Parameters
[in]nameThe name of the property to add.
[in]arrayThe array to add to the object.
Returns
N/A.
void JsonObject::setBoolean ( std::string  name,
bool  value 
)

Set the named boolean property.

Parameters
[in]nameThe name of the property to add.
[in]valueThe boolean to add to the object.
Returns
N/A.
void JsonObject::setDouble ( std::string  name,
double  value 
)

Set the named double property.

Parameters
[in]nameThe name of the property to add.
[in]valueThe double to add to the object.
Returns
N/A.
void JsonObject::setInt ( std::string  name,
int  value 
)

Set the named int property.

Parameters
[in]nameThe name of the property to add.
[in]valueThe int to add to the object.
Returns
N/A.
void JsonObject::setObject ( std::string  name,
JsonObject  value 
)

Set the named object property.

Parameters
[in]nameThe name of the property to add.
[in]valueThe object to add to the object.
Returns
N/A.
void JsonObject::setString ( std::string  name,
std::string  value 
)

Set the named string property.

Parameters
[in]nameThe name of the property to add.
[in]valueThe string to add to the object.
Returns
N/A.
std::string JsonObject::toString ( )

Convert the JSON object to a string.

Returns
A JSON string representation of the object.
std::string JsonObject::toStringUnformatted ( )

Build an unformatted string representation.

Returns
A string representation.

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