ZipReader.h header
#include <ew/app/ZipReader.h>
Namespace ew::app
Entry struct
struct ew::app::Entry
One archive entry as recorded in the central directory.
Members
int ew::app::ZipReader::Entry::method = 0
Compression method: 0 = STORED, 8 = DEFLATE.
qint64 ew::app::ZipReader::Entry::compressedSize = 0
Compressed size in bytes, from the central directory.
qint64 ew::app::ZipReader::Entry::localOffset = 0
Byte offset of the entry's local header within the archive.
ZipReader class
class ew::app::ZipReader
Reads entries out of a ZIP archive held in memory (the container format behind .docx, .epub and similar). Only the two methods those formats use are supported: STORED (method 0) and DEFLATE (method 8, via inflateRaw). The central directory is parsed once at construction; each entry is decompressed on demand. Sizes and offsets come from the central directory (the authoritative copy), so archives that use streaming data descriptors are handled correctly. It is the read counterpart to makeZip().
Members
ew::app::ZipReader::ZipReader(QByteArray zip)
Parses the central directory of zip. isValid() reports whether a directory was found.
bool ew::app::ZipReader::isValid() const
Whether a well-formed central directory was located.
QStringList ew::app::ZipReader::entryNames() const
The entry names, in central-directory order.
std::optional< QByteArray > ew::app::ZipReader::read(const QString &name) const
The decompressed bytes of the named entry, or nullopt if it is absent or uses an unsupported compression method.