Zip archive. More...
#include <zip_archive.h>
Public Member Functions | |
Construction | |
CL_ZipArchive () | |
Constructs or loads a ZIP archive. | |
CL_ZipArchive (CL_IODevice &input) | |
Constructs a ZipArchive. | |
CL_ZipArchive (const CL_StringRef &filename) | |
Constructs a ZipArchive. | |
CL_ZipArchive (const CL_ZipArchive ©) | |
Constructs a ZipArchive. | |
~CL_ZipArchive () | |
Attributes | |
std::vector< CL_ZipFileEntry > | get_file_list () |
List of file entries in archive. | |
std::vector< CL_ZipFileEntry > | get_file_list (const CL_StringRef &path) |
Operations | |
CL_IODevice | open_file (const CL_StringRef &filename) |
Opens a file in the archive. | |
CL_String | get_pathname (const CL_StringRef &filename) |
Get full path to source: | |
CL_IODevice | create_file (const CL_StringRef &filename, bool compress=true) |
Creates a new file entry. | |
void | add_file (const CL_StringRef &input_filename, const CL_StringRef &filename_in_archive) |
Adds a file to zip archive. | |
void | save () |
Saves zip archive. | |
void | save (const CL_StringRef &filename) |
Save. | |
void | save (CL_IODevice iodev) |
Save. | |
void | load (CL_IODevice &input) |
Loads the zip archive from a input device (done automatically at construction). |
Zip archive.
CL_ZipArchive::CL_ZipArchive | ( | ) |
Constructs or loads a ZIP archive.
filename | .zip archive to load. |
CL_ZipArchive::CL_ZipArchive | ( | CL_IODevice & | input | ) |
Constructs a ZipArchive.
input | = IODevice |
CL_ZipArchive::CL_ZipArchive | ( | const CL_StringRef & | filename | ) |
Constructs a ZipArchive.
filename | = String Ref |
CL_ZipArchive::CL_ZipArchive | ( | const CL_ZipArchive & | copy | ) |
Constructs a ZipArchive.
copy | = Zip Archive |
CL_ZipArchive::~CL_ZipArchive | ( | ) |
void CL_ZipArchive::add_file | ( | const CL_StringRef & | input_filename, | |
const CL_StringRef & | filename_in_archive | |||
) |
Adds a file to zip archive.
File is not added to zip file until it save() is called.
filename | Filename of file. |
CL_IODevice CL_ZipArchive::create_file | ( | const CL_StringRef & | filename, | |
bool | compress = true | |||
) |
Creates a new file entry.
std::vector<CL_ZipFileEntry> CL_ZipArchive::get_file_list | ( | ) |
List of file entries in archive.
std::vector<CL_ZipFileEntry> CL_ZipArchive::get_file_list | ( | const CL_StringRef & | path | ) |
CL_String CL_ZipArchive::get_pathname | ( | const CL_StringRef & | filename | ) |
Get full path to source:
void CL_ZipArchive::load | ( | CL_IODevice & | input | ) |
Loads the zip archive from a input device (done automatically at construction).
CL_IODevice CL_ZipArchive::open_file | ( | const CL_StringRef & | filename | ) |
Opens a file in the archive.
void CL_ZipArchive::save | ( | const CL_StringRef & | filename | ) |
Save.
filename | = the filename to save to |
void CL_ZipArchive::save | ( | CL_IODevice | iodev | ) |
Save.
iodev | = The file to save to |
void CL_ZipArchive::save | ( | ) |
Saves zip archive.
filename | Filename of zip archive. Must not be used to save to the same as loaded from. |
If no filename parameter was passed, it will modify the zip archive loaded at construction time. It does this by creating a temporary file, saving the new archive, deletes the old one and renames the temp file to the original archive filename.
If the archive was created instead of loaded, a filename must be specify a filename. Likewise, if saving to same archive as loaded from, a filename must not be specified. Doing so will cause the save operation to fail.