OpenAB  1.0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
OpenAB_Plugin::GenericParameters Class Reference

Generic storage for plugin parameters. Allows to store map of parameters with different types (OpenAB::Variant). Additionally allow for serialization and deserialization to/from JSON format. More...

#include <GenericParameters.hpp>

Inheritance diagram for OpenAB_Plugin::GenericParameters:
Collaboration diagram for OpenAB_Plugin::GenericParameters:

Public Member Functions

 GenericParameters ()
 Default constructor. More...
 
 GenericParameters (const std::string &json)
 Deserializes parameters from JSON sting. More...
 
virtual ~GenericParameters ()
 Destructor, virtual by default. More...
 
std::string toJSON () const
 Serializes parameters to JSON string. More...
 
bool fromJSON (const std::string &json)
 Deserializes parameters from JSON string. More...
 
OpenAB::Variant getValue (const std::string &key) const
 Returns value assigned to given key. More...
 
void setValue (const std::string &key, const OpenAB::Variant &value)
 Assigns or updates value to/of given key. More...
 
void removeKey (const std::string &key)
 Removes key and its assigned value. More...
 
std::vector< std::string > getAllKeys () const
 Returns list of all keys. list of all keys. More...
 
- Public Member Functions inherited from OpenAB_Plugin::Parameters
 Parameters ()
 
virtual ~Parameters ()
 

Detailed Description

Generic storage for plugin parameters. Allows to store map of parameters with different types (OpenAB::Variant). Additionally allow for serialization and deserialization to/from JSON format.

Constructor & Destructor Documentation

OpenAB_Plugin::GenericParameters::GenericParameters ( )

Default constructor.

OpenAB_Plugin::GenericParameters::GenericParameters ( const std::string &  json)

Deserializes parameters from JSON sting.

Parameters
[in]jsonJSON string to deserialize from.
OpenAB_Plugin::GenericParameters::~GenericParameters ( )
virtual

Destructor, virtual by default.

Member Function Documentation

bool OpenAB_Plugin::GenericParameters::fromJSON ( const std::string &  json)
virtual

Deserializes parameters from JSON string.

Note
all previous contents of parameters will be removed.
Parameters
[in]jsonJSON string to deserialize from.
Returns
true if deserialization was successful, false otherwise.

Implements OpenAB_Plugin::Parameters.

std::vector< std::string > OpenAB_Plugin::GenericParameters::getAllKeys ( ) const

Returns list of all keys. list of all keys.

OpenAB::Variant OpenAB_Plugin::GenericParameters::getValue ( const std::string &  key) const

Returns value assigned to given key.

Parameters
[in]keykey to lookup
Returns
value assigned to key, or invalid OpenAB::Variant (OpenAB::Variant::invalid) if provided key does not exist.
void OpenAB_Plugin::GenericParameters::removeKey ( const std::string &  key)

Removes key and its assigned value.

Parameters
[in]keykey to remove
void OpenAB_Plugin::GenericParameters::setValue ( const std::string &  key,
const OpenAB::Variant value 
)

Assigns or updates value to/of given key.

Parameters
[in]keykey to create/modify
[in]valuenew value
std::string OpenAB_Plugin::GenericParameters::toJSON ( ) const
virtual

Serializes parameters to JSON string.

Returns
JSON string if serialization was successful or empty string otherwise.

Implements OpenAB_Plugin::Parameters.


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