QuaZIP  quazip-0-7-6
quaziodevice.h
1 #ifndef QUAZIP_QUAZIODEVICE_H
2 #define QUAZIP_QUAZIODEVICE_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 <QIODevice>
29 #include "quazip_global.h"
30 
31 #include <zlib.h>
32 
33 class QuaZIODevicePrivate;
34 
36 
41 class QUAZIP_EXPORT QuaZIODevice: public QIODevice {
42  Q_OBJECT
43 public:
45 
49  QuaZIODevice(QIODevice *io, QObject *parent = NULL);
51  ~QuaZIODevice();
53 
73  virtual bool flush();
75 
79  virtual bool open(QIODevice::OpenMode mode);
81 
85  virtual void close();
87  QIODevice *getIoDevice() const;
89  virtual bool isSequential() const;
91  virtual bool atEnd() const;
93  virtual qint64 bytesAvailable() const;
94 protected:
96  virtual qint64 readData(char *data, qint64 maxSize);
98  virtual qint64 writeData(const char *data, qint64 maxSize);
99 private:
100  QuaZIODevicePrivate *d;
101 };
102 #endif // QUAZIP_QUAZIODEVICE_H
QuaZIODevice::atEnd
virtual bool atEnd() const
Returns true iff the end of the compressed stream is reached.
Definition: quaziodevice.cpp:325
QuaZIODevice::isSequential
virtual bool isSequential() const
Returns true.
Definition: quaziodevice.cpp:320
QuaZIODevice::writeData
virtual qint64 writeData(const char *data, qint64 maxSize)
Implementation of QIODevice::writeData().
Definition: quaziodevice.cpp:248
QuaZIODevice::getIoDevice
QIODevice * getIoDevice() const
Returns the underlying device.
Definition: quaziodevice.cpp:139
QuaZIODevice::QuaZIODevice
QuaZIODevice(QIODevice *io, QObject *parent=NULL)
Constructor.
Definition: quaziodevice.cpp:125
QuaZIODevice::bytesAvailable
virtual qint64 bytesAvailable() const
Returns the number of the bytes buffered.
Definition: quaziodevice.cpp:333
QuaZIODevice::flush
virtual bool flush()
Flushes data waiting to be written.
Definition: quaziodevice.cpp:284
QuaZIODevice::open
virtual bool open(QIODevice::OpenMode mode)
Opens the device.
Definition: quaziodevice.cpp:144
QuaZIODevice::~QuaZIODevice
~QuaZIODevice()
Destructor.
Definition: quaziodevice.cpp:132
QuaZIODevice::readData
virtual qint64 readData(char *data, qint64 maxSize)
Implementation of QIODevice::readData().
Definition: quaziodevice.cpp:187
QuaZIODevice
A class to compress/decompress QIODevice.
Definition: quaziodevice.h:41
QuaZIODevice::close
virtual void close()
Closes this device, but not the underlying one.
Definition: quaziodevice.cpp:171