ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::config Namespace Reference

Description:

This is the namespace ofALib Module, which implements access, evaluation and writing of configuration variables. Variable data can be load from different sources, for example configuration files, command line parameters, environment variables, or any custom storage type.

Please consult ALib Module Config - Programmer's Manual for further information.

Type Index:

struct  Bool
 
class  CLIVariablesPlugin
 
class  ConfigCamp
 
class  ConfigResourcePool
 
class  Configuration
 
struct  ConfigurationListener
 
class  ConfigurationPlugin
 
class  Declaration
 
class  EnvironmentVariablesPlugin
 
struct  ERPriority
 ALib Enum Record associated with enumeration Priority. More...
 
class  IniFile
 
class  IniFileFeeder
 
class  TSharedConfiguration
 
class  Variable
 
struct  VMeta
 

Type Definition Index:

using StringVectorComma = alib::StringVectorPA
 
using StringVectorSemicolon = alib::StringVectorPA
 

Enumeration Index:

enum class  Exceptions { ErrorOpeningFile = 1 , ErrorWritingFile = 2 }
 Exception codes of namespace alib::config. More...
 
enum class  Priority : uint16_t {
  NONE = 0 , AutoDetected = 1000 , DefaultValues = 2000 , Standard = 4000 ,
  ConfigFile = 6000 , Environment = 8000 , SessionFile = 10000 , CLI = 12000 ,
  Session = 14000 , Protected = (std::numeric_limits<uint16_t>::max)()
}
 

Type Definition Details:

◆ StringVectorComma

Type definition used with configuration variables of type "SV,", which stores a string array, imported by parsing a comma-separated string list.

Attention
When exported, NEW_LINE codes are added after each comma. This allows external configuration systems to smoothly format longer lists of values. However, the new line codes usually have to be detected with writing and eliminated on import. Built-in type IniFile processes such codes correctly.

Definition at line 249 of file vmeta.hpp.

◆ StringVectorSemicolon

Type definition used with configuration variables of type "SV;", which stores a string array, imported by parsing a string list separated by character ';'.

Attention
When exported, NEW_LINE codes are added after each semicolon. This allows external configuration systems to smoothly format longer lists of values. However, the new line codes usually have to be detected with writing and eliminated on import. Built-in type IniFile processes such codes correctly.

Definition at line 259 of file vmeta.hpp.

Enumeration Details:

◆ Exceptions

enum class Exceptions
strong

Exception codes of namespace alib::config.

Enumerator
ErrorOpeningFile 

File not found when reading.

ErrorWritingFile 

An error occurred writing the file .

Definition at line 23 of file configcamp.hpp.

◆ Priority

enum class Priority : uint16_t
strong

Arithmetical enumeration used to control write access to configuration variables, depending on the source of assignable values.

See also
Chapter 4.1 Variables and Priorities of the Programmer's Manual of camp ALib Configuration.
Enumerator
NONE 

This priority value denotes that a variable is undefined and has no value set. The underlying integral value is 0.

AutoDetected 

Constant providing a priority which is even lower than default. A use-case for this priority are for third party libraries that may preset variables in cases where values are estimated or detected instead of defaulted.
A using code of such library may then overwrite the auto-detection estimates, by setting a default value in the configuration.
This priority is not used internally (by any ALib camp) today.
The underlying integral value is 1,000.

DefaultValues 

Used to store default values, either from (resourced) declarations, hard-coded values, or values provided with method Configuration::PresetImportString. The underlying integral value is 2,000.

Standard 

This is the default priority when a variable is defined for setting a 'hard-coded' value. The underlying integral value is 4,000. Hard-coded values have a higher priority than default values, but are deemed to get overwritten by any other configuration source.

ConfigFile 

External application configuration sources use this element to define variables found. This element is also used with built-in class IniFileFeeder. The underlying integral value is 6,000.

Environment 

Used with plug-in EnvironmentVariablesPlugin. The underlying integral value is 8,000.

SessionFile 

Used to store temporary session information. Those are higher than Environment but lower than CLI. This session priority is only a proposal. Implementations might use a different value, even for different variables, for example Environment - 1 or CLI + 1 . It depends on the use case.
The underlying integral value is 10,000.

CLI 

Used with plug-in CLIVariablesPlugin. The underlying integral value is 12,000.

Session 

Used to store generate temporary session information. While usually changes made in source code has a low priority, session information is overwritten by running software, no matter from which external source an existing values came. If a software wants to disallow the change of session information imposed by a library or a different software part, still a value can be set to protected. The underlying integral value is 14,000.

Protected 

Used to define variables with protected values. If all code entities apply to the contract that this camp imposes in respect to variable definitions and priorities, a value set with this priority cannot be manipulated from "outside", hence by config files, command line arguments or any custom configuration source or plug-in.

The underlying integral value is std::numeric_limits<int>::max().

Definition at line 28 of file priority.hpp.