bit7z 4.0.0
A C++ library for interfacing with the 7-zip shared libs.
|
The BitCompressor template class allows compressing files into archives. More...
#include <bit7z/bitcompressor.hpp>
Public Member Functions | |
BitCompressor (Bit7zLibrary const &lib, BitInOutFormat const &format) | |
Constructs a BitCompressor object. | |
void | clearPassword () noexcept |
Clear the current password used by the handler. | |
void | compressFile (Input inFile, const tstring &outFile, const tstring &inputName={}) const |
Compresses a single file. | |
void | compressFile (Input inFile, ostream &outStream, const tstring &inputName={}) const |
Compresses the input file to the output stream. | |
void | compressFile (Input inFile, vector< byte_t > &outBuffer, const tstring &inputName={}) const |
Compresses the input file to the output buffer. | |
auto | compressionFormat () const noexcept -> const BitInOutFormat & |
auto | compressionLevel () const noexcept -> BitCompressionLevel |
auto | compressionMethod () const noexcept -> BitCompressionMethod |
auto | cryptHeaders () const noexcept -> bool |
auto | dictionarySize () const noexcept -> uint32_t |
auto | fileCallback () const -> FileCallback |
auto | format () const noexcept -> const BitInFormat &override |
auto | isPasswordDefined () const noexcept -> bool |
auto | library () const noexcept -> const Bit7zLibrary & |
auto | overwriteMode () const -> OverwriteMode |
auto | password () const -> tstring |
auto | passwordCallback () const -> PasswordCallback |
auto | progressCallback () const -> ProgressCallback |
auto | ratioCallback () const -> RatioCallback |
auto | retainDirectories () const noexcept -> bool |
void | setCompressionLevel (BitCompressionLevel level) noexcept |
Sets the compression level to be used when creating/updating an archive. | |
void | setCompressionMethod (BitCompressionMethod method) |
Sets the compression method to be used when creating/updating an archive. | |
void | setDictionarySize (uint32_t dictionarySize) |
Sets the dictionary size to be used when creating/updating an archive. | |
void | setFileCallback (const FileCallback &callback) |
Sets the function to be called when the current file being processed changes. | |
template<std::size_t N, typename T , typename = typename std::enable_if< !std::is_integral< T >::value >::type> | |
void | setFormatProperty (const wchar_t(&name)[N], const T &value) noexcept |
Sets a property for the output archive format as described by the 7-zip documentation (e.g., https://sevenzip.osdn.jp/chm/cmdline/switches/method.htm). | |
template<std::size_t N, typename T , typename = typename std::enable_if< std::is_integral< T >::value >::type> | |
void | setFormatProperty (const wchar_t(&name)[N], T value) noexcept |
Sets a property for the output archive format as described by the 7-zip documentation (e.g., https://sevenzip.osdn.jp/chm/cmdline/switches/method.htm). | |
void | setOverwriteMode (OverwriteMode mode) |
Sets how the handler should behave when it tries to output to an existing file or buffer. | |
void | setPassword (const tstring &password) override |
Sets up a password for the output archives. | |
void | setPassword (const tstring &password, bool cryptHeaders) |
Sets up a password for the output archive. | |
void | setPasswordCallback (const PasswordCallback &callback) |
Sets the function to be called when a password is needed to complete the ongoing operation. | |
void | setProgressCallback (const ProgressCallback &callback) |
Sets the function to be called when the processed size of the ongoing operation is updated. | |
void | setRatioCallback (const RatioCallback &callback) |
Sets the function to be called when the input processed size and current output size of the ongoing operation are known. | |
void | setRetainDirectories (bool retain) noexcept |
Sets whether the operations' output will preserve the input's directory structure or not. | |
void | setSolidMode (bool solidMode) noexcept |
Sets whether to use solid compression or not. | |
void | setStoreSymbolicLinks (bool storeSymlinks) noexcept |
Sets whether the creator will store symbolic links as links in the output archive. | |
void | setThreadsCount (uint32_t threadsCount) noexcept |
Sets the number of threads to be used when creating/updating an archive. | |
void | setTotalCallback (const TotalCallback &callback) |
Sets the function to be called when the total size of an operation is available. | |
void | setUpdateMode (bool canUpdate) |
Sets whether the creator can update existing archives or not. | |
virtual void | setUpdateMode (UpdateMode mode) |
Sets whether and how the creator can update existing archives or not. | |
void | setVolumeSize (uint64_t volumeSize) noexcept |
Sets the volumeSize (in bytes) of the output archive volumes. | |
void | setWordSize (uint32_t wordSize) |
Sets the word size to be used when creating/updating an archive. | |
auto | solidMode () const noexcept -> bool |
auto | storeSymbolicLinks () const noexcept -> bool |
auto | threadsCount () const noexcept -> uint32_t |
auto | totalCallback () const -> TotalCallback |
auto | updateMode () const noexcept -> UpdateMode |
auto | volumeSize () const noexcept -> uint64_t |
auto | wordSize () const noexcept -> uint32_t |
The BitCompressor template class allows compressing files into archives.
It let decide various properties of the produced archive file, such as the password protection and the compression level desired.
|
inline |
Constructs a BitCompressor object.
The Bit7zLibrary parameter is needed to have access to the functionalities of the 7z DLLs. On the contrary, the BitInOutFormat is required to know the format of the output archive.
lib | the 7z library to use. |
format | the output archive format. |
|
noexceptinherited |
Clear the current password used by the handler.
Calling clearPassword() will disable the encryption/decryption of archives.
|
inline |
Compresses a single file.
inFile | the file to be compressed. |
outFile | the path (relative or absolute) to the output archive file. |
inputName | (optional) the name to give to the compressed file inside the output archive. |
|
inline |
Compresses the input file to the output stream.
inFile | the file to be compressed. |
outStream | the output stream. |
inputName | (optional) the name to give to the compressed file inside the output archive. |
|
inline |
Compresses the input file to the output buffer.
inFile | the file to be compressed. |
outBuffer | the buffer going to contain the output archive. |
inputName | (optional) the name to give to the compressed file inside the output archive. |
|
noexceptinherited |
|
noexceptinherited |
|
noexceptinherited |
|
noexceptinherited |
|
noexceptinherited |
|
inherited |
|
overridevirtualnoexceptinherited |
Implements BitAbstractArchiveHandler.
|
noexceptinherited |
|
noexceptinherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
noexceptinherited |
|
noexceptinherited |
Sets the compression level to be used when creating/updating an archive.
level | the compression level desired. |
|
inherited |
Sets the compression method to be used when creating/updating an archive.
method | the compression method desired. |
|
inherited |
Sets the dictionary size to be used when creating/updating an archive.
dictionarySize | the dictionary size desired. |
|
inherited |
Sets the function to be called when the current file being processed changes.
callback | the file callback to be used. |
|
inlinenoexceptinherited |
Sets a property for the output archive format as described by the 7-zip documentation (e.g., https://sevenzip.osdn.jp/chm/cmdline/switches/method.htm).
For example, passing the string L"tm" with a false value while creating a .7z archive will disable storing the last modified timestamps of the compressed files.
T | A non-integral type (i.e., a string). |
name | The string name of the property to be set. |
value | The value to be used for the property. |
|
inlinenoexceptinherited |
Sets a property for the output archive format as described by the 7-zip documentation (e.g., https://sevenzip.osdn.jp/chm/cmdline/switches/method.htm).
T | An integral type (i.e., a bool or an integer type). |
name | The string name of the property to be set. |
value | The value to be used for the property. |
|
inherited |
Sets how the handler should behave when it tries to output to an existing file or buffer.
mode | the OverwriteMode to be used by the handler. |
|
overridevirtualinherited |
Sets up a password for the output archives.
When setting a password, the produced archives will be encrypted using the default cryptographic method of the output format. The option "crypt headers" remains unchanged, in contrast with what happens when calling the setPassword(tstring, bool) method.
password | the password to be used when creating/updating archives. |
Reimplemented from BitAbstractArchiveHandler.
|
inherited |
Sets up a password for the output archive.
When setting a password, the produced archive will be encrypted using the default cryptographic method of the output format. If the format is 7z, and the option "cryptHeaders" is set to true, the headers of the archive will be encrypted, resulting in a password request every time the output file will be opened.
password | the password to be used when creating/updating archives. |
cryptHeaders | if true, the headers of the output archives will be encrypted (valid only when using the 7z format). |
|
inherited |
Sets the function to be called when a password is needed to complete the ongoing operation.
callback | the password callback to be used. |
|
inherited |
Sets the function to be called when the processed size of the ongoing operation is updated.
static_cast<int>((100.0 * processed_size) / total_size)
.callback | the progress callback to be used. |
|
inherited |
Sets the function to be called when the input processed size and current output size of the ongoing operation are known.
static_cast<int>((100.0 * output_size) / input_size)
.callback | the ratio callback to be used. |
|
noexceptinherited |
Sets whether the operations' output will preserve the input's directory structure or not.
retain | the setting for preserving or not the input directory structure |
|
noexceptinherited |
Sets whether to use solid compression or not.
solidMode | if true, it will be used the "solid compression" method. |
|
noexceptinherited |
Sets whether the creator will store symbolic links as links in the output archive.
storeSymlinks | if true, symbolic links will be stored as links. |
|
noexceptinherited |
Sets the number of threads to be used when creating/updating an archive.
threadsCount | the number of threads desired. |
|
inherited |
Sets the function to be called when the total size of an operation is available.
callback | the total callback to be used. |
|
inherited |
Sets whether the creator can update existing archives or not.
canUpdate | if true, compressing operations will update existing archives. |
|
virtualinherited |
Sets whether and how the creator can update existing archives or not.
mode | the desired update mode. |
Reimplemented in BitArchiveEditor.
|
noexceptinherited |
Sets the volumeSize (in bytes) of the output archive volumes.
volumeSize | The dimension of a volume. |
|
inherited |
Sets the word size to be used when creating/updating an archive.
wordSize | the word size desired. |
|
noexceptinherited |
|
noexceptinherited |
|
noexceptinherited |
|
inherited |
|
noexceptinherited |
|
noexceptinherited |
|
noexceptinherited |