ALib C++ Library
Library Version: 2511 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 for ( auto it = begin() ; it != end() ; ++it )
108 it->Free( GetAllocator() );
109 clear();
110 }
111};
112
113//==================================================================================================
114/// This is the camp class for \alox logging library residing in namespace \ref alib::lox.
115///
116/// This is a strict singleton class. The only instance is found with the namespace variable
117/// \ref alib::ALOX.
118//==================================================================================================
119class ALoxCamp : public camp::Camp
120{
121 public:
122 /// Constructor.<br>
123 /// While this is public, it must not be invoked as this is a strict singleton type.
124 /// (See notes in \ref alib_camp_camp).
125 ALoxCamp();
126
127 // Public fields
128 public:
129
130 #if defined(_WIN32)
131 /// Attributes of corresponding configuration variable \ref alxcvALOX_CODEPAGE
132 /// used by class \alox{loggers,WindowsConsoleLogger}.
134 #endif
135
136 /// Resets this object. Concretely, the following steps are performed:
137 /// - If the debug lox singleton exists, it is deleted.
138 /// - It is asserted that no other lox object is registered.
139 /// - The \alox path of the configuration is deleted.
140 ///
141 /// \attention
142 /// This method was introduced to support resetting \alox in the unit tests.
143 /// In real applications, this method should NOT be used.
144 /// Side effects might appear using this method and it is not tested otherwise than
145 /// used in tests!
146 ALIB_DLL void Reset();
147
148 // Internals
149 protected:
150 /// Implementation of \alib{camp;Camp::Bootstrap}.
151 virtual void Bootstrap() override;
152
153 /// Implementation of \alib{camp;Camp::Shutdown}.
154 /// @param phase The shutdown phase to perform.
155 virtual void Shutdown( ShutdownPhases phase ) override;
156
157};// class ALoxCamp
158
159} // namespace alib[::lox]
160
161/// The singleton instance of \alibcamp class \alib{lox;ALoxCamp}.
163
164} // namespace [alib]
165
168
169//##################################################################################################
170// AppendableTraits<Scope> / AppendableTraits<Verbosity>
171//##################################################################################################
172#if !DOXYGEN
173ALIB_EXPORT namespace alib::strings {
174
175template<> struct AppendableTraits<Scope,nchar, lang::HeapAllocator>
176{
178 void operator()( TAString<nchar, lang::HeapAllocator>& target, const Scope src );
179};
180
181template<> struct AppendableTraits<Pair<Verbosity, Priority>,nchar, lang::HeapAllocator>
182{
184 void operator()( TAString<nchar, lang::HeapAllocator>& target, const Pair<Verbosity, Priority>& src );
185};
186
187} // namespace [alib::strings]
188#endif // !DOXYGEN
189
virtual void Bootstrap() override
Implementation of Camp::Bootstrap.
Definition aloxcamp.cpp:103
ALIB_DLL void Reset()
Definition aloxcamp.cpp:72
static ALIB_DLL variables::Declaration CODEPAGE
Definition aloxcamp.inl:133
integer Add(const strings::TString< character > &src)
#define ALIB_DLL
Definition alib.inl:503
#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:497
#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)