#include <cxxtools/application.h>
Inheritance diagram for Application:

Public Member Functions | |
| Application (int argc=0, char **argv=0) | |
| Application (EventLoopBase *loop, int argc=0, char **argv=0) | |
| EventLoopBase & | loop () |
| void | run () |
| void | exit () |
| bool | catchSystemSignal (int sig) |
| bool | raiseSystemSignal (int sig) |
| int | argc () const |
| char ** | argv () const |
| ApplicationImpl & | impl () |
Static Public Member Functions | |
| static Application & | instance () |
Public Attributes | |
| Signal< int > | systemSignal |
Protected Member Functions | |
| void | init (EventLoopBase &loop) |
Application contains the main event loop, where event sources can be registered and events from those sources are dispatched to listeners, that were registered to the event loop. Events may for example be operating system events (timer, file system changes).
The application and therefore the event loop is started with a call to run() and can be exited with a call to exit(). After calling exit() the application should terminate.
The event loop can be access by calling eventLoop(). Events can be committed by calling EventLoop::commitEvent(). Long running operations can call EventLoop::processEvents() to keep the application responsive.
There are convenience methods available for easier access to functionality of the underlying event loop. commitEvent() delegates to EventLoop::commitEvent(), queueEvent() delegates to EventLoop::delegateEvent() and processEvents() delegates to EventLoop::processEvents() without making it necessary to first obtain the event loop manually.