libopenraw  0.3.7
Classes | Functions
Internal IO API

API called internally for IO. More...

Classes

class  OpenRaw::IO::File
 File IO stream. More...
 
class  OpenRaw::IO::MemStream
 Memory based stream to read memory like a file IO. More...
 
class  OpenRaw::IO::Stream
 base virtual class for IO More...
 
class  OpenRaw::IO::StreamClone
 cloned stream. Allow reading from a different offset More...
 

Functions

struct io_methodsget_default_io_methods (void)
 Get the default IO methods. More...
 
IOFileRef raw_open (struct io_methods *methods, const char *path, int mode)
 Raw open function. More...
 
int raw_close (IOFileRef f)
 
int raw_seek (IOFileRef f, off_t offset, int whence)
 
int raw_read (IOFileRef f, void *buf, size_t count)
 
off_t raw_filesize (IOFileRef f)
 
void * raw_mmap (IOFileRef f, size_t l, off_t offset)
 
int raw_munmap (IOFileRef f, void *addr, size_t l)
 
int raw_get_error (IOFileRef f)
 
char * raw_get_path (IOFileRef f)
 

Detailed Description

API called internally for IO.

Function Documentation

◆ get_default_io_methods()

struct io_methods* get_default_io_methods ( void  )

Get the default IO methods.

Returns
the default io_methods instance, currently posix_io_methods
Todo:
currently hardcoded to POSIX

Definition at line 39 of file io.c.

◆ raw_close()

int raw_close ( IOFileRef  f)

close the file

Parameters
fthe file to close

The implement should free the private data is at will free the file ref. f will be invalid on return

Returns
-1 if error.

Definition at line 64 of file io.c.

References io_methods::close, and _IOFile::methods.

Referenced by OpenRaw::IO::File::close().

◆ raw_get_error()

int raw_get_error ( IOFileRef  f)

get the error for the file

Parameters
fthe file
Returns
the errno code

Definition at line 126 of file io.c.

References _IOFile::error.

◆ raw_get_path()

char* raw_get_path ( IOFileRef  f)

get the real path of the file

This function is needed because libtiff needs a pathname to open TIFF files.

Parameters
fthe file
Returns
the pathname

Definition at line 141 of file io.c.

References _IOFile::path.

◆ raw_open()

IOFileRef raw_open ( struct io_methods methods,
const char *  path,
int  mode 
)

Raw open function.

Parameters
methodsThe IO methods to use for this file.
pathThe file path to open.
modeThe open mode.
Returns
A file reference. Will be freed when closing.

open a file

Parameters
methodsthe io_methods instance to use
paththe file path
modethe POSIX file mode

Definition at line 49 of file io.c.

References io_methods::open.

Referenced by OpenRaw::IO::File::open().

◆ raw_read()

int raw_read ( IOFileRef  f,
void *  buf,
size_t  count 
)

read in the file

Parameters
fthe file to readk
bufthe buffer to read in
countthe number of byte to read
Returns
-1 if error

Definition at line 95 of file io.c.

References _IOFile::methods, and io_methods::read.

Referenced by OpenRaw::IO::File::read().

◆ raw_seek()

int raw_seek ( IOFileRef  f,
off_t  offset,
int  whence 
)

seek in the file

Parameters
fthe file to seek
offsetthe offset to seek
whencethe the directive for seek. See lseek(2) man page
Returns
-1 if error

Definition at line 81 of file io.c.

References _IOFile::methods, and io_methods::seek.

Referenced by OpenRaw::IO::File::seek().