2003-11-05 08:40:45 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/**
|
|
|
|
|
* \file io_callback.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author unknown
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author Jo<EFBFBD>o Luis M. Assirati
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef SOCKET_CALLBACK_H
|
|
|
|
|
#define SOCKET_CALLBACK_H
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <qobject.h>
|
|
|
|
|
#include <qsocketnotifier.h>
|
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
2004-07-21 19:03:21 +00:00
|
|
|
|
#include <boost/function.hpp>
|
2003-11-05 08:40:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* socket_callback - a simple wrapper for asynchronous socket notification
|
|
|
|
|
*
|
|
|
|
|
* This is used by the lyxsocket to notice the socket is ready to be
|
|
|
|
|
* connected/read.
|
|
|
|
|
*
|
|
|
|
|
* FIXME: this code apparently will not work on Windows.
|
|
|
|
|
*/
|
|
|
|
|
class socket_callback : public QObject {
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
/// connect a connection notification from the LyXServerSocket
|
2004-07-21 19:03:21 +00:00
|
|
|
|
socket_callback(int fd, boost::function<void()> func);
|
2003-11-05 08:40:45 +00:00
|
|
|
|
public slots:
|
2004-07-21 19:03:21 +00:00
|
|
|
|
void data_received();
|
2003-11-05 08:40:45 +00:00
|
|
|
|
private:
|
|
|
|
|
/// our notifier
|
|
|
|
|
boost::scoped_ptr<QSocketNotifier> sn_;
|
2004-07-21 19:03:21 +00:00
|
|
|
|
/// The callback function
|
|
|
|
|
boost::function<void()> func_;
|
2003-11-05 08:40:45 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // SOCKET_CALLBACK_H
|