Archive
Zip archive
-
struct zip_file_entry_header
Structure containing file entry header attributes.
Public Functions
-
zip_file_entry_header()
-
zip_file_entry_header(const zip_file_entry_header &other)
-
zip_file_entry_header(zip_file_entry_header &&other)
-
~zip_file_entry_header()
-
zip_file_entry_header &operator=(const zip_file_entry_header &other)
-
zip_file_entry_header &operator=(zip_file_entry_header &&other)
Public Members
-
uint32_t header_signature = 0
-
uint16_t required_version = 0
-
uint16_t flag = 0
-
uint16_t compression_method = 0
-
uint16_t last_modified_time = 0
-
uint16_t last_modified_date = 0
-
uint32_t crc32 = 0
-
uint32_t compressed_size = 0
-
uint32_t uncompressed_size = 0
-
std::string filename
-
std::vector<uint8_t> extra_field
-
zip_file_entry_header()
-
class zip_archive
Public Functions
-
zip_archive() = delete
-
zip_archive(const zip_archive&) = delete
-
zip_archive &operator=(const zip_archive) = delete
-
zip_archive(zip_archive_stream *stream)
-
~zip_archive()
-
void load()
Loading involves the parsing of the central directory of a zip archive (located toward the end of the stream) and building of file entry data which are stored in the central directory.
-
zip_file_entry_header get_file_entry_header(std::size_t index) const
Retrieve the header information for a file entry specified by index.
- Parameters:
index – file entry index.
- Returns:
header information for a file entry.
-
zip_file_entry_header get_file_entry_header(std::string_view name) const
Retrieve the header information for a file entry specified by name.
- Parameters:
name – file entry name.
- Returns:
header information for a file entry.
-
std::string_view get_file_entry_name(std::size_t index) const
Get file entry name from its index.
- Parameters:
index – file entry index
- Returns:
file entry name
-
size_t get_file_entry_count() const
Return the number of file entries stored in this zip archive. Note that a file entry may be a directory, so the number of files stored in the zip archive may not equal the number of file entries.
- Returns:
number of file entries.
-
std::vector<unsigned char> read_file_entry(std::string_view entry_name) const
Retrieve data stream of specified file entry. The retrieved data stream gets uncompressed if the original stream is compressed.
- Parameters:
entry_name – file entry name.
- Throws:
zip_error – thrown when any problem is encountered during data stream retrieval.
- Returns:
buffer containing the data stream for specified entry.
-
zip_archive() = delete
-
class zip_archive_stream
Subclassed by orcus::zip_archive_stream_blob, orcus::zip_archive_stream_fd
-
class zip_archive_stream_fd : public orcus::zip_archive_stream
Zip archive based on file descriptor. The caller needs to provide the file path to the zip archive.
-
class zip_archive_stream_blob : public orcus::zip_archive_stream
Zip archive whose content is already loaded onto memory.
Public Functions
-
zip_archive_stream_blob() = delete
-
zip_archive_stream_blob(const uint8_t *blob, std::size_t size)
-
virtual ~zip_archive_stream_blob()
-
virtual size_t size() const
-
virtual size_t tell() const
-
virtual void seek(size_t pos)
-
virtual void read(unsigned char *buffer, size_t length) const
-
zip_archive_stream_blob() = delete