|
libcdoc 0.1.8
|
The DataSource class. More...
#include <Io.h>
Inherited by libcdoc::ChainedSource, libcdoc::IStreamSource, libcdoc::MultiDataSource, and libcdoc::VectorSource.
Public Member Functions | |
| DataSource ()=default | |
| virtual | ~DataSource ()=default |
| virtual result_t | seek (size_t pos) |
| set stream input pointer | |
| virtual result_t | read (uint8_t *dst, size_t size) |
| read bytes from input object | |
| virtual bool | isError () |
| check whether DataConsumer is in error state | |
| virtual bool | isEof () |
| check whether DataConsumer is reached to the end of data | |
| virtual std::string | getLastErrorStr (result_t code) const |
| get textual description of the last error | |
| result_t | skip (size_t size) |
| skip specified number of bytes | |
| result_t | readAll (DataConsumer &dst) |
| read all data and writes to output object | |
| DataSource (const DataSource &)=delete | |
| DataSource & | operator= (const DataSource &)=delete |
The DataSource class.
An abstact base class for input objects
|
default |
Referenced by libcdoc::ChainedSource::ChainedSource(), DataSource(), and operator=().
|
virtualdefault |
|
delete |
References DataSource().
|
virtual |
get textual description of the last error
Implementation can decide whether to store the actual error string or return the generic text based on error code. It is undefined what will be returned if the last error code is not the one used as the argument.
| code | the last returned error code |
|
inlinevirtual |
check whether DataConsumer is reached to the end of data
Reimplemented in libcdoc::ChainedSource, libcdoc::FileListSource, libcdoc::IStreamSource, and libcdoc::VectorSource.
|
inlinevirtual |
check whether DataConsumer is in error state
Reimplemented in libcdoc::ChainedSource, libcdoc::FileListSource, libcdoc::IStreamSource, and libcdoc::VectorSource.
|
delete |
References DataSource().
|
inlinevirtual |
read bytes from input object
The following invariant holds:
| dst | the destination block |
| size | the number of bytes to read |
Reimplemented in libcdoc::ChainedSource, libcdoc::FileListSource, libcdoc::IStreamSource, and libcdoc::VectorSource.
References libcdoc::NOT_IMPLEMENTED.
|
inline |
read all data and writes to output object
Copies all bytes (until EOF or error) to the output object. If error occurs while writing data, the destination objects' error code is returned.
| dst | the destination DataConsumer |
References libcdoc::DataConsumer::writeAll().
|
inlinevirtual |
set stream input pointer
Positions the read pointer at the specific distance from the stream start. If the stream does not support seeking NOT_IMPLEMENTED is returned.
| pos | the position from the beggining of data |
Reimplemented in libcdoc::IStreamSource, and libcdoc::VectorSource.
References libcdoc::NOT_IMPLEMENTED.
| result_t libcdoc::DataSource::skip | ( | size_t | size | ) |
skip specified number of bytes
The following invariant holds:
| size | the number of bytes to skip |