Webdar 1.0.0
Web user interface to libdar
Public Member Functions | Static Protected Member Functions | Static Protected Attributes | List of all members
jsoner Class Referenceabstract

class jsoner More...

#include <jsoner.hpp>

Inheritance diagram for jsoner:
Inheritance graph
[legend]

Public Member Functions

 jsoner (const jsoner &ref)=default
 
 jsoner (jsoner &&ref) noexcept(false)=default
 
jsoneroperator= (const jsoner &ref)=default
 
jsoneroperator= (jsoner &&ref) noexcept(false)=default
 
virtual void load_json (const json &source)=0
 setup the components from the json provided information More...
 
virtual json save_json () const =0
 produce a json structure from the component configuration More...
 
virtual void clear_json ()=0
 instruct the object to get to its default/initial configuration More...
 

Static Protected Member Functions

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 More...
 
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 More...
 

Static Protected Attributes

static constexpr const char * jsoner_version_label = "version"
 
static constexpr const char * jsoner_id_label = "class_id"
 
static constexpr const char * jsoner_config_label = "config"
 

Detailed Description

class jsoner

jsoner class is the base class of all others that are able to save their status and read their status from a json formated configuration.

Examples
/home/denis/Webdar/webdar/src/html_form_input_file.hpp.

Member Function Documentation

◆ clear_json()

virtual void jsoner::clear_json ( )
pure virtual

◆ load_json()

virtual void jsoner::load_json ( const json &  source)
pure virtual

◆ save_json()

virtual json jsoner::save_json ( ) const
pure virtual

◆ unwrap_config_from_json_header()

json jsoner::unwrap_config_from_json_header ( const json &  source,
unsigned int &  version,
std::string &  class_id 
)
staticprotected

from a given json global and common json structure split header parts and return the config part

Parameters
[in]sourcethe global json configuration to apply to the current object
[in]versionthe format and expected fields of the returned json configuration
[in]class_idshould match the name of the class this static method is used by
Returns
inherited class specific data to apply to the current object following the format version 'version'
Note
may throw exception upon format error regarding expected json fields.

◆ wrap_config_with_json_header()

json jsoner::wrap_config_with_json_header ( unsigned int  version,
const std::string &  class_id,
const json &  config 
)
staticprotected

given a version, class_id and configuration generates the global and common json structure

Parameters
[in]versiondefine the expected field and structure of the config json parameter
[in]class_idis expected to be the class name that implements the jsoner interface
[in]configthis is the resulting current configuration as a json object to be wrapped wil version and class_id.

The documentation for this class was generated from the following files: