Elektra  0.9.5
Public Member Functions | List of all members
kdb::tools::PluginSpec Class Reference

Specifies a plugin by its name and configuration. More...

#include <pluginspec.hpp>

Public Member Functions

 PluginSpec (std::string pluginName, KeySet pluginConfig=KeySet())
 Construct a plugin spec with a given module name. More...
 
 PluginSpec (std::string pluginName, std::string refName, KeySet pluginConfig=KeySet())
 Construct a plugin spec with a given module and ref name. More...
 
 PluginSpec (std::string pluginName, size_t refNumber, KeySet pluginConfig=KeySet())
 Construct a plugin spec with a given module name and ref number. More...
 
std::string getFullName () const
 
std::string getRefName () const
 
bool isRefNumber () const
 Checks if reference name contains only numbers. More...
 
std::string getName () const
 
KeySet getConfig () const
 
void setFullName (std::string const &name)
 Set the full name with # or only the name. More...
 
void setRefName (std::string const &name)
 Set the reference name of the plugin. More...
 
void setRefNumber (size_t number)
 Set a number for automatic references during parsing. More...
 
void setName (std::string const &name)
 Set the module name of the plugin. More...
 
void appendConfig (KeySet config)
 Append to config. More...
 
void setConfig (KeySet config)
 Set plugin config. More...
 
void validate (std::string const &str) const
 Check if str starts with a-z and then only has chars a-z, 0-9 or underscore (_) More...
 

Detailed Description

Specifies a plugin by its name and configuration.

Invariant
name is valid (nonempty, starts with a-z, then a-z_0-9)
refname is valid (same as above or a size_t number)

Constructor & Destructor Documentation

◆ PluginSpec() [1/3]

kdb::tools::PluginSpec::PluginSpec ( std::string  pluginName,
KeySet  pluginConfig = KeySet () 
)
explicit

Construct a plugin spec with a given module name.

Parameters
pluginNamethe fullname (modulename # refname)
pluginConfigthe plugins config
Exceptions
BadPluginNameif name not a-z
See also
setFullName()

◆ PluginSpec() [2/3]

kdb::tools::PluginSpec::PluginSpec ( std::string  pluginName,
std::string  refName,
KeySet  pluginConfig = KeySet () 
)
explicit

Construct a plugin spec with a given module and ref name.

Parameters
pluginNamethe module this plugin is instantiated from
refNamefor uniqueness for more plugins from one module
pluginConfigthe plugins config
Exceptions
BadPluginNameif name not a-z
See also
setName()
setRefName()

◆ PluginSpec() [3/3]

kdb::tools::PluginSpec::PluginSpec ( std::string  pluginName,
size_t  refNumber,
KeySet  pluginConfig = KeySet () 
)
explicit

Construct a plugin spec with a given module name and ref number.

Parameters
pluginNamethe module this plugin is instantiated from
refNumberfor uniqueness for more plugins from one module
pluginConfigthe plugins config
Exceptions
BadPluginNameif name not a-z
See also
setName()
setRefName()

Member Function Documentation

◆ appendConfig()

void kdb::tools::PluginSpec::appendConfig ( KeySet  c)

Append to config.

Parameters
cconfig to append

◆ getConfig()

KeySet kdb::tools::PluginSpec::getConfig ( ) const
Returns
the config

◆ getFullName()

std::string kdb::tools::PluginSpec::getFullName ( ) const
Note
if no reference name is given its equal to the module name
Returns
the module name, then #, and then the reference name

◆ getName()

std::string kdb::tools::PluginSpec::getName ( ) const
Returns
the module name

◆ getRefName()

std::string kdb::tools::PluginSpec::getRefName ( ) const
Returns
the reference name

◆ isRefNumber()

bool kdb::tools::PluginSpec::isRefNumber ( ) const

Checks if reference name contains only numbers.

Return values
trueif only numbers
trueif a refname was given

◆ setConfig()

void kdb::tools::PluginSpec::setConfig ( KeySet  c)

Set plugin config.

Parameters
cnew config to be used as plugin config

◆ setFullName()

void kdb::tools::PluginSpec::setFullName ( std::string const &  n)

Set the full name with # or only the name.

Exceptions
BadPluginNameif name not a-z (no change then)
Parameters
nthe string to set

◆ setName()

void kdb::tools::PluginSpec::setName ( std::string const &  n)

Set the module name of the plugin.

Exceptions
BadPluginNameif name not a-z (no change then)
Parameters
nthe string to set

◆ setRefName()

void kdb::tools::PluginSpec::setRefName ( std::string const &  n)

Set the reference name of the plugin.

Exceptions
BadPluginNameif name not a-z (no change then)

Makes different plugins based from the same module unique.

Parameters
nthe string to set

◆ setRefNumber()

void kdb::tools::PluginSpec::setRefNumber ( size_t  refnumber)

Set a number for automatic references during parsing.

Parameters
refnumberthe number to set

◆ validate()

void kdb::tools::PluginSpec::validate ( std::string const &  n) const

Check if str starts with a-z and then only has chars a-z, 0-9 or underscore (_)

Parameters
nthe string to check

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