Zip archive. More...

#include <zip_archive.h>

Public Member Functions

 ZipArchive ()
 Constructs or loads a ZIP archive. More...
 
 ZipArchive (IODevice &input)
 Constructs a ZipArchive. More...
 
 ZipArchive (const std::string &filename)
 Constructs a ZipArchive. More...
 
 ZipArchive (const ZipArchive &copy)
 Constructs a ZipArchive. More...
 
 ~ZipArchive ()
 
void add_file (const std::string &input_filename, const std::string &filename_in_archive)
 Adds a file to zip archive. More...
 
IODevice create_file (const std::string &filename, bool compress=true)
 Creates a new file entry. More...
 
std::vector< ZipFileEntryget_file_list ()
 List of file entries in archive. More...
 
std::vector< ZipFileEntryget_file_list (const std::string &path)
 
std::string get_pathname (const std::string &filename)
 Get full path to source: More...
 
void load (IODevice &input)
 Loads the zip archive from a input device (done automatically at construction). More...
 
IODevice open_file (const std::string &filename)
 Opens a file in the archive. More...
 
void save ()
 Saves zip archive. More...
 
void save (const std::string &filename)
 Save. More...
 
void save (IODevice iodev)
 Save. More...
 

Detailed Description

Zip archive.

Constructor & Destructor Documentation

clan::ZipArchive::ZipArchive ( )

Constructs or loads a ZIP archive.

Parameters
filename.zip archive to load.
clan::ZipArchive::ZipArchive ( IODevice input)

Constructs a ZipArchive.

Parameters
input= IODevice
clan::ZipArchive::ZipArchive ( const std::string filename)

Constructs a ZipArchive.

Parameters
filename= String Ref
clan::ZipArchive::ZipArchive ( const ZipArchive copy)

Constructs a ZipArchive.

Parameters
copy= Zip Archive
clan::ZipArchive::~ZipArchive ( )

Member Function Documentation

void clan::ZipArchive::add_file ( const std::string input_filename,
const std::string filename_in_archive 
)

Adds a file to zip archive.

File is not added to zip file until it save() is called.

Parameters
filenameFilename of file.
IODevice clan::ZipArchive::create_file ( const std::string filename,
bool  compress = true 
)

Creates a new file entry.

std::vector<ZipFileEntry> clan::ZipArchive::get_file_list ( )

List of file entries in archive.

std::vector<ZipFileEntry> clan::ZipArchive::get_file_list ( const std::string path)
std::string clan::ZipArchive::get_pathname ( const std::string filename)

Get full path to source:

void clan::ZipArchive::load ( IODevice input)

Loads the zip archive from a input device (done automatically at construction).

IODevice clan::ZipArchive::open_file ( const std::string filename)

Opens a file in the archive.

void clan::ZipArchive::save ( )

Saves zip archive.

Parameters
filenameFilename 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.

void clan::ZipArchive::save ( const std::string filename)

Save.

Parameters
filename= the filename to save to
void clan::ZipArchive::save ( IODevice  iodev)

Save.

Parameters
iodev= The file to save to

The documentation for this class was generated from the following file: