00001
00002
00003
00004
00005
00006 #ifndef __WVQTSTREAMCLONE_H
00007 #define __WVQTSTREAMCLONE_H
00008
00009 #include <qobject.h>
00010 #include <qintdict.h>
00011 #include <qsocketnotifier.h>
00012 #include <qtimer.h>
00013 #include <qmetaobject.h>
00014 #include "wvstreamclone.h"
00015
00033 class WvQtStreamClone : public QObject, public WvStreamClone
00034 {
00035 Q_OBJECT
00036 int msec_timeout;
00037
00038 SelectInfo si;
00039 bool pending_callback;
00040 bool first_time;
00041 bool select_in_progress;
00042 int last_max_fd;
00043 QIntDict<QSocketNotifier> notify_readable;
00044 QIntDict<QSocketNotifier> notify_writable;
00045 QIntDict<QSocketNotifier> notify_exception;
00046 QTimer select_timer;
00047
00048 public:
00056 WvQtStreamClone(IWvStream *_cloned = NULL, int msec_timeout = -1);
00057 virtual ~WvQtStreamClone();
00058
00059
00060
00061
00062 void qt_detach();
00063
00064
00065
00066 void qt_attach();
00067
00068
00069
00070 void set_timeout(int msec_timeout);
00071
00072 private:
00073
00074 void pre_poll();
00075
00076 void post_poll();
00077
00078 private slots:
00080
00081 void qt_begin_event_loop_hook();
00082
00084
00085 void select_timer_expired();
00086
00087 void fd_readable(int fd);
00088
00089 void fd_writable(int fd);
00090
00091 void fd_exception(int fd);
00092
00093
00094 virtual void execute();
00095 };
00096
00097 #endif // __WVQTSTREAMCLONE_H