Jazz2::Utils::ZipWriter class

Writes a ZIP archive.

Files are added one after another, each compressed by Deflate unless it doesn't get smaller then, and the archive is completed by Finish(). The names are UTF-8 with / between directories. Archives larger than 4 GB, which would need ZIP64, aren't supported.

Public static functions

static auto Crc32(ArrayView<const std::uint8_t> data) -> std::uint32_t
Returns the CRC-32 of data, as ZIP and PNG use it.

Constructors, destructors, conversion operators

ZipWriter(Stream& target) explicit
Starts an archive in a stream.
ZipWriter(const ZipWriter&) deleted

Public functions

auto operator=(const ZipWriter&) -> ZipWriter& deleted
auto AddFile(StringView name, ArrayView<const std::uint8_t> data) -> bool
Adds a file, returns false if it couldn't be written.
auto Finish() -> bool
Writes the directory of the archive, returns false if anything couldn't be written.
auto GetCount() const -> std::size_t
Returns the number of files added.