#include <json_object.h>
Wrapper class for JSON implementation
Definition at line 16 of file json_object.h.
utilities::JsonObject::JsonObject |
( |
| ) |
|
virtual utilities::JsonObject::~JsonObject |
( |
| ) |
|
|
inlinevirtual |
utilities::JsonObject::JsonObject |
( |
json |
library_json | ) |
|
|
protected |
Construct JsonObject from underlying library object
- Parameters
-
[in] | library_json | Library JSON object |
Definition at line 15 of file json_object.cc.
template<typename Tparam >
bool utilities::JsonObject::add_value |
( |
const std::string & |
key, |
|
|
const Tparam & |
value |
|
) |
| |
Add value to key in JSON object. If key doesn't exist, it will automatically added.
- Template Parameters
-
Tparam | Template parameter for value |
- Parameters
-
[in] | key | Key to add values to |
[in] | value | Value to add to key |
- Returns
- Returns true if successful, false otherwise
void utilities::JsonObject::clear |
( |
| ) |
|
bool utilities::JsonObject::delete_key |
( |
const std::string & |
key | ) |
|
Delete key from JSON object
- Parameters
-
[in] | key | Key to remove from JSON object |
- Returns
- Returns true if successful, false otherwise
Definition at line 21 of file json_object.cc.
json utilities::JsonObject::get_library_json |
( |
| ) |
const |
|
inline |
Get underlying JSON library object
- Returns
- Copy of interal JSON implementation
Definition at line 106 of file json_object.h.
unsigned int utilities::JsonObject::get_size |
( |
| ) |
const |
Get the number of keys in the JSON object
- Returns
- Number of keys in the JSON object
Definition at line 72 of file json_object.cc.
template<typename Tparam >
Tparam utilities::JsonObject::get_value |
( |
const std::string & |
key | ) |
const |
Get the value associated with the input key
- Template Parameters
-
Tparam | Template parameter value |
- Parameters
-
[in] | key | Key at which to get value |
- Returns
- Returns value at input key. Throws exception if key is not present.
bool utilities::JsonObject::is_empty |
( |
| ) |
const |
Check if JSON object is empty
- Returns
- Returns true if object is empty, false otherwise
Definition at line 68 of file json_object.cc.
bool utilities::JsonObject::operator!= |
( |
const JsonObject & |
json_value | ) |
const |
|
inline |
Compares input JsonObject to this JsonObject for inequality
- Parameters
-
- Returns
- Returns true if JsonObjects are not equal, false otherwise
Definition at line 47 of file json_object.h.
bool utilities::JsonObject::operator== |
( |
const JsonObject & |
json_value | ) |
const |
|
inline |
Compares input JsonObject to this JsonObject for equality
- Parameters
-
- Returns
- Returns true if JsonObjects are equal, false otherwise
Definition at line 38 of file json_object.h.
bool utilities::JsonObject::write_to_file |
( |
const std::string & |
output_location | ) |
const |
Write prettified JSON object to file
- Parameters
-
[in] | output_location | Location to write JSON object to |
- Returns
- Returns true if successful, false otherwise
Definition at line 36 of file json_object.cc.
Friend operator for output stream insertion
Overload for output stream insertion operator
- Parameters
-
[in] | out | Output stream to insert JSON object into |
[in] | json_object | JSON object to insert into output stream |
- Returns
- Reference to output stream that JSON object has been inserted into
Definition at line 126 of file json_object.h.
json utilities::JsonObject::json_object_ |
|
protected |
The documentation for this class was generated from the following files: