Scribus
Open source desktop publishing at your fingertips
|
PKZip 2.0 file decompression. Compatibility with later versions is not ensured as they may use unsupported compression algorithms. Versions after 2.7 may have an incompatible header format and thus be completely incompatible. More...
#include <unzip.h>
Classes | |
struct | ZipEntry |
Public Types | |
enum | ErrorCode { Ok, ZlibInit, ZlibError, OpenFailed, PartiallyCorrupted, Corrupted, WrongPassword, NoOpenArchive, FileNotFound, ReadFailed, WriteFailed, SeekFailed, CreateDirFailed, InvalidDevice, InvalidArchive, HeaderConsistencyError, Skip, SkipAll } |
enum | ExtractionOption { ExtractPaths = 0x0001, SkipPaths = 0x0002, VerifyOnly = 0x0004, NoSilentDirectoryCreation = 0x0008 } |
enum | CompressionMethod { NoCompression, Deflated, UnknownCompression } |
enum | FileType { File, Directory } |
Public Member Functions | |
UnZip () | |
virtual | ~UnZip () |
bool | isOpen () const |
ErrorCode | openArchive (const QString &filename) |
ErrorCode | openArchive (QIODevice *device) |
void | closeArchive () |
QString | archiveComment () const |
QString | formatError (UnZip::ErrorCode c) const |
bool | contains (const QString &file) const |
QStringList | fileList () const |
QList< ZipEntry > | entryList () const |
ErrorCode | verifyArchive () |
ErrorCode | extractAll (const QString &dirname, ExtractionOptions options=ExtractPaths) |
ErrorCode | extractAll (const QDir &dir, ExtractionOptions options=ExtractPaths) |
ErrorCode | extractFile (const QString &filename, const QString &dirname, ExtractionOptions options=ExtractPaths) |
ErrorCode | extractFile (const QString &filename, const QDir &dir, ExtractionOptions options=ExtractPaths) |
ErrorCode | extractFile (const QString &filename, QIODevice *device, ExtractionOptions options=ExtractPaths) |
ErrorCode | extractFiles (const QStringList &filenames, const QString &dirname, ExtractionOptions options=ExtractPaths) |
ErrorCode | extractFiles (const QStringList &filenames, const QDir &dir, ExtractionOptions options=ExtractPaths) |
void | setPassword (const QString &pwd) |
PKZip 2.0 file decompression. Compatibility with later versions is not ensured as they may use unsupported compression algorithms. Versions after 2.7 may have an incompatible header format and thus be completely incompatible.
enum UnZip::ErrorCode |
The result of a decompression operation. UnZip::Ok No error occurred. UnZip::ZlibInit Failed to init or load the zlib library. UnZip::ZlibError The zlib library returned some error. UnZip::OpenFailed Unable to create or open a device. UnZip::PartiallyCorrupted Corrupted zip archive - some files could be extracted. UnZip::Corrupted Corrupted or invalid zip archive. UnZip::WrongPassword Unable to decrypt a password protected file. UnZip::NoOpenArchive No archive has been opened yet. UnZip::FileNotFound Unable to find the requested file in the archive. UnZip::ReadFailed Reading of a file failed. UnZip::WriteFailed Writing of a file failed. UnZip::SeekFailed Seek failed. UnZip::CreateDirFailed Could not create a directory. UnZip::InvalidDevice A null device has been passed as parameter. UnZip::InvalidArchive This is not a valid (or supported) ZIP archive. UnZip::HeaderConsistencyError Local header record info does not match with the central directory record info. The archive may be corrupted.
UnZip::Skip Internal use only. UnZip::SkipAll Internal use only.
UnZip::UnZip | ( | ) |
Creates a new Zip file decompressor.
|
virtual |
Closes any open archive and releases used resources.
void UnZip::closeArchive | ( | ) |
Closes the archive and releases all the used resources (like cached passwords).
bool UnZip::contains | ( | const QString & | file | ) | const |
Returns true if the archive contains a file with the given path and name.
QList< UnZip::ZipEntry > UnZip::entryList | ( | ) | const |
Returns information for each (correctly parsed) entry of this archive.
UnZip::ErrorCode UnZip::extractAll | ( | const QString & | dirname, |
ExtractionOptions | options = ExtractPaths |
||
) |
Extracts the whole archive to a directory.
UnZip::ErrorCode UnZip::extractAll | ( | const QDir & | dir, |
ExtractionOptions | options = ExtractPaths |
||
) |
Extracts the whole archive to a directory. Stops extraction at the first error.
UnZip::ErrorCode UnZip::extractFile | ( | const QString & | filename, |
const QString & | dirname, | ||
ExtractionOptions | options = ExtractPaths |
||
) |
Extracts a single file to a directory.
UnZip::ErrorCode UnZip::extractFile | ( | const QString & | filename, |
const QDir & | dir, | ||
ExtractionOptions | options = ExtractPaths |
||
) |
Extracts a single file to a directory.
UnZip::ErrorCode UnZip::extractFile | ( | const QString & | filename, |
QIODevice * | outDev, | ||
ExtractionOptions | options = ExtractPaths |
||
) |
Extracts a single file to a directory.
UnZip::ErrorCode UnZip::extractFiles | ( | const QStringList & | filenames, |
const QString & | dirname, | ||
ExtractionOptions | options = ExtractPaths |
||
) |
Extracts a list of files. Stops extraction at the first error (but continues if a file does not exist in the archive).
UnZip::ErrorCode UnZip::extractFiles | ( | const QStringList & | filenames, |
const QDir & | dir, | ||
ExtractionOptions | options = ExtractPaths |
||
) |
Extracts a list of files. Stops extraction at the first error (but continues if a file does not exist in the archive).
QStringList UnZip::fileList | ( | ) | const |
Returns complete paths of files and directories in this archive.
QString UnZip::formatError | ( | UnZip::ErrorCode | c | ) | const |
Returns a locale translated error string for a given error code.
bool UnZip::isOpen | ( | ) | const |
Returns true if there is an open archive.
UnZip::ErrorCode UnZip::openArchive | ( | const QString & | filename | ) |
Opens a zip archive and reads the files list. Closes any previously opened archive.
UnZip::ErrorCode UnZip::openArchive | ( | QIODevice * | device | ) |
Opens a zip archive and reads the entries list. Closes any previously opened archive.
void UnZip::setPassword | ( | const QString & | pwd | ) |
Remove/replace this method to add your own password retrieval routine.
UnZip::ErrorCode UnZip::verifyArchive | ( | ) |
Extracts the whole archive to a directory.