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

Description:

This class is the container for ALib variables.
The use of this type is documented with the Programmer's Manual of camp ALib Configuration.

Beside the interface that this class provides, publicly inherited interfaces of base types StringTree and PluginContainer are available for use.

See also
Note that a general configuration object is provided with ALib Camps. Usually one instance is shared between all ALib Camps. By customizing the bootstrap process, dedicated configuration instances for built-in or custom ALib Camps can be created.

Definition at line 165 of file configuration.hpp.

#include <configuration.hpp>

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

Inner Type Index:

struct  ListenerRecord
 Record used to manage registered listeners. More...
 
struct  ValueDescriptorRD
 Helper-struct used for implementing field replacementDeclarations. More...
 
struct  ValueDescriptorTypes
 Helper-struct used for implementing field types. More...
 

Public Field Index:

List< MonoAllocator, std::pair< Token, Token >, Recycling::None > BooleanTokens
 
StringEscaperStandard Escaper
 
alib::NumberFormat NumberFormat
 
PoolAllocator Pool
 
CString SubstitutionVariableDelimiters = A_CHAR(" $@,.;:\"\'+-*\\§%&()[]{}<>=?'`~#")
 
String SubstitutionVariableEnd = A_CHAR("}")
 
String SubstitutionVariableStart = A_CHAR("${")
 

Public Method Index:

ALIB_API Configuration (MonoAllocator &allocator, lang::CreateDefaults createDefaults=lang::CreateDefaults::Yes)
 
ALIB_API ~Configuration ()
 Destructor.
 
ALIB_API bool DeletePath (const String &path)
 
void MonitorDistinctVariable (lang::ContainerOp insertOrRemove, ConfigurationListener *listener, ConfigurationListener::Event event, const Variable &variable)
 
void MonitorPath (lang::ContainerOp insertOrRemove, ConfigurationListener *listener, ConfigurationListener::Event event, const Configuration::Cursor &cursor)
 
void MonitorPathPrefix (lang::ContainerOp insertOrRemove, ConfigurationListener *listener, ConfigurationListener::Event event, const String &pathPrefix)
 
void MonitorPathSubstring (lang::ContainerOp insertOrRemove, ConfigurationListener *listener, ConfigurationListener::Event event, const String &pathSubstring)
 
ALIB_API int MonitorStop (ConfigurationListener *listener)
 
void MonitorVariablesByName (lang::ContainerOp insertOrRemove, ConfigurationListener *listener, ConfigurationListener::Event event, const String &variableName)
 
ALIB_API std::pair< bool, int8_t > ParseBooleanToken (const String &src)
 
template<typename TEnum >
void PreloadVariables ()
 
void PresetImportString (const String &name, const String &value, Priority priority=Priority::DefaultValues)
 
void PresetImportString (const String &name, const String &value, StringEscaper *escaper, Priority priority=Priority::DefaultValues)
 
template<typename TVMeta >
void RegisterType ()
 
ALIB_API const DeclarationStoreDeclaration (const Declaration *orig, const Box &replacements)
 
ALIB_API AStringWriteBooleanToken (bool value, int8_t index, AString &dest)
 
- Public Method Index: inherited from StringTree< TAllocator, T, TNodeHandler, TRecycling >
 StringTree (AllocatorType &allocator, CharacterType pathSeparator)
 
template<typename TSharedRecycler = SharedRecyclerType, ATMP_T_IF(int, !ATMP_EQ(TSharedRecycler, void)) = 0>
 StringTree (CharacterType pathSeparator, TSharedRecycler &pRecycler)
 
 ~StringTree ()
 
void Clear ()
 
template<typename... TArgs>
void ConstructRootValue (TArgs &&... args)
 
void DbgSetDCSName (const char *name) const
 
void DestructRootValue ()
 
AllocatorTypeGetAllocator () noexcept
 
ConstCursor ImportCursor (ConstCursorHandle handle)
 
Cursor ImportCursor (CursorHandle handle)
 
bool IsEmpty () const
 
auto & NodeTable ()
 
const auto & NodeTable () const
 
integer RecyclablesCount () const
 
