Fawkes API
Fawkes Development Version
|
InterfaceFieldType representation for JSON transfer. More...
#include <InterfaceFieldType.h>
Public Member Functions | |
InterfaceFieldType () | |
Constructor. More... | |
InterfaceFieldType (const std::string &json) | |
Constructor from JSON. More... | |
InterfaceFieldType (const rapidjson::Value &v) | |
Constructor from JSON. More... | |
virtual | ~InterfaceFieldType () |
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 > | name () const |
Get name value. More... | |
void | set_name (const std::string &name) |
Set name value. More... | |
std::optional< std::string > | type () const |
Get type value. More... | |
void | set_type (const std::string &type) |
Set type value. More... | |
std::optional< bool > | is_array () const |
Get is_array value. More... | |
void | set_is_array (const bool &is_array) |
Set is_array value. More... | |
std::vector< std::string > | enums () const |
possible enum values for this field More... | |
void | set_enums (const std::vector< std::string > &enums) |
Set enums value. More... | |
void | addto_enums (const std::string &&enums) |
Add element to enums array. More... | |
void | addto_enums (const std::string &enums) |
Add element to enums array. More... | |
Static Public Member Functions | |
static std::string | api_version () |
Get version of implemented API. More... | |
InterfaceFieldType representation for JSON transfer.
Definition at line 26 of file InterfaceFieldType.h.
InterfaceFieldType::InterfaceFieldType | ( | ) |
Constructor.
Definition at line 23 of file InterfaceFieldType.cpp.
InterfaceFieldType::InterfaceFieldType | ( | const std::string & | json | ) |
Constructor from JSON.
json | JSON string to initialize from |
Definition at line 27 of file InterfaceFieldType.cpp.
References from_json().
InterfaceFieldType::InterfaceFieldType | ( | const rapidjson::Value & | v | ) |
Constructor from JSON.
v | RapidJSON value object to initialize from. |
Definition at line 32 of file InterfaceFieldType.cpp.
References from_json_value().
|
virtual |
Destructor.
Definition at line 37 of file InterfaceFieldType.cpp.
|
inline |
Add element to enums array.
enums | new value |
Definition at line 160 of file InterfaceFieldType.h.
References enums().
|
inline |
Add element to enums array.
The move-semantics version (std::move) should be preferred.
enums | new value |
Definition at line 170 of file InterfaceFieldType.h.
References enums().
|
inlinestatic |
Get version of implemented API.
Definition at line 48 of file InterfaceFieldType.h.
|
inline |
possible enum values for this field
Definition at line 143 of file InterfaceFieldType.h.
Referenced by addto_enums(), and set_enums().
|
virtual |
Retrieve data from JSON string.
json | JSON representation suitable for this object. Will allow partial assignment and not validate automaticaly. |
Definition at line 94 of file InterfaceFieldType.cpp.
References from_json_value().
Referenced by InterfaceFieldType().
|
virtual |
Retrieve data from JSON string.
v | RapidJSON value suitable for this object. Will allow partial assignment and not validate automaticaly. |
Definition at line 103 of file InterfaceFieldType.cpp.
Referenced by from_json(), InterfaceMessageType::from_json_value(), InterfaceInfo::from_json_value(), and InterfaceFieldType().
|
inline |
Get is_array value.
Definition at line 126 of file InterfaceFieldType.h.
Referenced by set_is_array().
|
inline |
Get name value.
Definition at line 92 of file InterfaceFieldType.h.
Referenced by set_name().
|
inline |
Set enums value.
enums | new value |
Definition at line 152 of file InterfaceFieldType.h.
References enums().
|
inline |
Set is_array value.
is_array | new value |
Definition at line 135 of file InterfaceFieldType.h.
References is_array().
|
inline |
Set name value.
name | new value |
Definition at line 101 of file InterfaceFieldType.h.
References name().
|
inline |
Set type value.
type | new value |
Definition at line 118 of file InterfaceFieldType.h.
References type().
|
virtual |
Render object to JSON.
pretty | true to enable pretty printing (readable spacing) |
Definition at line 42 of file InterfaceFieldType.cpp.
References to_json_value().
|
virtual |
Render object to JSON.
d | RapidJSON document to retrieve allocator from |
v | RapidJSON value to add data to |
Definition at line 61 of file InterfaceFieldType.cpp.
Referenced by to_json().
|
inline |
Get type value.
Definition at line 109 of file InterfaceFieldType.h.
Referenced by set_type().
|
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 |
Definition at line 126 of file InterfaceFieldType.cpp.