ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
aloxcamp.inl
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of module \alib_alox of the \aliblong.
4///
5/// \emoji :copyright: 2013-2025 A-Worx GmbH, Germany.
6/// Published under \ref mainpage_license "Boost Software License".
7//==================================================================================================
8ALIB_EXPORT namespace alib { namespace lox {
9
10//==================================================================================================
11/// Configuration variables uses by ALox.
12/// \note
13/// As required by module \alib_variables, this enumerations is equipped with
14/// \ref alib_enums_records "ALib Enum Records" of type \alib{variables;Declaration} and resourced
15/// with this module \alib_alox_nl.<br>
16/// Hence, all variable categories, names, default values and such can be modified
17/// by modifying the resource data of the singleton of class \alib{camp;Basecamp}.
18//==================================================================================================
19enum class Variables
20{
21 /// Denotes configuration variable \ref alxcvALOX_NO_IDE_LOGGER used by \alox{Log::AddDebugLogger}.
23
24 /// Denotes configuration variable \ref alxcvALOX_CONSOLE_TYPE used by \alox{Lox::CreateConsoleLogger}.
26
27 /// Denotes configuration variable \ref alxcvALOX_LOGGERNAME_VERBOSITY_WITH_LOXNAME.
29
30 /// Denotes configuration variable \ref alxcvALOX_GLOBAL_SOURCE_PATH_TRIM_RULES.
32
33 /// Denotes configuration variable \ref alxcvALOX_LOXNAME_SOURCE_PATH_TRIM_RULES used by class \alox{Lox}.
35
36 /// Denotes configuration variable \ref alxcvALOX_LOXNAME_DOMAIN_SUBSTITUTION used by class \alox{Lox}.
38
39 /// Denotes configuration variable \ref alxcvALOX_LOXNAME_PREFIXES used by class \alox{Lox}.
41
42 /// Denotes configuration variable \ref alxcvALOX_LOXNAME_DUMP_STATE_ON_EXIT used by class \alox{Lox}.
44
45 /// Denotes configuration variable \ref alxcvALOX_LOGGERNAME_AUTO_SIZES used by class \alox{textlogger,TextLogger}.
47
48 /// Denotes configuration variable \ref alxcvALOX_LOGGERNAME_FORMAT used by class \alox{textlogger,TextLogger}.
49 FORMAT = 21,
50
51 /// Denotes configuration variable \ref alxcvALOX_LOGGERNAME_FORMAT_DATE_TIME used by class \alox{textlogger,TextLogger}.
53
54 /// Denotes configuration variable \ref alxcvALOX_LOGGERNAME_FORMAT_MULTILINE used by class \alox{textlogger,TextLogger}.
56
57 /// Denotes configuration variable \ref alxcvALOX_LOGGERNAME_FORMAT_TIME_DIFF used by class \alox{textlogger,TextLogger}.
59
60 /// Denotes configuration variable \ref alxcvALOX_LOGGERNAME_FORMAT_OTHER used by class \alox{textlogger,TextLogger}.
62
63 /// Denotes configuration variable \ref alxcvALOX_LOGGERNAME_REPLACEMENTS used by class \alox{textlogger,TextLogger}.
65
66 /// Denotes configuration variable \ref alxcvALOX_CONSOLE_LIGHT_COLORS used by colorful specializations of class \alox{textlogger,TextLogger}.
68
69 #if defined(_WIN32)
70 /// Denotes configuration variable \ref alxcvALOX_CODEPAGE used by class \alox{loggers,WindowsConsoleLogger}.
72 #endif
73};
74
75//==================================================================================================
76/// Variable data struct, defining the verbosities of the domains of a \e Logger in a \e Lox.
77/// This struct is used with the \ref alib_mod_variables "configuration variable" named
78/// \ref alxcvALOX_LOGGERNAME_VERBOSITY_WITH_LOXNAME.
79///
80/// Note that during the run of software, the verbosity values are stored differently and this
81/// variable type is only for importing and exporting such values to external systems.
82//==================================================================================================
83struct CVVerbosities : protected StringVectorPA
84{
85 bool ExportAll= false; ///< Determines whether only the minimum necessary domain tree
86 ///< is written when verbosities are exported.
87 ///< If \c true, redundant verbosity information is given,
88 ///< even if Subdomains have the same value.
89 /// Constructor.
90 /// @param pAllocator The allocator to use.
92 : StringVectorPA(pAllocator) {}
93
94 /// Destructor. Frees all allocated strings.
96
98 using StringVectorPA::begin;
99 using StringVectorPA::end;
101
102 /// @return \c true if this vector is empty, \c false otherwise.
103 bool IsEmpty() { return empty(); }
104
105 /// Frees all allocated strings and clears vector.
106 void Clear()
107 {
108 for ( auto it = begin() ; it != end() ; ++it )
109 it->Free( GetAllocator() );
110 clear();
111 }
112};
113
114//==================================================================================================
115/// This is the camp class for \alox logging library residing in namespace \ref alib::lox.
116///
117/// This is a strict singleton class. The only instance is found with the namespace variable
118/// \ref alib::ALOX.
119//==================================================================================================
120class ALoxCamp : public camp::Camp
121{
122 public:
123 /// Constructor.<br>
124 /// While this is public, it must not be invoked as this is a strict singleton type.
125 /// (See notes in \ref alib_camp_camp).
126 ALoxCamp();
127
128 // Public fields
129 public:
130
131 #if defined(_WIN32)
132 /// Attributes of corresponding configuration variable \ref alxcvALOX_CODEPAGE
133 /// used by class \alox{loggers,WindowsConsoleLogger}.
135 #endif
136
137 /// Resets this object. Concretely, the following steps are performed:
138 /// - If the debug lox singleton exists, it is deleted.
139 /// - It is asserted that no other lox object is registered.
140 /// - The \alox path of the configuration is deleted.
141 ///
142 /// \attention
143 /// This method was introduced to support resetting \alox in the unit tests.
144 /// In real applications, this method should NOT be used.
145 /// Side effects might appear using this method and it is not tested otherwise than
146 /// used in tests!
147 ALIB_DLL void Reset();
148
149 // Internals
150 protected:
151 /// Implementation of \alib{camp;Camp::Bootstrap}.
152 virtual void Bootstrap() override;
153
154 /// Implementation of \alib{camp;Camp::Shutdown}.
155 /// @param phase The shutdown phase to perform.
156 virtual void Shutdown( ShutdownPhases phase ) override;
157
158};// class ALoxCamp
159
160} // namespace alib[::lox]
161
162/// The singleton instance of \alibcamp class \alib{lox;ALoxCamp}.
164
165} // namespace [alib]
166
169
170// #################################################################################################
171// AppendableTraits<Scope> / AppendableTraits<Verbosity>
172// #################################################################################################
173#if !DOXYGEN
174ALIB_EXPORT namespace alib::strings {
175
176template<> struct AppendableTraits<Scope,nchar, lang::HeapAllocator>
177{
179 void operator()( TAString<nchar, lang::HeapAllocator>& target, const Scope src );
180};
181
182template<> struct AppendableTraits<Pair<Verbosity, Priority>,nchar, lang::HeapAllocator>
183{
185 void operator()( TAString<nchar, lang::HeapAllocator>& target, const Pair<Verbosity, Priority>& src );
186};
187
188} // namespace [alib::strings]
189#endif // !DOXYGEN
190
192
193
virtual void Bootstrap() override
Implementation of Camp::Bootstrap.
Definition aloxcamp.cpp:105
ALIB_DLL void Reset()
Definition aloxcamp.cpp:73
static ALIB_DLL variables::Declaration CODEPAGE
Definition aloxcamp.inl:134
integer Add(const strings::TString< character > &src)
#define ALIB_DLL
Definition alib.inl:496
#define A_CHAR(STR)
#define ALIB_ENUMS_ASSIGN_RECORD(TEnum, TRecord)
#define ALIB_VARIABLES_DEFINE_TYPE_WITH_POOL_CONSTRUCTOR(Namespace, CPPName, CfgTypeString)
#define ALIB_EXPORT
Definition alib.inl:488
#define ALIB_RESOURCED_IN_MODULE(T, Camp, ResName)
@ FORMAT_TIME_DIFF
Denotes configuration variable ALOX/LOGGERNAME/FORMAT_TIME_DIFF used by class TextLogger.
Definition aloxcamp.inl:58
@ CONSOLE_LIGHT_COLORS
Denotes configuration variable ALOX/CONSOLE_LIGHT_COLORS used by colorful specializations of class Te...
Definition aloxcamp.inl:67
@ CONSOLE_TYPE
Denotes configuration variable ALOX/CONSOLE_TYPE used by Lox::CreateConsoleLogger.
Definition aloxcamp.inl:25
@ VERBOSITY
Denotes configuration variable ALOX/LOGGERNAME/VERBOSITY_WITH_LOXNAME.
Definition aloxcamp.inl:28
@ FORMAT
Denotes configuration variable ALOX/LOGGERNAME/FORMAT used by class TextLogger.
Definition aloxcamp.inl:49
@ DOMAIN_SUBSTITUTION
Denotes configuration variable ALOX/LOXNAME/DOMAIN_SUBSTITUTION used by class Lox.
Definition aloxcamp.inl:37
@ CODEPAGE
Denotes configuration variable ALOX/CODEPAGE used by class WindowsConsoleLogger.
Definition aloxcamp.inl:71
@ REPLACEMENTS
Denotes configuration variable ALOX/LOGGERNAME/REPLACEMENTS used by class TextLogger.
Definition aloxcamp.inl:64
@ DUMP_STATE_ON_EXIT
Denotes configuration variable ALOX/LOXNAME/DUMP_STATE_ON_EXIT used by class Lox.
Definition aloxcamp.inl:43
@ FORMAT_DATE_TIME
Denotes configuration variable ALOX/LOGGERNAME/FORMAT_DATE_TIME used by class TextLogger.
Definition aloxcamp.inl:52
@ FORMAT_MULTILINE
Denotes configuration variable ALOX/LOGGERNAME/FORMAT_MULTILINE used by class TextLogger.
Definition aloxcamp.inl:55
@ SPTR_GLOBAL
Denotes configuration variable ALOX/GLOBAL_SOURCE_PATH_TRIM_RULES.
Definition aloxcamp.inl:31
@ FORMAT_OTHER
Denotes configuration variable ALOX/LOGGERNAME/FORMAT_OTHER used by class TextLogger.
Definition aloxcamp.inl:61
@ SPTR_LOX
Denotes configuration variable ALOX/LOXNAME/SOURCE_PATH_TRIM_RULES used by class Lox.
Definition aloxcamp.inl:34
@ PREFIXES
Denotes configuration variable ALOX/LOXNAME/PREFIXES used by class Lox.
Definition aloxcamp.inl:40
@ NO_IDE_LOGGER
Denotes configuration variable ALOX/NO_IDE_LOGGER used by Log::AddDebugLogger.
Definition aloxcamp.inl:22
@ AUTO_SIZES
Denotes configuration variable ALOX/LOGGERNAME/AUTO_SIZES used by class TextLogger.
Definition aloxcamp.inl:46
lox::Scope Scope
Type alias in namespace alib.
ShutdownPhases
Termination levels usable with Bootstrapping ALib Camps.
Definition camp.inl:42
strings::util::TStringVector< character, PoolAllocator > StringVectorPA
Type alias in namespace alib.
boxing::Pair< T, U > Pair
Type alias in namespace alib.
alib::variables::Priority Priority
Type alias in namespace alib.
characters::nchar nchar
Type alias in namespace alib.
lox::ALoxCamp ALOX
The singleton instance of ALib Camp class ALoxCamp.
Definition aloxcamp.cpp:53
lang::HeapAllocator HeapAllocator
Type alias in namespace alib.
lox::Verbosity Verbosity
Type alias in namespace alib.
ALIB_DLL void Shutdown()
void Clear()
Frees all allocated strings and clears vector.
Definition aloxcamp.inl:106
CVVerbosities(AllocatorType &pAllocator)
Definition aloxcamp.inl:91
~CVVerbosities()
Destructor. Frees all allocated strings.
Definition aloxcamp.inl:95
void operator()(TAString< TChar > &target, const TAppendable &src)