/usr/include/Eris-1.3/Eris/PollGlibSource.h is in liberis-1.3-dev 1.3.14-3.
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 | #ifndef ERIS_POLL_GLIB_SOURCE_H
#define ERIS_POLL_GLIB_SOURCE_H
namespace Eris {
class PollGlibSource
{
public:
PollGlibSource(GMainContext *con = 0)
{
_source = g_source_new(&funcs_, sizeof(SourceStruct));
((SourceStruct*) _source)->poll = this;
g_source_set_priority(_source, G_PRIORITY_DEFAULT_IDLE);
_tag = g_source_attach(_source, con);
funcs_.prepare = prepareFunc;
funcs_.check = checkFunc;
funcs_.dispatch = dispatchFunc;
funcs_.finalize = 0;
}
virtual ~PollGlibSource()
{
g_source_remove(_tag);
g_source_unref(_source);
}
protected:
virtual bool prepare(int& timeout) = 0;
virtual bool check() = 0;
virtual bool dispatch() = 0;
GSource* source() {return _source;}
private:
GSource *_source;
guint _tag;
// begin funky C-like stuff
typedef struct {
GSource source;
PollGlibSource *poll;
} SourceStruct;
GSourceFuncs funcs_;
static PollGlibSource* sourceGetPoll(GSource *source)
{
return ((SourceStruct *) source)->poll;
}
static gboolean prepareFunc(GSource *source, gint* timeout)
{
return sourceGetPoll(source)->prepare(*timeout);
}
static gboolean checkFunc(GSource *source)
{
return sourceGetPoll(source)->check();
}
static gboolean dispatchFunc(GSource *source, GSourceFunc, gpointer)
{
return sourceGetPoll(source)->dispatch();
}
};
} // namespace Eris
#endif // ERIS_POLL_GLIB_SOURCE_H
|