Random access to the entries in a zip archive. More...
#include <Zip.hpp>
Public Member Functions | |
virtual | ~Unzipper () |
Destroy the unzipper, closing the archive if it is open. More... | |
virtual void | close () |
Close the archive. More... | |
long long | entryCount () const |
Get the number of entries in the original archive if one exists. More... | |
std::vector< std::string > | entryNames () const |
Get the entry names in the original archive if one exists. More... | |
long long | getEntryIndex (const std::string &name) const |
Get the index of the entry that corresponds to the supplied name. More... | |
void | getEntryInfo (const std::string &name, ZipEntryInfo &info) const |
Get information on the entry with the specified name. More... | |
void | getEntryInfo (long long index, ZipEntryInfo &info) const |
Get information on the entry with the specified index. More... | |
std::string | getEntryName (long long index) const |
Get the name of the entry that corresponds to the supplied index. More... | |
Resource::File | getPath () const |
Get the file URI that this unzipper accesses. More... | |
bool | hasEntry (const std::string &name) const |
Does the original archive have an entry with the specified name? More... | |
bool | isOpen () const |
Is an archive currently open? More... | |
virtual void | open (const Resource::File &path_, bool verify) |
Open the specified archive for reading. More... | |
virtual void | open (const Resource::File &path_, bool verify, const std::string &pw) |
Open the specified archive for reading. More... | |
std::string | readArchiveComment () const |
Get the comment on the archive if one exists. More... | |
std::vector< char > | readEntryAsBytes (const std::string &name) const |
Get the contents of the specified entry in the original archive if one exists. More... | |
std::vector< char > | readEntryAsBytes (long long index) const |
Get the contents of the specified entry in the original archive if one exists. More... | |
std::string | readEntryAsString (const std::string &name) const |
Get the contents of the specified entry in the original archive if one exists. More... | |
std::string | readEntryAsString (long long index) const |
Get the contents of the specified entry in the original archive if one exists. More... | |
std::string | readEntryComment (const std::string &name) const |
Get the comment on the entry if one exists. More... | |
std::string | readEntryComment (long long index) const |
Get the comment on the entry if one exists. More... | |
Random access to the entries in a zip archive.
Zip archive entries can be accessed via their names or their indices.
Unzipper instances are not thread safe and thus must be used in a single thread.
|
virtual |
Destroy the unzipper, closing the archive if it is open.
|
virtual |
long long entryCount | ( | ) | const |
Get the number of entries in the original archive if one exists.
If the archive is being written to (via Zipper) and is new, this will return zero.
ZipException | if the archive is not open |
std::vector<std::string> entryNames | ( | ) | const |
Get the entry names in the original archive if one exists.
If the archive is being written to (via Zipper) and is new, this will return an empty vector.
ZipException | if the archive is not open |
long long getEntryIndex | ( | const std::string & | name | ) | const |
Get the index of the entry that corresponds to the supplied name.
name | the name of the entry |
ZipException | if there is no such entry |
ZipException | if the archive is not open |
void getEntryInfo | ( | const std::string & | name, |
ZipEntryInfo & | info | ||
) | const |
Get information on the entry with the specified name.
A valid entry name must first be obtained by calling getEntryPaths().
name | the name of the entry |
info | the zip entry info structure that will be filled with the info |
ZipException | if the entry info could not be obtained |
ZipException | if the archive is not open |
void getEntryInfo | ( | long long | index, |
ZipEntryInfo & | info | ||
) | const |
Get information on the entry with the specified index.
index | the index of the entry |
info | the zip entry info structure that will be filled with the info |
ZipException | if the entry info could not be obtained |
ZipException | if the archive is not open |
std::string getEntryName | ( | long long | index | ) | const |
Get the name of the entry that corresponds to the supplied index.
index | the index of the entry |
ZipException | if the entry name could not be obtained |
ZipException | if the archive is not open |
|
inline |
Get the file URI that this unzipper accesses.
bool hasEntry | ( | const std::string & | name | ) | const |
Does the original archive have an entry with the specified name?
If the archive being written to is new, this will always return false.
name | the name of the entry |
ZipException | if the archive is not open |
|
inline |
Is an archive currently open?
|
virtual |
Open the specified archive for reading.
path_ | the path to the archive |
verify | if true, the implementation will first verify the archive |
InvalidArchiveException | if verify is true and the archive is deemed to be invalid |
Reimplemented in Zipper.
|
virtual |
Open the specified archive for reading.
path_ | the path to the archive |
verify | if true, the implementation will first verify the archive |
pw | the archive's password if encryption was used when writing |
InvalidArchiveException | if verify is true and the archive is deemed to be invalid |
Reimplemented in Zipper.
std::string readArchiveComment | ( | ) | const |
Get the comment on the archive if one exists.
If the archive is being written to (via Zipper) and is new, this will return an empty string.
ZipException | if the archive is not open |
std::vector<char> readEntryAsBytes | ( | const std::string & | name | ) | const |
Get the contents of the specified entry in the original archive if one exists.
A valid entry name must first be obtained by calling getEntryPaths().
name | the name of the entry |
ZipException | if the entry could not be obtained |
ZipException | if the archive is not open |
std::vector<char> readEntryAsBytes | ( | long long | index | ) | const |
Get the contents of the specified entry in the original archive if one exists.
index | the index of the entry |
ZipException | if the entry could not be obtained |
ZipException | if the archive is not open |
std::string readEntryAsString | ( | const std::string & | name | ) | const |
Get the contents of the specified entry in the original archive if one exists.
A valid entry name must first be obtained by calling getEntryPaths().
name | the name of the entry |
ZipException | if the entry could not be obtained |
ZipException | if the archive is not open |
std::string readEntryAsString | ( | long long | index | ) | const |
Get the contents of the specified entry in the original archive if one exists.
index | the index of the entry |
ZipException | if the entry could not be obtained |
ZipException | if the archive is not open |
std::string readEntryComment | ( | const std::string & | name | ) | const |
Get the comment on the entry if one exists.
A valid entry name must first be obtained by calling getEntryPaths().
ZipException | if the entry comment could not be obtained |
ZipException | if the archive is not open |
std::string readEntryComment | ( | long long | index | ) | const |
Get the comment on the entry if one exists.
ZipException | if the archive is not open |
ZipException | if the entry comment could not be obtained |