GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_io Struct Reference

An I/O abstraction. More...

#include <gp_io.h>

Data Fields

ssize_t(* read )(gp_io *self, void *buf, size_t size)
 A read() callback.
 
ssize_t(* write )(gp_io *self, const void *buf, size_t size)
 A write() callback.
 
off_t(* seek )(gp_io *self, off_t off, enum gp_seek_whence whence)
 A seek() callback.
 
int(* close )(gp_io *self)
 A close() callback.
 
off_t mark
 A mark to store offset to by the gp_io_mark().
 

Detailed Description

An I/O abstraction.

Definition at line 23 of file gp_io.h.

Field Documentation

◆ close

int(* gp_io::close) (gp_io *self)

A close() callback.

Finalizes writes, frees memory.

Parameters
selfAn I/O.
Returns
Zero on success -1 on a failure.

Definition at line 62 of file gp_io.h.

Referenced by gp_io_close().

◆ read

ssize_t(* gp_io::read) (gp_io *self, void *buf, size_t size)

A read() callback.

Parameters
selfAn I/O.
bufA buffer to read to.
sizeA size of the buffer.
Returns
A number of bytes that were read <= size or -1 on error.

Definition at line 33 of file gp_io.h.

Referenced by gp_io_getb(), and gp_io_read().

◆ seek

off_t(* gp_io::seek) (gp_io *self, off_t off, enum gp_seek_whence whence)

A seek() callback.

Parameters
offAn offset in the file.
whenceDefines to what the offset is relative to.
Returns
A new offset in the file or (off_t)-1 on a failure.

Definition at line 52 of file gp_io.h.

Referenced by gp_io_rewind(), gp_io_seek(), and gp_io_tell().

◆ write

ssize_t(* gp_io::write) (gp_io *self, const void *buf, size_t size)

A write() callback.

Parameters
selfAn I/O.
bufA buffer to write to.
sizeA size of the buffer.
Returns
A number of bytes that were written <= size or -1 on error.

Definition at line 43 of file gp_io.h.

Referenced by gp_io_putb(), and gp_io_write().


The documentation for this struct was generated from the following file: