scenepic 1.1.0
3D Visualization Made Easy
|
Representation of a JSON value according to the specification at https://www.json.org/json-en.html. More...
#include <json_value.h>
Public Member Functions | |
JsonValue () | |
Constructor. More... | |
JsonValue (JsonType type) | |
Constructor. More... | |
JsonValue (const std::string &value) | |
Constructor. More... | |
JsonValue (std::string &&value) | |
Constructor. More... | |
JsonValue (const char *value) | |
Constructor. More... | |
JsonValue (double value) | |
Constructor. More... | |
JsonValue (std::int64_t value) | |
Constructor. More... | |
JsonValue (bool value) | |
Constructor. More... | |
void | resize (std::size_t size) |
Convert this objec to an array of the specified size. More... | |
void | append (JsonValue &&object) |
Append the object to this array. More... | |
void | append (const JsonValue &object) |
Append the object to this array. More... | |
JsonValue & | operator[] (const std::string &key) |
Return the value stored in this object at the specified key. More... | |
const JsonValue & | operator[] (const std::string &key) const |
Return the value stored in this object at the specified key. More... | |
JsonValue & | operator= (const std::string &value) |
Set the value of this object to the specified value. More... | |
JsonValue & | operator= (std::string &&value) |
Set the value of this object to the specified value. More... | |
JsonValue & | operator= (const char *value) |
Set the value of this object to the specified value. More... | |
JsonValue & | operator= (double value) |
Set the value of this object to the specified value. More... | |
JsonValue & | operator= (std::int64_t value) |
Set the value of this object to the specified value. More... | |
JsonValue & | operator= (bool value) |
Set the value of this object to the specified value. More... | |
JsonType | type () const |
The type of this object. More... | |
std::string | to_string () const |
A string representation of this object in valid JSON. More... | |
const std::string & | as_string () const |
Return this object interpreted as a string. More... | |
double | as_double () const |
Return this object interpreted as a double. More... | |
float | as_float () const |
Return this object intepreted as a float. More... | |
std::int64_t | as_int () const |
Return this object intepreted as an integer. More... | |
bool | as_boolean () const |
Return this object intepreted as a boolean. More... | |
const std::vector< JsonValue > & | values () const |
Return the values of this JSON array. More... | |
const std::map< std::string, JsonValue > & | lookup () const |
Return the key/value lookup for this JSON object. More... | |
Static Public Member Functions | |
static JsonValue | parse (std::istream &stream) |
Parse a JsonValue object from the provided input stream. More... | |
static JsonValue | nullSingleton () |
Return a singleton representating a JSON NULL object. More... | |
Representation of a JSON value according to the specification at https://www.json.org/json-en.html.
scenepic::JsonValue::JsonValue | ( | ) |
Constructor.
Creates a default JSON object type.
scenepic::JsonValue::JsonValue | ( | JsonType | type | ) |
Constructor.
type | desired type of Json object |
scenepic::JsonValue::JsonValue | ( | const std::string & | value | ) |
Constructor.
value | string value to represent |
scenepic::JsonValue::JsonValue | ( | std::string && | value | ) |
Constructor.
value | string value to represent |
scenepic::JsonValue::JsonValue | ( | const char * | value | ) |
Constructor.
value | string value to represent |
scenepic::JsonValue::JsonValue | ( | double | value | ) |
Constructor.
value | floating point value to represent |
scenepic::JsonValue::JsonValue | ( | std::int64_t | value | ) |
Constructor.
value | integer value to represent |
scenepic::JsonValue::JsonValue | ( | bool | value | ) |
Constructor.
value | boolean value to represent |
void scenepic::JsonValue::append | ( | const JsonValue & | object | ) |
Append the object to this array.
object | the object to append. |
void scenepic::JsonValue::append | ( | JsonValue && | object | ) |
Append the object to this array.
object | the object to append. |
bool scenepic::JsonValue::as_boolean | ( | ) | const |
Return this object intepreted as a boolean.
double scenepic::JsonValue::as_double | ( | ) | const |
Return this object interpreted as a double.
float scenepic::JsonValue::as_float | ( | ) | const |
Return this object intepreted as a float.
std::int64_t scenepic::JsonValue::as_int | ( | ) | const |
Return this object intepreted as an integer.
const std::string & scenepic::JsonValue::as_string | ( | ) | const |
Return this object interpreted as a string.
const std::map< std::string, JsonValue > & scenepic::JsonValue::lookup | ( | ) | const |
Return the key/value lookup for this JSON object.
|
static |
Return a singleton representating a JSON NULL object.
JsonValue & scenepic::JsonValue::operator= | ( | bool | value | ) |
Set the value of this object to the specified value.
value | the value to use |
JsonValue & scenepic::JsonValue::operator= | ( | const char * | value | ) |
Set the value of this object to the specified value.
value | the value to use |
JsonValue & scenepic::JsonValue::operator= | ( | const std::string & | value | ) |
Set the value of this object to the specified value.
value | the value to use |
JsonValue & scenepic::JsonValue::operator= | ( | double | value | ) |
Set the value of this object to the specified value.
value | the value to use |
JsonValue & scenepic::JsonValue::operator= | ( | std::int64_t | value | ) |
Set the value of this object to the specified value.
value | the value to use |
JsonValue & scenepic::JsonValue::operator= | ( | std::string && | value | ) |
Set the value of this object to the specified value.
value | the value to use |
JsonValue & scenepic::JsonValue::operator[] | ( | const std::string & | key | ) |
Return the value stored in this object at the specified key.
key | the locator key |
const JsonValue & scenepic::JsonValue::operator[] | ( | const std::string & | key | ) | const |
Return the value stored in this object at the specified key.
key | the locator key |
|
static |
Parse a JsonValue object from the provided input stream.
stream | an input stream |
void scenepic::JsonValue::resize | ( | std::size_t | size | ) |
Convert this objec to an array of the specified size.
size | the number of elements in the array |
std::string scenepic::JsonValue::to_string | ( | ) | const |
A string representation of this object in valid JSON.
JsonType scenepic::JsonValue::type | ( | ) | const |
The type of this object.
const std::vector< JsonValue > & scenepic::JsonValue::values | ( | ) | const |
Return the values of this JSON array.