QuaZIP  quazip-0-9
quagzipfile.h
1 #ifndef QUAZIP_QUAGZIPFILE_H
2 #define QUAZIP_QUAGZIPFILE_H
3 
4 /*
5 Copyright (C) 2005-2014 Sergey A. Tachenov
6 
7 This file is part of QuaZIP.
8 
9 QuaZIP is free software: you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation, either version 2.1 of the License, or
12 (at your option) any later version.
13 
14 QuaZIP is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU Lesser General Public License for more details.
18 
19 You should have received a copy of the GNU Lesser General Public License
20 along with QuaZIP. If not, see <http://www.gnu.org/licenses/>.
21 
22 See COPYING file for the full LGPL text.
23 
24 Original ZIP package is copyrighted by Gilles Vollant and contributors,
25 see quazip/(un)zip.h files for details. Basically it's the zlib license.
26 */
27 
28 #include <QtCore/QIODevice>
29 #include "quazip_global.h"
30 
31 #include <zlib.h>
32 
33 class QuaGzipFilePrivate;
34 
36 
39 class QUAZIP_EXPORT QuaGzipFile: public QIODevice {
40  Q_OBJECT
41 public:
43 
46  QuaGzipFile();
48 
52  QuaGzipFile(QObject *parent);
54 
58  QuaGzipFile(const QString &fileName, QObject *parent = NULL);
60  virtual ~QuaGzipFile();
62  void setFileName(const QString& fileName);
64  QString getFileName() const;
66 
73  virtual bool isSequential() const;
75 
79  virtual bool open(QIODevice::OpenMode mode);
81 
87  virtual bool open(int fd, QIODevice::OpenMode mode);
89 
93  virtual bool flush();
95  virtual void close();
96 protected:
98  virtual qint64 readData(char *data, qint64 maxSize);
100  virtual qint64 writeData(const char *data, qint64 maxSize);
101 private:
102  // not implemented by design to disable copy
103  QuaGzipFile(const QuaGzipFile &that);
104  QuaGzipFile& operator=(const QuaGzipFile &that);
105  QuaGzipFilePrivate *d;
106 };
107 
108 #endif // QUAZIP_QUAGZIPFILE_H
QuaGzipFile::getFileName
QString getFileName() const
Returns the name of the GZIP file.
Definition: quagzipfile.cpp:117
QuaGzipFile
GZIP file.
Definition: quagzipfile.h:39
QuaGzipFile::open
virtual bool open(QIODevice::OpenMode mode)
Opens the file.
Definition: quagzipfile.cpp:127
QuaGzipFile::~QuaGzipFile
virtual ~QuaGzipFile()
Destructor.
Definition: quagzipfile.cpp:104
QuaGzipFile::close
virtual void close()
Closes the file.
Definition: quagzipfile.cpp:152
QuaGzipFile::flush
virtual bool flush()
Flushes data to file.
Definition: quagzipfile.cpp:147
QuaGzipFile::writeData
virtual qint64 writeData(const char *data, qint64 maxSize)
Implementation of QIODevice::writeData().
Definition: quagzipfile.cpp:163
QuaGzipFile::readData
virtual qint64 readData(char *data, qint64 maxSize)
Implementation of QIODevice::readData().
Definition: quagzipfile.cpp:158
QuaGzipFile::QuaGzipFile
QuaGzipFile()
Empty constructor.
Definition: quagzipfile.cpp:87
QuaGzipFile::setFileName
void setFileName(const QString &fileName)
Sets the name of the GZIP file to be opened.
Definition: quagzipfile.cpp:112
QuaGzipFile::isSequential
virtual bool isSequential() const
Returns true.
Definition: quagzipfile.cpp:122