Thin object-oriented wrapper around the MZ Zip library Zip file reader and extractor.
More...
#include <mz_zip_archive.h>
Thin object-oriented wrapper around the MZ Zip library Zip file reader and extractor.
Not thread safe. Move only.
Definition at line 20 of file mz_zip_archive.h.
◆ mz_zip_archivet() [1/4]
mz_zip_archivet::mz_zip_archivet |
( |
const std::string & |
filename | ) |
|
|
explicit |
Open a zip archive.
- Parameters
-
filename | Path of the zip archive |
- Exceptions
-
Throws | std::runtime_error if file cannot be opened |
Definition at line 47 of file mz_zip_archive.cpp.
◆ mz_zip_archivet() [2/4]
mz_zip_archivet::mz_zip_archivet |
( |
const void * |
data, |
|
|
size_t |
size |
|
) |
| |
Loads a zip buffer.
- Parameters
-
data | pointer to the memory buffer |
size | size of the buffer |
- Exceptions
-
Throws | std::runtime_error if data is not in correct format |
Definition at line 50 of file mz_zip_archive.cpp.
◆ mz_zip_archivet() [3/4]
◆ mz_zip_archivet() [4/4]
Move constructor. Doesn't throw. Leaves other object invalidated.
Definition at line 54 of file mz_zip_archive.cpp.
◆ ~mz_zip_archivet()
mz_zip_archivet::~mz_zip_archivet |
( |
| ) |
|
|
default |
◆ extract()
std::string mz_zip_archivet::extract |
( |
size_t |
index | ) |
|
Get contents of nth file in the archive.
- Parameters
-
index | id of the file in the archive |
- Exceptions
-
Throws | std::runtime_error if file cannot be extracted |
- Returns
- Contents of the file in the archive
Definition at line 87 of file mz_zip_archive.cpp.
◆ extract_to_file()
void mz_zip_archivet::extract_to_file |
( |
size_t |
index, |
|
|
const std::string & |
path |
|
) |
| |
Write contents of nth file in the archive to a file.
- Parameters
-
index | id of the file in the archive |
path | path to which to write the contents of the file |
- Exceptions
-
Throws | std::runtime_error if file cannot be written |
Definition at line 105 of file mz_zip_archive.cpp.
◆ get_filename()
std::string mz_zip_archivet::get_filename |
( |
size_t |
index | ) |
|
Get file name of nth file in the archive.
- Parameters
-
index | id of the file in the archive |
- Returns
- Name of the file in the archive
Definition at line 72 of file mz_zip_archive.cpp.
◆ get_num_files()
size_t mz_zip_archivet::get_num_files |
( |
| ) |
|
◆ operator=() [1/2]
◆ operator=() [2/2]
Move assignment.
Doesn't throw. Replaces this object's state with other object's state. Invalidates other object.
Definition at line 61 of file mz_zip_archive.cpp.
◆ m_state
The documentation for this class was generated from the following files: