24 #ifndef __IJsonUtils__ 25 #define __IJsonUtils__ 32 #include "boost/property_tree/json_parser.hpp" 36 typedef boost::property_tree::ptree Tree;
37 typedef std::vector<JSON> JSONArray;
57 JSON(Tree inputValue) : value(inputValue){}
58 Tree GetTree() {
return value; }
71 std::string GetString(std::string key);
72 std::string GetString();
79 uint64 GetNumber(std::string key);
86 double GetDouble(
const std::string& key);
93 float GetFloat(
const std::string& key);
100 bool GetBoolean(
const std::string& key);
107 void GetListAt(std::string key, JSONArray &outputArray);
114 void GetJSONAt(std::string key,
JSON &output);
121 Type GetType(std::string key);
128 bool checkKey(std::string key);
135 bool isMap(std::string key);
142 bool IsKeyPresent(std::string key);
149 bool isList(std::string key);
156 bool isNumber(std::string key);
163 bool isString(std::string key);
170 bool isBool(std::string key);
177 void addValue(std::string key, std::string val);
183 void read_json(std::stringstream &sstream);
190 void write_json(std::stringstream &stream,
bool ispretty =
false);
197 void write_json(std::string &str,
bool ispretty =
false);
204 void AddValue(std::string key,
bool val);
211 void AddValue(std::string key,
float val);
218 void AddValue(std::string key,
double val);
225 void AddValue(std::string key,
int val);
232 void AddValue(std::string key, Tree val);
239 void PutValue(std::string key, Tree val);
246 void AddValue(std::string key, JSONArray val);
253 void PushValue(std::string key, Tree val);
257 #endif // __IJsonUtils__