204 template<
typename TDerived, auto TMethodAddress >
208 static void Wrapper(
App& base) {
209 auto& self =
static_cast<TDerived&
>(base);
210 (self.*TMethodAddress)();
214 return Command { state, &Helper::Wrapper };
240 for ( it= begin() ; it!= end() && it->State != anchor ; ++it)
259 for ( ; it!= end() && it->State != anchor ; ++it)
264 insert(it== end() ? begin() : it + 1, cmd );
336 target <<
"Unused (later) exit-code: " << ec <<
NEW_LINE;
465 virtual int Main(
int argc,
const char** argv,
const wchar_t** argvw=
nullptr );
720template<
typename TApp= app::App>
733# define LOX_LOX (*::alib::app::APP_SINGLETON->GetRLox())
#define ALIB_ASSERT_ERROR(cond, domain,...)
virtual void onBsImportConfig()
virtual void onBsPreloadVariables()
virtual void onBsSetNameVersionAndInfo()
@ NOT_STARTED
Initial state before starting the App.
@ CleanALox
Invokes the virtual method onSdCleanALox.
@ ExportConfig
Invokes the virtual method onSdExportConfig.
@ SetCamps
Invokes the virtual method #"onBsSetCamps".
@ FinalizeBootstrap
Invokes the virtual method onBsFinalizeBootstrap.
@ Output
Invokes the virtual method onSdOutput.
@ RunStart
Invokes the virtual method onRunStart.
@ FinalizeShutdown
Invokes the virtual method onSdFinalizeShutdown.
@ SetupALox
Invokes the virtual method onBsSetupALox.
@ AnnounceShutdown
Invokes the virtual method onSdAnnounceShutdown.
@ PrepareResources
Invokes the virtual method #"onBsPrepareResources".
@ PrepareConfig
Invokes the virtual method onBsPrepareConfig.
@ PreloadVariables
Invokes the virtual method onBsPreloadVariables.
@ Run
Invokes the virtual method onRun.
@ SetNameVersionAndInfo
Invokes the virtual method onBsSetNameVersionAndInfo.
@ ImportConfig
Invokes the virtual method onBsImportConfig.
@ RunEnd
Invokes the virtual method onRunEnd.
virtual void onSdFinalizeShutdown()
virtual void onBsSetCamps()
virtual lox::textlogger::TextLogger * GetRLogger()
StateMachine machine
The state-machine singleton.
virtual int Main(int argc, const char **argv, const wchar_t **argvw=nullptr)
virtual void onSdOutput()
virtual void getConfigFilePathsFromResources(StdVectorMA< ConfigFileDescriptor > &files)
virtual void onBsPrepareConfig()
virtual ~App()
Virtual destructor.
virtual Enum exceptionToExitCode(alib::Exception &exception)
Flags
Configuration flags used with class #"App".
@ UseReleaseLoggerForDebugLogging
@ ALoxVerbosityExportAllAndWriteBackDbgLogger
@ ALoxVerbosityExportAllAndWriteBackRelLogger
virtual void onSdCleanALox()
virtual void onRunStart()
virtual void onBsPrepareResources()
virtual void printConfigFileInfo(Paragraphs &target)
virtual void exceptionDisplay(Exception &exception, AString &target)
virtual void onBsSetupALox()
Flags flags
Various boolean flags used to configure the application.
virtual lox::Lox * GetRLox()
virtual void onSdAnnounceShutdown()
virtual void getConfigFilePaths(StdVectorMA< ConfigFileDescriptor > &files)
virtual void getConfigFilePathsMakeAbsolutePaths(StdVectorMA< ConfigFileDescriptor > &files)
lox::textlogger::TextLogger * releaseLogger
@ ErrUnknown
An unknown exception occurred.
@ ErrConfigFileNotWritable
The configuration file(s) could not be written.
virtual void onBsFinalizeBootstrap()
Paragraphs * cErr
Same as cOut, but used for stream std::err.
virtual void onSdExportConfig()
This class acts as a container for Loggers and provides a convenient interface to logging.
#define ALIB_ENUMS_MAKE_BITWISE(TEnum)
constexpr CString NEW_LINE
A zero-terminated string containing the new-line character sequence.
time::StopWatch StopWatch
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
system::Path Path
Type alias in namespace alib.
exceptions::Exception Exception
Type alias in namespace alib.
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
format::Paragraphs Paragraphs
Type alias in namespace alib.
std::vector< T, StdMA< T > > StdVectorMA
Type alias in namespace alib.
boxing::Enum Enum
Type alias in namespace alib.
Path Pathname
The resolved full path to the file.
bool WasEmpty
If set, the file did not exist or was empty at the start of the application.
String Comment
The files' main comment to set, in case it does not exist, yet.
bool FromCfgOption
If set, the file name (and maybe path) came from option '–CONFIG'.
void AddBefore(Enum anchor, const Command &cmd)
void AddAfter(Enum anchor, const Command &cmd)
A struct denoting the next state and the corresponding method to execute.
static Command MakeCustom(Enum state)
void SetExitCode(Enum pExitCode)
CommandList Program
The list of commands to execute.
Enum exitCode
The exit code. Only the first set is stored and returned later.
void DbgDumpFurtherExitCodes(AString &target)
std::vector< Enum > dbgFurtherExitCodes
TIntegral Integral() const
void(* Custom)(App &)
A pointer to a method of a custom derived type.
MethodPointer(void(App::*method)())
MethodPointer(void(*method)(App &))
void(App::* BuiltIn)()
A pointer to a virtual method of class App.