ALib C++ Framework
by
Library Version: 2605 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
aloxcamp.hpp
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/// Copyright 2013-2026 A-Worx GmbH, Germany.
6/// Published under #"mainpage_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/// #"alib_enums_records;ALib Enum Records" of type #"var 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 #"BASECAMP;2".
18//==================================================================================================
19enum class Variables {
20 /// Denotes configuration variable #"alxcvALOX_NO_IDE_LOGGER" used by #"Log::AddDebugLogger;2".
22
23 /// Denotes configuration variable #"alxcvALOX_CONSOLE_TYPE" used by #"Lox::CreateConsoleLogger;2".
25
26 /// Denotes configuration variable #"alxcvALOX_LOGGERNAME_VERBOSITY_WITH_LOXNAME".
28
29 /// Denotes configuration variable #"alxcvALOX_GLOBAL_SOURCE_PATH_TRIM_RULES".
31
32 /// Denotes configuration variable #"alxcvALOX_LOXNAME_SOURCE_PATH_TRIM_RULES" used by class #"Lox".
34
35 /// Denotes configuration variable #"alxcvALOX_LOXNAME_DOMAIN_SUBSTITUTION" used by class #"Lox".
37
38 /// Denotes configuration variable #"alxcvALOX_LOXNAME_PREFIXES" used by class #"Lox".
40
41 /// Denotes configuration variable #"alxcvALOX_LOXNAME_DUMP_STATE_ON_EXIT" used by class #"Lox".
43
44 /// Denotes configuration variable #"alxcvALOX_LOGGERNAME_AUTO_SIZES" used by class #"TextLogger".
46
47 /// Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT" used by class #"TextLogger".
48 FORMAT = 21,
49
50 /// Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT_DATE_TIME" used by class #"TextLogger".
52
53 /// Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT_MULTILINE" used by class #"TextLogger".
55
56 /// Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT_TIME_DIFF" used by class #"TextLogger".
58
59 /// Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT_OTHER" used by class #"TextLogger".
61
62 /// Denotes configuration variable #"alxcvALOX_LOGGERNAME_REPLACEMENTS" used by class #"TextLogger".
64
65 /// Denotes configuration variable #"alxcvALOX_CONSOLE_LIGHT_COLORS" used by colorful specializations of class #"TextLogger".
67
68 #if defined(_WIN32)
69 /// Denotes configuration variable #"alxcvALOX_CODEPAGE" used by the class #"WindowsConsoleLogger".
71 #endif
72};
73
74//==================================================================================================
75/// Variable data struct, defining the verbosities of the domains of a \e Logger in a \e Lox.
76/// This struct is used with the #"alib_mod_variables;configuration variable" named
77/// #"alxcvALOX_LOGGERNAME_VERBOSITY_WITH_LOXNAME".
78///
79/// Note that during the run of software, the verbosity values are stored differently and this
80/// variable type is only for importing and exporting such values to external systems.
81//==================================================================================================
82struct CVVerbosities : protected StringVectorPA {
83 /// Determines whether only the minimum necessary domain tree is written when the verbosities
84 /// are exported. If \c true, redundant verbosity information is given, even if Subdomains
85 /// have the same value.
86 bool ExportAll =false;
87
88 /// Determines whether changes should be written back to configuration sources, if possible.
89 /// @see Methods #"Lox::SetVerbosityExport(detail::Logger*);2", #"Variable::IsWriteBack;2",
90 /// and the virtual method used to implement this feature: #"VMeta::isWriteBack;2".
91 bool WriteBack =false;
92
93 /// Constructor.
94 /// @param pAllocator The allocator to use.
96 : StringVectorPA(pAllocator) {}
97
98 /// Destructor. Frees all allocated strings.
100
102 using StringVectorPA::begin;
103 using StringVectorPA::end;
105
106 /// @return \c true if this vector is empty, \c false otherwise.
107 bool IsEmpty() { return empty(); }
108
109 /// Frees all allocated strings and clears vector.
110 void Clear() {
111 for ( auto it = begin() ; it != end() ; ++it )
112 it->Free( GetAllocator() );
113 clear();
114 }
115};
116
117//==================================================================================================
118/// This is the camp class for \alox logging library residing in namespace #"alib::lox".
119///
120/// This is a strict singleton class. The only instance is found with the namespace variable
121/// #"alib::ALOX".
122//==================================================================================================
123class ALoxCamp : public camp::Camp {
124 public:
125 /// Constructor.<br>
126 /// While this is public, it must not be invoked as this is a strict singleton type.
127 /// (See notes in #"alib_camp_camp").
128 ALoxCamp();
129
130 // Public fields
131 public:
132
133 #if defined(_WIN32)
134 /// Attributes of corresponding configuration variable #"alxcvALOX_CODEPAGE"
135 /// used by class #"WindowsConsoleLogger".
137 #endif
138
139 /// Resets this object. Concretely, the following steps are performed:
140 /// - If the debug lox singleton exists, it is deleted.
141 /// - It is asserted that no other lox object is registered.
142 /// - The \alox path of the configuration is deleted.
143 ///
144 /// \attention
145 /// This method was introduced to support resetting \alox in the unit tests.
146 /// In real applications, this method should NOT be used.
147 /// Side effects might appear using this method and it is not tested otherwise than
148 /// used in tests!
149 ALIB_DLL void Reset();
150
151 // Internals
152 protected:
153 /// Implementation of #"Camp::Bootstrap;*".
154 void Bootstrap() override;
155
156 /// Implementation of #"Camp::Shutdown;*".
157 /// @param phase The shutdown phase to perform.
158 void Shutdown( ShutdownPhases phase ) override;
159
160};// class ALoxCamp
161
162} // namespace alib[::lox]
163
164/// The singleton instance of \alibcamp class #"ALoxCamp".
166
167} // namespace [alib]
168
171
172//##################################################################################################
173// AppendableTraits<Scope> / AppendableTraits<Verbosity>
174//##################################################################################################
175#if !DOXYGEN
176ALIB_EXPORT namespace alib::strings {
177
178template<> struct AppendableTraits<Scope,nchar, lang::HeapAllocator> {
180 void operator()( TAString<nchar, lang::HeapAllocator>& target, const Scope src );
181};
182
183template<> struct AppendableTraits<Pair<Verbosity, Priority>,nchar, lang::HeapAllocator> {
185 void operator()( TAString<nchar, lang::HeapAllocator>& target, const Pair<Verbosity, Priority>& src );
186};
187
188} // namespace [alib::strings]
189
191struct VMeta_CVVerbosities : public VMeta {
192 ALIB_DLL String typeName () const override { return A_CHAR("ALOXV"); }
193ALIB_DBG(ALIB_DLL const std::type_info& dbgTypeID() override { return typeid(alib::lox::CVVerbosities); } )
194 ALIB_DLL void construct(VDATA* obj, PoolAllocator& pool) override { new (obj) alib::lox::CVVerbosities(pool); }
195 ALIB_DLL void destruct (VDATA* obj, PoolAllocator&) override { reinterpret_cast<alib::lox::CVVerbosities*>(obj)->~CVVerbosities(); }
196 ALIB_DLL size_t size () override { static_assert(alignof(alib::lox::CVVerbosities) <= alib::PoolAllocator::MAX_ALIGNMENT); return (std::max)( sizeof(alib::lox::CVVerbosities), sizeof(void*) ); }
197 ALIB_DLL void imPort (VDATA*, Configuration&, const StringEscaper&, const String&) override;
198 ALIB_DLL void exPort (VDATA*, Configuration&, const StringEscaper&, AString&) override;
199 ALIB_DLL bool isWriteBack(VDATA* obj) const override { return reinterpret_cast<alib::lox::CVVerbosities*>(obj)->WriteBack; }
200};}
201#endif // !DOXYGEN
#define ALIB_DLL
#define A_CHAR(STR)
#define ALIB_EXPORT
#define ALIB_DBG(...)
#define ALIB_RESOURCED_IN_CAMP(T, Camp, ResName)
void Bootstrap() override
Implementation of #"Camp::Bootstrap;*".
Definition aloxcamp.cpp:140
static variables::Declaration CODEPAGE
Definition aloxcamp.hpp:136
integer Add(const strings::TString< character > &src)
Definition vector.hpp:81
#define ALIB_ENUMS_ASSIGN_RECORD(TEnum, TRecord)
void typeName(const detail::VTable *vtable, AString &result)
@ FORMAT_TIME_DIFF
Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT_TIME_DIFF" used by class #"TextLogger".
Definition aloxcamp.hpp:57
@ CONSOLE_LIGHT_COLORS
Denotes configuration variable #"alxcvALOX_CONSOLE_LIGHT_COLORS" used by colorful specializations of ...
Definition aloxcamp.hpp:66
@ CONSOLE_TYPE
Denotes configuration variable #"alxcvALOX_CONSOLE_TYPE" used by #"Lox::CreateConsoleLogger;2".
Definition aloxcamp.hpp:24
@ VERBOSITY
Denotes configuration variable #"alxcvALOX_LOGGERNAME_VERBOSITY_WITH_LOXNAME".
Definition aloxcamp.hpp:27
@ FORMAT
Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT" used by class #"TextLogger".
Definition aloxcamp.hpp:48
@ DOMAIN_SUBSTITUTION
Denotes configuration variable #"alxcvALOX_LOXNAME_DOMAIN_SUBSTITUTION" used by class #"Lox".
Definition aloxcamp.hpp:36
@ CODEPAGE
Denotes configuration variable #"alxcvALOX_CODEPAGE" used by the class #"WindowsConsoleLogger".
Definition aloxcamp.hpp:70
@ REPLACEMENTS
Denotes configuration variable #"alxcvALOX_LOGGERNAME_REPLACEMENTS" used by class #"TextLogger".
Definition aloxcamp.hpp:63
@ DUMP_STATE_ON_EXIT
Denotes configuration variable #"alxcvALOX_LOXNAME_DUMP_STATE_ON_EXIT" used by class #"Lox".
Definition aloxcamp.hpp:42
@ FORMAT_DATE_TIME
Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT_DATE_TIME" used by class #"TextLogger".
Definition aloxcamp.hpp:51
@ FORMAT_MULTILINE
Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT_MULTILINE" used by class #"TextLogger".
Definition aloxcamp.hpp:54
@ SPTR_GLOBAL
Denotes configuration variable #"alxcvALOX_GLOBAL_SOURCE_PATH_TRIM_RULES".
Definition aloxcamp.hpp:30
@ FORMAT_OTHER
Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT_OTHER" used by class #"TextLogger".
Definition aloxcamp.hpp:60
@ SPTR_LOX
Denotes configuration variable #"alxcvALOX_LOXNAME_SOURCE_PATH_TRIM_RULES" used by class #"Lox".
Definition aloxcamp.hpp:33
@ PREFIXES
Denotes configuration variable #"alxcvALOX_LOXNAME_PREFIXES" used by class #"Lox".
Definition aloxcamp.hpp:39
@ NO_IDE_LOGGER
Denotes configuration variable #"alxcvALOX_NO_IDE_LOGGER" used by #"Log::AddDebugLogger;2".
Definition aloxcamp.hpp:21
@ AUTO_SIZES
Denotes configuration variable #"alxcvALOX_LOGGERNAME_AUTO_SIZES" used by class #"TextLogger".
Definition aloxcamp.hpp:45
Definition alox.cpp:14
lox::Verbosity Verbosity
Type alias in namespace #"%alib".
variables::Priority Priority
Type alias in namespace #"%alib".
lang::HeapAllocator HeapAllocator
Type alias in namespace #"%alib".
lox::ALoxCamp ALOX
The singleton instance of ALib Camp class #"ALoxCamp".
Definition aloxcamp.cpp:5
ShutdownPhases
Termination levels usable with #"alib_mod_bs_camps;Bootstrapping ALib Camps".
Definition camp.hpp:40
strings::util::TStringVector< character, PoolAllocator > StringVectorPA
Type alias in namespace #"%alib".
Definition vector.hpp:110
strings::TString< character > String
Type alias in namespace #"%alib".
Definition string.hpp:2165
boxing::Pair< T, U > Pair
Type alias in namespace #"%alib".
characters::nchar nchar
Type alias in namespace #"%alib".
void Shutdown()
lox::Scope Scope
Type alias in namespace #"%alib".
void Clear()
Frees all allocated strings and clears vector.
Definition aloxcamp.hpp:110
CVVerbosities(AllocatorType &pAllocator)
Definition aloxcamp.hpp:95
~CVVerbosities()
Destructor. Frees all allocated strings.
Definition aloxcamp.hpp:99
void operator()(TAString< TChar > &target, const TAppendable &src)