Documentation for JSON.cpp

Key:

Private function

Public function

Protected function

Other functions

JSON::JSON()

Blocks off the public constructor

JSONValue *JSON::Parse(const char *data)

Parses a complete JSON encoded string
This is just a wrapper around the UNICODE Parse().

Parameters

dataThe JSON text

Returns:

Returns a JSON Value representing the root, or NULL on error

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

Parses a complete JSON encoded string (UNICODE input version)

Parameters

dataThe JSON text

Returns:

Returns a JSON Value representing the root, or NULL on error

std::wstring JSON::Stringify(JSONValue *value)

Turns the passed in JSONValue into a JSON encode string

Parameters

valueThe root value

Returns:

Returns a JSON encoded string representation of the given value

bool JSON::SkipWhitespace(const wchar_t **data)

Skips over any whitespace characters (space, tab, \r or \n) defined by the JSON spec

Parameters

dataPointer to a wchar_t* that contains the JSON text

Returns:

Returns true if there is more data, or false if the end of the text was reached

bool JSON::ExtractString(const wchar_t **data, std::wstring &str)

Extracts a JSON String as defined by the spec - "<some chars>"
Any escaped characters are swapped out for their unescaped values

Parameters

dataPointer to a wchar_t* that contains the JSON text
strReference to a std::wstring to receive the extracted string

Returns:

Returns true on success, false on failure

int JSON::ParseInt(const wchar_t **data)

Parses some text as though it is an integer

Parameters

dataPointer to a wchar_t* that contains the JSON text

Returns:

Returns the int value of the number found