Async 1.5.0
AsyncQtApplication.h
Go to the documentation of this file.
1
35#ifndef ASYNC_QT_APPLICATION_INCLUDED
36#define ASYNC_QT_APPLICATION_INCLUDED
37
38
39/****************************************************************************
40 *
41 * System Includes
42 *
43 ****************************************************************************/
44
45#include <sigc++/sigc++.h>
46
47#include <QObject>
48#include <QApplication>
49#undef emit
50
51#include <utility>
52#include <map>
53#include <set>
54
55
56/****************************************************************************
57 *
58 * Project Includes
59 *
60 ****************************************************************************/
61
62#include <AsyncApplication.h>
63
64
65/****************************************************************************
66 *
67 * Local Includes
68 *
69 ****************************************************************************/
70
71
72
73/****************************************************************************
74 *
75 * Forward declarations
76 *
77 ****************************************************************************/
78
79class QSocketNotifier;
80class AsyncQtTimer;
81
82
83/****************************************************************************
84 *
85 * Namespace
86 *
87 ****************************************************************************/
88
89namespace Async
90{
91
92/****************************************************************************
93 *
94 * Defines & typedefs
95 *
96 ****************************************************************************/
97
98/*
99 *----------------------------------------------------------------------------
100 * Macro:
101 * Purpose:
102 * Input:
103 * Output:
104 * Author:
105 * Created:
106 * Remarks:
107 * Bugs:
108 *----------------------------------------------------------------------------
109 */
110
111
112/*
113 *----------------------------------------------------------------------------
114 * Type:
115 * Purpose:
116 * Members:
117 * Input:
118 * Output:
119 * Author:
120 * Created:
121 * Remarks:
122 *----------------------------------------------------------------------------
123 */
124
125
126/****************************************************************************
127 *
128 * Exported Global Variables
129 *
130 ****************************************************************************/
131
132
133
134/****************************************************************************
135 *
136 * Class definitions
137 *
138 ****************************************************************************/
139
155class QtApplication : public QApplication, public Application
156{
157 Q_OBJECT
158
159 public:
168 QtApplication(int &argc, char **argv);
169
173 virtual ~QtApplication(void);
174
182 void exec(void);
183
184 public slots:
190 void quit(void);
191
192 protected:
193
194 private:
195 typedef std::pair<Async::FdWatch*, QSocketNotifier*> FdWatchMapItem;
196 typedef std::map<int, FdWatchMapItem> FdWatchMap;
197 typedef std::map<Timer *, AsyncQtTimer *> TimerMap;
198
199 FdWatchMap rd_watch_map;
200 FdWatchMap wr_watch_map;
201 TimerMap timer_map;
202
203 void addFdWatch(FdWatch *fd_watch);
204 void delFdWatch(FdWatch *fd_watch);
205 void addTimer(Timer *timer);
206 void delTimer(Timer *timer);
207 DnsLookupWorker *newDnsLookupWorker(const std::string& label);
208
209 private slots:
210 void rdFdActivity(int socket);
211 void wrFdActivity(int socket);
212
213}; /* class QtApplication */
214
215
216} /* namespace */
217
218#endif /* ASYNC_QT_APPLICATION_INCLUDED */
219
220
221
222/*
223 * This file has not been truncated
224 */
225
The core class for writing asyncronous applications.
The base class for asynchronous applications.
A class for watching file descriptors.
Definition: AsyncFdWatch.h:120
An application class for writing GUI applications in Qt.
virtual ~QtApplication(void)
Destructor.
void exec(void)
Execute the application main loop.
void quit(void)
Exit the application main loop.
QtApplication(int &argc, char **argv)
Constructor.
A class that produces timer events.
Definition: AsyncTimer.h:117
Namespace for the asynchronous programming classes.