Abstract class that defines the plug-in interface for class Configuration. Plug-ins provide configuration data (variables) from external configuration data sources at the moment those are requested.
The rationale for this concept is that some external configuration sources may provide a lot of data that is not related to an application. This is for example true for for environment variables, the windows registry or the Gnome variable systems gconf/dconf. In these cases, variables have to be read into the ALib configuration system only at the moment they are declared.
With other sources, like dedicated INI-files, a different technique is usually preferred: Here, all data is read and imported into the configuration system with an application's bootstrap and variables (respectively whole subtrees of variables) may be exported when an application exits, just to populate empty INI-files with default values or to add new variables which occur with a new software version.
Category and Variable names are character case insensitive for the plug-ins predefined with ALib. It is up to a custom implementation to decide to ignore character case in custom specializations of this class as well.
Definition at line 42 of file config/plugins.hpp.
#include <plugins.hpp>
Public Method Index: | |
virtual | ~ConfigurationPlugin () |
Virtual Destructor. | |
virtual ALIB_API bool | Get (const String &name, AString &target)=0 |
virtual const StringEscaper & | GetEscaper () const |
virtual String | Name () const =0 |
Public Method Index: inherited from Plugin< Configuration, Priority > | |
PrioritiesType | GetPriority () const |
Protected Field Index: | |
StringEscaperStandard | stringEscaper |
Protected Field Index: inherited from Plugin< Configuration, Priority > | |
PrioritiesType | priority |
The priority of this plug-in. | |
Protected Method Index: | |
ConfigurationPlugin (Priority pPriority) | |
Protected Method Index: inherited from Plugin< Configuration, Priority > | |
Plugin (PrioritiesType pPriority) | |
Additional Inherited Members | |
Public Type Index: inherited from Plugin< Configuration, Priority > | |
using | PluginType |
This exposes the template parameter TPlugin to the outer world. | |
using | PrioritiesType |
This exposes the template parameter pTPlugin to the outer world. | |
|
protected |
A default string escaper instance. This is used with all plugins provided with ALib. (Namely CLIVariablesPlugin and EnvironmentVariablesPlugin.)
Definition at line 47 of file config/plugins.hpp.
|
inlineprotected |
Constructor which is protected, as this is an abstract class.
pPriority | The priority that this plug-in uses. |
Definition at line 51 of file config/plugins.hpp.
|
inlinevirtual |
Virtual Destructor.
Definition at line 56 of file config/plugins.hpp.
Abstract method that has to be overwritten by descendants. Searches and retrieves the value of a configuration variable.
name | The name of the variable to retrieve. | |
[out] | target | A reference to the buffer to write the variable's exported value to. |
true
if variable was found within this configuration source, false
if not. Implemented in CLIVariablesPlugin, and EnvironmentVariablesPlugin.
|
inlinevirtual |
Derived types may return a different, customized implementation specific to their needs. This default implementation returns field stringEscaper.
Definition at line 64 of file config/plugins.hpp.
|
pure virtual |
Abstract method. Descendents need to return a plug-in name. The name may be used in human readable output, e.g., log-files or exception messages to tell a user for example, which plug-in loaded a variable containing a syntax error.
Implemented in CLIVariablesPlugin, and EnvironmentVariablesPlugin.