ALib C++ Framework
by
Library Version: 2605 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
standardrepository.cpp
1namespace alib { namespace expressions {
2
4 int count= 0;
5 for( auto& entry : VariablesLoaded )
6 if( std::get<0>( entry ) == slot ) {
7 ++count;
8 Variable var(*config, std::get<1>( entry ), A_CHAR("S") );
9 var= compiler->GetNamed( std::get<2>( entry ))->GetNormalizedString();
10 }
11
12 return count;
13}
14
15bool StandardRepository::Get( const String& identifier, AString& target ) {
16 if( config != nullptr ) {
17 if( ConfigPaths.empty() )
18 ConfigPaths.emplace_back( "" );
19
20 // search in given default categories first.
21 Variable var(*config);
22 for( auto& path : ConfigPaths )
24 String256 name(path); name << '/' << identifier;
25 if( var.Try(name, A_CHAR("S") ) && var.IsDefined() ) {
26 target << var.GetString();
27 VariablesLoaded.emplace_back( var.GetPriority(), name, identifier );
28 return true;
29 } } }
30
31 if( resources != nullptr ) {
32 auto& result= resources->Get( resourceCategory, identifier ALIB_DBG(, false) );
33 if( result.IsNotNull() ) {
34 target << result;
35 return true;
36 } }
37
38 // failed
39 return false;
40
41}
42
43}} // namespace [alib::expressions]
#define A_CHAR(STR)
#define ALIB_DBG(...)
#define ALIB_LOCK_WITH(lock)
virtual Expression GetNamed(const String &name)
Definition compiler.cpp:344
int StoreLoadedExpressions(Compiler *compiler, Priority slot=Priority::Standard)
std::vector< std::tuple< Priority, AString, String > > VariablesLoaded
SharedConfiguration config
The configuration object used to retrieve definitions of nested expressions.
NString resourceCategory
The category within #".resources" to use for searching expression strings.
virtual bool Get(const String &identifier, AString &target) override
bool Try(const String &name)
Definition alox.cpp:14
variables::Priority Priority
Type alias in namespace #"%alib".
variables::Variable Variable
Type alias in namespace #"%alib".
strings::TString< character > String
Type alias in namespace #"%alib".
Definition string.hpp:2165
LocalString< 256 > String256
Type alias name for #"TLocalString;TLocalString<character,256>".
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace #"%alib".