24 #ifndef INC_XCKSFILEWRITER_HPP_82011D48_E442_4D38_8BFE_2DFF49B069B4
25 #define INC_XCKSFILEWRITER_HPP_82011D48_E442_4D38_8BFE_2DFF49B069B4
60 const std::filesystem::path& baseDir,
90 void getVersion(
unsigned int& major,
unsigned int& minor,
unsigned int& revision)
const;
108 time_t& filedatetime,
110 const std::filesystem::path& filePath,
111 bool& stopWriting)
const;
120 bool writeLine(std::ostream& os,
const std::string& line,
const int indent);
std::vector< ChecksumValue > ArrayChecksumValue
Array of values of checksum.
~XCKSFileWriter()
Destructor.
ArrayChecksumAlgoId getValidChecksumTypesForNewEntries(const ArrayChecksumAlgoId &ids) const
Gets a valid list of algorithms to calculate for each file.
bool getXCKSAlgorithmName(std::string &algoName, const ChecksumAlgoId algoId)
Gets the algorithm name in the XCKS specification.
std::string getStrVersion() const
Gets the version of the checksums' file type as a string.
static const std::string parentDir
Parent directory on Unix and windows.
XCKSFileWriter(XCKSWriterHandler &xcksWriterHandler, XCKSWriterChecksumProvider &checksumProvider, const XCKSWriterOptions &options, const std::filesystem::path &baseDir, const ArrayChecksumAlgoId &algoIds, const ChecksumFormatter::ConfigurationProvider &confProvider, Version version=Version::Last_Valid)
Constructor.
Version getVersion() const
Returns the version of the checksums' file type.
static Version getValidVersion(const Version ver)
Ensures a valid version of XCKS file.
XCKSWriterChecksumProvider::Status getChecksumValues(ArrayChecksumValue &ckValues, uintmax_t &filesize, time_t &filedatetime, const ArrayChecksumAlgoId &ids, const std::filesystem::path &filePath, bool &stopWriting) const
Gets checksums values from an array of wanted algorithms of checksums.
const std::filesystem::path baseDirectory
The base directory of the checksums' file.
bool writeV1(std::ostream &os, const ArrayPath &relativePaths)
Writes the XCKS file version 1.0.0 in a stream.
ArrayChecksumAlgoId getChecksumTypesForNewEntries() const
Returns the list of checksums algorithms to compute for new entries of this type of checksums' file.
const Version version
Version of the (Z)XCKS file to write.
const XCKSWriterOptions & writerOptions
The writer options.
XCKSFileWriter(const XCKSFileWriter &source)=delete
Deleted copy constructor.
XCKSFileWriter & operator=(const XCKSFileWriter &source)=delete
Deleted assignment operator.
bool writeLine(std::ostream &os, const std::string &line, const int indent)
Writes a line in the XCKS file.
XCKSWriterHandler & writerHandler
The XCKS file writer handler.
const ChecksumFormatter::ConfigurationProvider & ckfConfProvider
Configuration provider for ChecksumFormatter.
StringSet getAvailableChecksumTypesName() const
Returns the list of names of available checksums algorithms for this particular version of XCKS file.
const StringSet possibleSumsAlgos
Possible algorithms names for a (Z)XCKS file.
bool write(std::ostream &os, const ArrayPath &relativePaths)
Writes the checksums in a stream.
bool writeLocalFilesV1(std::ostream &os, const ArrayPath &relativePaths, int &indent)
Writes the "localFiles" section of a XCKS file version 1.0.0 in a stream.
const ArrayChecksumAlgoId sumsAlgos
Type of algorithms' checksums to write for each file.
XCKSWriterChecksumProvider & ckProvider
The provider of checksums values.
ArrayChecksumAlgoId getAvailableChecksumTypes() const
Returns the list of available checksums algorithms for this type of checksums' file.
Provides checksums values from an array of wanted algorithms of checksums for the XCKS writer.
Status
Return status of getChecksumValues().
Handler for writing XCKS files.
Provides options for the XCKS writer.
Handlers for reading and writing XCKS files.
std::vector< ChecksumAlgoId > ArrayChecksumAlgoId
Array of ids of algorithms of checksums.
std::vector< std::filesystem::path > ArrayPath
Array of paths.
ChecksumAlgoId
Ids of algorithms of checksums.
Version
Known versions of XCKS file.
std::set< std::string > StringSet
Set of strings.