ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
ConfigurationPlugin Class Referenceabstract

Description:

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>

Inheritance diagram for ConfigurationPlugin:
[legend]
Collaboration diagram for ConfigurationPlugin:
[legend]

Public Method Index:

virtual ~ConfigurationPlugin ()
 Virtual Destructor.
 
virtual ALIB_API bool Get (const String &name, AString &target)=0
 
virtual const StringEscaperGetEscaper () 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.
 

Field Details:

◆ stringEscaper

StringEscaperStandard stringEscaper
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.

Constructor(s) / Destructor Details:

◆ ConfigurationPlugin()

ConfigurationPlugin ( Priority pPriority)
inlineprotected

Constructor which is protected, as this is an abstract class.

Parameters
pPriorityThe priority that this plug-in uses.

Definition at line 51 of file config/plugins.hpp.

◆ ~ConfigurationPlugin()

virtual ~ConfigurationPlugin ( )
inlinevirtual

Virtual Destructor.

Definition at line 56 of file config/plugins.hpp.

Method Details:

◆ Get()

virtual ALIB_API bool Get ( const String & name,
AString & target )
pure virtual

Abstract method that has to be overwritten by descendants. Searches and retrieves the value of a configuration variable.

Parameters
nameThe name of the variable to retrieve.
[out]targetA reference to the buffer to write the variable's exported value to.
Returns
true if variable was found within this configuration source, false if not.

Implemented in CLIVariablesPlugin, and EnvironmentVariablesPlugin.

◆ GetEscaper()

virtual const StringEscaper & GetEscaper ( ) const
inlinevirtual

Derived types may return a different, customized implementation specific to their needs. This default implementation returns field stringEscaper.

Returns
An escaper used to convert string values from and to escaped sequences as provided by a configuration source that is based on serialization of variable values to and from ASCII/unicode strings which are human-readable and placeable in text files, command line parameters, etc.

Definition at line 64 of file config/plugins.hpp.

◆ Name()

virtual String Name ( ) const
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.

Returns
The name of the plug-in.

Implemented in CLIVariablesPlugin, and EnvironmentVariablesPlugin.


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