ckb-next  v0.2.8 at branch master
ckb-next driver for corsair devices
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
quazip.h
Go to the documentation of this file.
1 #ifndef QUA_ZIP_H
2 #define QUA_ZIP_H
3 
4 /*
5 Copyright (C) 2005-2014 Sergey A. Tachenov
6 
7 This file is part of QuaZIP.
8 
9 QuaZIP is free software: you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation, either version 2.1 of the License, or
12 (at your option) any later version.
13 
14 QuaZIP is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU Lesser General Public License for more details.
18 
19 You should have received a copy of the GNU Lesser General Public License
20 along with QuaZIP. If not, see <http://www.gnu.org/licenses/>.
21 
22 See COPYING file for the full LGPL text.
23 
24 Original ZIP package is copyrighted by Gilles Vollant, see
25 quazip/(un)zip.h files for details, basically it's zlib license.
26  **/
27 
28 #include <QString>
29 #include <QStringList>
30 #include <QTextCodec>
31 
32 #include "zip.h"
33 #include "unzip.h"
34 
35 #include "quazip_global.h"
36 #include "quazipfileinfo.h"
37 
38 // just in case it will be defined in the later versions of the ZIP/UNZIP
39 #ifndef UNZ_OPENERROR
40 // define additional error code
41 #define UNZ_OPENERROR -1000
42 #endif
43 
44 class QuaZipPrivate;
45 
47 
85  friend class QuaZipPrivate;
86  public:
88  enum Constants {
89  MAX_FILE_NAME_LENGTH=256
92  };
94  enum Mode {
98  mdAppend,
106  mdAdd
107  };
109 
115  csDefault=0,
116  csSensitive=1,
117  csInsensitive=2
118  };
120 
126  static Qt::CaseSensitivity convertCaseSensitivity(
127  CaseSensitivity cs);
128  private:
130  // not (and will not be) implemented
131  QuaZip(const QuaZip& that);
132  // not (and will not be) implemented
133  QuaZip& operator=(const QuaZip& that);
134  public:
136 
137  QuaZip();
139  QuaZip(const QString& zipName);
141 
144 
145  ~QuaZip();
147 
193  bool open(Mode mode, zlib_filefunc_def *ioApi =NULL);
195 
217  void close();
219 
224  void setFileNameCodec(QTextCodec *fileNameCodec);
226 
229  void setFileNameCodec(const char *fileNameCodecName);
231  QTextCodec* getFileNameCodec() const;
233 
235  void setCommentCodec(QTextCodec *commentCodec);
237 
240  void setCommentCodec(const char *commentCodecName);
242  QTextCodec* getCommentCodec() const;
244 
249  QString getZipName() const;
251 
256  void setZipName(const QString& zipName);
258 
262  QIODevice *getIoDevice() const;
264 
269  void setIoDevice(QIODevice *ioDevice);
271  Mode getMode() const;
273  bool isOpen() const;
275 
283  int getZipError() const;
285 
288  int getEntriesCount() const;
290  QString getComment() const;
292 
300  void setComment(const QString& comment);
302 
305  bool goToFirstFile();
307 
324  bool goToNextFile();
326 
350  bool setCurrentFile(const QString& fileName, CaseSensitivity cs =csDefault);
352  bool hasCurrentFile() const;
354 
375  bool getCurrentFileInfo(QuaZipFileInfo* info)const;
377 
385  bool getCurrentFileInfo(QuaZipFileInfo64* info)const;
387 
393  QString getCurrentFileName()const;
395 
410  unzFile getUnzFile();
412 
416  zipFile getZipFile();
418 
445  void setDataDescriptorWritingEnabled(bool enabled);
447 
450  bool isDataDescriptorWritingEnabled() const;
452 
458  QStringList getFileNameList() const;
460 
472  QList<QuaZipFileInfo> getFileInfoList() const;
474 
482  QList<QuaZipFileInfo64> getFileInfoList64() const;
484 
497  void setZip64Enabled(bool zip64);
499 
504  bool isZip64Enabled() const;
506 
509  bool isAutoClose() const;
511 
531  void setAutoClose(bool autoClose) const;
533 
562  static void setDefaultFileNameCodec(QTextCodec *codec);
568  static void setDefaultFileNameCodec(const char *codecName);
569 };
570 
571 #endif
QIODevice * ioDevice
The device to access the archive.
Definition: quazip.cpp:51
Constants
Useful constants.
Definition: quazip.h:88
voidp unzFile
Definition: unzip.h:75
QuaZipPrivate * p
Definition: quazip.h:129
ZIP file is not open. This is the initial mode.
Definition: quazip.h:95
QString comment
The global comment.
Definition: quazip.cpp:53
ZIP file was created with open() call.
Definition: quazip.h:97
QTextCodec * commentCodec
The codec for comments.
Definition: quazip.cpp:47
Information about a file inside archive.
voidp zipFile
Definition: zip.h:75
friend class QuaZip
Definition: quazip.cpp:40
Mode
Open mode of the ZIP file.
Definition: quazip.h:94
QString zipName
The archive file name.
Definition: quazip.cpp:49
bool zip64
The zip64 mode.
Definition: quazip.cpp:69
bool getFileInfoList(QList< TFileInfo > *result) const
Returns either a list of file names or a list of QuaZipFileInfo.
Definition: quazip.cpp:687
Information about a file inside archive (with zip64 support).
bool autoClose
The auto-close flag.
Definition: quazip.cpp:71
ZIP file is open for reading files inside it.
Definition: quazip.h:96
ZIP archive.
Definition: quazip.h:84
CaseSensitivity
Case sensitivity for the file names.
Definition: quazip.h:114
All the internal stuff for the QuaZip class.
Definition: quazip.cpp:39
#define QUAZIP_EXPORT
This is automatically defined when building a static library, but when including QuaZip sources direc...
Definition: quazip_global.h:46
QuaZip::Mode mode
The open mode.
Definition: quazip.cpp:55
QTextCodec * fileNameCodec
The codec for file names.
Definition: quazip.cpp:45