Async 1.8.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
98class DnsLookup;
99
100/*
101 *----------------------------------------------------------------------------
102 * Macro:
103 * Purpose:
104 * Input:
105 * Output:
106 * Author:
107 * Created:
108 * Remarks:
109 * Bugs:
110 *----------------------------------------------------------------------------
111 */
112
113
114/*
115 *----------------------------------------------------------------------------
116 * Type:
117 * Purpose:
118 * Members:
119 * Input:
120 * Output:
121 * Author:
122 * Created:
123 * Remarks:
124 *----------------------------------------------------------------------------
125 */
126
127
128/****************************************************************************
129 *
130 * Exported Global Variables
131 *
132 ****************************************************************************/
133
134
135
136/****************************************************************************
137 *
138 * Class definitions
139 *
140 ****************************************************************************/
141
157class QtApplication : public QApplication, public Application
158{
159 Q_OBJECT
160
161 public:
170 QtApplication(int &argc, char **argv);
171
175 virtual ~QtApplication(void);
176
184 void exec(void);
185
186 public slots:
192 void quit(void);
193
194 protected:
195
196 private:
197 typedef std::pair<Async::FdWatch*, QSocketNotifier*> FdWatchMapItem;
198 typedef std::map<int, FdWatchMapItem> FdWatchMap;
199 typedef std::map<Timer *, AsyncQtTimer *> TimerMap;
200
201 FdWatchMap rd_watch_map;
202 FdWatchMap wr_watch_map;
203 TimerMap timer_map;
204
205 void addFdWatch(FdWatch *fd_watch);
206 void delFdWatch(FdWatch *fd_watch);
207 void addTimer(Timer *timer);
208 void delTimer(Timer *timer);
209 DnsLookupWorker *newDnsLookupWorker(const DnsLookup& lookup);
210
211 private slots:
212 void rdFdActivity(int socket);
213 void wrFdActivity(int socket);
214
215}; /* class QtApplication */
216
217
218} /* namespace */
219
220#endif /* ASYNC_QT_APPLICATION_INCLUDED */
221
222
223
224/*
225 * This file has not been truncated
226 */
227
The core class for writing asyncronous applications.
The base class for asynchronous applications.
A class for performing asynchronous DNS lookups.
A class for watching file descriptors.
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.