ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::variables::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 environment variables, the windows registry or the Gnome variable systems gconf/dconf. In these cases, variables have to be read into the ALib variable 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 149 of file configuration.inl.

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

Public Method Index:

virtual ~ConfigurationPlugin ()
 Virtual Destructor.
 
virtual ALIB_DLL bool Get (const String &name, AString &target)=0
 
virtual const StringEscaperGetEscaper () const
 
virtual String Name () const =0
 
- Public Method Index: inherited from alib::lang::Plugin< Configuration, Priority >
PrioritiesType GetPriority () const
 

Protected Field Index:

StringEscaperStandard stringEscaper
 
- Protected Field Index: inherited from alib::lang::Plugin< Configuration, Priority >
PrioritiesType priority
 The priority of this plug-in.
 

Protected Method Index:

 ConfigurationPlugin (Priority pPriority)
 
- Protected Method Index: inherited from alib::lang::Plugin< Configuration, Priority >
 Plugin (PrioritiesType pPriority)
 

Additional Inherited Members

- Public Type Index: inherited from alib::lang::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 alib::variables::ConfigurationPlugin::stringEscaper
protected

A default string escaper instance. This is used with all plugins provided with ALib. (Namely CLIVariablesPlugin and EnvironmentVariablesPlugin.)

Definition at line 154 of file configuration.inl.

Constructor(s) / Destructor Details:

◆ ConfigurationPlugin()

alib::variables::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 158 of file configuration.inl.

Here is the call graph for this function:

◆ ~ConfigurationPlugin()

virtual alib::variables::ConfigurationPlugin::~ConfigurationPlugin ( )
inlinevirtual

Virtual Destructor.

Definition at line 163 of file configuration.inl.

Method Details:

◆ Get()

virtual ALIB_DLL bool alib::variables::ConfigurationPlugin::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 alib::variables::CLIVariablesPlugin, and alib::variables::EnvironmentVariablesPlugin.

◆ GetEscaper()

virtual const StringEscaper & alib::variables::ConfigurationPlugin::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 171 of file configuration.inl.

◆ Name()

virtual String alib::variables::ConfigurationPlugin::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 alib::variables::CLIVariablesPlugin, and alib::variables::EnvironmentVariablesPlugin.


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