00001 00035 #ifndef ASYNC_QT_APPLICATION_INCLUDED 00036 #define ASYNC_QT_APPLICATION_INCLUDED 00037 00038 00039 /**************************************************************************** 00040 * 00041 * System Includes 00042 * 00043 ****************************************************************************/ 00044 00045 #include <qapplication.h> 00046 00047 #include <pair.h> 00048 #include <map> 00049 #include <set> 00050 00051 00052 /**************************************************************************** 00053 * 00054 * Project Includes 00055 * 00056 ****************************************************************************/ 00057 00058 #include <AsyncApplication.h> 00059 00060 00061 /**************************************************************************** 00062 * 00063 * Local Includes 00064 * 00065 ****************************************************************************/ 00066 00067 00068 00069 /**************************************************************************** 00070 * 00071 * Forward declarations 00072 * 00073 ****************************************************************************/ 00074 00075 class QSocketNotifier; 00076 class AsyncQtTimer; 00077 00078 00079 /**************************************************************************** 00080 * 00081 * Namespace 00082 * 00083 ****************************************************************************/ 00084 00085 namespace Async 00086 { 00087 00088 /**************************************************************************** 00089 * 00090 * Defines & typedefs 00091 * 00092 ****************************************************************************/ 00093 00094 /* 00095 *---------------------------------------------------------------------------- 00096 * Macro: 00097 * Purpose: 00098 * Input: 00099 * Output: 00100 * Author: 00101 * Created: 00102 * Remarks: 00103 * Bugs: 00104 *---------------------------------------------------------------------------- 00105 */ 00106 00107 00108 /* 00109 *---------------------------------------------------------------------------- 00110 * Type: 00111 * Purpose: 00112 * Members: 00113 * Input: 00114 * Output: 00115 * Author: 00116 * Created: 00117 * Remarks: 00118 *---------------------------------------------------------------------------- 00119 */ 00120 00121 00122 /**************************************************************************** 00123 * 00124 * Exported Global Variables 00125 * 00126 ****************************************************************************/ 00127 00128 00129 00130 /**************************************************************************** 00131 * 00132 * Class definitions 00133 * 00134 ****************************************************************************/ 00135 00151 class QtApplication : public QApplication, public Application 00152 { 00153 Q_OBJECT 00154 00155 public: 00164 QtApplication(int argc, char **argv); 00165 00169 ~QtApplication(void); 00170 00178 void exec(void); 00179 00185 void quit(void); 00186 00187 protected: 00188 00189 private: 00190 typedef pair<Async::FdWatch*, QSocketNotifier*> FdWatchMapItem; 00191 typedef std::map<int, FdWatchMapItem> FdWatchMap; 00192 typedef std::map<Timer *, AsyncQtTimer *> TimerMap; 00193 00194 FdWatchMap rd_watch_map; 00195 FdWatchMap wr_watch_map; 00196 TimerMap timer_map; 00197 00198 void addFdWatch(FdWatch *fd_watch); 00199 void delFdWatch(FdWatch *fd_watch); 00200 void addTimer(Timer *timer); 00201 void delTimer(Timer *timer); 00202 DnsLookupWorker *newDnsLookupWorker(const std::string& label); 00203 00204 private slots: 00205 void rdFdActivity(int socket); 00206 void wrFdActivity(int socket); 00207 00208 }; /* class QtApplication */ 00209 00210 00211 } /* namespace */ 00212 00213 #endif /* ASYNC_QT_APPLICATION_INCLUDED */ 00214 00215 00216 00217 /* 00218 * This file has not been truncated 00219 */ 00220
1.4.4