QuaZIP  quazip-0-5
quazipfile.h
1 #ifndef QUA_ZIPFILE_H
2 #define QUA_ZIPFILE_H
3 
4 /*
5 Copyright (C) 2005-2011 Sergey A. Tachenov
6 
7 This program is free software; you can redistribute it and/or modify it
8 under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or (at
10 your option) any later version.
11 
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
15 General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 
21 See COPYING file for the full LGPL text.
22 
23 Original ZIP package is copyrighted by Gilles Vollant, see
24 quazip/(un)zip.h files for details, basically it's zlib license.
25  **/
26 
27 #include <QIODevice>
28 
29 #include "quazip_global.h"
30 #include "quazip.h"
31 #include "quazipnewinfo.h"
32 
33 class QuaZipFilePrivate;
34 
36 
73 class QUAZIP_EXPORT QuaZipFile: public QIODevice {
74  friend class QuaZipFilePrivate;
75  Q_OBJECT
76  private:
78  // these are not supported nor implemented
79  QuaZipFile(const QuaZipFile& that);
80  QuaZipFile& operator=(const QuaZipFile& that);
81  protected:
83  qint64 readData(char *data, qint64 maxSize);
85  qint64 writeData(const char *data, qint64 maxSize);
86  public:
88 
91  QuaZipFile();
93 
98  QuaZipFile(QObject *parent);
100 
109  QuaZipFile(const QString& zipName, QObject *parent =NULL);
111 
120  QuaZipFile(const QString& zipName, const QString& fileName,
121  QuaZip::CaseSensitivity cs =QuaZip::csDefault, QObject *parent =NULL);
123 
171  QuaZipFile(QuaZip *zip, QObject *parent =NULL);
173 
176  virtual ~QuaZipFile();
178 
187  QString getZipName()const;
189 
192  QuaZip* getZip()const;
194 
206  QString getFileName() const;
208 
219  QuaZip::CaseSensitivity getCaseSensitivity() const;
221 
245  QString getActualFileName()const;
247 
253  void setZipName(const QString& zipName);
255 
259  bool isRaw() const;
261 
269  void setZip(QuaZip *zip);
271 
282  void setFileName(const QString& fileName, QuaZip::CaseSensitivity cs =QuaZip::csDefault);
284 
291  virtual bool open(OpenMode mode);
293 
297  inline bool open(OpenMode mode, const char *password)
298  {return open(mode, NULL, NULL, false, password);}
300 
311  bool open(OpenMode mode, int *method, int *level, bool raw, const char *password =NULL);
313 
340  bool open(OpenMode mode, const QuaZipNewInfo& info,
341  const char *password =NULL, quint32 crc =0,
342  int method =Z_DEFLATED, int level =Z_DEFAULT_COMPRESSION, bool raw =false,
343  int windowBits =-MAX_WBITS, int memLevel =DEF_MEM_LEVEL, int strategy =Z_DEFAULT_STRATEGY);
345  virtual bool isSequential()const;
347 
368  virtual qint64 pos()const;
370 
386  virtual bool atEnd()const;
388 
400  virtual qint64 size()const;
402 
409  qint64 csize()const;
411 
419  qint64 usize()const;
421 
431  bool getFileInfo(QuaZipFileInfo *info);
433 
435  virtual void close();
437  int getZipError() const;
439  virtual qint64 bytesAvailable() const;
440 };
441 
442 #endif