ALib C++ Framework
by
Library Version: 2605 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
basecamp.hpp
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of module \alib_camp of the \aliblong.
4///
5/// Copyright 2013-2026 A-Worx GmbH, Germany.
6/// Published under #"mainpage_license".
7//==================================================================================================
8ALIB_EXPORT namespace alib {
9
10//==================================================================================================
11/// This is the reference documentation of module \alib_camp_nl of the \aliblong.<br>
12/// Besides the few entities found and documented here (namely in namespace
13/// <em>alib::camp</em>), this module <em>"injects"</em> several overloaded versions of
14/// the function #"CampVariable(camp::Camp&);CampVariable" into namespace <em>alib::variables</em>.
15/// @see
16/// Please also consult the #"alib_mod_camp;Programmer's Manual" of this module.
17//==================================================================================================
18namespace camp {
19
20
21//##################################################################################################
22// Variables
23//##################################################################################################
24
25/// Configuration variables of \alib.
26/// \note
27/// As required by module \alib_variables, this enumeration is equipped with
28/// #"alib_enums_records;ALib Enum Records" of type #"var Declaration"
29/// and resourced with this module.<br>
30/// Hence, all variable categories, names, default values and such can be modified
31/// by modifying the resource data of the singleton of class #"Basecamp".
32enum class Variables {
33 LOCALE = 1 , ///< See #"alibcvALIB_LOCALE".
34 WAIT_FOR_KEY_PRESS = 2 , ///< See #"alibcvALIB_WAIT_FOR_KEY_PRESS".
35 HAS_CONSOLE_WINDOW = 3 , ///< See #"alibcvALIB_HAS_CONSOLE_WINDOW".
36};
37
38
39//==================================================================================================
40/// This is a strict singleton class representing module \alib_camp.
41/// The only instance is found with the namespace variable #"alib::BASECAMP;2".
42///
43/// @see
44/// For detailed descriptions, please consult the chapter #"alib_camp_basecamp" of the
45/// Programmer's Manual of the module \alib_camp_nl.
46//==================================================================================================
47class Basecamp : public Camp {
48 public:
49 /// If \c true, within #".Shutdown", it is waited for a key press in the console
50 /// window.<br>
51 /// By default, this flag is enabled when debugging a console application under Visual
52 /// Studio.<br>
53 /// This default behavior can be overruled by setting configuration variable
54 /// #"alibcvALIB_WAIT_FOR_KEY_PRESS".<br>
55 /// In addition, this public flag may be modified at runtime (after method #"Bootstrap" was
56 /// invoked).
58
59 /// This flag indicates if the current process has console output window attached.
60 /// While this is not detectable in Unix like systems (or just with huge efforts), in
61 /// windows it is. The determination is performed in #"Bootstrap" and done as follows
62 /// - If configuration variable \b ALIB_HAS_CONSOLE_WINDOW
63 /// is set, its value is returned.
64 /// - Otherwise, on Unix like OS\c true is returned.
65 /// - On Windows OS it is determined if a console window is attached to the process
66 /// using system call \e GetConsoleWindow() and compare its result to \e NULL.
67 ///
68 /// In addition, this public flag may be modified at runtime (after method #"Bootstrap" was
69 /// invoked).
70 ///
71 /// \note
72 /// The evaluation of configuration variable \b ALIB_HAS_CONSOLE_WINDOW is done
73 /// only if module \alib_variables is included in the \alibbuild.
75
76 /// This string is set during bootstrapping in the case that a locale information was
77 /// found (via standard environment variables or \alib variable #"Variables::LOCALE")
78 /// and successfully set.<br>
79 /// Otherwise this string is \e nulled.
81
82 /// Constructor.<br>
83 /// While this is public, it must not be invoked as this is a strict singleton type.
84 /// (See notes in #"alib_camp_camp").
86 Basecamp();
87
88 /// Implementation of #"Camp::Bootstrap;*".
89 ///
90 /// In phase #"BootstrapPhases::Final;2" performs:
91 /// - In glibc versions of \alib (GNU/unix) probably invoke glibc method
92 /// <em>setlocale()</em>, depending on the setting of the environment variables
93 /// <em>LANG</em> and <em>LANGUAGE</em> and depending on \alib configuration variable
94 /// #"alibcvALIB_LOCALE".
95 ///
96 /// In addition, invokes
97 /// #"TNumberFormat::SetFromLocale" on static singleton
98 /// #"TNumberFormat::Global;NumberFormat::Global".
99 ///
100 /// - Config variable #"WAIT_FOR_KEY_PRESS" is read and the field
101 /// #"WaitForKeyPressOnTermination" set accordingly.
103 virtual void Bootstrap() override;
104
105 /// Terminates this camp.
106 /// @param phase The shutdown phase to perform.
108 virtual void Shutdown( ShutdownPhases phase) override;
109
110 //################################################################################################
111 // Environment definition/detection
112 //################################################################################################
113 /// If \c true, the current process is under the hood of a debugger.
114 ///
115 /// @return \c true if the application is run in a debugger.
117 bool IsDebuggerPresent();
118
119}; // class Basecamp
120
121} // namespace alib[::camp]
122
123/// The singleton instance of \alibcamp class #"Basecamp".
125
126} // namespace [alib]
127
128
129
131ALIB_RESOURCED_IN_CAMP( alib::format::FMTExceptions , alib::BASECAMP, "FE" )
132
133ALIB_RESOURCED_IN_CAMP( alib::variables::Exceptions , alib::BASECAMP, "VARE" )
134
135DOX_MARKER([DOX_VARIABLES_DECLARATION5])
136ALIB_CAMP_ENUM( alib::camp::Variables, alib::variables::Declaration, alib::BASECAMP, "Var" )
137DOX_MARKER([DOX_VARIABLES_DECLARATION5])
138ALIB_RESOURCED_IN_CAMP( alib::variables::Priority , alib::BASECAMP, "VarPrio" )
#define ALIB_DLL
#define ALIB_EXPORT
#define ALIB_CAMP_ENUM(T, TRecord, Camp, ResName)
#define ALIB_RESOURCED_IN_CAMP(T, Camp, ResName)
bool WaitForKeyPressOnTermination
Definition basecamp.hpp:57
virtual void Bootstrap() override
Definition basecamp.cpp:181
Camp(const NCString &resourceCategory)
Definition camp.hpp:104
@ HAS_CONSOLE_WINDOW
See #"alibcvALIB_HAS_CONSOLE_WINDOW".
Definition basecamp.hpp:35
@ LOCALE
See #"alibcvALIB_LOCALE".
Definition basecamp.hpp:33
@ WAIT_FOR_KEY_PRESS
See #"alibcvALIB_WAIT_FOR_KEY_PRESS".
Definition basecamp.hpp:34
Definition alox.cpp:14
ShutdownPhases
Termination levels usable with #"alib_mod_bs_camps;Bootstrapping ALib Camps".
Definition camp.hpp:40
strings::TString< character > String
Type alias in namespace #"%alib".
Definition string.hpp:2165
camp::Basecamp BASECAMP
The singleton instance of ALib Camp class #"Basecamp".
Definition basecamp.cpp:2
void Shutdown()