Base application interface class. More...
#include <application.h>

Public Types | |
|
typedef delegate1 < cmdline_parameter &, bool > | cmdline_parameter_handler |
| Command line parameter handler. | |
| typedef delegate0< int > | on_execute_handler |
| Execute command handler. | |
|
typedef delegate1< const std::exception &, void > | on_exception_handler |
| Exception handler. | |
Public Member Functions | |
| virtual | ~application_int () |
| Destructor. | |
| virtual void | set_name (const std::string &name)=0 |
| Set application name. | |
| virtual void | set_description (const std::string &description)=0 |
| Set application description. | |
| virtual void | register_cmdline_parameter (const cmdline_parameter ¶m, cmdline_parameter_handler handler)=0 |
| Register the application command line parameter. | |
| virtual void | on_execute (on_execute_handler handler)=0 |
| Register the application main execute cycle handler. | |
| virtual void | on_exception (on_exception_handler handler)=0 |
| Register the exception handler. | |
| virtual int | run (int argc, char *argv[])=0 |
| Execute the application. | |
Base application interface class.
Each concrete application should implement this interface by overriding its pure virtual methods.
| virtual void dbp::application_int::on_execute | ( | on_execute_handler | handler | ) | [pure virtual] |
Register the application main execute cycle handler.
You need to register your own application execution handler with application logic.
See the 'examples/hello_world/console_application' directory for the sample code.
| handler | an execute command delegate. |
Implemented in dbp::daemon_application, and dbp::gui_application.
Referenced by dbp::daemon_application::on_execute().
| virtual void dbp::application_int::register_cmdline_parameter | ( | const cmdline_parameter & | param, | |
| cmdline_parameter_handler | handler | |||
| ) | [pure virtual] |
Register the application command line parameter.
You can register one or more command line parameters supported by your application. When application starts, it checks of command line parameters passed for registered ones. If none is found, it reports about invalid command line parameter; if registered one is found, on_cmdline_parameter handler is called.
See the 'examples/hello_world/console_application' directory for the sample code using this method.
| param | the command line parameter to register. | |
| handler | a command line parameter delegate. |
Implemented in dbp::application, dbp::daemon_application, and dbp::gui_application.
Referenced by dbp::daemon_application::register_cmdline_parameter().
| virtual void dbp::application_int::set_description | ( | const std::string & | description | ) | [pure virtual] |
Set application description.
| description | a brief application description for displaying purposes. |
Implemented in dbp::application, dbp::daemon_application, and dbp::gui_application.
Referenced by dbp::daemon_application::set_description().
| virtual void dbp::application_int::set_name | ( | const std::string & | name | ) | [pure virtual] |
Set application name.
The application name is used for displaying purposes. The internationalization (i18n) resources path (catalog) is also initialized from the application name.
| name | the name of the application. |
Implemented in dbp::application, dbp::daemon_application, and dbp::gui_application.
Referenced by dbp::daemon_application::set_name().