libcdoc 0.5.0
libcdoc::FileListConsumer Struct Reference

#include <Io.h>

Inherits libcdoc::MultiDataConsumer.

Public Member Functions

 FileListConsumer (const std::string &base_path)
result_t write (const uint8_t *src, size_t size) noexcept final
 write write bytes to output object
result_t close () noexcept final
 informs DataConsumer that the writing is finished
bool isError () noexcept final
 checks whether DataSource is in error state
result_t open (const std::string &name, int64_t size) final
 create a new named sub-stream
Public Member Functions inherited from libcdoc::MultiDataConsumer
virtual ~MultiDataConsumer ()=default
Public Member Functions inherited from libcdoc::DataConsumer
 DataConsumer ()=default
virtual ~DataConsumer ()=default
virtual std::string getLastErrorStr (result_t code) const
 get textual description of the last error
result_t write (const std::vector< uint8_t > &src) noexcept
 write all bytes in vector
result_t write (const std::string &src) noexcept
 write all bytes in string
result_t writeAll (DataSource &src) noexcept
 write all data from input object
 DataConsumer (const DataConsumer &)=delete
DataConsumeroperator= (const DataConsumer &)=delete

Protected Attributes

std::filesystem::path base
std::ofstream ofs

Constructor & Destructor Documentation

◆ FileListConsumer()

libcdoc::FileListConsumer::FileListConsumer ( const std::string & base_path)
inline

References base.

Member Function Documentation

◆ close()

result_t libcdoc::FileListConsumer::close ( )
inlinefinalvirtualnoexcept

informs DataConsumer that the writing is finished

Returns
error code or OK

Implements libcdoc::DataConsumer.

References ofs, libcdoc::OK, and libcdoc::OUTPUT_STREAM_ERROR.

◆ isError()

bool libcdoc::FileListConsumer::isError ( )
inlinefinalvirtualnoexcept

checks whether DataSource is in error state

Returns
true if error state

Implements libcdoc::DataConsumer.

References ofs.

◆ open()

result_t libcdoc::FileListConsumer::open ( const std::string & name,
int64_t size )
finalvirtual

create a new named sub-stream

Creates a new named sub-stream. It is up to implementation to handle the name and optional size.

Parameters
namethe name of sub-stream
sizethe size of sub-stream or -1 if unknown at creation time
Returns
error code or OK

Implements libcdoc::MultiDataConsumer.

◆ write()

result_t libcdoc::FileListConsumer::write ( const uint8_t * src,
size_t size )
inlinefinalvirtualnoexcept

write write bytes to output object

The following invariant holds: If there was no error then result == size If there was an error then result < 0

Parameters
srcsource block
sizethe number of bytes to write
Returns
size or error code

Implements libcdoc::DataConsumer.

References ofs, and libcdoc::OUTPUT_STREAM_ERROR.

Member Data Documentation

◆ base

std::filesystem::path libcdoc::FileListConsumer::base
protected

Referenced by FileListConsumer().

◆ ofs

std::ofstream libcdoc::FileListConsumer::ofs
protected

Referenced by close(), isError(), and write().


The documentation for this struct was generated from the following file:
  • Io.h