TnySeekable

TnySeekable — Makes a TnyStream seekable

Synopsis




                    TnySeekable;
                    TnySeekableIface;
off_t               tny_seekable_seek                   (TnySeekable *self,
                                                         off_t offset,
                                                         int policy);
off_t               tny_seekable_tell                   (TnySeekable *self);
gint                tny_seekable_set_bounds             (TnySeekable *self,
                                                         off_t start,
                                                         off_t end);

Object Hierarchy


  GInterface
   +----TnySeekable

Known Implementations

TnySeekable is implemented by TnyCamelStream, TnyFsStream, TnyCamelMemStream and TnyVfsStream.

Description

Interface for making a stream seekable

Details

TnySeekable

typedef struct _TnySeekable TnySeekable;

A seekable type

free-function: g_object_unref


TnySeekableIface

typedef struct {
	GTypeInterface parent;

	off_t (*seek)		(TnySeekable *self, off_t offset, int policy);
	off_t (*tell)		(TnySeekable *self);
	gint  (*set_bounds)	(TnySeekable *self, off_t start, off_t end);
} TnySeekableIface;


tny_seekable_seek ()

off_t               tny_seekable_seek                   (TnySeekable *self,
                                                         off_t offset,
                                                         int policy);

Seek to the specified position in self.

If policy is SEEK_SET, seeks to offset.

If policy is SEEK_CUR, seeks to the current position plus offset.

If policy is SEEK_END, seeks to the end of the stream plus offset.

Regardless of policy, the stream's final position will be clamped to the range specified by its lower and upper bounds, and the stream's eos state will be updated.

self : a TnySeekable
offset : offset value
policy : what to do with the offset
Returns : new position, -1 if operation failed.

Since 1.0 audience: application-developer


tny_seekable_tell ()

off_t               tny_seekable_tell                   (TnySeekable *self);

Get the current position of a seekable stream.

self : a TnySeekable
Returns : the current position of the stream.

Since 1.0 audience: application-developer


tny_seekable_set_bounds ()

gint                tny_seekable_set_bounds             (TnySeekable *self,
                                                         off_t start,
                                                         off_t end);

Set the range of valid data this stream is allowed to cover. If there is to be no end value, then end should be set to ~0.

self : a TnySeekable
start : the first valid position
end : the first invalid position, or ~0 for unbound
Returns : -1 on error

Since 1.0 audience: application-developer