The DataSource class.
More...
#include <Io.h>
Inherited by libcdoc::ChainedSource, libcdoc::IStreamSource, libcdoc::MultiDataSource, and libcdoc::VectorSource.
The DataSource class.
An abstact base class for input objects
◆ DataSource() [1/2]
libcdoc::DataSource::DataSource |
( |
| ) |
|
|
default |
◆ ~DataSource()
virtual libcdoc::DataSource::~DataSource |
( |
| ) |
|
|
virtualdefault |
◆ DataSource() [2/2]
libcdoc::DataSource::DataSource |
( |
const DataSource & |
| ) |
|
|
delete |
◆ getLastErrorStr()
virtual std::string libcdoc::DataSource::getLastErrorStr |
( |
result_t |
code | ) |
const |
|
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.
- Parameters
-
code | the last returned error code |
- Returns
- error text
◆ isEof()
virtual bool libcdoc::DataSource::isEof |
( |
| ) |
|
|
inlinevirtual |
◆ isError()
virtual bool libcdoc::DataSource::isError |
( |
| ) |
|
|
inlinevirtual |
◆ operator=()
◆ read()
virtual result_t libcdoc::DataSource::read |
( |
uint8_t * |
dst, |
|
|
size_t |
size |
|
) |
| |
|
inlinevirtual |
◆ readAll()
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.
- Parameters
-
- Returns
- error code or OK
References libcdoc::DataConsumer::writeAll().
◆ seek()
virtual result_t libcdoc::DataSource::seek |
( |
size_t |
pos | ) |
|
|
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.
- Parameters
-
pos | the position from the beggining of data |
- Returns
- error code or OK
Reimplemented in libcdoc::IStreamSource, and libcdoc::VectorSource.
References libcdoc::NOT_IMPLEMENTED.
◆ skip()
result_t libcdoc::DataSource::skip |
( |
size_t |
size | ) |
|
skip specified number of bytes
The following invariant holds:
- if there is neither error nor eof then result == size
- if there is no errors but end of stream is reached then 0 <= result <= size
- if there is error then result < 0
- Parameters
-
size | the number of bytes to skip |
- Returns
- the number of bytes skipped
The documentation for this struct was generated from the following file: