|
RDK Documentation (Open Sourced RDK Components)
|
Go to the documentation of this file.
19 #ifndef _AAMP_JSON_OBJECT_H
20 #define _AAMP_JSON_OBJECT_H
31 #include <cjson/cJSON.h>
78 bool add(
const std::string& name,
const std::vector<std::string>& values);
97 bool add(
const std::string& name, std::vector<AampJsonObject*>& values);
106 bool get(
const std::string& name, std::vector<std::string>& values);
115 bool get(
const std::string& name,
int& value);
124 bool get(
const std::string& name, std::string& value);
166 void print(std::vector<uint8_t>& data);
174 bool add(
const std::string& name,
bool value);
182 bool add(
const std::string& name,
int value);
191 bool add(
const std::string& name,
double value);
200 bool add(
const std::string& name,
long value);
211 bool add(
const std::string& name, cJSON *value);
218 bool isArray(
const std::string& name);
225 bool isString(
const std::string& name);
232 bool isNumber(
const std::string& name);
239 bool isObject(
const std::string& name);
243 bool add(
const std::string& name);
255 virtual const char* what()
const throw()
257 return "Failed to parse JSON string";
261 #endif //_AAMP_JSON_OBJECT_H
bool set(AampJsonObject *parent, cJSON *object)
Set cJSON value.
Handles the exception for JSON parser.
bool get(const std::string &name, std::vector< std::string > &values)
Get a string value.
bool isArray(const std::string &name)
Check whether the value is Array or not.
bool isObject(const std::string &name)
Check whether the value is Object or not.
bool isString(const std::string &name)
Check whether the value is String or not.
std::string print()
Print the constructed JSON to a string.
bool isNumber(const std::string &name)
Check whether the value is Number or not.
std::string print_UnFormatted()
Print the constructed JSON to a string.
bool add(const std::string &name, const std::string &value, const ENCODING encoding=ENCODING_STRING)
Add a string value.
Utility class to construct a JSON string.