1 #ifndef _json_json_hpp_ 2 #define _json_json_hpp_ 68 typedef decltype(
nullptr) null_t;
132 json(type t,
const std::string &raw_value);
152 json(
const std::string &s);
162 json(null_t) noexcept;
170 json(std::unique_ptr<std::string> s);
181 json &operator=(
json &&other) noexcept;
187 json &operator=(
int i);
193 json &operator=(
double d);
199 json &operator=(
bool b);
205 json &operator=(
const char *s);
211 json &operator=(
const std::string &s);
219 json &operator=(std::unique_ptr<std::string> s);
226 json &operator=(
const std::map<std::string, std::unique_ptr<json>> &o);
233 json &operator=(
const std::vector<std::unique_ptr<json>> &a);
240 json &operator=(null_t);
245 type get_instance_type()
const;
250 const char *get_instance_type_name()
const;
256 std::vector<std::unique_ptr<json>> &get_array();
262 const std::vector<std::unique_ptr<json>> &get_array()
const;
268 std::map<std::string, std::unique_ptr<json>> &get_object();
274 const std::map<std::string, std::unique_ptr<json>> &get_object()
const;
280 operator int()
const;
286 operator double()
const;
292 operator const std::string&()
const;
298 operator bool()
const;
307 json &operator[](
const std::string &name);
316 json &operator[](
const char *name);
324 const json &operator[](
const std::string &name)
const;
332 const json &operator[](
const char *name)
const;
340 json &operator[](
size_t index);
350 json &operator[](
int index);
358 const json &operator[](
size_t index)
const;
367 const json &operator[](
int index)
const;
387 const json &append(std::unique_ptr<json> j);
396 const json &insert(
const std::string &name,
const json &j);
408 const json &insert(
const std::string &name, std::unique_ptr<json> j);
414 const std::string &get_raw_value()
const;
420 bool operator==(
const json &other)
const;
426 bool operator!=(
const json &other)
const;
435 bool operator<(
const json &other)
const;
444 bool operator<=(
const json &other)
const;
453 bool operator>(
const json &other)
const;
462 bool operator>=(
const json &other)
const;
468 bool operator==(
int i)
const;
471 bool operator==(
double d)
const;
473 bool operator==(
const std::string &s)
const;
475 bool operator==(
const char *s)
const;
477 bool operator!=(
int i)
const;
479 bool operator!=(
double d)
const;
481 bool operator!=(
const std::string &s)
const;
483 bool operator!=(
const char *s)
const;
485 bool operator<(
int i)
const;
487 bool operator<(
double d)
const;
489 bool operator<(
const std::string &s)
const;
491 bool operator<(
const char *s)
const;
493 bool operator<=(
int i)
const;
495 bool operator<=(
double d)
const;
497 bool operator<=(
const std::string &s)
const;
499 bool operator<=(
const char *s)
const;
501 bool operator>(
int i)
const;
503 bool operator>(
double d)
const;
505 bool operator>(
const std::string &s)
const;
507 bool operator>(
const char *s)
const;
509 bool operator>=(
int i)
const;
511 bool operator>=(
double d)
const;
513 bool operator>=(
const std::string &s)
const;
515 bool operator>=(
const char *s)
const;
533 std::map<std::string, std::unique_ptr<json>> *u_object;
535 std::vector<std::unique_ptr<json>> *u_array;
541 double u_number_double;
543 std::string *u_string;
566 std::string m_raw_value;
575 void copy_json(
const json &other);
578 void move_json(
json &other);
581 bool number_equal(
const json &other)
const;
584 bool string_equal(
const json &other)
const;
587 bool object_equal(
const json &other)
const;
590 bool array_equal(
const json &other)
const;
#define NAMESPACE
You can change the namespace of the whole library by changing this value.
Common defs needed everywhere and, as far as is possible, platform specific changes.
JSON pointers as per the RFT.
All json things are represented by instances of this class.