A reader supports binary block reads and string-oriented line reads that zero-terminate the result. More...
#include <ireader.h>
Public Member Functions | |
virtual Sint64 | read (char *buffer, Sint64 size)=0 |
Reads a number of bytes from the stream. More... | |
virtual bool | readline (char *buffer, Sint32 size)=0 |
Reads a line from the stream. More... | |
Lookahead capability | |
virtual bool | supports_lookahead () const =0 |
Indicates whether lookahead is (in principle) supported. More... | |
virtual Sint64 | lookahead (Sint64 size, const char **buffer) const =0 |
Gives access to the lookahead data. More... | |
Public Member Functions inherited from mi::neuraylib::IReader_writer_base | |
virtual Sint32 | get_error_number () const =0 |
Returns the error number of the last error that happened in this reader or writer, or 0 if no error occurred. More... | |
virtual const char * | get_error_message () const =0 |
Returns the error message of the last error that happened in this reader or writer. More... | |
virtual bool | eof () const =0 |
Returns true if the end of the file has been reached. More... | |
virtual Sint32 | get_file_descriptor () const =0 |
Returns the file descriptor of the stream, or -1 if it is not available. More... | |
virtual bool | supports_recorded_access () const =0 |
Returns true if random recorded access is supported, and false otherwise. More... | |
virtual const IStream_position * | tell_position () const =0 |
Returns the current position in this stream. More... | |
virtual bool | seek_position (const IStream_position *stream_position)=0 |
Repositions the stream to the position stream_position . More... | |
virtual bool | rewind ()=0 |
Resets the stream position to the beginning. More... | |
virtual bool | supports_absolute_access () const =0 |
Returns true if random absolute access is supported, and false otherwise. More... | |
virtual Sint64 | tell_absolute () const =0 |
Returns the absolute position in bytes from the beginning of the stream beginning, or -1 if absolute access is not supported. More... | |
virtual bool | seek_absolute (Sint64 pos)=0 |
Repositions the stream to the absolute position pos . More... | |
virtual Sint64 | get_file_size () const =0 |
Returns the size in bytes of the data in the stream. More... | |
virtual bool | seek_end ()=0 |
Sets the stream position to the end of the file. More... | |
Public Member Functions inherited from mi::base::IInterface | |
virtual Uint32 | retain () const =0 |
Increments the reference count. More... | |
virtual Uint32 | release () const =0 |
Decrements the reference count. More... | |
virtual const IInterface * | get_interface (const Uuid &interface_id) const =0 |
Acquires a const interface from another. More... | |
template<class T> | |
const T * | get_interface () const |
Acquires a const interface from another. More... | |
virtual IInterface * | get_interface (const Uuid &interface_id)=0 |
Acquires a mutable interface from another. More... | |
template<class T> | |
T * | get_interface () |
Acquires a mutable interface from another. More... | |
virtual Uuid | get_iid () const =0 |
Returns the interface ID of the most derived interface. More... | |
Additional Inherited Members | |
Public Types inherited from mi::base::Interface_declare< 0xc03de0cf, ... > | |
typedef Interface_declare< id1, ... > | Self |
Own type. More... | |
typedef Uuid_t< id1, ... > | IID |
Declares the interface ID (IID) of this interface. More... | |
Public Types inherited from mi::base::Interface_declare< 0x919370c2, ... > | |
typedef Interface_declare< id1, ... > | Self |
Own type. More... | |
typedef Uuid_t< id1, ... > | IID |
Declares the interface ID (IID) of this interface. More... | |
Public Types inherited from mi::base::IInterface | |
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> | IID |
Declares the interface ID (IID) of this interface. More... | |
Static Public Member Functions inherited from mi::base::Interface_declare< 0xc03de0cf, ... > | |
static bool | compare_iid (const Uuid &iid) |
Compares the interface ID iid against the interface ID of this interface and of its ancestors. More... | |
Static Public Member Functions inherited from mi::base::Interface_declare< 0x919370c2, ... > | |
static bool | compare_iid (const Uuid &iid) |
Compares the interface ID iid against the interface ID of this interface and of its ancestors. More... | |
Static Public Member Functions inherited from mi::base::IInterface | |
static bool | compare_iid (const Uuid &iid) |
Compares the interface ID iid against the interface ID of this interface. More... | |
A reader supports binary block reads and string-oriented line reads that zero-terminate the result.
|
pure virtual |
Gives access to the lookahead data.
The first size
bytes of binary data are made available from the reader without changing its read position. The method sets the buffer pointer to point to the available lookahead data. It may be set to 0 if no lookahead is available, in which case the return value must be either 0 or -1.
size | The size of the desired lookahead. | |
[out] | buffer | The address of a pointer to the buffer with the lookahead data. The address might be NULL if no lookahead is available, in which case the return value is either 0 or -1. The buffer is owned by the reader and must not be changed or deleted. |
Reads a number of bytes from the stream.
buffer | The buffer to store the data in. |
size | The number of bytes to be read. |
size
, or -1 in case of errors.
|
pure virtual |
Reads a line from the stream.
Reads at most size
- 1 characters from the stream and stores them in buffer
. Reading stops after a newline character or an end-of-file. If a newline is read, it is stored in the buffer. The buffer contents will be zero-terminated.
buffer | The buffer to store the data in. |
size | The maximum number of bytes to be read. |
true
in case of success, or false
in case of errors.
|
pure virtual |
Indicates whether lookahead is (in principle) supported.
An actual lookahead request might still report zero bytes of available lookahead data.