57 #include <initializer_list> 60 #if _MSC_VER <= 1800 // VS 2013 62 #define noexcept throw() 66 #define snprintf _snprintf_s 87 typedef std::vector<Json>
array;
88 typedef std::map<std::string, Json>
object;
100 Json(array &&values);
102 Json(
object &&values);
105 template <class T, class = decltype(&T::
to_json)>
109 template <
class M,
typename std::enable_if<
110 std::is_constructible<std::string, decltype(std::declval<M>().begin()->first)>::value
111 && std::is_constructible<
Json, decltype(std::declval<M>().begin()->second)>::value,
113 Json(
const M & m) :
Json(
object(m.begin(), m.end())) {}
116 template <
class V,
typename std::enable_if<
117 std::is_constructible<Json, decltype(*std::declval<V>().begin())>::value,
123 Json(
void *) =
delete;
157 void dump(std::string &out)
const;
165 static Json parse(
const std::string & in,
180 const std::string & in,
181 std::string::size_type & parser_stop_pos,
186 const std::string & in,
189 std::string::size_type parser_stop_pos;
205 typedef std::initializer_list<std::pair<std::string, Type>>
shape;
206 bool has_shape(
const shape & types, std::string & err)
const;
219 virtual bool equals(
const JsonValue * other)
const = 0;
220 virtual bool less(
const JsonValue * other)
const = 0;
221 virtual void dump(std::string &out)
const = 0;
friend class JsonDouble
Definition: json11.hpp:217
std::initializer_list< std::pair< std::string, Type > > shape
Definition: json11.hpp:205
std::map< std::string, Json > object
Definition: json11.hpp:88
static std::vector< Json > parse_multi(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
Definition: json11.hpp:185
Definition: json11.hpp:79
bool operator!=(const Json &rhs) const
Definition: json11.hpp:195
Definition: json11.hpp:83
int i
Definition: rw_test.cpp:37
virtual ~JsonValue()
Definition: json11.hpp:230
bool operator>(const Json &rhs) const
Definition: json11.hpp:197
std::string type_name() const
Definition: json11.cpp:271
bool operator==(const Json &rhs) const
Definition: json11.cpp:311
Definition: json11.hpp:74
Type type() const
Definition: json11.cpp:270
static Json parse(const char *in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
Definition: json11.hpp:168
Type
Definition: json11.hpp:82
const Json & operator[](size_t i) const
Definition: json11.cpp:286
JsonParse
Definition: json11.hpp:73
Definition: json11.hpp:83
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
std::string dump() const
Definition: json11.hpp:158
Definition: json11.hpp:74
const std::string & string_value() const
Definition: json11.cpp:283
bool is_string() const
Definition: json11.hpp:132
bool bool_value() const
Definition: json11.cpp:282
const array & array_items() const
Definition: json11.cpp:284
friend class JsonInt
Definition: json11.hpp:216
bool operator<=(const Json &rhs) const
Definition: json11.hpp:196
bool is_array() const
Definition: json11.hpp:133
Json(const M &m)
Definition: json11.hpp:113
Definition: json11.cpp:29
string & err
Definition: json11.cpp:362
Definition: json11.hpp:83
std::vector< Json > array
Definition: json11.hpp:87
bool has_shape(const shape &types, std::string &err) const
Definition: json11.cpp:812
static std::vector< Json > parse_multi(const std::string &in, std::string::size_type &parser_stop_pos, std::string &err, JsonParse strategy=JsonParse::STANDARD)
Definition: json11.hpp:213
Definition: json11.hpp:83
bool operator>=(const Json &rhs) const
Definition: json11.hpp:198
bool is_number() const
Definition: json11.hpp:130
bool operator<(const Json &rhs) const
Definition: json11.cpp:320
Definition: json11.hpp:83
bool is_bool() const
Definition: json11.hpp:131
Json() noexcept
Definition: json11.cpp:253
const JsonParse strategy
Definition: json11.cpp:364
friend class Json
Definition: json11.hpp:215
#define const
Definition: zconf.h:217
Json(const V &v)
Definition: json11.hpp:119
bool is_object() const
Definition: json11.hpp:134
int int_value() const
Definition: json11.cpp:281
string to_json(string key, string value)
Definition: stringlib.cpp:334
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
double number_value() const
Definition: json11.cpp:280
Definition: json11.hpp:83
bool is_null() const
Definition: json11.hpp:129
const object & object_items() const
Definition: json11.cpp:285