FGx  1
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
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 
65 class QUAZIP_EXPORT QuaZipFile: public QIODevice {
66  friend class QuaZipFilePrivate;
67  Q_OBJECT
68  private:
70  // these are not supported nor implemented
71  QuaZipFile(const QuaZipFile& that);
72  QuaZipFile& operator=(const QuaZipFile& that);
73  protected:
75  qint64 readData(char *data, qint64 maxSize);
77  qint64 writeData(const char *data, qint64 maxSize);
78  public:
80 
83  QuaZipFile();
85 
90  QuaZipFile(QObject *parent);
92 
101  QuaZipFile(const QString& zipName, QObject *parent =NULL);
103 
112  QuaZipFile(const QString& zipName, const QString& fileName,
113  QuaZip::CaseSensitivity cs =QuaZip::csDefault, QObject *parent =NULL);
115 
163  QuaZipFile(QuaZip *zip, QObject *parent =NULL);
165 
168  virtual ~QuaZipFile();
170 
179  QString getZipName()const;
181 
184  QuaZip* getZip()const;
186 
198  QString getFileName() const;
200 
211  QuaZip::CaseSensitivity getCaseSensitivity() const;
213 
237  QString getActualFileName()const;
239 
245  void setZipName(const QString& zipName);
247 
251  bool isRaw() const;
253 
261  void setZip(QuaZip *zip);
263 
274  void setFileName(const QString& fileName, QuaZip::CaseSensitivity cs =QuaZip::csDefault);
276 
283  virtual bool open(OpenMode mode);
285 
289  inline bool open(OpenMode mode, const char *password)
290  {return open(mode, NULL, NULL, false, password);}
292 
303  bool open(OpenMode mode, int *method, int *level, bool raw, const char *password =NULL);
305 
325  bool open(OpenMode mode, const QuaZipNewInfo& info,
326  const char *password =NULL, quint32 crc =0,
327  int method =Z_DEFLATED, int level =Z_DEFAULT_COMPRESSION, bool raw =false,
328  int windowBits =-MAX_WBITS, int memLevel =DEF_MEM_LEVEL, int strategy =Z_DEFAULT_STRATEGY);
330  virtual bool isSequential()const;
332 
353  virtual qint64 pos()const;
355 
371  virtual bool atEnd()const;
373 
385  virtual qint64 size()const;
387 
394  qint64 csize()const;
396 
404  qint64 usize()const;
406 
416  bool getFileInfo(QuaZipFileInfo *info);
418 
420  virtual void close();
422  int getZipError() const;
423 };
424 
425 #endif