Open Lighting Architecture
0.9.0
|
A JSON object. JSON Objects are key : value mappings, similar to dictionaries in Python.
If the same key is added more than once, the latest value wins.
Public Member Functions | |
JsonObject () | |
Create a new JsonObject. | |
void | Add (const std::string &key, const std::string &value) |
Add a key to string mapping. | |
void | Add (const std::string &key, const char *value) |
Set the given key to a string value. | |
void | Add (const std::string &key, unsigned int i) |
Set the given key to a unsigned int value. | |
void | Add (const std::string &key, int i) |
Set the given key to a int value. | |
void | Add (const std::string &key, bool value) |
Set the given key to a bool value. | |
void | Add (const std::string &key) |
Set the given key to a null value. | |
JsonObject * | AddObject (const std::string &key) |
Set the given key to a JsonObject. | |
class JsonArray * | AddArray (const std::string &key) |
Set the given key to a JsonArray. | |
void | AddRaw (const std::string &key, const std::string &value) |
Set the given key to a raw value. | |
void | ToString (std::ostream *output, unsigned int indent) const |
Output the string representation of this value to an ostream. |
Additional Inherited Members | |
Protected Member Functions inherited from ola::web::JsonValue | |
void | Indent (std::ostream *output, unsigned int indent) const |
Append the give number of spaces to the output stream. | |
Static Protected Attributes inherited from ola::web::JsonValue | |
static const unsigned int | DEFAULT_INDENT = 2 |
the default indent level |
void ola::web::JsonObject::Add | ( | const std::string & | key, |
const std::string & | value | ||
) |
Add a key to string mapping.
key | the key to set. |
value | the value to add. |
void ola::web::JsonObject::Add | ( | const std::string & | key, |
const char * | value | ||
) |
Set the given key to a string value.
key | the key to set. |
value | the value to add |
void ola::web::JsonObject::Add | ( | const std::string & | key, |
unsigned int | i | ||
) |
Set the given key to a unsigned int value.
key | the key to set. |
i | the value to add |
void ola::web::JsonObject::Add | ( | const std::string & | key, |
int | i | ||
) |
Set the given key to a int value.
key | the key to set. |
i | the value to add |
void ola::web::JsonObject::Add | ( | const std::string & | key, |
bool | value | ||
) |
Set the given key to a bool value.
key | the key to set. |
value | the value to add |
void ola::web::JsonObject::Add | ( | const std::string & | key | ) |
Set the given key to a null value.
key | the key to set. |
JsonArray * ola::web::JsonObject::AddArray | ( | const std::string & | key | ) |
JsonObject * ola::web::JsonObject::AddObject | ( | const std::string & | key | ) |
void ola::web::JsonObject::AddRaw | ( | const std::string & | key, |
const std::string & | value | ||
) |
Set the given key to a raw value.
key | the key to add |
value | the raw value to append. |
|
virtual |
Output the string representation of this value to an ostream.
output | the ostream to output to. |
indent | the number of spaces to prepend. |
Implements ola::web::JsonValue.