libgta
1.2.1
Read and Write Generic Tagged Array (GTA) files
|
Class for custom input/output. More...
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... | |
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().
|
inlinevirtual |
Custom read function.
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.
|
inlinevirtual |
Custom write function.
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.
|
inlinevirtual |
Tell if 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.
|
inlinevirtual |
Custom seek function.
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.