/** * \file io_callback.h * Copyright 2002 the LyX Team * Read the file COPYING * * \author unknown * \author John Levon */ #ifndef IO_CALLBACK_H #define IO_CALLBACK_H #include #include "lyxserver.h" #include "debug.h" #include #include /** * io_callback - a simple wrapper for asynchronous pipe notification * * This is used by the lyxserver to notice the pipe is ready to be * read. * * FIXME: this code apparently will not work on Windows. */ class io_callback : public QObject { Q_OBJECT public: /// connect a read ready notification for fd to the LyXComm io_callback(int fd, LyXComm * comm) : comm_(comm) { sn_.reset(new QSocketNotifier(fd, QSocketNotifier::Read, this)); connect(sn_.get(), SIGNAL(activated(int)), this, SLOT(data_received())); } public slots: void data_received() { comm_->read_ready(); } private: /// our notifier boost::scoped_ptr sn_; LyXComm * comm_; }; #endif // IO_CALLBACK_H