Fawkes API  Fawkes Development Version
DomainFact Class Reference

DomainFact representation for JSON transfer. More...

#include <DomainFact.h>

Public Member Functions

 DomainFact ()
 Constructor. More...
 
 DomainFact (const std::string &json)
 Constructor from JSON. More...
 
 DomainFact (const rapidjson::Value &v)
 Constructor from JSON. More...
 
virtual ~DomainFact ()
 Destructor. More...
 
virtual std::string to_json (bool pretty=false) const
 Render object to JSON. More...
 
virtual void to_json_value (rapidjson::Document &d, rapidjson::Value &v) const
 Render object to JSON. More...
 
virtual void from_json (const std::string &json)
 Retrieve data from JSON string. More...
 
virtual void from_json_value (const rapidjson::Value &v)
 Retrieve data from JSON string. More...
 
virtual void validate (bool subcall=false) const
 Validate if all required fields have been set. More...
 
std::optional< std::string > kind () const
 Get kind value. More...
 
void set_kind (const std::string &kind)
 Set kind value. More...
 
std::optional< std::string > apiVersion () const
 Get apiVersion value. More...
 
void set_apiVersion (const std::string &apiVersion)
 Set apiVersion value. More...
 
std::optional< std::string > name () const
 Get name value. More...
 
void set_name (const std::string &name)
 Set name value. More...
 
std::vector< std::string > param_values () const
 Get param-values value. More...
 
void set_param_values (const std::vector< std::string > &param_values)
 Set param-values value. More...
 
void addto_param_values (const std::string &&param_values)
 Add element to param-values array. More...
 
void addto_param_values (const std::string &param_values)
 Add element to param-values array. More...
 

Static Public Member Functions

static std::string api_version ()
 Get version of implemented API. More...
 

Detailed Description

DomainFact representation for JSON transfer.

Definition at line 25 of file DomainFact.h.

Constructor & Destructor Documentation

◆ DomainFact() [1/3]

DomainFact::DomainFact ( )

Constructor.

Definition at line 22 of file DomainFact.cpp.

◆ DomainFact() [2/3]

DomainFact::DomainFact ( const std::string &  json)

Constructor from JSON.

Parameters
jsonJSON string to initialize from

Definition at line 26 of file DomainFact.cpp.

References from_json().

◆ DomainFact() [3/3]

DomainFact::DomainFact ( const rapidjson::Value &  v)

Constructor from JSON.

Parameters
vRapidJSON value object to initialize from.

Definition at line 31 of file DomainFact.cpp.

References from_json_value().

◆ ~DomainFact()

DomainFact::~DomainFact ( )
virtual

Destructor.

Definition at line 36 of file DomainFact.cpp.

Member Function Documentation

◆ addto_param_values() [1/2]

void DomainFact::addto_param_values ( const std::string &&  param_values)
inline

Add element to param-values array.

Parameters
param_valuesnew value

Definition at line 159 of file DomainFact.h.

References param_values().

◆ addto_param_values() [2/2]

void DomainFact::addto_param_values ( const std::string &  param_values)
inline

Add element to param-values array.

The move-semantics version (std::move) should be preferred.

Parameters
param_valuesnew value

Definition at line 169 of file DomainFact.h.

References param_values().

◆ api_version()

static std::string DomainFact::api_version ( )
inlinestatic

Get version of implemented API.

Returns
string representation of version

Definition at line 47 of file DomainFact.h.

◆ apiVersion()

std::optional<std::string> DomainFact::apiVersion ( ) const
inline

Get apiVersion value.

Returns
apiVersion value

Definition at line 108 of file DomainFact.h.

Referenced by set_apiVersion().

◆ from_json()

void DomainFact::from_json ( const std::string &  json)
virtual

Retrieve data from JSON string.

Parameters
jsonJSON representation suitable for this object. Will allow partial assignment and not validate automaticaly.
See also
validate()

Definition at line 93 of file DomainFact.cpp.

References from_json_value().

Referenced by DomainFact().

◆ from_json_value()

void DomainFact::from_json_value ( const rapidjson::Value &  v)
virtual

Retrieve data from JSON string.

Parameters
vRapidJSON value suitable for this object. Will allow partial assignment and not validate automaticaly.
See also
validate()

Definition at line 102 of file DomainFact.cpp.

Referenced by DomainFact(), and from_json().

◆ kind()

std::optional<std::string> DomainFact::kind ( ) const
inline

Get kind value.

Returns
kind value

Definition at line 91 of file DomainFact.h.

Referenced by set_kind().

◆ name()

std::optional<std::string> DomainFact::name ( ) const
inline

Get name value.

Returns
name value

Definition at line 125 of file DomainFact.h.

Referenced by set_name().

◆ param_values()

std::vector<std::string> DomainFact::param_values ( ) const
inline

Get param-values value.

Returns
param-values value

Definition at line 142 of file DomainFact.h.

Referenced by addto_param_values(), and set_param_values().

◆ set_apiVersion()

void DomainFact::set_apiVersion ( const std::string &  apiVersion)
inline

Set apiVersion value.

Parameters
apiVersionnew value

Definition at line 117 of file DomainFact.h.

References apiVersion().

◆ set_kind()

void DomainFact::set_kind ( const std::string &  kind)
inline

Set kind value.

Parameters
kindnew value

Definition at line 100 of file DomainFact.h.

References kind().

◆ set_name()

void DomainFact::set_name ( const std::string &  name)
inline

Set name value.

Parameters
namenew value

Definition at line 134 of file DomainFact.h.

References name().

◆ set_param_values()

void DomainFact::set_param_values ( const std::vector< std::string > &  param_values)
inline

Set param-values value.

Parameters
param_valuesnew value

Definition at line 151 of file DomainFact.h.

References param_values().

◆ to_json()

std::string DomainFact::to_json ( bool  pretty = false) const
virtual

Render object to JSON.

Parameters
prettytrue to enable pretty printing (readable spacing)
Returns
JSON string

Definition at line 41 of file DomainFact.cpp.

References to_json_value().

◆ to_json_value()

void DomainFact::to_json_value ( rapidjson::Document &  d,
rapidjson::Value &  v 
) const
virtual

Render object to JSON.

Parameters
dRapidJSON document to retrieve allocator from
vRapidJSON value to add data to

Definition at line 60 of file DomainFact.cpp.

Referenced by to_json().

◆ validate()

void DomainFact::validate ( bool  subcall = false) const
virtual

Validate if all required fields have been set.

Parameters
subcalltrue if this is called from another class, e.g., a sub-class or array holder. Will modify the kind of exception thrown.
Exceptions
std::vector<std::string>thrown if required information is missing and subcall is set to true. Contains a list of missing fields.
std::runtime_errorinformative message describing the missing fields

Definition at line 125 of file DomainFact.cpp.


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