diff options
Diffstat (limited to 'rbutil/rbutilqt/zip/zip.h')
-rw-r--r-- | rbutil/rbutilqt/zip/zip.h | 230 |
1 files changed, 115 insertions, 115 deletions
diff --git a/rbutil/rbutilqt/zip/zip.h b/rbutil/rbutilqt/zip/zip.h index 44fdd08b5f..8f82f1738a 100644 --- a/rbutil/rbutilqt/zip/zip.h +++ b/rbutil/rbutilqt/zip/zip.h | |||
@@ -1,115 +1,115 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** Filename: zip.h | 2 | ** Filename: zip.h |
3 | ** Last updated [dd/mm/yyyy]: 01/02/2007 | 3 | ** Last updated [dd/mm/yyyy]: 01/02/2007 |
4 | ** | 4 | ** |
5 | ** pkzip 2.0 file compression. | 5 | ** pkzip 2.0 file compression. |
6 | ** | 6 | ** |
7 | ** Some of the code has been inspired by other open source projects, | 7 | ** Some of the code has been inspired by other open source projects, |
8 | ** (mainly Info-Zip and Gilles Vollant's minizip). | 8 | ** (mainly Info-Zip and Gilles Vollant's minizip). |
9 | ** Compression and decompression actually uses the zlib library. | 9 | ** Compression and decompression actually uses the zlib library. |
10 | ** | 10 | ** |
11 | ** Copyright (C) 2007 Angius Fabrizio. All rights reserved. | 11 | ** Copyright (C) 2007 Angius Fabrizio. All rights reserved. |
12 | ** | 12 | ** |
13 | ** This file is part of the OSDaB project (http://osdab.sourceforge.net/). | 13 | ** This file is part of the OSDaB project (http://osdab.sourceforge.net/). |
14 | ** | 14 | ** |
15 | ** This file may be distributed and/or modified under the terms of the | 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 | 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 | 17 | ** Foundation and appearing in the file LICENSE.GPL included in the |
18 | ** packaging of this file. | 18 | ** packaging of this file. |
19 | ** | 19 | ** |
20 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 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. | 21 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
22 | ** | 22 | ** |
23 | ** See the file LICENSE.GPL that came with this software distribution or | 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. | 24 | ** visit http://www.gnu.org/copyleft/gpl.html for GPL licensing information. |
25 | ** | 25 | ** |
26 | **********************************************************************/ | 26 | **********************************************************************/ |
27 | 27 | ||
28 | #ifndef OSDAB_ZIP__H | 28 | #ifndef OSDAB_ZIP__H |
29 | #define OSDAB_ZIP__H | 29 | #define OSDAB_ZIP__H |
30 | 30 | ||
31 | #include <QtGlobal> | 31 | #include <QtGlobal> |
32 | #include <QMap> | 32 | #include <QMap> |
33 | 33 | ||
34 | #include <zlib/zlib.h> | 34 | #include <zlib/zlib.h> |
35 | 35 | ||
36 | class ZipPrivate; | 36 | class ZipPrivate; |
37 | 37 | ||
38 | class QIODevice; | 38 | class QIODevice; |
39 | class QFile; | 39 | class QFile; |
40 | class QDir; | 40 | class QDir; |
41 | class QStringList; | 41 | class QStringList; |
42 | class QString; | 42 | class QString; |
43 | 43 | ||
44 | 44 | ||
45 | class Zip | 45 | class Zip |
46 | { | 46 | { |
47 | public: | 47 | public: |
48 | enum ErrorCode | 48 | enum ErrorCode |
49 | { | 49 | { |
50 | Ok, | 50 | Ok, |
51 | ZlibInit, | 51 | ZlibInit, |
52 | ZlibError, | 52 | ZlibError, |
53 | FileExists, | 53 | FileExists, |
54 | OpenFailed, | 54 | OpenFailed, |
55 | NoOpenArchive, | 55 | NoOpenArchive, |
56 | FileNotFound, | 56 | FileNotFound, |
57 | ReadFailed, | 57 | ReadFailed, |
58 | WriteFailed, | 58 | WriteFailed, |
59 | SeekFailed | 59 | SeekFailed |
60 | }; | 60 | }; |
61 | 61 | ||
62 | enum CompressionLevel | 62 | enum CompressionLevel |
63 | { | 63 | { |
64 | Store, | 64 | Store, |
65 | Deflate1 = 1, Deflate2, Deflate3, Deflate4, | 65 | Deflate1 = 1, Deflate2, Deflate3, Deflate4, |
66 | Deflate5, Deflate6, Deflate7, Deflate8, Deflate9, | 66 | Deflate5, Deflate6, Deflate7, Deflate8, Deflate9, |
67 | AutoCPU, AutoMIME, AutoFull | 67 | AutoCPU, AutoMIME, AutoFull |
68 | }; | 68 | }; |
69 | 69 | ||
70 | enum CompressionOption | 70 | enum CompressionOption |
71 | { | 71 | { |
72 | //! Does not preserve absolute paths in the zip file when adding a file/directory (default) | 72 | //! Does not preserve absolute paths in the zip file when adding a file/directory (default) |
73 | RelativePaths = 0x0001, | 73 | RelativePaths = 0x0001, |
74 | //! Preserve absolute paths | 74 | //! Preserve absolute paths |
75 | AbsolutePaths = 0x0002, | 75 | AbsolutePaths = 0x0002, |
76 | //! Do not store paths. All the files are put in the (evtl. user defined) root of the zip file | 76 | //! Do not store paths. All the files are put in the (evtl. user defined) root of the zip file |
77 | IgnorePaths = 0x0004 | 77 | IgnorePaths = 0x0004 |
78 | }; | 78 | }; |
79 | Q_DECLARE_FLAGS(CompressionOptions, CompressionOption) | 79 | Q_DECLARE_FLAGS(CompressionOptions, CompressionOption) |
80 | 80 | ||
81 | Zip(); | 81 | Zip(); |
82 | virtual ~Zip(); | 82 | virtual ~Zip(); |
83 | 83 | ||
84 | bool isOpen() const; | 84 | bool isOpen() const; |
85 | 85 | ||
86 | void setPassword(const QString& pwd); | 86 | void setPassword(const QString& pwd); |
87 | void clearPassword(); | 87 | void clearPassword(); |
88 | QString password() const; | 88 | QString password() const; |
89 | 89 | ||
90 | ErrorCode createArchive(const QString& file, bool overwrite = true); | 90 | ErrorCode createArchive(const QString& file, bool overwrite = true); |
91 | ErrorCode createArchive(QIODevice* device); | 91 | ErrorCode createArchive(QIODevice* device); |
92 | 92 | ||
93 | QString archiveComment() const; | 93 | QString archiveComment() const; |
94 | void setArchiveComment(const QString& comment); | 94 | void setArchiveComment(const QString& comment); |
95 | 95 | ||
96 | ErrorCode addDirectoryContents(const QString& path, CompressionLevel level = AutoFull); | 96 | ErrorCode addDirectoryContents(const QString& path, CompressionLevel level = AutoFull); |
97 | ErrorCode addDirectoryContents(const QString& path, const QString& root, CompressionLevel level = AutoFull); | 97 | ErrorCode addDirectoryContents(const QString& path, const QString& root, CompressionLevel level = AutoFull); |
98 | 98 | ||
99 | ErrorCode addDirectory(const QString& path, CompressionOptions options = RelativePaths, CompressionLevel level = AutoFull); | 99 | ErrorCode addDirectory(const QString& path, CompressionOptions options = RelativePaths, CompressionLevel level = AutoFull); |
100 | ErrorCode addDirectory(const QString& path, const QString& root, CompressionLevel level = AutoFull); | 100 | ErrorCode addDirectory(const QString& path, const QString& root, CompressionLevel level = AutoFull); |
101 | ErrorCode addDirectory(const QString& path, const QString& root, CompressionOptions options = RelativePaths, CompressionLevel level = AutoFull); | 101 | ErrorCode addDirectory(const QString& path, const QString& root, CompressionOptions options = RelativePaths, CompressionLevel level = AutoFull); |
102 | 102 | ||
103 | ErrorCode closeArchive(); | 103 | ErrorCode closeArchive(); |
104 | 104 | ||
105 | QString formatError(ErrorCode c) const; | 105 | QString formatError(ErrorCode c) const; |
106 | 106 | ||
107 | virtual void progress() {} | 107 | virtual void progress() {} |
108 | 108 | ||
109 | private: | 109 | private: |
110 | ZipPrivate* d; | 110 | ZipPrivate* d; |
111 | }; | 111 | }; |
112 | 112 | ||
113 | Q_DECLARE_OPERATORS_FOR_FLAGS(Zip::CompressionOptions) | 113 | Q_DECLARE_OPERATORS_FOR_FLAGS(Zip::CompressionOptions) |
114 | 114 | ||
115 | #endif // OSDAB_ZIP__H | 115 | #endif // OSDAB_ZIP__H |