ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

#include <json.h>

Collaboration diagram for Common::JSONValue:

List of all members.

Public Member Functions

 JSONValue ()
 Basic constructor for creating a JSON Value of type NULL.
 JSONValue (const char *charValue)
 Basic constructor for creating a JSON Value of type String.
 JSONValue (const String &stringValue)
 Basic constructor for creating a JSON Value of type String.
 JSONValue (bool boolValue)
 Basic constructor for creating a JSON Value of type Bool.
 JSONValue (double numberValue)
 Basic constructor for creating a JSON Value of type Number.
 JSONValue (long long int numberValue)
 Basic constructor for creating a JSON Value of type Number (Integer).
 JSONValue (const JSONArray &arrayValue)
 Basic constructor for creating a JSON Value of type Array.
 JSONValue (const JSONObject &objectValue)
 Basic constructor for creating a JSON Value of type Object.
 JSONValue (const JSONValue &source)
 Copy constructor to perform a deep copy of array / object values.
 ~JSONValue ()
 The destructor for the JSON Value object Handles deleting the objects in the array or the object value.
bool isNull () const
 Checks if the value is a NULL.
bool isString () const
 Checks if the value is a String.
bool isBool () const
 Checks if the value is a Bool.
bool isNumber () const
 Checks if the value is a Number.
bool isIntegerNumber () const
 Checks if the value is an Integer.
bool isArray () const
 Checks if the value is an Array.
bool isObject () const
 Checks if the value is an Object.
const StringasString () const
 Retrieves the String value of this JSONValue Use isString() before using this method.
bool asBool () const
 Retrieves the Bool value of this JSONValue Use isBool() before using this method.
double asNumber () const
 Retrieves the Number value of this JSONValue Use isNumber() before using this method.
long long int asIntegerNumber () const
 Retrieves the Integer value of this JSONValue Use isIntegerNumber() before using this method.
const JSONArrayasArray () const
 Retrieves the Array value of this JSONValue Use isArray() before using this method.
const JSONObjectasObject () const
 Retrieves the Object value of this JSONValue Use isObject() before using this method.
size_t countChildren () const
 Retrieves the number of children of this JSONValue.
bool hasChild (size_t index) const
JSONValuechild (size_t index)
bool hasChild (const char *name) const
 Checks if this JSONValue has a child at the given key.
JSONValuechild (const char *name)
 Retrieves the child of this JSONValue at the given key.
Array< StringobjectKeys () const
 Retrieves the keys of the JSON Object or an empty vector if this value is not an object.
String stringify (bool const prettyprint=false) const
 Creates a JSON encoded string for the value with all necessary characters escaped.

Static Protected Member Functions

static JSONValueparse (const char **data)
 Parses a JSON encoded value to a JSONValue object.

Private Member Functions

String stringifyImpl (size_t const indentDepth) const
 Creates a JSON encoded string for the value with all necessary characters escaped.

Static Private Member Functions

static String stringifyString (const String &str)
 Creates a JSON encoded string with all required fields escaped Works from http://www.ecma-internationl.org/publications/files/ECMA-ST/ECMA-262.pdf Section 15.12.3.
static String indent (size_t depth)
 Creates the indentation string for the depth given.

Private Attributes

JSONType _type
union {
   bool   _boolValue
   double   _numberValue
   long long int   _integerValue
   String *   _stringValue
   JSONArray *   _arrayValue
   JSONObject *   _objectValue
}; 

Friends

class JSON

Detailed Description

Definition at line 90 of file json.h.


Constructor & Destructor Documentation

Common::JSONValue::JSONValue (  ) 

Basic constructor for creating a JSON Value of type NULL.

public

Definition at line 512 of file json.cpp.

Common::JSONValue::JSONValue ( const char *  charValue  ) 

Basic constructor for creating a JSON Value of type String.

public

Parameters:
char* m_char_value The string to use as the value

Definition at line 523 of file json.cpp.

