1#ifndef YAZE_UTIL_JSON_H
2#define YAZE_UTIL_JSON_H
4#include "yaze_config.h"
6#if defined(YAZE_WITH_JSON)
7#include "nlohmann/json.hpp"
9using Json = nlohmann::json;
29 Json(
const std::string&) {}
31 template <
typename T>
Json(
const T&) {}
36 static Json parse(
const std::string&) {
throw std::runtime_error(
"JSON support disabled"); }
49 template <
typename T> T
get()
const {
return T(); }
50 template <
typename T> T
value(
const std::string&,
const T& def)
const {
return def; }
53 bool contains(
const std::string&)
const {
return false; }
61 size_t size()
const {
return 0; }
62 bool empty()
const {
return true; }
69 std::string
key()
const {
return ""; }
91 std::string
dump(
int = -1,
char =
' ',
bool =
false,
int = 0)
const {
return "{}"; }
96 const char*
what() const noexcept
override {
return "JSON error"; }
const char * what() const noexcept override
Json(const std::string &)
const Json & operator[](size_t) const
static Json parse(const std::string &)
const Json & operator[](const std::string &) const
Json & operator[](size_t)
Json & operator[](const std::string &)
const_iterator end() const
std::string dump(int=-1, char=' ', bool=false, int=0) const
const Json & operator[](int) const
bool contains(const std::string &) const
T value(const std::string &, const T &def) const
Json & operator=(const T &)
bool is_discarded() const
const_iterator begin() const
const Json & operator*() const
bool operator!=(const const_iterator &) const
bool operator!=(const iterator &) const