bit7z 4.0.0
A C++ library for interfacing with the 7-zip shared libs.
|
The BitExtractor template class allows extracting the content of archives from supported input types. More...
#include <bit7z/bitextractor.hpp>
Public Member Functions | |
BitExtractor (const Bit7zLibrary &lib, const BitInFormat &format=BitFormat::Auto) | |
Constructs a BitExtractor object. | |
void | clearPassword () noexcept |
Clear the current password used by the handler. | |
void | extract (Input inArchive, const tstring &outDir={}) const |
Extracts the given archive to the chosen directory. | |
void | extract (Input inArchive, std::map< tstring, vector< byte_t > > &outMap) const |
Extracts the content of the given archive into a map of memory buffers, where the keys are the paths of the files (inside the archive), and the values are their decompressed contents. | |
void | extract (Input inArchive, std::ostream &outStream, uint32_t index=0) const |
Extracts a file from the given archive to the output stream. | |
void | extract (Input inArchive, vector< byte_t > &outBuffer, uint32_t index=0) const |
Extracts a file from the given archive to the output buffer. | |
auto | extractionFormat () const noexcept -> const BitInFormat & |
void | extractItems (Input inArchive, const std::vector< uint32_t > &indices, const tstring &outDir={}) const |
Extracts the specified items from the given archive to the chosen directory. | |
void | extractMatching (Input inArchive, const tstring &itemFilter, const tstring &outDir={}, FilterPolicy policy=FilterPolicy::Include) const |
Extracts the files in the archive that match the given wildcard pattern to the chosen directory. | |
void | extractMatching (Input inArchive, const tstring &itemFilter, vector< byte_t > &outBuffer, FilterPolicy policy=FilterPolicy::Include) const |
Extracts to the output buffer the first file in the archive matching the given wildcard pattern. | |
void | extractMatchingRegex (Input inArchive, const tstring ®ex, const tstring &outDir={}, FilterPolicy policy=FilterPolicy::Include) const |
Extracts the files in the archive that match the given regex pattern to the chosen directory. | |
void | extractMatchingRegex (Input inArchive, const tstring ®ex, vector< byte_t > &outBuffer, FilterPolicy policy=FilterPolicy::Include) const |
Extracts the first file in the archive that matches the given regex pattern to the output buffer. | |
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 | setFileCallback (const FileCallback &callback) |
Sets the function to be called when the current file being processed changes. | |
void | setOverwriteMode (OverwriteMode mode) |
Sets how the handler should behave when it tries to output to an existing file or buffer. | |
virtual void | setPassword (const tstring &password) |
Sets up a password to be used by the archive handler. | |
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 | setTotalCallback (const TotalCallback &callback) |
Sets the function to be called when the total size of an operation is available. | |
void | test (Input inArchive) const |
Tests the given archive without extracting its content. | |
auto | totalCallback () const -> TotalCallback |
The BitExtractor template class allows extracting the content of archives from supported input types.
Input | the type of input archives that the generated extractor class supports. |
|
inlineexplicit |
Constructs a BitExtractor object.
The Bit7zLibrary parameter is needed to have access to the functionalities of the 7z DLLs. On the contrary, the BitInFormat is required to know the format of the in_file archives.
lib | the 7z library to use. |
format | the in_file archive format. |
|
noexceptinherited |
Clear the current password used by the handler.
Calling clearPassword() will disable the encryption/decryption of archives.
|
inline |
Extracts the given archive to the chosen directory.
inArchive | the input archive to be extracted. |
outDir | the output directory where extracted files will be put. |
|
inline |
Extracts the content of the given archive into a map of memory buffers, where the keys are the paths of the files (inside the archive), and the values are their decompressed contents.
inArchive | the input archive to be extracted. |
outMap | the output map. |
|
inline |
Extracts a file from the given archive to the output stream.
inArchive | the input archive to extract from. |
outStream | the (binary) stream where the content of the extracted file will be put. |
index | the index of the file to be extracted from the archive. |
|
inline |
Extracts a file from the given archive to the output buffer.
inArchive | the input archive to extract from. |
outBuffer | the output buffer where the content of the extracted file will be put. |
index | the index of the file to be extracted from the archive. |
|
noexceptinherited |
|
inline |
Extracts the specified items from the given archive to the chosen directory.
inArchive | the input archive to extract from. |
indices | the indices of the files in the archive that should be extracted. |
outDir | the output directory where the extracted files will be placed. |
|
inline |
Extracts the files in the archive that match the given wildcard pattern to the chosen directory.
inArchive | the input archive to extract from. |
itemFilter | the wildcard pattern used for matching the paths of files inside the archive. |
outDir | the output directory where extracted files will be put. |
policy | the filtering policy to be applied to the matched items. |
|
inline |
Extracts to the output buffer the first file in the archive matching the given wildcard pattern.
inArchive | the input archive to extract from. |
itemFilter | the wildcard pattern used for matching the paths of files inside the archive. |
outBuffer | the output buffer where to extract the file. |
policy | the filtering policy to be applied to the matched items. |
|
inline |
Extracts the files in the archive that match the given regex pattern to the chosen directory.
inArchive | the input archive to extract from. |
regex | the regex used for matching the paths of files inside the archive. |
outDir | the output directory where extracted files will be put. |
policy | the filtering policy to be applied to the matched items. |
|
inline |
Extracts the first file in the archive that matches the given regex pattern to the output buffer.
inArchive | the input archive to extract from. |
regex | the regex used for matching the paths of files inside the archive. |
outBuffer | the output buffer where the extracted file will be put. |
policy | the filtering policy to be applied to the matched items. |
|
inherited |
|
overridevirtualnoexceptinherited |
Implements BitAbstractArchiveHandler.
|
noexceptinherited |
|
noexceptinherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
noexceptinherited |
|
inherited |
Sets the function to be called when the current file being processed changes.
callback | the file callback to be used. |
|
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. |
|
virtualinherited |
Sets up a password to be used by the archive handler.
The password will be used to encrypt/decrypt archives by using the default cryptographic method of the archive format.
password | the password to be used. |
Reimplemented in BitAbstractArchiveCreator.
|
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 |
|
inherited |
Sets the function to be called when the total size of an operation is available.
callback | the total callback to be used. |
|
inline |
Tests the given archive without extracting its content.
If the archive is not valid, a BitException is thrown!
inArchive | the input archive to be tested. |
|
inherited |