libcdoc 0.1.8
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) override final
 write write bytes to output object
 
result_t close () override final
 informs DataConsumer that the writing is finished
 
bool isError () override final
 checks whether DataSource is in error state
 
result_t open (const std::string &name, int64_t size) override 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)
 write all bytes in vector
 
result_t write (const std::string &src)
 write all bytes in string
 
result_t writeAll (DataSource &src)
 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

Member Function Documentation

◆ close()

result_t libcdoc::FileListConsumer::close ( )
inlinefinaloverridevirtual

informs DataConsumer that the writing is finished

Returns
error code or OK

Implements libcdoc::DataConsumer.

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

◆ isError()

bool libcdoc::FileListConsumer::isError ( )
inlinefinaloverridevirtual

checks whether DataSource is in error state

Returns
true if error state

Implements libcdoc::DataConsumer.

◆ open()

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

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.

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

◆ write()

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

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 libcdoc::OUTPUT_STREAM_ERROR.

Member Data Documentation

◆ base

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

◆ ofs

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

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