#include <json11.hpp>
Enumerator |
---|
NUL |
|
NUMBER |
|
BOOL |
|
STRING |
|
ARRAY |
|
OBJECT |
|
Definition: json11.hpp:83
Definition: json11.hpp:83
Definition: json11.hpp:83
Definition: json11.hpp:83
Definition: json11.hpp:83
Definition: json11.hpp:83
static const Statics & statics()
Definition: json11.cpp:238
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
json11::Json::Json |
( |
std::nullptr_t |
| ) |
|
|
noexcept |
static const Statics & statics()
Definition: json11.cpp:238
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
json11::Json::Json |
( |
double |
value | ) |
|
255 :
m_ptr(make_shared<JsonDouble>(value)) {}
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
json11::Json::Json |
( |
int |
value | ) |
|
256 :
m_ptr(make_shared<JsonInt>(value)) {}
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
json11::Json::Json |
( |
bool |
value | ) |
|
static const Statics & statics()
Definition: json11.cpp:238
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
json11::Json::Json |
( |
const std::string & |
value | ) |
|
json11::Json::Json |
( |
std::string && |
value | ) |
|
json11::Json::Json |
( |
const char * |
value | ) |
|
260 :
m_ptr(make_shared<JsonString>(value)) {}
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
261 :
m_ptr(make_shared<JsonArray>(values)) {}
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
262 :
m_ptr(make_shared<JsonArray>(move(values))) {}
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
json11::Json::Json |
( |
object && |
values | ) |
|
template<class T , class = decltype(&T::to_json)>
json11::Json::Json |
( |
const T & |
t | ) |
|
|
inline |
106 :
Json(t.to_json()) {}
Json() noexcept
Definition: json11.cpp:253
template<class M , typename std::enable_if< std::is_constructible< std::string, decltype(std::declval< M >().begin() ->first)>::value &&std::is_constructible< Json, decltype(std::declval< M >().begin() -> second>
json11::Json::Json |
( |
const M & |
m | ) |
|
|
inline |
113 :
Json(
object(m.begin(), m.end())) {}
Json() noexcept
Definition: json11.cpp:253
template<class V , typename std::enable_if< std::is_constructible< Json, decltype(*std::declval< V >().begin())>::value, int >::type = 0>
json11::Json::Json |
( |
const V & |
v | ) |
|
|
inline |
std::vector< Json > array
Definition: json11.hpp:87
Json() noexcept
Definition: json11.cpp:253
json11::Json::Json |
( |
void * |
| ) |
|
|
delete |
270 {
return m_ptr->type(); }
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
string json11::Json::type_name |
( |
| ) |
const |
272 if(
m_ptr->type()==
NUL)
return "NULL";
Definition: json11.hpp:83
Definition: json11.hpp:83
Definition: json11.hpp:83
Definition: json11.hpp:83
Definition: json11.hpp:83
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
Definition: json11.hpp:83
bool json11::Json::is_null |
( |
| ) |
const |
|
inline |
Definition: json11.hpp:83
Type type() const
Definition: json11.cpp:270
bool json11::Json::is_number |
( |
| ) |
const |
|
inline |
Type type() const
Definition: json11.cpp:270
Definition: json11.hpp:83
bool json11::Json::is_bool |
( |
| ) |
const |
|
inline |
Type type() const
Definition: json11.cpp:270
Definition: json11.hpp:83
bool json11::Json::is_string |
( |
| ) |
const |
|
inline |
Type type() const
Definition: json11.cpp:270
Definition: json11.hpp:83
bool json11::Json::is_array |
( |
| ) |
const |
|
inline |
Type type() const
Definition: json11.cpp:270
Definition: json11.hpp:83
bool json11::Json::is_object |
( |
| ) |
const |
|
inline |
Type type() const
Definition: json11.cpp:270
Definition: json11.hpp:83
double json11::Json::number_value |
( |
| ) |
const |
280 {
return m_ptr->number_value(); }
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
int json11::Json::int_value |
( |
| ) |
const |
281 {
return m_ptr->int_value(); }
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
bool json11::Json::bool_value |
( |
| ) |
const |
282 {
return m_ptr->bool_value(); }
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
const string & json11::Json::string_value |
( |
| ) |
const |
283 {
return m_ptr->string_value(); }
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
const vector< Json > & json11::Json::array_items |
( |
| ) |
const |
284 {
return m_ptr->array_items(); }
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
const map< string, Json > & json11::Json::object_items |
( |
| ) |
const |
285 {
return m_ptr->object_items(); }
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
const Json & json11::Json::operator[] |
( |
size_t |
i | ) |
const |
size_t i
Definition: json11.cpp:361
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
void json11::Json::dump |
( |
std::string & |
out | ) |
const |
std::string json11::Json::dump |
( |
| ) |
const |
|
inline |
std::string dump() const
Definition: json11.hpp:158
static Json json11::Json::parse |
( |
const std::string & |
in, |
|
|
std::string & |
err, |
|
|
JsonParse |
strategy = JsonParse::STANDARD |
|
) |
| |
|
static |
static Json json11::Json::parse |
( |
const char * |
in, |
|
|
std::string & |
err, |
|
|
JsonParse |
strategy = JsonParse::STANDARD |
|
) |
| |
|
inlinestatic |
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
string & err
Definition: json11.cpp:362
const JsonParse strategy
Definition: json11.cpp:364
static std::vector<Json> json11::Json::parse_multi |
( |
const std::string & |
in, |
|
|
std::string::size_type & |
parser_stop_pos, |
|
|
std::string & |
err, |
|
|
JsonParse |
strategy = JsonParse::STANDARD |
|
) |
| |
|
static |
static std::vector<Json> json11::Json::parse_multi |
( |
const std::string & |
in, |
|
|
std::string & |
err, |
|
|
JsonParse |
strategy = JsonParse::STANDARD |
|
) |
| |
|
inlinestatic |
189 std::string::size_type parser_stop_pos;
string & err
Definition: json11.cpp:362
static std::vector< Json > parse_multi(const std::string &in, std::string::size_type &parser_stop_pos, std::string &err, JsonParse strategy=JsonParse::STANDARD)
const JsonParse strategy
Definition: json11.cpp:364
bool json11::Json::operator== |
( |
const Json & |
rhs | ) |
const |
312 if (
m_ptr == other.m_ptr)
314 if (
m_ptr->type() != other.m_ptr->type())
317 return m_ptr->equals(other.m_ptr.get());
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
bool json11::Json::operator< |
( |
const Json & |
rhs | ) |
const |
321 if (
m_ptr == other.m_ptr)
323 if (
m_ptr->type() != other.m_ptr->type())
324 return m_ptr->type() < other.m_ptr->type();
326 return m_ptr->less(other.m_ptr.get());
std::shared_ptr< JsonValue > m_ptr
Definition: json11.hpp:209
bool json11::Json::operator!= |
( |
const Json & |
rhs | ) |
const |
|
inline |
195 {
return !(*
this == rhs); }
bool json11::Json::operator<= |
( |
const Json & |
rhs | ) |
const |
|
inline |
196 {
return !(rhs < *
this); }
bool json11::Json::operator> |
( |
const Json & |
rhs | ) |
const |
|
inline |
197 {
return (rhs < *
this); }
bool json11::Json::operator>= |
( |
const Json & |
rhs | ) |
const |
|
inline |
198 {
return !(*
this < rhs); }
bool json11::Json::has_shape |
( |
const shape & |
types, |
|
|
std::string & |
err |
|
) |
| const |
814 err =
"expected JSON object, got " +
dump();
819 for (
auto & item : types) {
820 const auto it = obj_items.find(item.first);
821 if (it == obj_items.cend() || it->second.type() != item.second) {
822 err =
"bad type for " + item.first +
" in " +
dump();
std::string dump() const
Definition: json11.hpp:158
string & err
Definition: json11.cpp:362
bool is_object() const
Definition: json11.hpp:134
const object & object_items() const
Definition: json11.cpp:285
std::shared_ptr<JsonValue> json11::Json::m_ptr |
|
private |
The documentation for this class was generated from the following files: