QuaZip quazip-1-4
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) override;
86 qint64 writeData(const char *data, qint64 maxSize) override;
87 public:
89
92 QuaZipFile();
94
99 QuaZipFile(QObject *parent);
101
110 QuaZipFile(const QString& zipName, QObject *parent =nullptr);
112
121 QuaZipFile(const QString& zipName, const QString& fileName,
124
172 QuaZipFile(QuaZip *zip, QObject *parent =nullptr);
174
177 ~QuaZipFile() override;
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 bool open(OpenMode mode) override;
294
298 inline bool open(OpenMode mode, const char *password)
299 {return open(mode, nullptr, nullptr, false, password);}
301
312 bool open(OpenMode mode, int *method, int *level, bool raw, const char *password =nullptr);
314
346 bool open(OpenMode mode, const QuaZipNewInfo& info,
347 const char *password =nullptr, quint32 crc =0,
348 int method =Z_DEFLATED, int level =Z_DEFAULT_COMPRESSION, bool raw =false,
349 int windowBits =-MAX_WBITS, int memLevel =DEF_MEM_LEVEL, int strategy =Z_DEFAULT_STRATEGY);
351 bool isSequential()const override;
353
374 qint64 pos()const override;
376
392 bool atEnd()const override;
394
406 qint64 size()const override;
408
415 qint64 csize()const;
417
425 qint64 usize()const;
427
443 bool getFileInfo(QuaZipFileInfo *info);
445
450 bool getFileInfo(QuaZipFileInfo64 *info);
452
454 void close() override;
456 int getZipError() const;
458 qint64 bytesAvailable() const override;
460
470 QByteArray getLocalExtraField();
472
486 QDateTime getExtModTime();
488
498 QDateTime getExtAcTime();
500
510 QDateTime getExtCrTime();
511};
512
513#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
virtual bool atEnd() const const
virtual qint64 bytesAvailable() const const
virtual void close()
virtual bool isSequential() const const
virtual bool open(QIODevice::OpenMode mode)
virtual qint64 pos() const const
virtual qint64 readData(char *data, qint64 maxSize)=0
virtual qint64 size() const const
virtual qint64 writeData(const char *data, qint64 maxSize)=0
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