7#include <boost/json.hpp>
11 namespace json = boost::json;
49 operator json::value()
const;
70 int get_int(
const std::string &key)
const;
103 double get_double(
const std::string &key,
const double def)
const;
112 int get_int(
const std::string &key,
const int def)
const;
130 std::string
get_string(
const std::string &key,
const std::string &def)
const;
139 bool get_bool(
const std::string &key,
const bool def)
const;
189 void pretty_print(std::ostream &os, json::value
const &v, std::string *indent =
nullptr)
const;
A wrapper around the boost json value class.
Definition json.hh:19
std::string get_string(const std::string &key, const std::string &def) const
Get the value of a key in the json object, with a default value.
bool operator==(const JSONValue &other) const
Equality operator. Checks all values in the json object to be equal.
JSONValue(const std::string filename)
Construct a new JSONValue object from a json file.
JSONValue()
Construct an empty JSONValue object.
void set_double(const std::string &key, double value)
Set the value of a key in the json object.
void print(std::ostream &os) const
Pretty-print the json value to a stream.
void set_bool(const std::string &key, bool value)
Set the value of a key in the json object.
void set_string(const std::string &key, const std::string &value)
Set the value of a key in the json object.
void set_int(const std::string &key, int value)
Set the value of a key in the json object.
int get_int(const std::string &key, const int def) const
Get the value of a key in the json object, with a default value.
json::value & operator()()
The call operator gives access to the wrapped json value.
json::value value
Definition json.hh:187
void pretty_print(std::ostream &os, json::value const &v, std::string *indent=nullptr) const
double get_double(const std::string &key) const
Get the value of a key in the json object.
std::string get_string(const std::string &key) const
Get the value of a key in the json object.
bool get_bool(const std::string &key) const
Get the value of a key in the json object.
bool get_bool(const std::string &key, const bool def) const
Get the value of a key in the json object, with a default value.
int get_int(const std::string &key) const
Get the value of a key in the json object.
uint get_uint(const std::string &key, const uint def) const
Get the value of a key in the json object, with a default value.
uint get_uint(const std::string &key) const
Get the value of a key in the json object.
void set_uint(const std::string &key, uint value)
Set the value of a key in the json object.
double get_double(const std::string &key, const double def) const
Get the value of a key in the json object, with a default value.
JSONValue(const json::value &v)
Construct a new JSONValue object.
Definition complex_math.hh:14
unsigned int uint
Definition utils.hh:22