|
bit7z 4.1.0
A C++ library for interfacing with the 7-zip shared libs.
|
The BitInputArchive class, given a handler object, allows reading/extracting the content of archives. More...
#include <bit7z/bitinputarchive.hpp>
Classes | |
| class | ConstIterator |
| An iterator for the elements contained in an archive. More... | |
Public Member Functions | |
| BitInputArchive (const BitAbstractArchiveHandler &handler, const bit7zfs::path &arcPath, ArchiveStartOffset startOffset=ArchiveStartOffset::None) | |
| Constructs a BitInputArchive object, opening the input file archive. | |
| BitInputArchive (const BitAbstractArchiveHandler &handler, const buffer_t &inBuffer, ArchiveStartOffset startOffset=ArchiveStartOffset::None) | |
| Constructs a BitInputArchive object, opening the archive given in the input buffer. | |
| BitInputArchive (const BitAbstractArchiveHandler &handler, const tstring &inFile, ArchiveStartOffset startOffset=ArchiveStartOffset::None) | |
| Constructs a BitInputArchive object, opening the input file archive. | |
| BitInputArchive (const BitAbstractArchiveHandler &handler, std::istream &inStream, ArchiveStartOffset startOffset=ArchiveStartOffset::None) | |
| Constructs a BitInputArchive object, opening the archive by reading the given input stream. | |
| auto | archiveHasPath () const noexcept -> bool |
| auto | archivePath () const noexcept -> const tstring & |
| 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 |
| 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 |
| void | extractFolderTo (const tstring &outDir, const tstring &folderPath, FolderPathPolicy policy=FolderPathPolicy::Strip) const |
| Extracts a folder from the archive to the chosen directory. | |
| void | extractMatchingRegexTo (buffer_t &outBuffer, const tstring ®ex, FilterPolicy policy=FilterPolicy::Include) const |
| Extracts to the output buffer the first file in the archive that matches the given regex pattern. | |
| void | extractMatchingRegexTo (const tstring &outDir, const tstring ®ex, FilterPolicy policy=FilterPolicy::Include) const |
| Extracts to the output directory all the items whose paths match the given regex pattern. | |
| void | extractMatchingTo (buffer_t &outBuffer, const tregex ®ex, FilterPolicy policy=FilterPolicy::Include) const |
| Extracts to the output buffer the first file in the archive that matches the given regex pattern. | |
| void | extractMatchingTo (buffer_t &outBuffer, const tstring &itemFilter, FilterPolicy policy=FilterPolicy::Include) const |
| Extracts to the output buffer the first file whose path matches the given wildcard pattern. | |
| void | extractMatchingTo (const tstring &outDir, const tregex ®ex, FilterPolicy policy=FilterPolicy::Include) const |
| Extracts to the output directory all the items whose paths match the given regex pattern. | |
| void | extractMatchingTo (const tstring &outDir, const tstring &itemFilter, FilterPolicy policy=FilterPolicy::Include) const |
| Extracts to the output directory all the items whose paths match the given wildcard pattern. | |
| void | extractRootFolderContentTo (const tstring &outDir) const |
| Extracts the content of the archive's root folder to the chosen directory. | |
| void | extractTo (buffer_t &outBuffer, FilterCallback filterCallback) const |
| Extracts to the output buffer the first item satisfying the given filtering criteria. | |
| void | extractTo (buffer_t &outBuffer, std::uint32_t index=0) const |
| Extracts a file to the output buffer. | |
| void | extractTo (BufferCallback callback, BitIndicesView indices={}) const |
| Extracts the content of the archive to the buffers provided by the given BufferCallback. | |
| void | extractTo (byte_t *outBuffer, std::size_t size, std::uint32_t index=0) const |
| Extracts a file to the pre-allocated output buffer. | |
| template<std::size_t N> | |
| void | extractTo (byte_t(&outBuffer)[N], std::uint32_t index=0) const |
| Extracts a file to the pre-allocated output buffer. | |
| void | extractTo (const tstring &outDir, BitIndicesView indices={}) const |
| Extracts the specified items to the chosen directory. | |
| void | extractTo (const tstring &outDir, FilterCallback filterCallback) const |
| Extracts to the output directory all the items that satisfy the given filtering criteria. | |
| void | extractTo (const tstring &outDir, RenameCallback renameCallback) const |
| Extracts the archive to the chosen directory, specifying the names of the extracted items via a RenameCallback. | |
| void | extractTo (RawDataCallback callback, BitIndicesView indices={}) const |
| Extracts the raw content of the archive to the given callback. | |
| template<std::size_t N> | |
| void | extractTo (std::array< byte_t, N > &outBuffer, std::uint32_t index=0) const |
| Extracts a file to the pre-allocated output buffer. | |
| void | extractTo (std::map< tstring, buffer_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, std::uint32_t index=0) const |
| Extracts a file to the output stream. | |
| auto | find (const tstring &path) const noexcept -> BitInputArchive::ConstIterator |
| Find an item in the archive that has the given path. | |
| auto | findByName (const tstring &name) const noexcept -> BitInputArchive::ConstIterator |
| Find an item in the archive that has the given name (last component of its path within the archive). | |
| auto | handler () const noexcept -> const BitAbstractArchiveHandler & |
| auto | isItemEncrypted (std::uint32_t index) const -> bool |
| auto | isItemFolder (std::uint32_t index) const -> bool |
| auto | itemAt (std::uint32_t index) const -> BitArchiveItemOffset |
| Retrieve the item at the given index. | |
| auto | itemHasProperty (std::uint32_t index, BitProperty property) const -> bool |
| Checks whether the item at the given index has the specified property. | |
| auto | itemProperty (std::uint32_t index, BitProperty property) const -> BitPropVariant |
| Gets the specified property of an item in the archive. | |
| auto | itemsCount () const -> std::uint32_t |
| auto | mainSubfileIndex () const -> std::uint32_t |
| auto | rootFolder () const -> tstring |
| Returns the single top-level folder that contains all of the archive's items. | |
| void | test (BitIndicesView indices={}) const |
| Tests the archive without extracting its content. | |
| void | testItem (std::uint32_t index) const |
| Tests the archive item at the given index without extracting it. | |
| 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. | |
The BitInputArchive class, given a handler object, allows reading/extracting the content of archives.
| BitInputArchive | ( | const BitAbstractArchiveHandler & | handler, |
| const tstring & | inFile, | ||
| ArchiveStartOffset | startOffset = ArchiveStartOffset::None ) |
Constructs a BitInputArchive object, opening the input file archive.
| handler | the reference to the BitAbstractArchiveHandler object containing all the settings to be used for reading the input archive |
| inFile | the path to the input archive file |
| startOffset | (optional) specifies whether to search for the archive's start throughout the entire file or only at the beginning. The default behavior is to search at the beginning. |
| BitInputArchive | ( | const BitAbstractArchiveHandler & | handler, |
| const bit7zfs::path & | arcPath, | ||
| ArchiveStartOffset | startOffset = ArchiveStartOffset::None ) |
Constructs a BitInputArchive object, opening the input file archive.
| handler | the reference to the BitAbstractArchiveHandler object containing all the settings to be used for reading the input archive |
| arcPath | the path to the input archive file |
| startOffset | (optional) whether to search for the archive's start throughout the entire file or only at the beginning. The default behavior is to search at the beginning. |
| BitInputArchive | ( | const BitAbstractArchiveHandler & | handler, |
| const buffer_t & | inBuffer, | ||
| ArchiveStartOffset | startOffset = ArchiveStartOffset::None ) |
Constructs a BitInputArchive object, opening the archive given in the input buffer.
| handler | the reference to the BitAbstractArchiveHandler object containing all the settings to be used for reading the input archive |
| inBuffer | the buffer containing the input archive |
| startOffset | (optional) whether to search for the archive's start throughout the entire file or only at the beginning. The default behavior is to search at the beginning. |
| BitInputArchive | ( | const BitAbstractArchiveHandler & | handler, |
| std::istream & | inStream, | ||
| ArchiveStartOffset | startOffset = ArchiveStartOffset::None ) |
Constructs a BitInputArchive object, opening the archive by reading the given input stream.
| handler | the reference to the BitAbstractArchiveHandler object containing all the settings to be used for reading the input archive |
| inStream | the standard input stream of the input archive |
| startOffset | (optional) whether to search for the archive's start throughout the entire file or only at the beginning. The default behavior is to search at the beginning. |
|
noexcept |
|
noexcept |
| auto archiveProperty | ( | BitProperty | property | ) | const -> BitPropVariant |
Gets the specified archive property.
| property | the property to be retrieved. |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
Find if there is an item in the archive that has the given path.
| path | the path to be searched in the archive. |
|
noexcept |
|
noexcept |
| void extractFolderTo | ( | const tstring & | outDir, |
| const tstring & | folderPath, | ||
| FolderPathPolicy | policy = FolderPathPolicy::Strip ) const |
Extracts a folder from the archive to the chosen directory.
| outDir | the output directory where the extracted folder will be put. |
| folderPath | the path of the folder inside the archive to be extracted. |
| policy | (optional) the path policy to be used for extracting the folder. |
| void extractMatchingRegexTo | ( | buffer_t & | outBuffer, |
| const tstring & | regex, | ||
| FilterPolicy | policy = FilterPolicy::Include ) const |
Extracts to the output buffer the first file in the archive that matches the given regex pattern.
| outBuffer | the output buffer where the extracted file will be put. |
| regex | the regex used for matching the paths of files inside the archive. |
| policy | (optional) the filtering policy to be applied to the matched items. |
| void extractMatchingRegexTo | ( | const tstring & | outDir, |
| const tstring & | regex, | ||
| FilterPolicy | policy = FilterPolicy::Include ) const |
Extracts to the output directory all the items whose paths match the given regex pattern.
| outDir | the output directory where extracted files will be put. |
| regex | the regex used for matching the paths of files inside the archive. |
| policy | (optional) the filtering policy to be applied to the matching items. |
| void extractMatchingTo | ( | buffer_t & | outBuffer, |
| const tregex & | regex, | ||
| FilterPolicy | policy = FilterPolicy::Include ) const |
Extracts to the output buffer the first file in the archive that matches the given regex pattern.
| outBuffer | the output buffer where the extracted file will be put. |
| regex | the regex used for matching the paths of files inside the archive. |
| policy | (optional) the filtering policy to be applied to the matched items. |
| void extractMatchingTo | ( | buffer_t & | outBuffer, |
| const tstring & | itemFilter, | ||
| FilterPolicy | policy = FilterPolicy::Include ) const |
Extracts to the output buffer the first file whose path matches the given wildcard pattern.
| outBuffer | the output buffer where to extract the file. |
| itemFilter | the wildcard pattern used for matching the paths of files inside the archive. |
| policy | (optional) the filtering policy to be applied to the matched items. |
| void extractMatchingTo | ( | const tstring & | outDir, |
| const tregex & | regex, | ||
| FilterPolicy | policy = FilterPolicy::Include ) const |
Extracts to the output directory all the items whose paths match the given regex pattern.
| outDir | the output directory where extracted files will be put. |
| regex | the regex used for matching the paths of files inside the archive. |
| policy | (optional) the filtering policy to be applied to the matching items. |
| void extractMatchingTo | ( | const tstring & | outDir, |
| const tstring & | itemFilter, | ||
| FilterPolicy | policy = FilterPolicy::Include ) const |
Extracts to the output directory all the items whose paths match the given wildcard pattern.
| outDir | the output directory where extracted files will be put. |
| itemFilter | the wildcard pattern used for matching the paths of items inside the archive. |
| policy | (optional) the filtering policy to be applied to the matching items. |
| void extractRootFolderContentTo | ( | const tstring & | outDir | ) | const |
Extracts the content of the archive's root folder to the chosen directory.
The archive's root folder is the single top-level folder shared by all the items in the archive; its name is stripped from the extracted items' paths.
| outDir | the output directory where the root folder's content will be put. |
| void extractTo | ( | buffer_t & | outBuffer, |
| FilterCallback | filterCallback ) const |
Extracts to the output buffer the first item satisfying the given filtering criteria.
| outBuffer | the output buffer where the extracted file will be put. |
| filterCallback | the filtering callback that specifies whether to extract an item or not. |
| void extractTo | ( | buffer_t & | outBuffer, |
| std::uint32_t | index = 0 ) const |
Extracts a file to the output buffer.
| outBuffer | the output buffer where the content of the archive will be put. |
| index | (optional) the index of the file to be extracted. |
| void extractTo | ( | BufferCallback | callback, |
| BitIndicesView | indices = {} ) const |
Extracts the content of the archive to the buffers provided by the given BufferCallback.
| callback | the function providing the buffers. |
| indices | (optional) the indices of the files in the archive that must be extracted. |
| void extractTo | ( | byte_t * | outBuffer, |
| std::size_t | size, | ||
| std::uint32_t | index = 0 ) const |
Extracts a file to the pre-allocated output buffer.
| outBuffer | 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. |
|
inline |
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). |
| outBuffer | the pre-allocated output buffer. |
| index | the index of the file to be extracted. |
| void extractTo | ( | const tstring & | outDir, |
| BitIndicesView | indices = {} ) const |
Extracts the specified items to the chosen directory.
| outDir | the output directory where the extracted files will be put. |
| indices | (optional) the indices of the files in the archive that must be extracted. |
| void extractTo | ( | const tstring & | outDir, |
| FilterCallback | filterCallback ) const |
Extracts to the output directory all the items that satisfy the given filtering criteria.
| outDir | the output directory where extracted files will be put. |
| filterCallback | the filtering callback that specifies whether to extract an item or not. |
| void extractTo | ( | const tstring & | outDir, |
| RenameCallback | renameCallback ) const |
Extracts the archive to the chosen directory, specifying the names of the extracted items via a RenameCallback.
| outDir | the output directory where the extracted files will be put. |
| renameCallback | the callback that returns the names for the extracted files. |
| void extractTo | ( | RawDataCallback | callback, |
| BitIndicesView | indices = {} ) const |
Extracts the raw content of the archive to the given callback.
| callback | a function providing the extracted raw data to the user. |
| indices | (optional) the indices of the files in the archive that must be extracted. |
|
inline |
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). |
| outBuffer | the pre-allocated output buffer. |
| index | the index of the file to be extracted. |
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. |
| void extractTo | ( | std::ostream & | outStream, |
| std::uint32_t | index = 0 ) const |
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. |
|
noexcept |
Find an item in the archive that has the given path.
| path | the path to be searched in the archive. |
|
noexcept |
Find an item in the archive that has the given name (last component of its path within the archive).
| name | the name to be searched in the archive. |
|
noexcept |
| auto isItemEncrypted | ( | std::uint32_t | index | ) | const -> bool |
| index | the index of an item in the archive. |
| auto isItemFolder | ( | std::uint32_t | index | ) | const -> bool |
| index | the index of an item in the archive. |
| auto itemAt | ( | std::uint32_t | index | ) | const -> BitArchiveItemOffset |
Retrieve the item at the given index.
| index | the index of the item to be retrieved. |
| auto itemHasProperty | ( | std::uint32_t | index, |
| BitProperty | property ) const -> bool |
Checks whether the item at the given index has the specified property.
| index | the index (in the archive) of the item. |
| property | the property to be checked for existence. |
| auto itemProperty | ( | std::uint32_t | index, |
| BitProperty | property ) const -> BitPropVariant |
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 itemsCount | ( | ) | const -> std::uint32_t |
| auto mainSubfileIndex | ( | ) | const -> std::uint32_t |
| BitException | if the archive format doesn't have a main subfile. |
| auto rootFolder | ( | ) | const -> tstring |
Returns the single top-level folder that contains all of the archive's items.
The archive is considered to have a root folder only when every item is contained within the same top-level folder. There is no common root folder if the items belong to different top-level folders, if the archive contains a file at its root, or if the archive is empty.
| void test | ( | BitIndicesView | indices = {} | ) | const |
Tests the archive without extracting its content.
| indices | (optional) the indices of the items to be tested. |
| BitException | if the archive is not valid. |
| void testItem | ( | std::uint32_t | index | ) | const |
Tests the archive item at the given index without extracting it.
| index | the index of the item to be tested. |
| BitException | if the index is not valid, or the item at the given index is not valid, or the whole archive is not valid. |
| void useFormatProperty | ( | const wchar_t * | name, |
| const BitPropVariant & | property ) const |
Use the given format property to read the archive.
| name | the name of the property. |
| property | the property value. |
|
inline |
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. |