JSON

JSONString

JSONString

The JSONString object is used to represent string objects and is returned from methods like toString() in the JSONValue class. Note that this is merely a view into the parsed JSON object. It does not create a separate copy of the string!

JSONString::JSONString(const JSONValue &value);

// PROTOTYPE
explicit JSONString(const JSONValue &value);

Constructs a JSONString from a JSONValue. You will probably use the toString() method of JSONValue instead of manually constructing the object.

JSONString::data()

JSONString::data, data, JSONString.data

// PROTOTYPE
const char* data() const; 

Returns a c-string (null-terminated). Note that only 7-bit ASCII characters are supported. This returns a pointer to the original parsed JSON data, not a copy.

JSONString::operator const char *()

JSONString::operator const char , operator const char , JSONString.operator const char *

// PROTOTYPE
explicit operator const char*() const;

Returns a c-string (null-terminated). Note that only 7-bit ASCII characters are supported. This returns a pointer to the original parsed JSON data, not a copy. This is basically the same as data().

JSONString::operator String()

JSONString::operator String, operator String, JSONString.operator String

// PROTOTYPE
explicit operator String() const;

Returns a String object containing a copy of the string data. Note that only 7-bit ASCII characters are supported.

JSONString::size()

JSONString::size, size, JSONString.size

// PROTOTYPE
size_t size() const;

Returns the size of the string in bytes, not including the null terminator. Since the data must be 7-bit ASCII characters (not Unicode), the number of bytes and the number of characters will be the same.

The size() method is fast, O(1), as the length is stored in the parsed JSON tokens.

JSONString::isEmpty()

JSONString::isEmpty, isEmpty, JSONString.isEmpty

// PROTOTYPE
bool isEmpty() const;

Returns true if the string is empty, false if not.

JSONString::operator==()

JSONString::operator==, operator==, JSONString.operator==

// PROTOTYPES
bool operator==(const char *str) const;
bool operator==(const String &str) const;
bool operator==(const JSONString &str) const;

Tests for equality with another string. Uses strncmp internally.

JSONString::operator!=()

JSONString::operator!=, operator!=, JSONString.operator!=

// PROTOTYPES
bool operator!=(const char *str) const;
bool operator!=(const String &str) const;
bool operator!=(const JSONString &str) const;

Tests for inequality with another string.