void ReserveRecyclables (integer qty, lang::ValueReference reference)
 
void Reset ()
 
Cursor Root ()
 
const ConstCursor Root () const
 
constexpr CharacterType Separator () const noexcept
 
integer Size () const
 
- Public Method Index: inherited from PluginContainer< ConfigurationPlugin, Priority >
 ~PluginContainer ()
 
integer CountPlugins ()
 
ConfigurationPlugin * GetPlugin (integer number)
 
ConfigurationPlugin * GetPlugin (Priority priority)
 
TPluginType * GetPluginTypeSafe ()
 
TPluginType * GetPluginTypeSafe (Priority priority)
 
Priority GetPriority (integer number)
 
bool HasPlugins ()
 
void InsertPlugin (ConfigurationPlugin *plugin, lang::Responsibility responsibility=lang::Responsibility::KeepWithSender)
 
bool RemovePlugin (ConfigurationPlugin *plugIn)
 
void RemovePlugin (integer idx)
 
ConfigurationPlugin * RemovePlugin (Priority priority)
 

Protected Type Index:

using RDHashTable
 
using TypesHashTable
 A hashtable for the registered types. Key is the type name, value is the VMeta singleton.
 
- Protected Type Index: inherited from StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >
using CharacterType = typename TNodeHandler::CharacterType
 
using ConstCursorBase = TCursorBase<true>
 The constant version of type StringTreeBase::TCursorBase<TConst>.
 
using CursorBase = TCursorBase<false>
 The mutable version of type StringTreeBase::TCursorBase<TConst>.
 
using NameStorageType = typename TNodeHandler::NameStringType
 
using NameType = const strings::TString<CharacterType>
 The string-type of node names and paths if provided externally for comparison.
 
using NodeList = lang::BidiListHook<NodeBase>
 Alias shortcut for a bidirectional list of Node elements.
 
using SharedRecyclerType = typename decltype(nodeTable)::SharedRecyclerType
 
using SubstringType = typename strings::TSubstring<CharacterType>
 

Protected Field Index:

CLIVariablesPlugincliPlugin
 A default plugin created and inserted with construction.
 
EnvironmentVariablesPluginenvironmentPlugin
 A default plugin created and inserted with construction.
 
List< MonoAllocator, ListenerRecordlisteners
 The list of registered listeners.
 
RDHashTable replacementDeclarations
 
TypesHashTable types
 A hashtable for the registered types. Key is the type name, value is the VMeta singleton.
 
- Protected Field Index: inherited from StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >
int dbgRootDataSet = 0
 
HashTable< TAllocator, typename NodeKey::ValueDescriptor, typename NodeKey::Hash, typename NodeKey::EqualTo, lang::Caching::Enabled, TRecycling > nodeTable
 
RootNodeSpacer root
 The root node.
 
CharacterType separator
 
- Protected Field Index: inherited from PluginContainer< ConfigurationPlugin, Priority >
std::vector< Slot > plugins
 The plug-ins we have attached in descending priority order.
 

Protected Method Index:

ALIB_API void notifyListeners (int event, const Variable &variable, const String &variablePath, Priority previousPriority)
 
ALIB_API void presetImportString (const String &name, const String &value, const StringEscaper *escaper, Priority priority)
 
ALIB_API void registerListener (ConfigurationListener *listener, lang::ContainerOp insertOrRemove, int event, const Variable *variable, const StringTree::Cursor *subTree, const String &variableName, const String &pathPrefix, const String &pathSubstring)
 
template<typename TVMeta >
void registerType ()
 
- Protected Method Index: inherited from StringTree< TAllocator, T, TNodeHandler, TRecycling >
Cursor createCursor (baseNode &node)
 
- Protected Method Index: inherited from StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >
 StringTreeBase (TAllocator &allocator, CharacterType pathSeparator)
 
template<typename TSharedRecycler = SharedRecyclerType, ATMP_T_IF(int, !ATMP_EQ(TSharedRecycler, void)) = 0>
 StringTreeBase (TAllocator &allocator, TSharedRecycler &pRecycler, CharacterType pathSeparator)
 
