-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjson.hpp
74 lines (56 loc) · 1.51 KB
/
json.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <iostream>
#include <string>
#include <limits>
#include <assert.h>
struct json_exception {
std::string msg;
};
class json {
public:
struct list_iterator;
struct dictionary_iterator;
struct const_list_iterator;
struct const_dictionary_iterator;
json();
json(json const&);
json(json&&);
~json();
json& operator=(json const&);
json& operator=(json&&);
bool is_list() const;
bool is_dictionary() const;
bool is_string() const;
bool is_number() const;
bool is_bool() const;
bool is_null() const;
json const& operator[](std::string const&) const;
json& operator[](std::string const&);
list_iterator begin_list();
const_list_iterator begin_list() const;
list_iterator end_list();
const_list_iterator end_list() const;
dictionary_iterator begin_dictionary();
const_dictionary_iterator begin_dictionary() const;
dictionary_iterator end_dictionary();
const_dictionary_iterator end_dictionary() const;
double& get_number();
double const& get_number() const;
bool& get_bool();
bool const& get_bool() const;
std::string& get_string();
std::string const& get_string() const;
void set_string(std::string const&);
void set_bool(bool);
void set_number(double);
void set_null();
void set_list();
void set_dictionary();
void push_front(json const&);
void push_back(json const&);
void insert(std::pair<std::string,json> const&);
private:
struct impl;
impl* pimpl;
};
std::ostream& operator<<(std::ostream& lhs, json const& rhs);
std::istream& operator>>(std::istream& lhs, json& rhs);