libcdoc 0.1.8
libcdoc::ChainedSource Struct Reference

#include <Io.h>

Inherits libcdoc::DataSource.

Public Member Functions

 ChainedSource (DataSource *src, bool take_ownership)
 
 ~ChainedSource ()
 
result_t read (uint8_t *dst, size_t size) noexcept override
 read bytes from input object
 
bool isError () noexcept override
 check whether DataConsumer is in error state
 
bool isEof () noexcept override
 check whether DataConsumer is reached to the end of data
 
- Public Member Functions inherited from libcdoc::DataSource
 DataSource ()=default
 
virtual ~DataSource ()=default
 
virtual result_t seek (size_t pos)
 set stream input pointer
 
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) noexcept
 read all data and writes to output object
 
 DataSource (const DataSource &)=delete
 
DataSourceoperator= (const DataSource &)=delete
 

Protected Attributes

DataSource_src
 
bool _owned
 

Constructor & Destructor Documentation

◆ ChainedSource()

libcdoc::ChainedSource::ChainedSource ( DataSource src,
bool  take_ownership 
)
inline

◆ ~ChainedSource()

libcdoc::ChainedSource::~ChainedSource ( )
inline

Member Function Documentation

◆ isEof()

bool libcdoc::ChainedSource::isEof ( )
inlineoverridevirtualnoexcept

check whether DataConsumer is reached to the end of data

Returns
true if end of stream

Reimplemented from libcdoc::DataSource.

◆ isError()

bool libcdoc::ChainedSource::isError ( )
inlineoverridevirtualnoexcept

check whether DataConsumer is in error state

Returns
true if error state

Reimplemented from libcdoc::DataSource.

◆ read()

result_t libcdoc::ChainedSource::read ( uint8_t *  dst,
size_t  size 
)
inlineoverridevirtualnoexcept

read bytes from input object

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
    dstthe destination block
    sizethe number of bytes to read
    Returns
    the number of bytes read or error code

Reimplemented from libcdoc::DataSource.

Member Data Documentation

◆ _owned

bool libcdoc::ChainedSource::_owned
protected

◆ _src

DataSource* libcdoc::ChainedSource::_src
protected

The documentation for this struct was generated from the following file: