35#include <dar/libdar.hpp>
38#if HAVE_NLOHMANN_JSON_HPP
39#include <nlohmann/json.hpp>
43#include "exceptions.hpp"
47using json = nlohmann::json;
58 exception_json(
const std::string & context,
const json::exception & e):
62 virtual exception_base *clone()
const override {
return cloner<exception_json>((
void *)
this); };
79 jsoner & operator = (
jsoner && ref)
noexcept(
false) =
default;
113 const std::string & class_id,
114 const json & config);
125 unsigned int & version,
126 std::string & class_id);
128 static constexpr const char* jsoner_version_label =
"version";
129 static constexpr const char* jsoner_id_label =
"class_id";
130 static constexpr const char* jsoner_config_label =
"config";
pure virtual class parent of all webdar exceptions
Definition: exceptions.hpp:47
class exception_json
Definition: jsoner.hpp:55
class jsoner
Definition: jsoner.hpp:73
virtual void load_json(const json &source)=0
setup the components from the json provided information
virtual json save_json() const =0
produce a json structure from the component configuration
static json unwrap_config_from_json_header(const json &source, unsigned int &version, std::string &class_id)
from a given json global and common json structure split header parts and return the config part
Definition: jsoner.cpp:63
static json wrap_config_with_json_header(unsigned int version, const std::string &class_id, const json &config)
given a version, class_id and configuration generates the global and common json structure
Definition: jsoner.cpp:43
virtual void clear_json()=0
instruct the object to get to its default/initial configuration