Async  0.18.0
AsyncQtApplication.h
Go to the documentation of this file.
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 <QObject>
00046 #include <QApplication>
00047 #undef emit
00048 
00049 #include <utility>
00050 #include <map>
00051 #include <set>
00052 
00053 
00054 /****************************************************************************
00055  *
00056  * Project Includes
00057  *
00058  ****************************************************************************/
00059 
00060 #include <AsyncApplication.h>
00061 
00062 
00063 /****************************************************************************
00064  *
00065  * Local Includes
00066  *
00067  ****************************************************************************/
00068 
00069 
00070 
00071 /****************************************************************************
00072  *
00073  * Forward declarations
00074  *
00075  ****************************************************************************/
00076 
00077 class QSocketNotifier;
00078 class AsyncQtTimer;
00079 
00080 
00081 /****************************************************************************
00082  *
00083  * Namespace
00084  *
00085  ****************************************************************************/
00086 
00087 namespace Async
00088 {
00089 
00090 /****************************************************************************
00091  *
00092  * Defines & typedefs
00093  *
00094  ****************************************************************************/
00095 
00096 /*
00097  *----------------------------------------------------------------------------
00098  * Macro:   
00099  * Purpose: 
00100  * Input:   
00101  * Output:  
00102  * Author:  
00103  * Created: 
00104  * Remarks: 
00105  * Bugs:    
00106  *----------------------------------------------------------------------------
00107  */
00108 
00109 
00110 /*
00111  *----------------------------------------------------------------------------
00112  * Type:    
00113  * Purpose: 
00114  * Members: 
00115  * Input:   
00116  * Output:  
00117  * Author:  
00118  * Created: 
00119  * Remarks: 
00120  *----------------------------------------------------------------------------
00121  */
00122 
00123 
00124 /****************************************************************************
00125  *
00126  * Exported Global Variables
00127  *
00128  ****************************************************************************/
00129 
00130 
00131 
00132 /****************************************************************************
00133  *
00134  * Class definitions
00135  *
00136  ****************************************************************************/
00137 
00153 class QtApplication : public QApplication, public Application
00154 {
00155   Q_OBJECT
00156     
00157   public:
00166     QtApplication(int &argc, char **argv);
00167 
00171     virtual ~QtApplication(void);
00172     
00180     void exec(void);
00181     
00182   public slots:
00188     void quit(void);
00189     
00190   protected:
00191     
00192   private:
00193     typedef std::pair<Async::FdWatch*, QSocketNotifier*>  FdWatchMapItem;
00194     typedef std::map<int, FdWatchMapItem>                 FdWatchMap;
00195     typedef std::map<Timer *, AsyncQtTimer *>             TimerMap;
00196     
00197     FdWatchMap  rd_watch_map;
00198     FdWatchMap  wr_watch_map;
00199     TimerMap    timer_map;
00200     
00201     void addFdWatch(FdWatch *fd_watch);
00202     void delFdWatch(FdWatch *fd_watch);
00203     void addTimer(Timer *timer);
00204     void delTimer(Timer *timer);
00205     DnsLookupWorker *newDnsLookupWorker(const std::string& label);
00206     
00207   private slots:
00208     void rdFdActivity(int socket);
00209     void wrFdActivity(int socket);
00210     
00211 };  /* class QtApplication */
00212 
00213 
00214 } /* namespace */
00215 
00216 #endif /* ASYNC_QT_APPLICATION_INCLUDED */
00217 
00218 
00219 
00220 /*
00221  * This file has not been truncated
00222  */
00223