libgta 1.2.1 Read and Write Generic Tagged Array (GTA) files

Public Member Functions | List of all members
gta::custom_io Class Reference

Class for custom input/output. More...

`#include <gta.hpp>`

## Public Member Functions
virtual size_t | read (void *buffer, size_t size, bool *error)
| Custom read function. More...
virtual size_t | write (const void *buffer, size_t size, bool *error)
| Custom write function. More...
virtual bool | seekable ()
| Tell if this object is seekable. More...
virtual void | seek (intmax_t offset, int whence, bool *error)
| Custom seek function. More...

## Detailed Description

Class for custom input/output.

You can define your own custom input/output media by implementing this interface. The seek function is only required if you want to use the out-of-core data access funtions header::read_block() or header::write_block().

## Member Function Documentation

## ◆ read()

virtual size_t gta::custom_io::read | ( | void * | buffer,
|  | size_t | size,
|  | bool * | error
| ) |  |
| inline virtual

Custom read function.

Parameters

  buffer | The destionation buffer.
  size | The number of bytes to read.
  error | The error flag.

This function must read the given number of bytes into the given buffer.
Its return value must be the number of bytes successfully read.
If an error occured, the error flag must be set to true. The function must set errno to indicate the type of error. If the error type is unknown, errno should be set to EIO.

## ◆ write()

virtual size_t gta::custom_io::write | ( | const void * | buffer,
|  | size_t | size,
|  | bool * | error
| ) |  |
| inline virtual

Custom write function.

Parameters

  buffer | The source buffer.
  size | The number of bytes to write.
  error | The error flag.

This function must write the given number of bytes from the given buffer.
Its return value must be the number of bytes successfully written.
If an error occured, the error flag must be set to true. The function must set errno to indicate the type of error. If the error type is unknown, errno should be set to EIO.

## ◆ seekable()

virtual bool gta::custom_io::seekable | ( |  | ) |
| inline virtual

Tell if this object is seekable.

Returns
  Whether this object is seekable.

This function must return true if the object is seekable, i.e. if the seek function can be used. Otherwise, it must return false.

## ◆ seek()

virtual void gta::custom_io::seek | ( | intmax_t | offset,
|  | int | whence,
|  | bool * | error
| ) |  |
| inline virtual

Custom seek function.

Parameters

  offset | The position offset.
  whence | SEEK_SET or SEEK_CUR.
  error | The error flag.

This function must change the position indicator as indicated by the parameters offset and whence, just like fseeko() and lseek() do. The parameter whence can be SEEK_SET or SEEK_CUR (SEEK_END is never used).
If an error occured, the error flag must be set to true. The function must set errno to indicate the type of error. If the error type is unknown, errno should be set to EIO.

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

- gta/gta.hpp