80 explicit JsonValue(
const std::string& value);
88 explicit JsonValue(
const std::vector<JsonValue>& values);
92 explicit JsonValue(
const std::map<std::string, JsonValue>& values);
118 return this->operator=(
JsonValue(value));
139 bool isNumber()
const;
143 bool isString()
const;
147 bool isArray()
const;
151 bool isObject()
const;
156 bool toBool(
bool defaultValue =
false)
const;
161 int toInt(
int defaultValue = 0)
const;
166 double toDouble(
double defaultValue = 0.0)
const;
176 const std::vector<JsonValue>& getArray(
const std::vector<JsonValue>& defaultValue = std::vector<JsonValue>())
const;
181 const std::map<std::string, JsonValue>& getObject(
const std::map<std::string, JsonValue>& defaultValue = std::map<std::string, JsonValue>())
const;
188 operator bool()
const;
192 operator int()
const;
196 operator double()
const;
200 operator std::string()
const;
212 const JsonValue& operator[](
size_t index)
const;
213 const JsonValue& operator[](
int index)
const;
219 JsonValue& operator[](
const std::string& key);
225 const JsonValue& operator[](
const std::string& key)
const;
226 const JsonValue& operator[](
const char* key)
const;
233 void setBool(
bool value);
237 void setInt(
int value);
241 void setDouble(
double value);
249 void setArray(
const std::vector<JsonValue>& values={});
253 void setObject(
const std::map<std::string, JsonValue>& values={});
261 void insert(
const std::string& name, JsonValue value);
267 void insert(
const std::string& name, T value)
288 std::string toJsonString(
int indent = 0)
const;
321 std::string formatString(
int indent,
int indentSize)
const;