251 template<
typename TDerived, auto TMethodAddress >
255 static void Wrapper(
App& base) {
256 auto& self =
static_cast<TDerived&
>(base);
257 (self.*TMethodAddress)();
261 push_back({ state, &Helper::Wrapper });
334 target <<
"Unused (later) exit-code: " << ec <<
NEW_LINE;
465 virtual int Main(
int argc,
const char** argv,
const wchar_t** argvw=
nullptr );
706 virtual void onRun();
769template<
typename TApp= App>
#define ALIB_CAMP_ENUM(T, TRecord, Camp, ResName)
virtual void onRunStart()
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".
@ CLIReadOptions
Invokes the virtual method #"onBsCLIReadOptions".
@ RunStart
Invokes the virtual method #"onRunStart".
@ ConfigureCLI
Invokes the virtual method #"onBsConfigureCLI".
@ CLIDefine
Invokes the virtual method #"onBsCLIDefine".
@ 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".
@ ReadDryRunOption
Invokes the virtual method #"onBsReadDryRunOption".
@ 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.
NString releaseLoggerName
virtual int Main(int argc, const char **argv, const wchar_t **argvw=nullptr)
virtual void onSdOutput()
virtual void onBsReadDryRunOption()
virtual void getConfigFilePathsFromResources(StdVectorMA< ConfigFileDescriptor > &files)
virtual void onBsPrepareConfig()
virtual ~App()
Virtual destructor.
Parameters
Built-in parameters of commands and options used with class #"App".
@ Topic
Used with command help to optionally denote a help topic.
Flags
Configuration flags used with class #"App".
@ UseReleaseLoggerForDebugLogging
@ ALoxVerbosityExportAllAndWriteBackDbgLogger
@ ALoxVerbosityExportAllAndWriteBackRelLogger
virtual void onSdCleanALox()
virtual void onBsPrepareResources()
virtual void printConfigFileInfo(Paragraphs &target)
@ ErrUnknownCommand
Unknown command.
@ ErrUnknown
An unknown exception occurred. This should never happen.
@ ErrMissingCmdParam
Missing parameter of a command.
@ ErrNoCmdGiven
No command given.
@ ErrParsingOption
Error when parsing an option.
@ ErrMissingOptParam
Missing parameter of an option.
@ ErrBadParamValue
Bad parameter value.
@ ErrParsingCommand
Error when parsing a command.
@ ErrConfigFileNotWritable
The configuration file(s) could not be written.
virtual void exitWithHelpOutput(Enum exitCode, const String &helpTopic=NULL_STRING, Box formatParam1=EMPTY_STRING, Box formatParam2=EMPTY_STRING)
virtual void exceptionDisplay(Exception &exception, AString &target)
virtual void getConfigFilePathsFromCLIParam(StdVectorMA< ConfigFileDescriptor > &files)
virtual void onBsSetupALox()
Flags flags
Various boolean flags used to configure the application.
virtual lox::Lox * GetRLox()
Options
Built-in options used with class #"App".
@ DryRun
Sets the flag #"App::dryrun".
@ Verbose
Reserved option for increasing verbosity.
@ Config
Change the configured config file path(s).
virtual void onSdAnnounceShutdown()
virtual void getConfigFilePaths(StdVectorMA< ConfigFileDescriptor > &files)
virtual void getConfigFilePathsMakeAbsolutePaths(StdVectorMA< ConfigFileDescriptor > &files)
virtual bool processCLICmd(Command *cmd)
Commands
Built-in commands used with class #"App".
@ Version
Show version information.
@ Info
Show info and configuration details.
virtual void onBsConfigureCLI()
virtual void onBsCLIReadOptions()
virtual void onBsCLIDefine()
CommandLine cli
The command-line parser.
lox::textlogger::TextLogger * releaseLogger
virtual Enum exceptionToExitCode(Exception &exception)
bool cliStop
Flag to stop the CLI processing loop.
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)
strings::TString< nchar > NString
Type alias in namespace #"%alib".
constexpr String NULL_STRING
A nulled string of the default character type.
constexpr CString NEW_LINE
A zero-terminated string containing the new-line character sequence.
constexpr const String EMPTY_STRING
An empty string of the default character type.
boxing::Box Box
Type alias in namespace #"%alib".
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".
app::AppCamp APP
The singleton instance of the camp class used by class #"App".
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'.
A struct denoting the next state and the corresponding method to execute.
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
A command argument of the command-line.
#"alib_enums_records;ALib Enum Record" type used by class #"CommandDecl".
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".