libxcks  0.1.0.1
libxcks::XCKSWriter Class Reference

XCKS file writer. More...

#include <xckswriter.hpp>

Inheritance diagram for libxcks::XCKSWriter:
Collaboration diagram for libxcks::XCKSWriter:

Public Member Functions

 XCKSWriter ()=delete
 Deleted default constructor. More...
 
 XCKSWriter (const XCKSWriter &)=delete
 Deleted copy constructor. More...
 
XCKSWriteroperator= (const XCKSWriter &)=delete
 Deleted copy assignment operator. More...
 
 XCKSWriter (XCKSWriterHandler &xcksWriterHandler, XCKSWriterChecksumProvider &checksumProvider, const XCKSWriterOptions &options, const Version version, const ArrayChecksumAlgoId &algoIds, const ChecksumFormatter::ConfigurationProvider &ckftConfProvider)
 Constructor. More...
 
virtual ~XCKSWriter ()
 Destructor. More...
 
bool write (std::ostream &os, const std::filesystem::path &basePath, const ArrayPath &relativePaths)
 Writes an XCKS file to an output stream. More...
 
bool write (const std::filesystem::path &fileFullPath, const ArrayPath &relativePaths)
 Writes an XCKS file to a file. More...
 
bool write (const std::filesystem::path &filePath, const std::filesystem::path &basePath, const ArrayPath &relativePaths)
 Writes an XCKS file to a file with a different base path. More...
 

Protected Member Functions

virtual bool doWrite (std::ostream &os, const std::filesystem::path &basePath, const ArrayPath &relativePaths)
 Writes an XCKS file to an output stream. More...
 

Protected Attributes

XCKSWriterHandlerwriterHandler
 The XCKS file writer handler. More...
 
XCKSWriterChecksumProviderckProvider
 The provider of checksums values. More...
 
const XCKSWriterOptionswriterOptions
 The writer options. More...
 
const Version version
 Version of the (Z)XCKS file to write. More...
 
const ArrayChecksumAlgoId sumsAlgos
 Type of algorithms' checksums to write for each file. More...
 
const ChecksumFormatter::ConfigurationProviderckfConfProvider
 Configuration provider for ChecksumFormatter. More...
 

Detailed Description

XCKS file writer.

Definition at line 46 of file xckswriter.hpp.

Constructor & Destructor Documentation

◆ XCKSWriter() [1/3]

libxcks::XCKSWriter::XCKSWriter ( )
delete

Deleted default constructor.

◆ XCKSWriter() [2/3]

libxcks::XCKSWriter::XCKSWriter ( const XCKSWriter )
delete

Deleted copy constructor.

◆ XCKSWriter() [3/3]

libxcks::XCKSWriter::XCKSWriter ( XCKSWriterHandler xcksWriterHandler,
XCKSWriterChecksumProvider checksumProvider,
const XCKSWriterOptions options,
const Version  version,
const ArrayChecksumAlgoId algoIds,
const ChecksumFormatter::ConfigurationProvider ckftConfProvider 
)

Constructor.

Parameters
xcksWriterHandlerThe XCKS file reader handler.
checksumProviderThe provider of checksums values from an array of of wanted algorithms of checksums.
optionsOptions of the XCKS writer.
versionThe wanted version of XCKS specification file.
algoIdsThe algorithms to compute for each file. Each algorithm must appears only once in the array.
ckftConfProviderConfiguration provider for ChecksumFormatter.

Definition at line 55 of file xckswriter.cpp.

◆ ~XCKSWriter()

libxcks::XCKSWriter::~XCKSWriter ( )
virtual

Destructor.

Definition at line 75 of file xckswriter.cpp.

Member Function Documentation

◆ doWrite()

bool libxcks::XCKSWriter::doWrite ( std::ostream &  os,
const std::filesystem::path &  basePath,
const ArrayPath relativePaths 
)
protectedvirtual

Writes an XCKS file to an output stream.

Call this method only after checkBaseDirAndPathList().

