Fawkes API Fawkes Development Version
Plugin Class Reference

Plugin representation for JSON transfer. More...

#include <Plugin.h>

Public Member Functions

 Plugin ()
 Constructor. More...
 
 Plugin (const std::string &json)
 Constructor from JSON. More...
 
 Plugin (const rapidjson::Value &v)
 Constructor from JSON. More...
 
virtual ~Plugin ()
 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::optional< std::string > description () const
 Get description value. More...
 
void set_description (const std::string &description)
 Set description value. More...
 
std::optional< bool > is_meta () const
 Get is_meta value. More...
 
void set_is_meta (const bool &is_meta)
 Set is_meta value. More...
 
std::vector< std::string > meta_children () const
 Get meta_children value. More...
 
void set_meta_children (const std::vector< std::string > &meta_children)
 Set meta_children value. More...
 
void addto_meta_children (const std::string &&meta_children)
 Add element to meta_children array. More...
 
void addto_meta_children (const std::string &meta_children)
 Add element to meta_children array. More...
 
std::optional< bool > is_loaded () const
 Get is_loaded value. More...
 
void set_is_loaded (const bool &is_loaded)
 Set is_loaded value. More...
 

Static Public Member Functions

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

Detailed Description

Plugin representation for JSON transfer.

Definition at line 26 of file Plugin.h.

Constructor & Destructor Documentation

◆ Plugin() [1/3]

Plugin::Plugin ( )

Constructor.

Definition at line 23 of file Plugin.cpp.

◆ Plugin() [2/3]

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

Constructor from JSON.

Parameters
jsonJSON string to initialize from

Definition at line 27 of file Plugin.cpp.

References from_json().

◆ Plugin() [3/3]

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

Constructor from JSON.

Parameters
vRapidJSON value object to initialize from.

Definition at line 32 of file Plugin.cpp.

References from_json_value().

◆ ~Plugin()

Plugin::~Plugin ( )
virtual

Destructor.

Definition at line 37 of file Plugin.cpp.

Member Function Documentation

◆ addto_meta_children() [1/2]

void Plugin::addto_meta_children ( const std::string &&  meta_children)
inline

Add element to meta_children array.

Parameters
meta_childrennew value

Definition at line 194 of file Plugin.h.

References meta_children().

◆ addto_meta_children() [2/2]

void Plugin::addto_meta_children ( const std::string &  meta_children)
inline

Add element to meta_children array.

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

Parameters
meta_childrennew value

Definition at line 204 of file Plugin.h.

References meta_children().

◆ api_version()

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

Get version of implemented API.

Returns
string representation of version

Definition at line 48 of file Plugin.h.

◆ apiVersion()

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

Get apiVersion value.

Returns
apiVersion value

Definition at line 109 of file Plugin.h.

Referenced by set_apiVersion().

◆ description()

std::optional< std::string > Plugin::description ( ) const
inline

Get description value.

Returns
description value

Definition at line 143 of file Plugin.h.

Referenced by set_description().

◆ from_json()

void Plugin::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 109 of file Plugin.cpp.

References from_json_value().

Referenced by Plugin().

◆ from_json_value()

void Plugin::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 118 of file Plugin.cpp.

Referenced by from_json(), and Plugin().

◆ is_loaded()

std::optional< bool > Plugin::is_loaded ( ) const
inline

Get is_loaded value.

Returns
is_loaded value

Definition at line 212 of file Plugin.h.

Referenced by set_is_loaded().

◆ is_meta()

std::optional< bool > Plugin::is_meta ( ) const
inline

Get is_meta value.

Returns
is_meta value

Definition at line 160 of file Plugin.h.

Referenced by set_is_meta().

◆ kind()

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

Get kind value.

Returns
kind value

Definition at line 92 of file Plugin.h.

Referenced by set_kind().

◆ meta_children()

std::vector< std::string > Plugin::meta_children ( ) const
inline

Get meta_children value.

Returns
meta_children value

Definition at line 177 of file Plugin.h.

Referenced by addto_meta_children(), and set_meta_children().

◆ name()

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

Get name value.

Returns
name value

Definition at line 126 of file Plugin.h.

Referenced by set_name().

◆ set_apiVersion()

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

Set apiVersion value.

Parameters
apiVersionnew value

Definition at line 118 of file Plugin.h.

References apiVersion().

◆ set_description()

void Plugin::set_description ( const std::string &  description)
inline

Set description value.

Parameters
descriptionnew value

Definition at line 152 of file Plugin.h.

References description().

◆ set_is_loaded()

void Plugin::set_is_loaded ( const bool &  is_loaded)
inline

Set is_loaded value.

Parameters
is_loadednew value

Definition at line 221 of file Plugin.h.

References is_loaded().

◆ set_is_meta()

void Plugin::set_is_meta ( const bool &  is_meta)
inline

Set is_meta value.

Parameters
is_metanew value

Definition at line 169 of file Plugin.h.

References is_meta().

◆ set_kind()

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

Set kind value.

Parameters
kindnew value

Definition at line 101 of file Plugin.h.

References kind().

◆ set_meta_children()

void Plugin::set_meta_children ( const std::vector< std::string > &  meta_children)
inline

Set meta_children value.

Parameters
meta_childrennew value

Definition at line 186 of file Plugin.h.

References meta_children().

◆ set_name()

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

Set name value.

Parameters
namenew value

Definition at line 135 of file Plugin.h.

References name().

◆ to_json()

std::string Plugin::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 42 of file Plugin.cpp.

References to_json_value().

◆ to_json_value()

void Plugin::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 61 of file Plugin.cpp.

Referenced by to_json().

◆ validate()

void Plugin::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 150 of file Plugin.cpp.


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