This is a default implementation of abstract interface ExpressionRepository which retrieves definitions of named expressions using core mechanics of ALib , namely:
Definition at line 34 of file standardrepository.hpp.
#include <standardrepository.hpp>
Public Field Index: | |
std::vector< AString > | DefaultCategories |
std::vector< std::tuple< Priorities, AString, AString, String > > | VariablesLoaded |
Public Method Index: | |
StandardRepository (Configuration *pConfig, ResourcePool *pResources, NString pResCategory) | |
virtual ALIB_API bool | Get (const String &identifier, AString &target) override |
ALIB_API int | StoreLoadedExpressions (Compiler *compiler, Priorities slot=Priorities::Standard) |
Public Method Index: inherited from ExpressionRepository | |
virtual | ~ExpressionRepository () |
|
protected |
The configuration object used to retrieve definitions of nested expressions.
Definition at line 43 of file standardrepository.hpp.
std::vector<AString> DefaultCategories |
May be filled with category names of field config. A named expression's identifier will be first tried to be loaded using each category name added here. If this fails, it is checked if an underscore '_'
character is found in the name, if yes, it is then tried to extract the category from the variable name.
Definition at line 65 of file standardrepository.hpp.
|
protected |
The category within resources to use for searching expression strings.
Definition at line 54 of file standardrepository.hpp.
|
protected |
The resource pool used to retrieve definitions of nested expressions, if not found with configuration data of field config.
Definition at line 49 of file standardrepository.hpp.
|
protected |
A variable object, reused (performance vs memory)
Definition at line 38 of file standardrepository.hpp.
std::vector<std::tuple<Priorities,AString,AString,String> > VariablesLoaded |
Within this vector, all variables that have been loaded from config are stored.
The tuple elements provide:
The latter is needed, as it might differ from the combination of the category and variable name due to definitions in DefaultCategories.
This vector might be used for various things, e.g. logging out status information. It is also used by method StoreLoadedExpressions.
Definition at line 87 of file standardrepository.hpp.
|
inline |
Constructor.
pConfig | The configuration data to use. May be set to nullptr to omit the use of configuration data. |
pResources | The resources to use. May be set to nullptr to omit the use of resource data. |
pResCategory | The category within resources to use for searching expression strings. |
Definition at line 101 of file standardrepository.hpp.
Implementation of the central interface method. If invoked, the definition string is first searched in config and if not found, secondly searched in field resources.
identifier | The name of the required expression. | |
[out] | target | The target to write the requested expression string to. |
true
, if the expression string could be retrieved, false
otherwise. If true
is returned and target is still empty, then the string is defined to be empty, which throws an exception on compilation. Implements ExpressionRepository.
Definition at line 39 of file standardrepository.cpp.
int StoreLoadedExpressions | ( | Compiler * | compiler, |
Priorities | slot = Priorities::Standard ) |
Stores back all expression strings which had been automatically loaded from the plug-in of field config, specified by parameter slot . For storing, the normalized expression string is used. Thus, this method may be used to write a "clean" expression string, that does not use abbreviations for identifiers, has no unnecessary whitespaces, etc.
Note the importance of parameter slot : Usually, only such expression variables should be stored that had been loaded from a configuration source that is manually edited by end-users, like INI-files.
compiler | The compiler that this interface is attached to. |
slot | The slot of the configuration plug-in of which loaded variables are to be written back. |
Definition at line 23 of file standardrepository.cpp.