Note
Errors must be handled in XCKSWriterHandler::onFatalError, XCKSWriterHandler::onFileGetChecksumsError, XCKSWriterHandler::onFileGetChecksumError and XCKSWriterHandler::onFileReadError (the provided XCKS file writer's handler).
Parameters
[in,out]osThe output stream.
[in]basePathThe base path of the written XCKS file. This path must be an absolute path of a directory and must ends with a path separator.
[in]relativePathsRelative paths (to basePath) of files to add in the XCKS file.
Returns
true if the XCKS file has been successfully written to the given stream, false otherwise.

Reimplemented in libxcks::ZXCKSWriter.

Definition at line 190 of file xckswriter.cpp.

◆ operator=()

XCKSWriter& libxcks::XCKSWriter::operator= ( const XCKSWriter )
delete

Deleted copy assignment operator.

◆ write() [1/3]

bool libxcks::XCKSWriter::write ( const std::filesystem::path &  fileFullPath,
const ArrayPath relativePaths 
)

Writes an XCKS file to a file.

Note
Errors must be handled in XCKSWriterHandler::onFatalError, XCKSWriterHandler::onFileGetChecksumsError, XCKSWriterHandler::onFileGetChecksumError and XCKSWriterHandler::onFileReadError (the provided XCKS file writer's handler).
Parameters
[in]fileFullPathThe path of the XCKS file to write. This path must be an absolute path.
[in]relativePathsRelative paths (to the path of fileFullPath) of files to add in the XCKS file.
Returns
true if the XCKS file has been successfully written in the given file, false otherwise.

Definition at line 98 of file xckswriter.cpp.

◆ write() [2/3]

bool libxcks::XCKSWriter::write ( const std::filesystem::path &  filePath,
const std::filesystem::path &  basePath,
const ArrayPath relativePaths 
)

Writes an XCKS file to a file with a different base path.

Note
Errors must be handled in XCKSWriterHandler::onFatalError, XCKSWriterHandler::onFileGetChecksumsError, XCKSWriterHandler::onFileGetChecksumError and XCKSWriterHandler::onFileReadError (the provided XCKS file writer's handler).
Parameters
[in]filePathThe path of the XCKS file to write. This path can be an absolute path or relative path.
[in]basePathThe base path of the written XCKS file. This path must be an absolute path of a directory and must ends with a path separator.
[in]relativePathsRelative paths (to basePath) of files to add in the XCKS file.
Returns
true if the XCKS file has been successfully written in the given file, false otherwise.

Definition at line 129 of file xckswriter.cpp.

◆ write() [3/3]

bool libxcks::XCKSWriter::write ( std::ostream &  os,
const std::filesystem::path &  basePath,
const ArrayPath relativePaths 
)

Writes an XCKS file to an output stream.

Note
Errors must be handled in XCKSWriterHandler::onFatalError, XCKSWriterHandler::onFileGetChecksumsError, XCKSWriterHandler::onFileGetChecksumError and XCKSWriterHandler::onFileReadError (the provided XCKS file writer's handler).
Parameters
[in,out]osThe output stream.
[in]basePathThe base path of the written XCKS file. This path must be an absolute path of a directory and must ends with a path separator.
[in]relativePathsRelative paths (to basePath) of files to add in the XCKS file.
Returns
true if the XCKS file has been successfully written to the given stream, false otherwise.

Definition at line 84 of file xckswriter.cpp.

Member Data Documentation

◆ ckfConfProvider

const ChecksumFormatter::ConfigurationProvider& libxcks::XCKSWriter::ckfConfProvider
protected

Configuration provider for ChecksumFormatter.

Definition at line 54 of file xckswriter.hpp.

◆ ckProvider

XCKSWriterChecksumProvider& libxcks::XCKSWriter::ckProvider
protected

The provider of checksums values.

Definition at line 50 of file xckswriter.hpp.

◆ sumsAlgos

const ArrayChecksumAlgoId libxcks::XCKSWriter::sumsAlgos
protected

Type of algorithms' checksums to write for each file.

Definition at line 53 of file xckswriter.hpp.

◆ version

const Version libxcks::XCKSWriter::version
protected

Version of the (Z)XCKS file to write.

Definition at line 52 of file xckswriter.hpp.

◆ writerHandler

XCKSWriterHandler& libxcks::XCKSWriter::writerHandler
protected

The XCKS file writer handler.

Definition at line 49 of file xckswriter.hpp.

◆ writerOptions

const XCKSWriterOptions& libxcks::XCKSWriter::writerOptions
protected

The writer options.

Definition at line 51 of file xckswriter.hpp.


The documentation for this class was generated from the following files: