00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef CXXTOOLS_APPLICATION_H
00029 #define CXXTOOLS_APPLICATION_H
00030
00031 #include <cxxtools/api.h>
00032 #include <cxxtools/eventloop.h>
00033 #include <cxxtools/application.h>
00034 #include <cxxtools/connectable.h>
00035 #include <cxxtools/event.h>
00036 #include <cxxtools/signal.h>
00037
00038 namespace cxxtools {
00039
00040 class ApplicationImpl;
00041
00069 class CXXTOOLS_API Application : public Connectable
00070 {
00071 public:
00072 explicit Application(int argc = 0, char** argv = 0);
00073
00074 Application(EventLoopBase* loop, int argc = 0, char** argv = 0);
00075
00076 ~Application();
00077
00078 static Application& instance();
00079
00080 EventLoopBase& loop()
00081 { return *_loop; }
00082
00083 void run()
00084 { _loop->run(); }
00085
00086 void exit()
00087 { _loop->exit(); }
00088
00089 bool catchSystemSignal(int sig);
00090
00091 bool raiseSystemSignal(int sig);
00092
00093 Signal<int> systemSignal;
00094
00095 int argc() const
00096 { return _argc; }
00097
00098 char** argv() const
00099 { return _argv; }
00100
00101 ApplicationImpl& impl()
00102 { return *_impl; }
00103
00104 protected:
00105 void init(EventLoopBase& loop);
00106
00107 private:
00108 ApplicationImpl* _impl;
00109 int _argc;
00110 char** _argv;
00111 EventLoopBase* _loop;
00112 EventLoop* _owner;
00113 };
00114
00115 }
00116
00117 #endif