Documentation for JSONValue.cpp

Key:

Private function

Public function

Protected function

Other functions

JSONValue *JSONValue::Parse(const wchar_t **data)

Parses a JSON encoded value to a JSONValue object

Parameters

dataPointer to a wchar_t* that contains the data

Returns:

Returns a pointer to a JSONValue object on success, NULL on error

JSONValue::JSONValue(/*NULL*/)

Basic constructor for creating a JSON Value of type NULL

JSONValue::JSONValue(const wchar_t *m_char_value)

Basic constructor for creating a JSON Value of type String

Parameters

m_char_valueThe string to use as the value

JSONValue::JSONValue(std::wstring m_string_value)

Basic constructor for creating a JSON Value of type String

Parameters

m_string_valueThe string to use as the value

JSONValue::JSONValue(bool m_bool_value)

Basic constructor for creating a JSON Value of type Bool

Parameters

m_bool_valueThe bool to use as the value

JSONValue::JSONValue(double m_number_value)

Basic constructor for creating a JSON Value of type Number

Parameters

m_number_valueThe number to use as the value

JSONValue::JSONValue(JSONArray m_array_value)

Basic constructor for creating a JSON Value of type Array

Parameters

m_array_valueThe JSONArray to use as the value

JSONValue::JSONValue(JSONObject m_object_value)

Basic constructor for creating a JSON Value of type Object

Parameters

m_object_valueThe JSONObject to use as the value

JSONValue::~JSONValue()

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

bool JSONValue::IsNull()

Checks if the value is a NULL

Returns:

Returns true if it is a NULL value, false otherwise

bool JSONValue::IsString()

Checks if the value is a String

Returns:

Returns true if it is a String value, false otherwise

bool JSONValue::IsBool()

Checks if the value is a Bool

Returns:

Returns true if it is a Bool value, false otherwise

bool JSONValue::IsNumber()

Checks if the value is a Number

Returns:

Returns true if it is a Number value, false otherwise

bool JSONValue::IsArray()

Checks if the value is an Array

Returns:

Returns true if it is an Array value, false otherwise

bool JSONValue::IsObject()

Checks if the value is an Object

Returns:

Returns true if it is an Object value, false otherwise

std::wstring JSONValue::AsString()

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

Returns:

Returns the string value

bool JSONValue::AsBool()

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

Returns:

Returns the bool value

double JSONValue::AsNumber()

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

Returns:

Returns the number value

JSONArray JSONValue::AsArray()

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

Returns:

Returns the array value

JSONObject JSONValue::AsObject()

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

Returns:

Returns the object value

std::wstring JSONValue::Stringify()

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

Returns:

Returns the JSON string

std::wstring JSONValue::StringifyString(std::wstring 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.

Parameters

strThe string that needs to have the characters escaped

Returns:

Returns the JSON string