26 #ifndef app_application_hpp
27 #define app_application_hpp
31 #include "../ioutils/textTable.hpp"
194 virtual void setup(
int argc,
288 #ifdef MX_APP_DEFAULT_configPathGlobal
289 #error MX_APP_DEFAULT_configPathGlobal no longer works. Set m_configPathGlobal in constructor.
292 #ifdef MX_APP_DEFAULT_configPathGlobal_env
293 #error MX_APP_DEFAULT_configPathGlobal_env no longer works. Set m_configPathGlobal_env in constructor.
296 #ifdef MX_APP_DEFAULT_configPathUser
297 #error MX_APP_DEFAULT_configPathUser no longer works. Set m_configPathUser in constructor.
300 #ifdef MX_APP_DEFAULT_configPathUser_env
301 #error MX_APP_DEFAULT_configPathUser_env no longer works. Set m_configPathUser_env in constructor.
304 #ifdef MX_APP_DEFAULT_configPathLocal
305 #error MX_APP_DEFAULT_configPathLocal no longer works. Set m_configPathLocal in constructor.
308 #ifdef MX_APP_DEFAULT_configPathLocal_env
309 #error MX_APP_DEFAULT_configPathLocal_env no longer works. Set m_configPathLocal_env in constructor.
312 #ifdef MX_APP_DEFAULT_configPathCLBase_env
313 #error MX_APP_DEFAULT_configPathCLBase_env no longer works. Set m_configPathCLBase_env in constructor.
An application configuration manager.
A class for managing application configuration and execution.
virtual void setup(int argc, char **argv)
Sets up the application by executing the configuration steps.
std::string invokedName
The name used to invoke this application.
std::string m_configPathCLBase
A base path to add to the CL path. Set in constructor to use.
virtual void setupStandardConfig()
Set up the command-line config option in a standard way.
std::string m_configPathUser
The path to the user's configuration file. If the first character is not '/' or '~',...
std::string m_configPathUser_env
Environment variable to check fo the user config path. Set in constructor to use.
virtual void checkConfig()
Check the config. This is called at the end of setup, before the configuration is cleared.
virtual void setupStandardHelp()
Set up the help an options in a standard way.
bool doHelp
Flag to control whether the help message is printed or not.
virtual void loadBasicConfig()
Load a basic configuration. Can be used in an intermediate derived class to allow its children to use...
int reReadConfig()
Re-read the config stack.
virtual void loadStandardConfig()
Loads the values of "config".
int main(int argc, char **argv)
The application main function.
char ** m_argv
Store argv for later use. E.g. in reReadConfig().
virtual void loadConfig()
Override this function to extract the configured values and set up the application.
int m_argc
Store argc for later use. E.g. in reReadConfig().
void setConfigPathUser(const std::string &s)
Set the user configuration path.
std::string m_configPathLocal_env
Environment variable to check for the local config path. Set in constructor to use.
int m_helpLOColWidth
The width of the long option (–option) column in the help message.
int m_helpCFColWidth
The width of the config file option column in the help message.
bool m_preserveConfig
Flag controlling whether the configuration is cleared before execution. Set in derived constructor.
int m_helpTypeColWidth
The width of the argument type column in the help message.
appConfigurator config
The structure used for parsing and storing the configuration.
bool m_requireConfigPathLocal
Flag controlling whether lack of a local configuration file should be reported.
int m_helpWidth
The total text width available for the help message.
virtual void optionHelp(configTarget &tgt, ioutils::textTable &tt)
Format a configTarget for the help message.
virtual void setDefaults(int argc, char **argv)
Set the default search paths for config files.
virtual void help()
Print a formatted help message, based on the config target inputs.
virtual void setupBasicConfig()
Setup a basic configuration. Can be used in an intermediate derived class to allow its children to us...
virtual int execute()
This function is where the derived class should do its work.
std::string m_configPathCL
The path to a configuration file specified on the command line.
std::string m_configPathGlobal
The path to the gobal configuration file. Set in constructor to use.
virtual void loadStandardHelp()
Loads the value of "help" into doHelp.
std::string m_configPathGlobal_env
Environment variable to check for the global config path. Set in constructor to use.
void setConfigPathGlobal(const std::string &s)
Set the global configuration path.
virtual void setupConfig()
In derived classes this is where the config targets are added to config.
int m_helpSOColWidth
The width of the short option (-o) column in the help message.
std::string m_configPathLocal
The path to a local configuration file. Set in constructor to use.
std::string m_configPathCLBase_env
Environment variable to check for the CL base path. Set in constructor to use.
void setConfigPathLocal(const std::string &s)
Set the local configuration path.
Class to manage a set of configurable values, and read their values from config/ini files and the com...
An ascii table formatter.