/usr/include/libqinfinity/qtio.h is in libqinfinity-dev 1:0.5.2-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | /*
* Copyright 2009 Gregory Haynes <greg@greghaynes.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QINFINITY_QTIO_H
#define QINFINITY_QTIO_H
#include <libinfinity/common/inf-io.h>
#include <QObject>
#include <QList>
#include <QHash>
#include <QTimer>
#include <QEvent>
#include <QLinkedList>
#include <QMutex>
namespace QInfinity
{
class QtIo;
class QtIoWatch;
class InfEvent;
typedef struct _QInfQtIoClass QInfQtIoClass;
typedef struct _QInfQtIo QInfQtIo;
/**
* @brief Event handler interface for libinfinity.
*/
class QtIo
: public QObject
{
public:
static QtIo *instance();
QtIo( QObject *parent = 0 );
virtual ~QtIo();
virtual InfIoWatch *addWatch( InfNativeSocket *socket,
InfIoEvent events,
InfIoWatchFunc func,
gpointer user_data,
GDestroyNotify notify );
virtual void updateWatch( InfIoWatch *watch,
InfIoEvent events );
virtual void removeWatch( InfIoWatch *watch );
virtual InfIoTimeout *addTimeout( unsigned int msecs,
InfIoTimeoutFunc func,
void *user_data,
GDestroyNotify notify );
virtual void removeTimeout( InfIoTimeout *timer );
virtual InfIoDispatch *addDispatch( InfIoDispatchFunc func,
gpointer user_data,
GDestroyNotify notify );
virtual void removeDispatch( InfIoDispatch *dispatch );
virtual bool event( QEvent *e );
GObject *gobject() const;
void setOwner( bool own_gobject );
private:
QInfQtIo *m_gobject;
bool own_gobject;
QHash<int, QtIoWatch*> socketToWatchMap;
QLinkedList<InfEvent*> cancelledEvents;
QMutex cancelledEventsMutex;
};
/**
* @brief Timer for QtIo
*/
class InfTimer
: public QTimer
{
Q_OBJECT;
public:
InfTimer( unsigned int msecs,
InfIoTimeoutFunc func,
void *user_data,
GDestroyNotify notify,
QObject *parent = 0 );
~InfTimer();
void activate();
private Q_SLOTS:
void activated();
private:
InfIoTimeoutFunc m_func;
void *m_user_data;
GDestroyNotify m_notify;
};
/**
* @brief QEvent wrapper for addDispatch/postEvent
*/
class InfEvent
: public QEvent
{
public:
InfEvent( InfIoDispatchFunc func,
gpointer user_data,
GDestroyNotify notify );
~InfEvent();
void call();
private:
InfIoDispatchFunc m_func;
gpointer m_user_data;
GDestroyNotify m_notify;
};
}
#endif
|