bit7z 4.0.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 fs::path &arcPath) | |
Constructs a BitInputArchive object, opening the input file archive. | |
BitInputArchive (const BitAbstractArchiveHandler &handler, const std::vector< byte_t > &inBuffer) | |
Constructs a BitInputArchive object, opening the archive given in the input buffer. | |
BitInputArchive (const BitAbstractArchiveHandler &handler, const tstring &inFile) | |
Constructs a BitInputArchive object, opening the input file archive. | |
BitInputArchive (const BitAbstractArchiveHandler &handler, std::istream &inStream) | |
Constructs a BitInputArchive object, opening the archive by reading the given input stream. | |
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 | 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 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 | find (const tstring &path) const noexcept -> BitInputArchive::ConstIterator |
Find an item in the archive that has the given path. | |
auto | handler () const noexcept -> const BitAbstractArchiveHandler & |
auto | isItemEncrypted (uint32_t index) const -> bool |
auto | isItemFolder (uint32_t index) 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 | itemsCount () const -> uint32_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. | |
The BitInputArchive class, given a handler object, allows reading/extracting the content of archives.
BitInputArchive | ( | const BitAbstractArchiveHandler & | handler, |
const tstring & | inFile | ||
) |
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 |
BitInputArchive | ( | const BitAbstractArchiveHandler & | handler, |
const fs::path & | arcPath | ||
) |
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 |
BitInputArchive | ( | const BitAbstractArchiveHandler & | handler, |
const std::vector< byte_t > & | inBuffer | ||
) |
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 |
BitInputArchive | ( | const BitAbstractArchiveHandler & | handler, |
std::istream & | inStream | ||
) |
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 |
|
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 extractTo | ( | byte_t * | buffer, |
std::size_t | size, | ||
uint32_t | index = 0 |
||
) | const |
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. |
|
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). |
buffer | the pre-allocated output buffer. |
index | the index of the file to be extracted. |
void extractTo | ( | const tstring & | outDir, |
const std::vector< uint32_t > & | indices = {} |
||
) | const |
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. |
|
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). |
buffer | the pre-allocated output buffer. |
index | the index of the file to be extracted. |
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.
outMap | the output map. |
void extractTo | ( | std::ostream & | outStream, |
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. |
void extractTo | ( | std::vector< byte_t > & | outBuffer, |
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 | 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 |
auto isItemEncrypted | ( | uint32_t | index | ) | const -> bool |
index | the index of an item in the archive. |
auto isItemFolder | ( | uint32_t | index | ) | const -> bool |
index | the index of an item in the archive. |
auto itemAt | ( | uint32_t | index | ) | const -> BitArchiveItemOffset |
Retrieve the item at the given index.
index | the index of the item to be retrieved. |
auto itemProperty | ( | 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 -> uint32_t |
void test | ( | ) | const |
Tests the archive without extracting its content.
If the archive is not valid, a BitException is thrown!
void testItem | ( | uint32_t | index | ) | const |
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. |