![]() |
libgenua
Basic Geometry, Numerical Algorithms and Interfaces
|
Minimal frontend to zlib.
ZipFile provides a simple interface for the reading and writing of standard .zip archive files. This class is available only if the 'zip' option is added to the genua.pro project file.
#include <zipfile.h>
Public Member Functions | |
ZipFile () | |
undefined zipfile | |
~ZipFile () | |
close file if any | |
bool | openArchive (const std::string &archive) |
open existing zip file, move to first file in archive | |
bool | nextFile () |
move to next file | |
std::string | currentFile () |
retrieve name of current file in archive | |
bool | locateFile (const std::string &fname) |
move to file named fname | |
bool | openCurrentFile () |
open current file | |
int | read (uint nbytes, char *buf) |
read data from current file | |
size_t | readOffset () const |
current uncompressed byte offset (reading) | |
uint | skip (uint n) |
read n bytes (decompressed) from current file and discard | |
bool | closeCurrentFile () |
close current file | |
size_t | dumpFile (std::ostream &os) |
dump content of current file into stream | |
bool | createArchive (const std::string &archive) |
create new zip archive | |
bool | newFile (const std::string &fname, int level=-1) |
begin a new file in currently created archive | |
bool | write (uint nbytes, const char *buf) |
write data to file | |
size_t | writeOffset () const |
current uncompressed byte offset (writing) | |
bool | closeFile () |
close current archive file | |
bool | write (const std::string &fname, uint nbytes, const char *buf) |
shortcut for the above three | |
bool | closeArchive () |
close archive file | |
Static Public Member Functions | |
static bool | isZip (const std::string &fname) |
test file header | |
Private Attributes | |
unzFile | m_ufile |
zlib file handle for unzipping | |
zipFile | m_zfile |
zlib file handle for zipping | |
size_t | m_rposition |
uncompressed byte position pointer for reading | |
size_t | m_wposition |
uncompressed byte position pointer for writing | |