1 /****************************************************************************
3 ** Last updated [dd/mm/yyyy]: 28/01/2007
5 ** pkzip 2.0 decompression.
7 ** Some of the code has been inspired by other open source projects,
8 ** (mainly Info-Zip and Gilles Vollant's minizip).
9 ** Compression and decompression actually uses the zlib library.
11 ** Copyright (C) 2007-2008 Angius Fabrizio. All rights reserved.
13 ** This file is part of the OSDaB project (http://osdab.sourceforge.net/).
15 ** This file may be distributed and/or modified under the terms of the
16 ** GNU General Public License version 2 as published by the Free Software
17 ** Foundation and appearing in the file LICENSE.GPL included in the
18 ** packaging of this file.
20 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
21 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 ** See the file LICENSE.GPL that came with this software distribution or
24 ** visit http://www.gnu.org/copyleft/gpl.html for GPL licensing information.
26 **********************************************************************/
28 #ifndef OSDAB_UNZIP__H
29 #define OSDAB_UNZIP__H
35 #include <zlib/zlib.h>
65 HeaderConsistencyError
,
67 Skip
, SkipAll
// internal use only
72 //! Extracts paths (default)
73 ExtractPaths
= 0x0001,
74 //! Ignores paths and extracts all the files to the same directory
77 Q_DECLARE_FLAGS(ExtractionOptions
, ExtractionOption
)
79 enum CompressionMethod
81 NoCompression
, Deflated
, UnknownCompression
96 quint32 compressedSize
;
97 quint32 uncompressedSize
;
100 QDateTime lastModified
;
102 CompressionMethod compression
;
113 ErrorCode
openArchive(const QString
& filename
);
114 ErrorCode
openArchive(QIODevice
* device
);
117 QString
archiveComment() const;
119 QString
formatError(UnZip::ErrorCode c
) const;
121 bool contains(const QString
& file
) const;
123 QStringList
fileList() const;
124 QList
<ZipEntry
> entryList() const;
126 ErrorCode
extractAll(const QString
& dirname
, ExtractionOptions options
= ExtractPaths
);
127 ErrorCode
extractAll(const QDir
& dir
, ExtractionOptions options
= ExtractPaths
);
129 ErrorCode
extractFile(const QString
& filename
, const QString
& dirname
, ExtractionOptions options
= ExtractPaths
);
130 ErrorCode
extractFile(const QString
& filename
, const QDir
& dir
, ExtractionOptions options
= ExtractPaths
);
131 ErrorCode
extractFile(const QString
& filename
, QIODevice
* device
, ExtractionOptions options
= ExtractPaths
);
133 ErrorCode
extractFiles(const QStringList
& filenames
, const QString
& dirname
, ExtractionOptions options
= ExtractPaths
);
134 ErrorCode
extractFiles(const QStringList
& filenames
, const QDir
& dir
, ExtractionOptions options
= ExtractPaths
);
136 void setPassword(const QString
& pwd
);
142 Q_DECLARE_OPERATORS_FOR_FLAGS(UnZip::ExtractionOptions
)
144 #endif // OSDAB_UNZIP__H