|
Fawkes API
Fawkes Development Version
|
Fact representation for JSON transfer. More...
#include <Fact.h>
Public Member Functions | |
| Fact () | |
| Constructor. More... | |
| Fact (const std::string &json) | |
| Constructor from JSON. More... | |
| Fact (const rapidjson::Value &v) | |
| Constructor from JSON. More... | |
| virtual | ~Fact () |
| 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< int64_t > | index () const |
| Get index value. More... | |
| void | set_index (const int64_t &index) |
| Set index value. More... | |
| std::optional< std::string > | template_name () const |
| Get template_name value. More... | |
| void | set_template_name (const std::string &template_name) |
| Set template_name value. More... | |
| std::optional< std::string > | formatted () const |
| Get formatted value. More... | |
| void | set_formatted (const std::string &formatted) |
| Set formatted value. More... | |
| std::vector< std::shared_ptr< SlotValue > > | slots () const |
| Get slots value. More... | |
| void | set_slots (const std::vector< std::shared_ptr< SlotValue >> &slots) |
| Set slots value. More... | |
| void | addto_slots (const std::shared_ptr< SlotValue > &&slots) |
| Add element to slots array. More... | |
| void | addto_slots (const std::shared_ptr< SlotValue > &slots) |
| Add element to slots array. More... | |
| void | addto_slots (const SlotValue &&slots) |
| Add element to slots array. More... | |
Static Public Member Functions | |
| static std::string | api_version () |
| Get version of implemented API. More... | |
| Fact::Fact | ( | const std::string & | json | ) |
Constructor from JSON.
| json | JSON string to initialize from |
Definition at line 27 of file Fact.cpp.
References from_json().
| Fact::Fact | ( | const rapidjson::Value & | v | ) |
Constructor from JSON.
| v | RapidJSON value object to initialize from. |
Definition at line 32 of file Fact.cpp.
References from_json_value().
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inline |
Get apiVersion value.
Definition at line 111 of file Fact.h.
Referenced by set_apiVersion().
|
inline |
Get formatted value.
Definition at line 162 of file Fact.h.
Referenced by set_formatted().
|
virtual |
Retrieve data from JSON string.
| json | JSON representation suitable for this object. Will allow partial assignment and not validate automaticaly. |
Definition at line 104 of file Fact.cpp.
References from_json_value().
Referenced by Fact().
|
virtual |
Retrieve data from JSON string.
| v | RapidJSON value suitable for this object. Will allow partial assignment and not validate automaticaly. |
Definition at line 113 of file Fact.cpp.
References SlotValue::from_json_value().
Referenced by Fact(), and from_json().
|
inline |
Get index value.
Definition at line 128 of file Fact.h.
Referenced by set_index().
|
inline |
|
inline |
Set apiVersion value.
| apiVersion | new value |
Definition at line 120 of file Fact.h.
References apiVersion().
|
inline |
Set formatted value.
| formatted | new value |
Definition at line 171 of file Fact.h.
References formatted().
|
inline |
|
inline |
|
inline |
|
inline |
Set template_name value.
| template_name | new value |
Definition at line 154 of file Fact.h.
References template_name().
|
inline |
Get slots value.
Definition at line 179 of file Fact.h.
Referenced by addto_slots(), and set_slots().
|
inline |
Get template_name value.
Definition at line 145 of file Fact.h.
Referenced by set_template_name().
|
virtual |
Render object to JSON.
| pretty | true to enable pretty printing (readable spacing) |
Definition at line 42 of file Fact.cpp.
References to_json_value().
|
virtual |
|
virtual |
Validate if all required fields have been set.
| subcall | true if this is called from another class, e.g., a sub-class or array holder. Will modify the kind of exception thrown. |
| std::vector<std::string> | thrown if required information is missing and subcall is set to true. Contains a list of missing fields. |
| std::runtime_error | informative message describing the missing fields |