GMimeStreamGIO

GMimeStreamGIO — A wrapper for GLib's GIO streams

Functions

Types and Values

Description

A simple GMimeStream implementation that sits on top of GLib's GIO input and output streams.

Constructors take ownership of the supplied GFile reference. The owner flag controls releasing that reference, not closing the input/output streams opened by this wrapper. Explicit close attempts both streams and reports the first error through errno, even though the wrapper is closed afterward. Finalization releases resources but cannot report close failures.

Functions

g_mime_stream_gio_new ()

GMimeStream *
g_mime_stream_gio_new (GFile *file);

Creates a new GMimeStreamGIO wrapper around a GFile object. Pass an additional reference if the caller also needs to retain file .

Parameters

file

a GFile reference to take ownership of.

[transfer full]

Returns

a stream using file .

[transfer full]


g_mime_stream_gio_new_with_bounds ()

GMimeStream *
g_mime_stream_gio_new_with_bounds (GFile *file,
                                   gint64 start,
                                   gint64 end);

Creates a new GMimeStreamGIO stream around a GFile with bounds start and end . Pass an additional reference if the caller also needs to retain file .

Parameters

file

a GFile reference to take ownership of.

[transfer full]

start

start boundary

 

end

end boundary

 

Returns

a stream using file with bounds start and end .

[transfer full]


g_mime_stream_gio_get_owner ()

gboolean
g_mime_stream_gio_get_owner (GMimeStreamGIO *stream);

Gets whether or not stream owns the backend GFile.

Parameters

stream

a GMimeStreamGIO stream

 

Returns

TRUE if stream owns the backend GFile or FALSE otherwise.


g_mime_stream_gio_set_owner ()

void
g_mime_stream_gio_set_owner (GMimeStreamGIO *stream,
                             gboolean owner);

Sets whether close or finalization releases the supplied GFile reference. Changing this flag does not acquire or release a reference immediately.

With owner set to FALSE, the caller must keep the GFile alive and release its reference after the wrapper is no longer needed. Input and output streams opened by the wrapper are always closed and released, regardless of this flag. Substreams borrow the parent's GFile; do not explicitly close an owning parent while its substreams still need it.

Parameters

stream

a GMimeStreamGIO stream

 

owner

TRUE if this stream should own the GFile or FALSE otherwise

 

Types and Values

GMimeStreamGIO

typedef struct _GMimeStreamGIO GMimeStreamGIO;

A GMimeStream wrapper around GLib's GIO streams.

See Also

GMimeStream