ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
quazipfile.h
Go to the documentation of this file.
1 #ifndef QUA_ZIPFILE_H
2 #define QUA_ZIPFILE_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 <QIODevice>
29 
30 #include "quazip.h"
31 #include "quazip_global.h"
32 #include "quazipnewinfo.h"
33 
34 class QuaZipFilePrivate;
35 
37 
74 class QUAZIP_EXPORT QuaZipFile : public QIODevice {
75  friend class QuaZipFilePrivate;
76  Q_OBJECT
77 private:
78  QuaZipFilePrivate *p;
79  // these are not supported nor implemented
80  QuaZipFile(const QuaZipFile &that);
81  QuaZipFile &operator=(const QuaZipFile &that);
82 
83 protected:
85  qint64 readData(char *data, qint64 maxSize);
87  qint64 writeData(const char *data, qint64 maxSize);
88 
89 public:
91 
94  QuaZipFile();
96 
101  QuaZipFile(QObject *parent);
103 
112  QuaZipFile(const QString &zipName, QObject *parent = NULL);
114 
123  QuaZipFile(const QString &zipName,
124  const QString &fileName,
126  QObject *parent = NULL);
128 
176  QuaZipFile(QuaZip *zip, QObject *parent = NULL);
178 
181  virtual ~QuaZipFile();
183 
192  QString getZipName() const;
194 
197  QuaZip *getZip() const;
199 
211  QString getFileName() const;
213 
224  QuaZip::CaseSensitivity getCaseSensitivity() const;
226 
250  QString getActualFileName() const;
252 
258  void setZipName(const QString &zipName);
260 
264  bool isRaw() const;
266 
274  void setZip(QuaZip *zip);
276 
287  void setFileName(const QString &fileName,
290 
297  virtual bool open(OpenMode mode);
299 
303  inline bool open(OpenMode mode, const char *password) {
304  return open(mode, NULL, NULL, false, password);
305  }
307 
318  bool open(OpenMode mode,
319  int *method,
320  int *level,
321  bool raw,
322  const char *password = NULL);
324 
351  bool open(OpenMode mode,
352  const QuaZipNewInfo &info,
353  const char *password = NULL,
354  quint32 crc = 0,
355  int method = Z_DEFLATED,
356  int level = Z_DEFAULT_COMPRESSION,
357  bool raw = false,
358  int windowBits = -MAX_WBITS,
359  int memLevel = DEF_MEM_LEVEL,
360  int strategy = Z_DEFAULT_STRATEGY);
362  virtual bool isSequential() const;
364 
385  virtual qint64 pos() const;
387 
403  virtual bool atEnd() const;
405 
417  virtual qint64 size() const;
419 
426  qint64 csize() const;
428 
436  qint64 usize() const;
438 
454  bool getFileInfo(QuaZipFileInfo *info);
456 
461  bool getFileInfo(QuaZipFileInfo64 *info);
463 
465  virtual void close();
467  int getZipError() const;
469  virtual qint64 bytesAvailable() const;
470 };
471 
472 #endif
int size
#define NULL
A file inside ZIP archive.
Definition: quazipfile.h:74
bool open(OpenMode mode, const char *password)
Opens a file for reading.
Definition: quazipfile.h:303
ZIP archive.
Definition: quazip.h:128
CaseSensitivity
Case sensitivity for the file names.
Definition: quazip.h:159
@ csDefault
Definition: quazip.h:160
#define QUAZIP_EXPORT
Definition: quazip_global.h:46
Information about a file inside archive (with zip64 support).
Information about a file inside archive.
Information about a file to be created.
Definition: quazipnewinfo.h:49
#define DEF_MEM_LEVEL
Definition: zip.h:99