template<typename TSharedRecycler = SharedRecyclerType, ATMP_T_IF(int, !ATMP_EQ(TSharedRecycler, void)) = 0>
 StringTreeBase (TSharedRecycler &pRecycler, CharacterType pathSeparator)
 
bool checkChildName (const NameType &name) const
 
TAllocator & GetAllocator () noexcept
 

Private Type Index:

using base = StringTree<MonoAllocator,detail::Entry, detail::ConfigNodeHandler>
 Alias to the StringTree-parent.
 

Additional Inherited Members

- Public Type Index: inherited from StringTree< TAllocator, T, TNodeHandler, TRecycling >
using AllocatorType = TAllocator
 Type definition publishing template parameter TAllocator.
 
using CharacterType = typename TNodeHandler::CharacterType
 
using ConstCursor = TCursor<true>
 The constant version of type StringTree::TCursor<TConst>.
 
using ConstRecursiveIterator = TRecursiveIterator<true>
 The constant version of type StringTree::TRecursiveIterator<TConst>.
 
using Cursor = TCursor<false>
 The mutable version of type StringTree::TCursor<TConst>.
 
using HandlerType = TNodeHandler
 Type definition publishing template parameter TNodeHandler.
 
using NameType = strings::TString<CharacterType>
 
using RecursiveIterator = TRecursiveIterator<false>
 The mutable version of type StringTree::TRecursiveIterator<TConst>.
 
using SharedRecyclerType = typename basetree::SharedRecyclerType
 
using SubstringType = typename strings::TSubstring<CharacterType>
 
- Public Type Index: inherited from PluginContainer< ConfigurationPlugin, Priority >
using PluginType
 This exposes the template parameter pTPlugin to the outer world.
 
using PrioritiesType
 This exposes the template parameter pTPlugin to the outer world.
 

Friends And Related Entity Details:

◆ detail::ConfigNodeHandler

friend struct detail::ConfigNodeHandler
friend

Definition at line 174 of file configuration.hpp.

◆ detail::Entry

friend class detail::Entry
friend

Definition at line 173 of file configuration.hpp.

◆ Variable

friend class Variable
friend

Type alias in namespace alib.

Definition at line 172 of file configuration.hpp.

Type Definition Details:

◆ base

Alias to the StringTree-parent.

Definition at line 169 of file configuration.hpp.

◆ RDHashTable

using RDHashTable
protected
Initial value:
ValueDescriptorRD ,
std::hash <String> ,
std::equal_to<String> ,
Recycling::None >
@ Disabled
Caching is disabled.
containers::HashTable< TAllocator, TValueDescriptor, THash, TEqual, THashCaching, TRecycling > HashTable
Type alias in namespace alib. See type definition alib::containers::HashSet.
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator

Type definition of the container that stores declarations allocated with method Configuration::StoreDeclaration.

Definition at line 239 of file configuration.hpp.

◆ TypesHashTable

using TypesHashTable
protected
Initial value:
ValueDescriptorTypes ,
std::hash<String> ,
std::equal_to<String> ,
Recycling::None >
@ Enabled
Caching is enabled.

A hashtable for the registered types. Key is the type name, value is the VMeta singleton.

Definition at line 217 of file configuration.hpp.

Field Details:

◆ BooleanTokens

List<MonoAllocator, std::pair<Token,Token>, Recycling::None> BooleanTokens

This is a list that holds pairs of type strings::util::Token which is used by the built-in boolean variable type (type name "B"). The list defines how extern string data (for example, from command line args, environment variables, or INI-files) is converted to boolean values.

