CSCI3081W Drone Delivery System
|
Manages a picojson::value, provides implicit casting for valid JSON types. More...
#include <json.h>
Public Member Functions | |
JsonValue () | |
Default constructor. | |
JsonValue (picojson::value val) | |
Create a JsonValue from an existing picojson::value (creates a copy) More... | |
JsonValue (double d) | |
Create a JsonValue from a double. More... | |
JsonValue (int i) | |
Create a JsonValue from an int. More... | |
JsonValue (const std::string &s) | |
Create a JsonValue from a string. More... | |
JsonValue (const char *s) | |
Create a JsonValue from a string literal. More... | |
JsonValue (bool b) | |
Create a JsonValue from a bool. More... | |
JsonValue (const JsonObject &o) | |
Create a JsonValue from a JsonObject. More... | |
JsonValue (const JsonArray &a) | |
Create a JsonValue from a JsonArray. More... | |
~JsonValue () | |
Destructor. | |
JsonValue (const JsonValue &other) | |
Copy constructor. More... | |
JsonValue & | operator= (const JsonValue &other) |
Copy operator. More... | |
JsonValue (JsonValue &&other) | |
Move constructor. More... | |
JsonValue & | operator= (JsonValue &&other) noexcept |
Move operator. More... | |
picojson::value & | getValue () |
const picojson::value & | getValue () const |
operator double () const | |
JsonValue & | operator= (double d) |
set this value to a double More... | |
operator float () const | |
JsonValue & | operator= (float f) |
set this value to a float More... | |
operator int () const | |
JsonValue & | operator= (int i) |
set this value to an int More... | |
operator std::string () const | |
JsonValue & | operator= (const std::string &s) |
set this value to a string More... | |
JsonValue & | operator= (const char *s) |
set this value to a string More... | |
operator bool () const | |
JsonValue & | operator= (bool b) |
set this value to a bool More... | |
operator JsonObject () const | |
JsonValue & | operator= (const JsonObject &o) |
set this value to a JsonObject More... | |
operator JsonArray () const | |
JsonValue & | operator= (const JsonArray &a) |
set this value to a JsonArray More... | |
std::string | toString () const |
Serialize this to valid JSON text. More... | |
Static Public Member Functions | |
static JsonValue | fromReference (picojson::value &v) |
Create a a JsonValue using a reference to an existing picojson::value. Instead of creating a copy of the picojson::value, this just stores a reference to it. This is only needed for internal use. More... | |
Protected Member Functions | |
template<class T > | |
T | get () const |
Gets the value from the specific template. | |
template<class T > | |
void | set (const T &t) |
Sets the value from the specific template. More... | |
Protected Attributes | |
union { | |
picojson::value v | |
std::reference_wrapper< picojson::value > ref | |
}; | |
bool | isRef = false |
Manages a picojson::value, provides implicit casting for valid JSON types.
|
inline |
Create a JsonValue from an existing picojson::value (creates a copy)
val | picojson:value to copy |
|
inline |
Create a JsonValue from a double.
d | a double |
|
inline |
Create a JsonValue from an int.
i | an int |
|
inline |
Create a JsonValue from a string.
s | a string |
|
inline |
Create a JsonValue from a string literal.
s | a string literal |
|
inline |
Create a JsonValue from a bool.
b | a bool |
JsonValue::JsonValue | ( | const JsonObject & | o | ) |
Create a JsonValue from a JsonObject.
o | a JsonObject |
JsonValue::JsonValue | ( | const JsonArray & | a | ) |
Create a JsonValue from a JsonArray.
a | a JsonArray |
|
static |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
JsonValue::operator JsonArray | ( | ) | const |
JsonValue::operator JsonObject | ( | ) | const |
|
inline |
|
inline |
set this value to a bool
|
inline |
set this value to a string
JsonValue& JsonValue::operator= | ( | const JsonArray & | a | ) |
set this value to a JsonArray
JsonValue& JsonValue::operator= | ( | const JsonObject & | o | ) |
set this value to a JsonObject
|
inline |
set this value to a string
|
inline |
set this value to a double
|
inline |
set this value to a float
|
inline |
set this value to an int
|
inlineprotected |
Sets the value from the specific template.
t | The specific template |
|
inline |
Serialize this to valid JSON text.