QuaZIP quazip-0-7-1
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 <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:
78 QuaZipFilePrivate *p;
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
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);}
300
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
The implementation class for QuaZip.
Definition quazipfile.cpp:37
bool open(OpenMode mode, const char *password)
Opens a file for reading.
Definition quazipfile.h:298
bool isRaw() const
Returns true if the file was opened in raw mode.
Definition quazipfile.cpp:518
void setFileName(const QString &fileName, QuaZip::CaseSensitivity cs=QuaZip::csDefault)
Sets the file name.
Definition quazipfile.cpp:220
virtual bool open(OpenMode mode)
Opens a file for reading.
Definition quazipfile.cpp:250
QString getActualFileName() const
Returns the actual file name in the archive.
Definition quazipfile.cpp:184
QString getZipName() const
Returns the ZIP archive file name.
Definition quazipfile.cpp:174
qint64 readData(char *data, qint64 maxSize)
Implementation of the QIODevice::readData().
Definition quazipfile.cpp:486
void setZip(QuaZip *zip)
Binds to the existing QuaZip instance.
Definition quazipfile.cpp:207
qint64 writeData(const char *data, qint64 maxSize)
Implementation of the QIODevice::writeData().
Definition quazipfile.cpp:497
QuaZip * getZip() const
Returns a pointer to the associated QuaZip object.
Definition quazipfile.cpp:179
void setZipName(const QString &zipName)
Sets the ZIP archive file name.
Definition quazipfile.cpp:195
QString getFileName() const
Returns file name.
Definition quazipfile.cpp:508
QuaZip::CaseSensitivity getCaseSensitivity() const
Returns case sensitivity of the file name.
Definition quazipfile.cpp:513
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:81
Information about a file inside archive.
Definition quazipfileinfo.h:41
Information about a file to be created.
Definition quazipnewinfo.h:50