Struct

GLibIOFuncs

Description [src]

struct GIOFuncs {
  GIOStatus (* io_read) (
    GIOChannel* channel,
    gchar* buf,
    gsize count,
    gsize* bytes_read,
    GError** error
  );
  GIOStatus (* io_write) (
    GIOChannel* channel,
    const gchar* buf,
    gsize count,
    gsize* bytes_written,
    GError** error
  );
  GIOStatus (* io_seek) (
    GIOChannel* channel,
    gint64 offset,
    GSeekType type,
    GError** error
  );
  GIOStatus (* io_close) (
    GIOChannel* channel,
    GError** error
  );
  GSource* (* io_create_watch) (
    GIOChannel* channel,
    GIOCondition condition
  );
  void (* io_free) (
    GIOChannel* channel
  );
  GIOStatus (* io_set_flags) (
    GIOChannel* channel,
    GIOFlags flags,
    GError** error
  );
  GIOFlags (* io_get_flags) (
    GIOChannel* channel
  );
}

A table of functions used to handle different types of GIOChannel in a generic way.

Structure members
io_read

Reads raw bytes from the channel. This is called from various functions such as g_io_channel_read_chars() to read raw bytes from the channel. Encoding and buffering issues are dealt with at a higher level.

io_write

Writes raw bytes to the channel. This is called from various functions such as g_io_channel_write_chars() to write raw bytes to the channel. Encoding and buffering issues are dealt with at a higher level.

io_seek

Seeks the channel. This is called from g_io_channel_seek() on channels that support it.

io_close

Closes the channel. This is called from g_io_channel_close() after flushing the buffers.

io_create_watch

Creates a watch on the channel. This call corresponds directly to g_io_create_watch().

io_free

Called from g_io_channel_unref() when the channel needs to be freed. This function must free the memory associated with the channel, including freeing the GIOChannel structure itself. The channel buffers have been flushed and possibly io_close has been called by the time this function is called.

io_set_flags

Sets the GIOFlags on the channel. This is called from g_io_channel_set_flags() with all flags except for G_IO_FLAG_APPEND and G_IO_FLAG_NONBLOCK masked out.

io_get_flags

Gets the GIOFlags for the channel. This function need only return the G_IO_FLAG_APPEND and G_IO_FLAG_NONBLOCK flags; g_io_channel_get_flags() automatically adds the others as appropriate.