Common::JSONValue::JSONValue ( const String stringValue  ) 

Basic constructor for creating a JSON Value of type String.

public

Parameters:
String m_string_value The string to use as the value

Definition at line 535 of file json.cpp.

Common::JSONValue::JSONValue ( bool  boolValue  ) 

Basic constructor for creating a JSON Value of type Bool.

public

Parameters:
bool m_bool_value The bool to use as the value

Definition at line 547 of file json.cpp.

Common::JSONValue::JSONValue ( double  numberValue  ) 

Basic constructor for creating a JSON Value of type Number.

public

Parameters:
double m_number_value The number to use as the value

Definition at line 559 of file json.cpp.

Common::JSONValue::JSONValue ( long long int  numberValue  ) 

Basic constructor for creating a JSON Value of type Number (Integer).

public

Parameters:
int numberValue The number to use as the value

Definition at line 571 of file json.cpp.

Common::JSONValue::JSONValue ( const JSONArray arrayValue  ) 

Basic constructor for creating a JSON Value of type Array.

public

Parameters:
JSONArray m_array_value The JSONArray to use as the value

Definition at line 583 of file json.cpp.

Common::JSONValue::JSONValue ( const JSONObject objectValue  ) 

Basic constructor for creating a JSON Value of type Object.

public

Parameters:
JSONObject m_object_value The JSONObject to use as the value

Definition at line 595 of file json.cpp.

Common::JSONValue::JSONValue ( const JSONValue source  ) 

Copy constructor to perform a deep copy of array / object values.

public

Parameters:
JSONValue m_source The source JSONValue that is being copied

Definition at line 607 of file json.cpp.

Common::JSONValue::~JSONValue (  ) 

The destructor for the JSON Value object Handles deleting the objects in the array or the object value.

public

Definition at line 659 of file json.cpp.


Member Function Documentation

const JSONArray & Common::JSONValue::asArray (  )  const

Retrieves the Array value of this JSONValue Use isArray() before using this method.

public

Returns:
JSONArray Returns the array value

Definition at line 809 of file json.cpp.

bool Common::JSONValue::asBool (  )  const

Retrieves the Bool value of this JSONValue Use isBool() before using this method.

public

Returns:
bool Returns the bool value

Definition at line 773 of file json.cpp.

long long int Common::JSONValue::asIntegerNumber (  )  const

Retrieves the Integer value of this JSONValue Use isIntegerNumber() before using this method.

public

Returns:
int Returns the number value

Definition at line 797 of file json.cpp.

double Common::JSONValue::asNumber (  )  const

Retrieves the Number value of this JSONValue Use isNumber() before using this method.

public

Returns:
double Returns the number value

Definition at line 785 of file json.cpp.

const JSONObject & Common::JSONValue::asObject (  )  const

Retrieves the Object value of this JSONValue Use isObject() before using this method.

public

Returns:
JSONObject Returns the object value

Definition at line 821 of file json.cpp.

const String & Common::JSONValue::asString (  )  const

Retrieves the String value of this JSONValue Use isString() before using this method.

public

Returns:
String Returns the string value

Definition at line 761 of file json.cpp.

JSONValue* Common::JSONValue::child ( size_t  index  ) 
JSONValue * Common::JSONValue::child ( const char *  name  ) 

Retrieves the child of this JSONValue at the given key.

Use isObject() before using this method.

public

Returns:
JSONValue* Returns JSONValue for the given key in the object or NULL if it doesn't exist.

Definition at line 903 of file json.cpp.

std::size_t Common::JSONValue::countChildren (  )  const

Retrieves the number of children of this JSONValue.

This number will be 0 or the actual number of children if isArray() or isObject().

public

Returns:
The number of children.

Definition at line 834 of file json.cpp.

bool Common::JSONValue::hasChild ( const char *  name  )  const

Checks if this JSONValue has a child at the given key.

Use isObject() before using this method.

public

