QuaZIP  quazip-0-6-2
quazipfile.h
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 3 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_global.h"
31 #include "quazip.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:
79  // these are not supported nor implemented
80  QuaZipFile(const QuaZipFile& that);
81  QuaZipFile& operator=(const QuaZipFile& that);
82  protected:
84  qint64 readData(char *data, qint64 maxSize);
86  qint64 writeData(const char *data, qint64 maxSize);
87  public:
89 
92  QuaZipFile();
94 
99  QuaZipFile(QObject *parent);
101 
110  QuaZipFile(const QString& zipName, QObject *parent =NULL);
112 
121  QuaZipFile(const QString& zipName, const QString& fileName,
122  QuaZip::CaseSensitivity cs =QuaZip::csDefault, QObject *parent =NULL);
124 
172  QuaZipFile(QuaZip *zip, QObject *parent =NULL);
174 
177  virtual ~QuaZipFile();
179 
188  QString getZipName()const;
190 
193  QuaZip* getZip()const;
195 
207  QString getFileName() const;
209 
220  QuaZip::CaseSensitivity getCaseSensitivity() const;
222 
246  QString getActualFileName()const;
248 
254  void setZipName(const QString& zipName);
256 
260  bool isRaw() const;
262 
270  void setZip(QuaZip *zip);
272 
283  void setFileName(const QString& fileName, QuaZip::CaseSensitivity cs =QuaZip::csDefault);
285 
292  virtual bool open(OpenMode mode);
294 
298  inline bool open(OpenMode mode, const char *password)
299  {return open(mode, NULL, NULL, false, password);}
301 
312  bool open(OpenMode mode, int *method, int *level, bool raw, const char *password =NULL);
314 
341  bool open(OpenMode mode, const QuaZipNewInfo& info,
342  const char *password =NULL, quint32 crc =0,
343  int method =Z_DEFLATED, int level =Z_DEFAULT_COMPRESSION, bool raw =false,
344  int windowBits =-MAX_WBITS, int memLevel =DEF_MEM_LEVEL, int strategy =Z_DEFAULT_STRATEGY);
346  virtual bool isSequential()const;
348 
369  virtual qint64 pos()const;
371 
387  virtual bool atEnd()const;
389 
401  virtual qint64 size()const;
403 
410  qint64 csize()const;
412 
420  qint64 usize()const;
422 
438  bool getFileInfo(QuaZipFileInfo *info);
440 
445  bool getFileInfo(QuaZipFileInfo64 *info);
447 
449  virtual void close();
451  int getZipError() const;
453  virtual qint64 bytesAvailable() const;
454 };
455 
456 #endif