|
bit7z 4.0.9
A C++ library for interfacing with the 7-zip shared libs.
|
The BitArchiveReader class allows reading metadata of archives, as well as extracting them. More...
#include <bit7z/bitarchivereader.hpp>
Inheritance diagram for BitArchiveReader:
Collaboration diagram for BitArchiveReader:Public Member Functions | |
| BitArchiveReader (const Bit7zLibrary &lib, const buffer_t &inArchive, ArchiveStartOffset archiveStart, const BitInFormat &format=BitFormat::Auto, const tstring &password={}) | |
| Constructs a BitArchiveReader object, opening the archive in the input buffer. | |
| BitArchiveReader (const Bit7zLibrary &lib, const std::vector< byte_t > &inArchive, const BitInFormat &format=BitFormat::Auto, const tstring &password={}) | |
| Constructs a BitArchiveReader object, opening the archive in the input buffer. | |
| BitArchiveReader (const Bit7zLibrary &lib, const tstring &inArchive, ArchiveStartOffset archiveStart, const BitInFormat &format=BitFormat::Auto, const tstring &password={}) | |
| Constructs a BitArchiveReader object, opening the input file archive. | |
| BitArchiveReader (const Bit7zLibrary &lib, const tstring &inArchive, const BitInFormat &format=BitFormat::Auto, const tstring &password={}) | |
| Constructs a BitArchiveReader object, opening the input file archive. | |
| BitArchiveReader (const Bit7zLibrary &lib, std::istream &inArchive, ArchiveStartOffset archiveStart, const BitInFormat &format=BitFormat::Auto, const tstring &password={}) | |
| Constructs a BitArchiveReader object, opening the archive from the standard input stream. | |
| BitArchiveReader (const Bit7zLibrary &lib, std::istream &inArchive, const BitInFormat &format=BitFormat::Auto, const tstring &password={}) | |
| Constructs a BitArchiveReader object, opening the archive from the standard input stream. | |
| ~BitArchiveReader () override=default | |
| BitArchiveReader destructor. | |
| auto | archivePath () const noexcept -> const tstring & |
| auto | archiveProperties () const -> map< BitProperty, BitPropVariant > |
| auto | archiveProperty (BitProperty property) const -> BitPropVariant |
| Gets the specified archive property. | |
| auto | begin () const noexcept -> BitInputArchive::ConstIterator |
| auto | cbegin () const noexcept -> BitInputArchive::ConstIterator |
| auto | cend () const noexcept -> BitInputArchive::ConstIterator |
| void | clearPassword () noexcept |
| Clear the current password used by the handler. | |
| auto | contains (const tstring &path) const noexcept -> bool |
| Find if there is an item in the archive that has the given path. | |
| auto | detectedFormat () const noexcept -> const BitInFormat & |
| auto | end () const noexcept -> BitInputArchive::ConstIterator |
| auto | extractionFormat () const noexcept -> const BitInFormat & |
| void | extractTo (byte_t *buffer, std::size_t size, uint32_t index=0) const |
| Extracts a file to the pre-allocated output buffer. | |
| template<std::size_t N> | |
| void | extractTo (byte_t(&buffer)[N], uint32_t index=0) const |
| Extracts a file to the pre-allocated output buffer. | |
| void | extractTo (const tstring &outDir) const |
| Extracts the archive to the chosen directory. | |
| void | extractTo (const tstring &outDir, const std::vector< uint32_t > &indices) const |
| Extracts the specified items to the chosen directory. | |
| template<std::size_t N> | |
| void | extractTo (std::array< byte_t, N > &buffer, uint32_t index=0) const |
| Extracts a file to the pre-allocated output buffer. | |
| void | extractTo (std::map< tstring, std::vector< byte_t > > &outMap) const |
| Extracts the content of the archive to 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 | extractTo (std::ostream &outStream, uint32_t index=0) const |
| Extracts a file to the output stream. | |
| void | extractTo (std::vector< byte_t > &outBuffer, uint32_t index=0) const |
| Extracts a file to the output buffer. | |
| auto | fileCallback () const -> FileCallback |
| auto | filesCount () const -> uint32_t |
| auto | find (const tstring &path) const noexcept -> BitInputArchive::ConstIterator |
| Find an item in the archive that has the given path. | |
| auto | foldersCount () const -> uint32_t |
| auto | format () const noexcept -> const BitInFormat &override |
| auto | handler () const noexcept -> const BitAbstractArchiveHandler & |
| auto | hasEncryptedItems () const -> bool |
| auto | isEncrypted () const -> bool |
| auto | isItemEncrypted (uint32_t index) const -> bool |
| auto | isItemFolder (uint32_t index) const -> bool |
| auto | isMultiVolume () const -> bool |
| auto | isPasswordDefined () const noexcept -> bool |
| auto | isSolid () const -> bool |
| auto | itemAt (uint32_t index) const -> BitArchiveItemOffset |
| Retrieve the item at the given index. | |
| auto | itemProperty (uint32_t index, BitProperty property) const -> BitPropVariant |
| Gets the specified property of an item in the archive. | |
| auto | items () const -> vector< BitArchiveItemInfo > |
| auto | itemsCount () const -> uint32_t |
| auto | library () const noexcept -> const Bit7zLibrary & |
| auto | overwriteMode () const -> OverwriteMode |
| auto | packSize () const -> uint64_t |
| 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. | |
| auto | size () const -> uint64_t |
| void | test () const |
| Tests the archive without extracting its content. | |
| void | testItem (uint32_t index) const |
| Tests the item at the given index inside the archive without extracting it. | |
| auto | totalCallback () const -> TotalCallback |
| void | useFormatProperty (const wchar_t *name, const BitPropVariant &property) const |
| Use the given format property to read the archive. | |
| template<typename T , typename = typename std::enable_if< is_explicitly_convertible< T, BitPropVariant >::value >::type> | |
| void | useFormatProperty (const wchar_t *name, T &&value) const |
| Use the given format property to read the archive. | |
| auto | volumesCount () const -> uint32_t |
Static Public Member Functions | |
| template<typename T > | |
| static auto | isEncrypted (const Bit7zLibrary &lib, T &&inArchive, const BitInFormat &format=BitFormat::Auto) -> bool |
| Checks if the given archive contains only encrypted items. | |
| template<typename T > | |
| static auto | isHeaderEncrypted (const Bit7zLibrary &lib, T &&inArchive, const BitInFormat &format=BitFormat::Auto) -> bool |
| Checks if the given archive is header-encrypted or not. | |
The BitArchiveReader class allows reading metadata of archives, as well as extracting them.
| BitArchiveReader | ( | const Bit7zLibrary & | lib, |
| const tstring & | inArchive, | ||
| ArchiveStartOffset | archiveStart, | ||
| const BitInFormat & | format = BitFormat::Auto, | ||
| const tstring & | password = {} ) |
Constructs a BitArchiveReader object, opening the input file archive.
BIT7Z_AUTO_FORMAT option, the format argument has the default value BitFormat::Auto (automatic format detection of the input archive). On the contrary, when BIT7Z_AUTO_FORMAT is not defined (i.e., no auto format detection available), the format argument must be specified.| lib | the 7z library used. |
| inArchive | the path to the archive to be read. |
| archiveStart | whether to search for the archive's start throughout the entire file or only at the beginning. |
| format | the format of the input archive. |
| password | (optional) the password needed for opening the input archive. |
| BitArchiveReader | ( | const Bit7zLibrary & | lib, |
| const tstring & | inArchive, | ||
| const BitInFormat & | format = BitFormat::Auto, | ||
| const tstring & | password = {} ) |
Constructs a BitArchiveReader object, opening the input file archive.
BIT7Z_AUTO_FORMAT option, the format argument has the default value BitFormat::Auto (automatic format detection of the input archive). On the contrary, when BIT7Z_AUTO_FORMAT is not defined (i.e., no auto format detection available), the format argument must be specified.| lib | the 7z library used. |
| inArchive | the path to the archive to be read. |
| format | the format of the input archive. |
| password | (optional) the password needed for opening the input archive. |
| BitArchiveReader | ( | const Bit7zLibrary & | lib, |
| const buffer_t & | inArchive, | ||
| ArchiveStartOffset | archiveStart, | ||
| const BitInFormat & | format = BitFormat::Auto, | ||
| const tstring & | password = {} ) |
Constructs a BitArchiveReader object, opening the archive in the input buffer.
BIT7Z_AUTO_FORMAT option, the format argument has the default value BitFormat::Auto (automatic format detection of the input archive). On the contrary, when BIT7Z_AUTO_FORMAT is not defined (i.e., no auto format detection available), the format argument must be specified.| lib | the 7z library used. |
| inArchive | the input buffer containing the archive to be read. |
| archiveStart | whether to search for the archive's start throughout the entire file or only at the beginning. |
| format | the format of the input archive. |
| password | (optional) the password needed for opening the input archive. |
| BitArchiveReader | ( | const Bit7zLibrary & | lib, |
| const std::vector< byte_t > & | inArchive, | ||
| const BitInFormat & | format = BitFormat::Auto, | ||
| const tstring & | password = {} ) |
Constructs a BitArchiveReader object, opening the archive in the input buffer.
BIT7Z_AUTO_FORMAT option, the format argument has the default value BitFormat::Auto (automatic format detection of the input archive). On the contrary, when BIT7Z_AUTO_FORMAT is not defined (i.e., no auto format detection available), the format argument must be specified.| lib | the 7z library used. |
| inArchive | the input buffer containing the archive to be read. |
| format | the format of the input archive. |
| password | (optional) the password needed for opening the input archive. |
| BitArchiveReader | ( | const Bit7zLibrary & | lib, |
| std::istream & | inArchive, | ||
| ArchiveStartOffset | archiveStart, | ||
| const BitInFormat & | format = BitFormat::Auto, | ||
| const tstring & | password = {} ) |
Constructs a BitArchiveReader object, opening the archive from the standard input stream.
BIT7Z_AUTO_FORMAT option, the format argument has the default value BitFormat::Auto (automatic format detection of the input archive). On the contrary, when BIT7Z_AUTO_FORMAT is not defined (i.e., no auto format detection available), the format argument must be specified.| lib | the 7z library used. |
| inArchive | the standard input stream of the archive to be read. |
| archiveStart | whether to search for the archive's start throughout the entire file or only at the beginning. |
| format | the format of the input archive. |
| password | (optional) the password needed for opening the input archive. |
| BitArchiveReader | ( | const Bit7zLibrary & | lib, |
| std::istream & | inArchive, | ||
| const BitInFormat & | format = BitFormat::Auto, | ||
| const tstring & | password = {} ) |
Constructs a BitArchiveReader object, opening the archive from the standard input stream.
BIT7Z_AUTO_FORMAT option, the format argument has the default value BitFormat::Auto (automatic format detection of the input archive). On the contrary, when BIT7Z_AUTO_FORMAT is not defined (i.e., no auto format detection available), the format argument must be specified.| lib | the 7z library used. |
| inArchive | the standard input stream of the archive to be read. |
| format | the format of the input archive. |
| password | (optional) the password needed for opening the input archive. |
|
overridedefault |
BitArchiveReader destructor.
|
noexceptinherited |
| auto archiveProperties | ( | ) | const -> map< BitProperty, BitPropVariant > |
|
inherited |
Gets the specified archive property.
| property | the property to be retrieved. |
|
noexceptinherited |
|
noexceptinherited |
|
noexceptinherited |
|
noexceptinherited |
Clear the current password used by the handler.
Calling clearPassword() will disable the encryption/decryption of archives.
|
noexceptinherited |
Find if there is an item in the archive that has the given path.
| path | the path to be searched in the archive. |
|
noexceptinherited |
|
noexceptinherited |
|
noexceptinherited |
|
inherited |
Extracts a file to the pre-allocated output buffer.
| buffer | the pre-allocated output buffer. |
| size | the size of the output buffer (it must be equal to the unpacked size of the item to be extracted). |
| index | the index of the file to be extracted. |
|
inlineinherited |
Extracts a file to the pre-allocated output buffer.
| N | the size of the output buffer (it must be equal to the unpacked size of the item to be extracted). |
| buffer | the pre-allocated output buffer. |
| index | the index of the file to be extracted. |
|
inherited |
Extracts the archive to the chosen directory.
| outDir | the output directory where the extracted files will be put. |
|
inherited |
Extracts the specified items to the chosen directory.
| outDir | the output directory where the extracted files will be put. |
| indices | the array of indices of the files in the archive that must be extracted. |
|
inlineinherited |
Extracts a file to the pre-allocated output buffer.
| N | the size of the output buffer (it must be equal to the unpacked size of the item to be extracted). |
| buffer | the pre-allocated output buffer. |
| index | the index of the file to be extracted. |
|
inherited |
Extracts the content of the archive to a map of memory buffers, where the keys are the paths of the files (inside the archive), and the values are their decompressed contents.
| outMap | the output map. |
|
inherited |
Extracts a file to the output stream.
| outStream | the (binary) stream where the content of the archive will be put. |
| index | the index of the file to be extracted. |
|
inherited |
Extracts a file to the output buffer.
| outBuffer | the output buffer where the content of the archive will be put. |
| index | the index of the file to be extracted. |
|
inherited |
| auto filesCount | ( | ) | const -> uint32_t |
|
noexceptinherited |
Find an item in the archive that has the given path.
| path | the path to be searched in the archive. |
| auto foldersCount | ( | ) | const -> uint32_t |
|
overridevirtualnoexceptinherited |
Implements BitAbstractArchiveHandler.
|
noexceptinherited |
| auto hasEncryptedItems | ( | ) | const -> bool |
| auto isEncrypted | ( | ) | const -> bool |
|
inlinestatic |
Checks if the given archive contains only encrypted items.
| T | The input type of the archive (i.e., file path, buffer, or standard stream). |
| lib | the 7z library used. |
| inArchive | the archive to be read. |
| format | the format of the input archive. |
|
inlinestatic |
Checks if the given archive is header-encrypted or not.
| T | The input type of the archive (i.e., file path, buffer, or standard stream). |
| lib | the 7z library used. |
| inArchive | the archive to be read. |
| format | the format of the input archive. |
|
inherited |
| index | the index of an item in the archive. |
|
inherited |
| index | the index of an item in the archive. |
| auto isMultiVolume | ( | ) | const -> bool |
|
noexceptinherited |
| auto isSolid | ( | ) | const -> bool |
|
inherited |
Retrieve the item at the given index.
| index | the index of the item to be retrieved. |
|
inherited |
Gets the specified property of an item in the archive.
| index | the index (in the archive) of the item. |
| property | the property to be retrieved. |
| auto items | ( | ) | const -> vector< BitArchiveItemInfo > |
|
inherited |
|
noexceptinherited |
|
inherited |
| auto packSize | ( | ) | const -> uint64_t |
|
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. |
| auto size | ( | ) | const -> uint64_t |
|
inherited |
Tests the archive without extracting its content.
If the archive is not valid, a BitException is thrown!
|
inherited |
Tests the item at the given index inside the archive without extracting it.
If the archive is not valid, or there's no item at the given index, a BitException is thrown!
| index | the index of the file to be tested. |
|
inherited |
|
inherited |
Use the given format property to read the archive.
| name | the name of the property. |
| property | the property value. |
|
inlineinherited |
Use the given format property to read the archive.
| T | the type of the property. |
| name | the name of the property. |
| value | the property value. |
| auto volumesCount | ( | ) | const -> uint32_t |