Returns:
bool Returns true if the object has a value at the given key.

Definition at line 886 of file json.cpp.

bool Common::JSONValue::hasChild ( size_t  index  )  const
String Common::JSONValue::indent ( size_t  depth  )  [static, private]

Creates the indentation string for the depth given.

private

Parameters:
size_t indent The prettyprint indentation depth (0 : no indentation)
Returns:
String Returns the string

Definition at line 1087 of file json.cpp.

bool Common::JSONValue::isArray (  )  const

Checks if the value is an Array.

public

Returns:
bool Returns true if it is an Array value, false otherwise

Definition at line 738 of file json.cpp.

bool Common::JSONValue::isBool (  )  const

Checks if the value is a Bool.

public

Returns:
bool Returns true if it is a Bool value, false otherwise

Definition at line 705 of file json.cpp.

bool Common::JSONValue::isIntegerNumber (  )  const

Checks if the value is an Integer.

public

Returns:
bool Returns true if it is an Integer value, false otherwise

Definition at line 727 of file json.cpp.

bool Common::JSONValue::isNull (  )  const

Checks if the value is a NULL.

public

Returns:
bool Returns true if it is a NULL value, false otherwise

Definition at line 683 of file json.cpp.

bool Common::JSONValue::isNumber (  )  const

Checks if the value is a Number.

public

Returns:
bool Returns true if it is a Number value, false otherwise

Definition at line 716 of file json.cpp.

bool Common::JSONValue::isObject (  )  const

Checks if the value is an Object.

public

Returns:
bool Returns true if it is an Object value, false otherwise

Definition at line 749 of file json.cpp.

bool Common::JSONValue::isString (  )  const

Checks if the value is a String.

public

Returns:
bool Returns true if it is a String value, false otherwise

Definition at line 694 of file json.cpp.

Array< String > Common::JSONValue::objectKeys (  )  const

Retrieves the keys of the JSON Object or an empty vector if this value is not an object.

public

Returns:
std::vector<String> A vector containing the keys.

Definition at line 920 of file json.cpp.

JSONValue * Common::JSONValue::parse ( const char **  data  )  [static, protected]

Parses a JSON encoded value to a JSONValue object.

protected

Parameters:
char** data Pointer to a char* that contains the data
Returns:
JSONValue* Returns a pointer to a JSONValue object on success, NULL on error

Definition at line 274 of file json.cpp.

String Common::JSONValue::stringify ( bool const   prettyprint = false  )  const

Creates a JSON encoded string for the value with all necessary characters escaped.

public

Parameters:
bool prettyprint Enable prettyprint
Returns:
String Returns the JSON string

Definition at line 944 of file json.cpp.

String Common::JSONValue::stringifyImpl ( size_t const   indentDepth  )  const [private]

Creates a JSON encoded string for the value with all necessary characters escaped.

private

Parameters:
size_t indentDepth The prettyprint indentation depth (0 : no prettyprint)
Returns:
String Returns the JSON string

Definition at line 959 of file json.cpp.

String Common::JSONValue::stringifyString ( const String str  )  [static, private]

Creates a JSON encoded string with all required fields escaped Works from http://www.ecma-internationl.org/publications/files/ECMA-ST/ECMA-262.pdf Section 15.12.3.

private

Parameters:
String str The string that needs to have the characters escaped
Returns:
String Returns the JSON string

Definition at line 1037 of file json.cpp.


Friends And Related Function Documentation

friend class JSON [friend]

Definition at line 91 of file json.h.


Member Data Documentation

union { ... } [private]

Definition at line 143 of file json.h.

Definition at line 139 of file json.h.

Definition at line 141 of file json.h.

Definition at line 140 of file json.h.

Definition at line 144 of file json.h.

Definition at line 142 of file json.h.

Definition at line 136 of file json.h.


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


Generated on Sat Mar 16 2019 05:05:39 for ResidualVM by doxygen 1.7.1
curved edge   curved edge