QuaZIP quazip-0-9
quazipfile.h
1#ifndef QUA_ZIPFILE_H
2#define QUA_ZIPFILE_H
3
4/*
5Copyright (C) 2005-2014 Sergey A. Tachenov
6
7This file is part of QuaZIP.
8
9QuaZIP is free software: you can redistribute it and/or modify
10it under the terms of the GNU Lesser General Public License as published by
11the Free Software Foundation, either version 2.1 of the License, or
12(at your option) any later version.
13
14QuaZIP is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License
20along with QuaZIP. If not, see <http://www.gnu.org/licenses/>.
21
22See COPYING file for the full LGPL text.
23
24Original ZIP package is copyrighted by Gilles Vollant, see
25quazip/(un)zip.h files for details, basically it's zlib license.
26 **/
27
28#include <QtCore/QIODevice>
29
30#include "quazip_global.h"
31#include "quazip.h"
32#include "quazipnewinfo.h"
33
35
37
74class 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;
455
465 QByteArray getLocalExtraField();
467
481 QDateTime getExtModTime();
483
493 QDateTime getExtAcTime();
495
505 QDateTime getExtCrTime();
506};
507
508#endif
The implementation class for QuaZip.
Definition quazipfile.cpp:41
A file inside ZIP archive.
Definition quazipfile.h:74
bool open(OpenMode mode, const char *password)
Opens a file for reading.
Definition quazipfile.h:298
ZIP archive.
Definition quazip.h:84
CaseSensitivity
Case sensitivity for the file names.
Definition quazip.h:114
@ csDefault
Default for platform. Case sensitive for UNIX, not for Windows.
Definition quazip.h:115
Information about a file inside archive (with zip64 support).
Definition quazipfileinfo.h:85
Information about a file inside archive.
Definition quazipfileinfo.h:45
Information about a file to be created.
Definition quazipnewinfo.h:50