ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
configcamp.cpp
1// #################################################################################################
2// ALib C++ Library
3//
4// Copyright 2013-2024 A-Worx GmbH, Germany
5// Published under 'Boost Software License' (a free software license, see LICENSE.txt)
6// #################################################################################################
8
9#if !DOXYGEN
17#endif // !DOXYGEN
18
19
20
25
26using namespace alib;
27using namespace alib::config;
28
29namespace alib {
30
32
33namespace config {
34
36: Camp( "CFG" )
37{
38 ALIB_ASSERT_ERROR( this == &CONFIG, "CONFIG",
39 "Instances of class Config must not be created. Use singleton alib::CONFIG" )
40}
41
42
44{
46 {
47 ALIB_BOXING_BOOTSTRAP_VTABLE_DBG_REGISTER( vt_config_priorities )
48 ALIB_BOXING_BOOTSTRAP_VTABLE_DBG_REGISTER( vt_config_exceptions )
50 ALIB_BOXING_BOOTSTRAP_VTABLE_DBG_REGISTER( vt_config_constcursor )
54
55
56#if !ALIB_RESOURCES_OMIT_DEFAULTS
58 "E<", A_CHAR("config::"),
59 "E" , A_CHAR("0" "," "OK" "," "" ","
60 "1" "," "ErrorOpeningFile" "," "ERF" ","
61 "2" "," "ErrorWritingFile" "," "EWF" ),
62
63 "ERF", A_CHAR("Can't open {}file {!Q'} for reading.") ,
64 "EWF", A_CHAR("Can't open {}file {!Q'} for writing.") ,
65
66
67 "Priority",
68 A_CHAR( "0" "," "NONE" ",1,"
69 "1000" "," "AutoDetected" ",1,"
70 "2000" "," "DefaultValues" ",1,"
71 "4000" "," "Standard" ",1,"
72 "6000" "," "ConfigFile" ",2,"
73 "8000" "," "Environment" ",1,"
74 "10000" "," "SessionFile" ",8,"
75 "12000" "," "CLI" ",2,"
76 "14000" "," "Session" ",2,"
77 "max" "," "Protected" ",1" ),
78
79
80 // names of the configuration plug-ins added to configuration in default construction.
81 "CfgPlgEnv" , A_CHAR("Environment Variables") ,
82 "CfgPlgCLI" , A_CHAR("Command Line Arguments") ,
83
84 "INIWB" , A_CHAR("writeback") ,
85
86 // boolean tokens
87 "BTF", A_CHAR("False I 1," ) A_CHAR( "True I 1," )
88 A_CHAR( "0 I 1," ) A_CHAR( "1 I 1," )
89 A_CHAR( "No I 1," ) A_CHAR( "Yes I 1," )
90 A_CHAR( "Off I 3," ) A_CHAR( "On I 2," )
91 A_CHAR( "--- I 1," ) A_CHAR( "OK I 2" ),
92
93 // end of BootstrapBulk()
94 nullptr );
95#endif // !ALIB_RESOURCES_OMIT_DEFAULTS
96
97
98 // parse enum records
99 EnumRecords<Priority>::Bootstrap( *this, "Priority" );
101 }
102
103 else if( phase == BootstrapPhases::PrepareConfig )
104 {}
105
106 else if( phase == BootstrapPhases::Final )
107 {}
108}
109
110
111
112// #################################################################################################
113// Implementation of parsing methods of built-in record types.
114// #################################################################################################
116{
117 enums::EnumRecordParser::Get( ERSerializable::EnumElementName );
119}
120}} // namespace [alib::config]
virtual void bootstrap(BootstrapPhases phase) override
NCString ResourceCategory
Definition camp.hpp:119
lang::resources::ResourcePool * resourcePool
Definition camp.hpp:75
virtual void BootstrapBulk(const nchar *category,...)=0
#define ALIB_BOXING_VTABLE_DEFINE(TMapped, Identifier)
Definition vtable.inl:473
#define A_CHAR(STR)
#define ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE(TAppendable)
#define ALIB_BOXING_BOOTSTRAP_VTABLE_DBG_REGISTER(Identifier)
Definition vtable.inl:489
#define ALIB_ASSERT_ERROR(cond,...)
Definition alib.hpp:1271
Exceptions
Exception codes of namespace alib::config.
Definition alib.cpp:69
config::ConfigCamp CONFIG
The singleton instance of ALib Camp class ConfigCamp.
BootstrapPhases
Initialization levels usable with Bootstrapping ALib Camps.
Definition alib.hpp:1393
@ Final
The final initialization phase. Here, camps are initializing their custom setup.
ALIB_API void Parse()
Implementation of EnumRecordPrototype::Parse.
static ALIB_API void Get(String &result, bool isLastField=false)
static void Bootstrap(TEnum element, TArgs &&... args) noexcept