13#ifndef BITCOMPRESSOR_HPP
14#define BITCOMPRESSOR_HPP
18#include "bitoutputarchive.hpp"
30using namespace filesystem;
32#ifdef __cpp_if_constexpr
33#define BIT7Z_IF_CONSTEXPR if constexpr
35#define BIT7Z_IF_CONSTEXPR if
44template<
typename Input >
69 const tstring& inputName = {} )
const {
75 name = inputName.empty() ? fsutil::stem( outFile ) : inputName;
78 BitOutputArchive outputArchive{ *
this, outFile };
79 outputArchive.addFile( inFile, name );
80 outputArchive.compressTo( outFile );
92 const tstring& inputName = {} )
const {
94 outputArchive.addFile( inFile, inputName );
95 outputArchive.compressTo( outBuffer );
107 const tstring& inputName = {} )
const {
109 outputArchive.
addFile( inFile, inputName );
110 outputArchive.compressTo( outStream );
The Bit7zLibrary class allows accessing the basic functionalities provided by the 7z DLLs.
Definition bit7zlibrary.hpp:56
Abstract class representing a generic archive creator.
Definition bitabstractarchivecreator.hpp:44
auto format() const noexcept -> const BitInFormat &override
The BitCompressor template class allows compressing files into archives.
Definition bitcompressor.hpp:45
void compressFile(Input inFile, const tstring &outFile, const tstring &inputName={}) const
Compresses a single file.
Definition bitcompressor.hpp:67
void compressFile(Input inFile, ostream &outStream, const tstring &inputName={}) const
Compresses the input file to the output stream.
Definition bitcompressor.hpp:105
BitCompressor(Bit7zLibrary const &lib, BitInOutFormat const &format)
Constructs a BitCompressor object.
Definition bitcompressor.hpp:57
void compressFile(Input inFile, vector< byte_t > &outBuffer, const tstring &inputName={}) const
Compresses the input file to the output buffer.
Definition bitcompressor.hpp:90
The BitOutputArchive class, given a creator object, allows creating new archives.
Definition bitoutputarchive.hpp:60
void addFile(const tstring &inFile, const tstring &name={})
Adds the given file path, with an optional user-defined path to be used in the output archive.
The main namespace of the bit7z library.
Definition bit7zlibrary.hpp:30
std::basic_string< tchar > tstring
Definition bittypes.hpp:90