ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
system.hpp
Go to the documentation of this file.
1 /** ************************************************************************************************
2  * \file
3  * This header file is part of module \alib_system of the \aliblong.
4  *
5  * \emoji :copyright: 2013-2023 A-Worx GmbH, Germany.
6  * Published under \ref mainpage_license "Boost Software License".
7  **************************************************************************************************/
8 #ifndef HPP_ALIB_SYSTEM_SYSTEM
9 #define HPP_ALIB_SYSTEM_SYSTEM 1
10 
11 #if !defined(HPP_ALIB_SYSTEM_ERRORS)
13 #endif
14 
15 ALIB_ASSERT_MODULE(SYSTEM)
16 
17 #if !defined(HPP_ALIB_FS_MODULES_MODULE)
19 #endif
20 
21 namespace aworx { namespace lib {
22 
23 /** ************************************************************************************************
24  * Types found in this namespace comprise module \alib_system_nl. This module collects types
25  * and functions that are interfacing with the operating system, hardware drivers etc.
26  *
27  * \note
28  * As of today, the term "collects" unfortunately expresses very well that this module and
29  * namespace is not developed with a plan and road map. Instead, types are added when other
30  * modules / software need them. While this hopefully changes in the future, it has to be
31  * stated that the functionality found in this module is rather limited.
32  **************************************************************************************************/
33 namespace system {
34 
35 /** ************************************************************************************************
36  * This is a strict singleton class representing module \alib_system.
37  *
38  * The only instance is found with namespace variable \ref aworx::lib::SYSTEM.
39  *
40  * ## Friends ##
41  * class \alib{system,CalendarDateTime}
42  **************************************************************************************************/
43 class System : public Module
44 {
45  #if !defined(ALIB_DOX)
46  friend class CalendarDateTime;
47  #endif
48 
49  public:
50  /** ****************************************************************************************
51  * Constructor.<br>
52  * While this is public, it must not be invoked as this is a strict singleton type.
53  * (See notes in \ref alib_manual_bootstrapping_class_module_singletons).
54  ******************************************************************************************/
55  System();
56 
57  protected:
58  /** ****************************************************************************************
59  * Initializes this module.
60  *
61  * @param phase The initialization phase to perform.
62  * @param argc The number of command line arguments. Defaults to \c 0.
63  * @param argv List of command line arguments if given as single byte character strings.
64  * @param wargv List of command line arguments if given as multi-byte character strings.
65  ******************************************************************************************/
66  virtual void bootstrap( BootstrapPhases phase,
67  int argc, const char** argv, const wchar_t** wargv ) override;
68 
69  /** ****************************************************************************************
70  * Terminates this module. (Nothing to do.)
71  * @param phase The shutdown phase to perform.
72  ******************************************************************************************/
73  virtual void shutdown( ShutdownPhases phase ) override
74  { (void) phase; }
75 
76 }; // class System
77 
78 
79 
80 /** ************************************************************************************************
81  * Implementation of \alib{text,FFormat} for boxable type \alib{time,DateTime}.<br>
82  * Writes the content of \p{box} (which is of type \b %DateTime) to the given \b %AString
83  * object \p{target} using a local instance of class \alib{system,CalendarDateTime} and its method
84  * \alib{system,CalendarDateTime::Format}.
85  *
86  * If parameter \p{formatSpec} is empty, a default format string defined by string resource
87  * of key \b "DFMT" is used.
88  *
89  * \note
90  * This interface implementation is only available if modules \alib_system and \alib_time
91  * are included in the library distribution.
92  *
93  * @param self The box that the function was invoked on.
94  * @param formatSpec The specification of the format.
95  * @param target The AString object receiving the formatted string.
96  **************************************************************************************************/
97 ALIB_API void
98 FFormat_DateTime( const Box & self, const String & formatSpec, AString & target );
99 
100 
101 } // namespace aworx::lib[::system]
102 
103 /** The singleton of module-class \alib{system,System}. */
104 extern ALIB_API system::System SYSTEM;
105 
106 }} // namespace [aworx::lib]
107 
111 
112 ALIB_BOXING_VTABLE_DECLARE( aworx::lib::system::SystemErrors , vt_system_systemerrors )
113 ALIB_ENUMS_ASSIGN_RECORD( aworx::lib::system::SystemErrors , aworx::lib::results::ERException )
114 ALIB_RESOURCED_IN_MODULE( aworx::lib::system::SystemErrors , aworx::lib::SYSTEM, "SE" )
115 
116 
117 #endif // HPP_ALIB_SYSTEM_SYSTEM
ALIB_ASSERT_MODULE
#define ALIB_ASSERT_MODULE(modulename)
Definition: modules.hpp:237
ALIB_RESOURCED_IN_MODULE
#define ALIB_RESOURCED_IN_MODULE(T, Module, ResName)
Definition: resources.hpp:648
aworx::lib::system::System
Definition: system.hpp:43
aworx::lib::Module::ShutdownPhases
ShutdownPhases
Definition: module.hpp:88
aworx::lib::Module::BootstrapPhases
BootstrapPhases
Definition: module.hpp:78
aworx::lib::SYSTEM
system::System SYSTEM
Definition: system.cpp:58
aworx::lib::system::System::System
System()
Definition: system.cpp:94
ALIB_BOXING_VTABLE_DECLARE
#define ALIB_BOXING_VTABLE_DECLARE(TMapped, Identifier)
Definition: vtable.inl:477
aworx::lib::strings::TString< character >
systemerrors.hpp
aworx::lib::system::System::shutdown
virtual void shutdown(ShutdownPhases phase) override
Definition: system.hpp:73
aworx::lib::system::Exceptions
Exceptions
Definition: systemerrors.hpp:281
aworx::lib::system::CalendarDateTime
Definition: calendar.hpp:58
aworx::lib::results::ERException
Definition: exception.hpp:62
aworx
Definition: alox/alox.hpp:40
aworx::lib::strings::TAString< character >
module.hpp
ALIB_ENUMS_ASSIGN_RECORD
#define ALIB_ENUMS_ASSIGN_RECORD(TEnum, TRecord)
Definition: records.hpp:769
ALIB_API
#define ALIB_API
Definition: compilers.hpp:150
aworx::lib::system::SystemErrors
SystemErrors
Definition: systemerrors.hpp:28
aworx::lib::system::FFormat_DateTime
ALIB_API void FFormat_DateTime(const Box &self, const String &formatSpec, AString &target)
aworx::lib::Module
Definition: module.hpp:74
aworx::lib::system::System::bootstrap
virtual void bootstrap(BootstrapPhases phase, int argc, const char **argv, const wchar_t **wargv) override
Definition: system.cpp:102
aworx::lib::boxing::Box
Definition: box.inl:33