When parsed from outside, the index of the pair that had the match is stored and in the case of writing back (e.g., to the INI-file), the corresponding representation of this pair will be written out. (For example, if a user used "On" in the configuration file, and the software switched it to false, the word "Off" is to be written.

During bootstrap, this list might be modified, but before any variable was read. Otherwise the indices would become invalid. However, the preferred way of changing the accepted tokens is to modify the resources. This allows having localization of terms, in case this should be needed some day.

If even with modification of the predefined list, some other needs or flexibility is wanted, then the definition of an alternative boolean configuration variable type is the way to go.

The list of resourced predefined tokens after construction of a configuration is:

Index True Token False Token
0 false I 1 true I 1
1 0 I 1 1 I 1
2 no I 1 yes I 1
3 off I 3 on I 2
4 — I 1 OK I 2
See also
Methods ParseBooleanToken and WriteBooleanToken.

Definition at line 360 of file configuration.hpp.

◆ cliPlugin

CLIVariablesPlugin* cliPlugin
protected

A default plugin created and inserted with construction.

Definition at line 201 of file configuration.hpp.

◆ environmentPlugin

EnvironmentVariablesPlugin* environmentPlugin
protected

A default plugin created and inserted with construction.

Definition at line 204 of file configuration.hpp.

◆ Escaper

A standard string escaper that can be used to set preset values received from external escaped strings.

Definition at line 311 of file configuration.hpp.

◆ listeners

List<MonoAllocator, ListenerRecord> listeners
protected

The list of registered listeners.

Definition at line 252 of file configuration.hpp.

◆ NumberFormat

Number format definition used to read and write int and float values. Can be tweaked to change the way external information is parsed.

Definition at line 307 of file configuration.hpp.

◆ Pool

An object pool for recycling variable values as well as the hashtable entries. It is chained to the allocator provided with construction.

The pool may be used in accordance with the general rules imposed by camp ALib Monomem. If so, in multithreaded environments, this configuration has to be locked (in addition to all other custom locks when interfacing this type), when using this pool from custom code.

Definition at line 184 of file configuration.hpp.

◆ replacementDeclarations

RDHashTable replacementDeclarations
protected

A hashtable for declarations allocated with method Configuration::StoreDeclaration.

Definition at line 249 of file configuration.hpp.

◆ SubstitutionVariableDelimiters

CString SubstitutionVariableDelimiters = A_CHAR(" $@,.;:\"\'+-*\\§%&()[]{}<>=?'`~#")

The delimiters used to identify the end of a substitutable variable. If field SubstitutionVariableEnd is not empty, this field is ignored. Otherwise, all characters defined in this string are used to identify the end of a substitution variable.

Definition at line 328 of file configuration.hpp.

◆ SubstitutionVariableEnd

String SubstitutionVariableEnd = A_CHAR("}")

The end of a substitution variables. If this field is set, then field SubstitutionVariableDelimiters is ignored. If this field is nullptr (the default) or empty, it is ignored and characters in field SubstitutionVariableDelimiters are used to identify the end of the variable.

Definition at line 322 of file configuration.hpp.

◆ SubstitutionVariableStart

String SubstitutionVariableStart = A_CHAR("${")

The start string to identify substitution variables. Defaults to single character '$'. If a string is set, i.e., "${", then field SubstitutionVariableEnd may be set accordingly, i.e., "}"

Definition at line 316 of file configuration.hpp.

◆ types

TypesHashTable types
protected

A hashtable for the registered types. Key is the type name, value is the VMeta singleton.

Definition at line 225 of file configuration.hpp.

Constructor(s) / Destructor Details:

◆ Configuration()

Constructs a Configuration.

If addDefaultPlugins is true, registers the initial plug-ins as follows:

Priority Plug-in Type
Priority::Environment EnvironmentVariablesPlugin
Priority::CLI CLIVariablesPlugin

Furthermore all built-in variable types are registered.

Modifications (in respect to plug-ins and registered types) should be performed during bootstrap, right after construction of this type (when no parallel threads are active) or with prior locking the Configuration instance.

Parameters
allocatorThe allocator to use.
createDefaultsDetermines if default plug-ins are to be created. Defaults to Yes.

Definition at line 55 of file configuration.cpp.

Here is the call graph for this function:

◆ ~Configuration()

Destructor.

Definition at line 89 of file configuration.cpp.

Here is the call graph for this function:

Method Details:

◆ DeletePath()

bool DeletePath ( const String & path)

Deletes the given variable path, respectively all variables under the given path as well as the path node itself.

This is a convenience method. Full access to the underlying StringTree is provided by public inheritance, which offers many other ways of manipulating variable data. As an example, consider the implementation of this method:

// get root node of the tree
Cursor cs= Root();
// try to walk the givedn path. If a remainder of the string exits, exit.
if( cs.GoTo(path).IsNotEmpty() )
return false;
// now delete the subtree, including the node the cursor represents
cs.Delete();
// that's it
return true;
Parameters
pathThe path in the variable tree.
Returns
true on success, false, if the given path was not found.

Definition at line 394 of file configuration.cpp.

Here is the call graph for this function:

◆ MonitorDistinctVariable()

void MonitorDistinctVariable ( lang::ContainerOp insertOrRemove,
ConfigurationListener * listener,
ConfigurationListener::Event event,
const Variable & variable )
inline

Inserts or removes a listener to a specific variable. Note that this version of the method cannot be used to fetch declaration events, because the given variable obviously is already declared and created.

Parameters
insertOrRemoveDenotes whether the listener should be inserted or removed. (Only enum elements ContainerOp::Insert or ContainerOp::Remove must be passed.)
listenerThe listener to register.
eventThe event to listen to.
variableThe variable to listen to.
See also
Chapter 9. Monitoring Changes of Variables of the Programmer's Manual of camp ALib Configuration.

Definition at line 557 of file configuration.hpp.

Here is the call graph for this function:

◆ MonitorPath()

void MonitorPath ( lang::ContainerOp insertOrRemove,
ConfigurationListener * listener,
ConfigurationListener::Event event,
const Configuration::Cursor & cursor )
inline

Inserts or removes a listener for all variables below subtree specified by the given cursor.

Parameters
insertOrRemoveDenotes whether the listener should be inserted or removed. (Only enum elements ContainerOp::Insert or ContainerOp::Remove must be passed.)
listenerThe listener to register.
eventThe event to listen to.
cursorThe parent node in the configuration variable tree of the variables to monitor.
See also
Chapter 9. Monitoring Changes of Variables of the Programmer's Manual of camp ALib Configuration.

Definition at line 600 of file configuration.hpp.

Here is the call graph for this function:

◆ MonitorPathPrefix()

void MonitorPathPrefix ( lang::ContainerOp insertOrRemove,
ConfigurationListener * listener,
ConfigurationListener::Event event,
const String & pathPrefix )
inline

Inserts or removes a listener for all variables below the subtree specified by the given startPath.

Parameters
insertOrRemoveDenotes whether the listener should be inserted or removed. (Only enum elements ContainerOp::Insert or ContainerOp::Remove must be passed.)
listenerThe listener to register.
eventThe event to listen to.
pathPrefixThe path prefix of the subtree of variables to monitor. Note that a missing leading separator character '/' will be added.
See also
Chapter 9. Monitoring Changes of Variables of the Programmer's Manual of camp ALib Configuration.

Definition at line 624 of file configuration.hpp.

Here is the call graph for this function:

◆ MonitorPathSubstring()

void MonitorPathSubstring ( lang::ContainerOp insertOrRemove,
ConfigurationListener * listener,
ConfigurationListener::Event event,
const String & pathSubstring )
inline

Inserts or removes a listener for all variables below the subtree specified by the given startPath.

Parameters
insertOrRemoveDenotes whether the listener should be inserted or removed. (Only enum elements ContainerOp::Insert or ContainerOp::Remove must be passed.)
listenerThe listener to register.
eventThe event to listen to.
pathSubstringThe substring to match in the path (including the variable name) of the variables to monitor.
See also
Chapter 9. Monitoring Changes of Variables of the Programmer's Manual of camp ALib Configuration.

Definition at line 647 of file configuration.hpp.

Here is the call graph for this function:

◆ MonitorStop()

int MonitorStop ( ConfigurationListener * listener)

Removes all registrations of the given listener.

Parameters
listenerThe listener to remove.
Returns
The number of registrations that have been removed.
See also
Chapter 9. Monitoring Changes of Variables of the Programmer's Manual of camp ALib Configuration.

Definition at line 155 of file configuration.cpp.

◆ MonitorVariablesByName()

void MonitorVariablesByName ( lang::ContainerOp insertOrRemove,
ConfigurationListener * listener,
ConfigurationListener::Event event,
const String & variableName )
inline

Inserts or removes a listener for all variables that share the given variableName.

Parameters
insertOrRemoveDenotes whether the listener should be inserted or removed. (Only enum elements ContainerOp::Insert or ContainerOp::Remove must be passed.)
listenerThe listener to register.
eventThe event to listen to.
variableNameThe name of one or more variables to listen to.
See also
Chapter 9. Monitoring Changes of Variables of the Programmer's Manual of camp ALib Configuration.

Definition at line 579 of file configuration.hpp.

Here is the call graph for this function:

◆ notifyListeners()

void notifyListeners ( int event,
const Variable & variable,
const String & variablePath,
Priority previousPriority )
protected

Notifies registered listeners on events.

Parameters
eventThe event that occurred.
variableThe variable.
variablePathThe full path of the variable. Might be nulled if not available, yet.
previousPriorityThe priority of the variable before the event.

Definition at line 174 of file configuration.cpp.

Here is the call graph for this function:

◆ ParseBooleanToken()

std::pair< bool, int8_t > ParseBooleanToken ( const String & src)

Utility method that checks if a given value represents boolean true.

See also
Field BooleanTokens, which is used by this function and sibling method WriteBooleanToken
Parameters
srcThe input string to check.
Returns
Returns the value found and the index of the pair of tokens that matched. If no token matched (false,-1) is returned.

Definition at line 360 of file configuration.cpp.

Here is the call graph for this function:

◆ PreloadVariables()

template<typename TEnum >
void PreloadVariables ( )
inline

Declares and defines all variables of the given enum type which do not contain placeholders are contained in the variable's name.

The purpose of this method is to fill the configuration system with variables (usually during or right after bootstrap) regardless of their later use, which depends on the concrete execution path of a run of a software. The rationale to do this is is twofold:

  1. To allow external configuaration plug-ins to set all variable's values, which is not possible if a variable is not declared, yet, and thus its type is not known. In that case, an external source can only use method Configuration::PresetImportString, which in the end leads to correctly setting a variable's external value, but which creates a little overhead in respect to execution time and memory consumption.
  2. To give external configuaration plug-ins the possibiltiy to "populate" their files with all known variables, including their default values and comments, again independently from a concrete excution path of a run of the software, which might not declare certain variables and thus those would not be "known" to the external source. Populating external configuration files (with the first run of a software), tremendously supports an end-user in learning about configuration options.
    For example, built-in class IniFileFeeder supports such "population" of for INI-fles through its Export methods.

Alltogether, the use of this method does not not impose much of an overhead, because:

  • as explained above, the need of method Configuration::PresetImportString is avoided for all variables that do not contain placeholders, and because
  • most variables would anyhow be declared later during the run of a software and thus, this declaration is just performed earlier and the variable are already in place when a software later uses them.
See also
Chapter 7.3 Built-in Class IniFileFeeder of the Programmer's Manual of camp ALib Configuration.
Template Parameters
TEnumEnumeration type equipped with ALib Enum Records of type Declaration.

◆ PresetImportString() [1/2]

void PresetImportString ( const String & name,
const String & value,
Priority priority = Priority::DefaultValues )
inline

Same as overloaded version PresetImportString(const String&, const String&,StringEscaper*, Priority), but does not accept an StringEscaper and thus expects the value is in C++ internal string format (aka 'not escaped').

Parameters
nameThe name of the variable.
valueThe value to import.
priorityThe priority to set for the value. Defaults to Default.

Definition at line 500 of file configuration.hpp.

Here is the call graph for this function:

◆ PresetImportString() [2/2]

void PresetImportString ( const String & name,
const String & value,
StringEscaper * escaper,
Priority priority = Priority::DefaultValues )
inline

Stores the given information as a default value, which will be assigned to a variable as soon as it is declared. If a variable is deleted and later again declared, the given value is again imported. In other words, a preset will not be removed with a first declaration and use.
To delete a previously set import string, a nulled string is to be passed with for parameter value.

This method is to be used in cases when a declaration of a variable is not possible, i.e., when a variable's type is not known, which often is the case when external configuration values are to be set.

See also
Parameters
nameThe name of the variable.
valueThe value to import. Will be 'unescaped' using escaper.
escaperThe escaper to use for importing. Has to be still valid at the time(s) the value read. A pointer to field Escaper might be passed here.
priorityThe priority to set for the value. Defaults to Default.

Definition at line 488 of file configuration.hpp.

Here is the call graph for this function:

◆ presetImportString()

void presetImportString ( const String & name,
const String & value,
const StringEscaper * escaper,
Priority priority )
protected

Stores the given information as a default value, which is imported to a variable as soon as it becomes declared.

See also
Overloaded public methods Configuration::PresetImportString.
Parameters
nameThe name of the variable.
valueThe value to import.
escaperThe escaper to use for importing.
priorityThe priority to set for the value.

Definition at line 209 of file configuration.cpp.

Here is the call graph for this function:

◆ registerListener()

void registerListener ( ConfigurationListener * listener,
lang::ContainerOp insertOrRemove,
int event,
const Variable * variable,
const StringTree::Cursor * subTree,
const String & variableName,
const String & pathPrefix,
const String & pathSubstring )
protected

Implements the various overloaded listener registration methods.

Parameters
listenerThe listener to register or dispose.
insertOrRemoveDenotes registration or disposal of a listener.
eventThe event to listen to.
variableIf given, the exported value of the variable to listen to.
subTreeIf given, the exported value of the subtree of variables to listen to.
variableNameIf given, the variable's name to listen to.
pathPrefixIf given, the start string of the path of the variables to monitor.
pathSubstringIf given, the substring to match in the path (including the variable name) of the variables to monitor.

Definition at line 99 of file configuration.cpp.

Here is the call graph for this function:

◆ RegisterType()

template<typename TVMeta >
void RegisterType ( )
inline

Registers a variable type with this configuration. The only parameter is the template parameter TVMeta. The function will create the singleton of this type and store it in a hash table of types. When a variable associated with this configuration object is declared, this variable type is used as the key to this hash table. Then this singleton object of the given type is responsible for construction, destruction and import/export of variables of this type.

Template Parameters
TVMetaThe meta-information type of the type to register.

Definition at line 398 of file configuration.hpp.

Here is the call graph for this function:

◆ registerType()

template<typename TVMeta >
void registerType ( )
inlineprotected

Implementation of Configuration::RegisterType.

Template Parameters
TVMetaThe meta-information type of the type to register.

Definition at line 258 of file configuration.hpp.

Here is the call graph for this function:

◆ StoreDeclaration()

const Declaration * StoreDeclaration ( const Declaration * orig,
const Box & replacements )

Creates and stores a declaration. Placeholders "%1", "%2" ... "%N" found in the fields (except typeName) are replaced with the replacement values given with boxed argument (list) replacements.

Attention
This method creates a copy a new declaration instance within the monotonic allocator of this Configuration object. This imposes a potential memory drain (leak). To mitigate the problem and widen the use cases, this method uses a hashtable to cache the resulting declarations. This means, that only for combinations of parameters that result to a different variable name, a declaration is created.
See also
Chapter 2.4 Placeholders in Variable Names of the Programmer's Manual of camp ALib Configuration.
Parameters
origThe original, typically resourced declaration with placeholders.
replacementsA list of replacement values. Must be of boxed types that are alib::strings,T_Append,appendable "strings,T_Append,appendable" to class AString. To provide more than one object, pass an object of class alib::boxing,Boxes "boxing,Boxes" or a boxed array.
Returns
The allocated (or cached) copy of orig.

Definition at line 272 of file configuration.cpp.

Here is the call graph for this function:

◆ WriteBooleanToken()

AString & WriteBooleanToken ( bool value,
int8_t index,
AString & dest )

Utility method that writes the given boolean value as specified with the token found at index in BooleanTokens.
This method is used internally by the meta-information handler of variable type "B"/bool.

See also
Sibling method ParseBooleanToken.
Parameters
valueThe boolean value to write.
indexThe token to use. If negative, this is corrected to 0.
destThe destination string.
Returns
dest to allow concatenated operations.

Definition at line 376 of file configuration.cpp.

Here is the call graph for this function:

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