![]() |
KSquare Utilities
|
The base class for all standalone application. More...
#include <Application.h>
Public Member Functions | |
| Application () | |
| Constructor for Application class that will start with a default logger(RunLog),. More... | |
| Application (const Application &_application) | |
| Copy Constructor for Application class. More... | |
| Application (RunLog &_log) | |
| Constructor for Application class where we already have an existing logger '_log'. More... | |
| virtual | ~Application () |
| bool | Abort () |
| Returns 'true' if application has been aborted. More... | |
| void | Abort (bool _abort) |
| Used to specify that the application is been aborted. More... | |
| virtual const char * | ApplicationName () |
| void | AssignLog (RunLog &_log) |
| Replaces the Log file to write to. More... | |
| virtual KKStr | BuildDate () const |
| virtual void | InitalizeApplication (kkint32 argc, char **argv) |
| Initialized Application Instance; 1st method to be called after instance construction. More... | |
Public Attributes | |
| RunLog & | log |
Protected Member Functions | |
| virtual void | DisplayCommandLineParameters () |
| Will display Command Lone parameters that the 'Application' class will manage. More... | |
| virtual bool | ProcessCmdLineParameter (const KKStr &parmSwitch, const KKStr &parmValue) |
| This method will get called once for each parameter specified in the command line. More... | |
The base class for all standalone application.
This class is meant to be a general class that all standalone applications should be inherited from. It supports command line processing, and logging facilities. Derived classes will need to override the virtual methods "ApplicationName", "DisplayCommandLineParameters", and "ProcessCmdLineParameter". Right after an instance is created you need to call the "InitalizeApplication" method; this will start the processing of any encountered parameters. For each set of parameters encountered a call to "ProcessCmdLineParameter" will be made; this is where you can intercept and process parameters that are specific to your application. Any parameters that you do not recognized should be passed onto the base-class by calling "Application::ProcessCmdLineParameter".
Definition at line 29 of file Application.h.
| Application::Application | ( | ) |
Constructor for Application class that will start with a default logger(RunLog),.
After creating an instance of this class you initialize it by calling InitalizeApplication.
Definition at line 39 of file Application.cpp.
References KKB::KKStr::KKStr(), log, and KKB::RunLog::RunLog().
| Application::Application | ( | const Application & | _application | ) |
Copy Constructor for Application class.
| [in] | _application | Application instance to copy. |
Definition at line 51 of file Application.cpp.
References KKB::KKStr::KKStr(), and log.
| Application::Application | ( | RunLog & | _log | ) |
Constructor for Application class where we already have an existing logger '_log'.
After creating an instance of this class you initialize it by calling InitalizeApplication.
| [in] | _log | A reference to a RunLog object. |
Definition at line 29 of file Application.cpp.
References KKB::KKStr::KKStr(), and log.
|
virtual |
Definition at line 61 of file Application.cpp.
|
inline |
Returns 'true' if application has been aborted.
You would typically call this method after you are done processing the command line to make sure that the application is to keep on running.
Definition at line 62 of file Application.h.
|
inline |
Used to specify that the application is been aborted.
If you have a reason to abort the processing of this application you would call this method to set the 'abort' flag to true. It will be the responsibility of the derived class to monitor the 'Abort' flag. If is set to true they should terminate as quickly as they can; they should also release any resources they have taken.
| [in] | _abort | Abort status to set; if set to true you are telling the application that the program needs to be terminated. |
Definition at line 71 of file Application.h.
|
virtual |
Specify the name of the application
Definition at line 80 of file Application.cpp.
| void Application::AssignLog | ( | RunLog & | _log | ) |
|
virtual |
Definition at line 162 of file Application.cpp.
References KKB::DateType::DateType(), KKB::TimeType::HH_MM_SS(), KKB::KKStr::operator+(), KKB::TimeType::TimeType(), and KKB::DateType::YYYY_MM_DD().
|
protectedvirtual |
Will display Command Lone parameters that the 'Application' class will manage.
Derived classes that implement this method need to call their immediate base class version of this method to include these parameters.
Definition at line 134 of file Application.cpp.
|
virtual |
Initialized Application Instance; 1st method to be called after instance construction.
This method will scan the command line parameters for the log file options (-L, -Log, or -LogFile) and use its parameter as the LogFile name. If none is provided it will assume the stdout as the Log File to write to. It will take ownership of this log file and delete it in its destructor. Right after calling this constructor you will need to call the method ProcessCmdLineParameters.
| [in] | argc | Number of arguments in argv. |
| [in] | argv | List of asciiz strings; one string for each argument. |
Definition at line 69 of file Application.cpp.
References KKB::RunLog::AttachFile(), KKB::KKStr::Empty(), and log.
|
protectedvirtual |
This method will get called once for each parameter specified in the command line.
Derived classes should define this method to intercept parameters that they are interested in. Parameters are treated as pairs, Switch and Values where switches have a leading dash("-"). The CmdLineExpander class will be used to expand any "-CmdFile" parameters.
| [in] | parmSwitch | The fill switch parameter. |
| [in] | parmValue | Any value parameter that followed the switch parameter. |
Definition at line 149 of file Application.cpp.
| RunLog& KKB::Application::log |
Definition at line 143 of file Application.h.
Referenced by Application(), AssignLog(), and InitalizeApplication().