QuaZip quazip-1-4
quaziodevice.h
1#ifndef QUAZIP_QUAZIODEVICE_H
2#define QUAZIP_QUAZIODEVICE_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 and contributors,
25see 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
33class QuaZIODevicePrivate;
34
36
41class QUAZIP_EXPORT QuaZIODevice: public QIODevice {
42 friend class QuaZIODevicePrivate;
43 Q_OBJECT
44public:
46
50 QuaZIODevice(QIODevice *io, QObject *parent = nullptr);
52 ~QuaZIODevice() override;
54
74 virtual bool flush();
76
80 bool open(QIODevice::OpenMode mode) override;
82
86 void close() override;
88 QIODevice *getIoDevice() const;
90 bool isSequential() const override;
92 bool atEnd() const override;
94 qint64 bytesAvailable() const override;
95protected:
97 qint64 readData(char *data, qint64 maxSize) override;
99 qint64 writeData(const char *data, qint64 maxSize) override;
100private:
101 QuaZIODevicePrivate *d;
102};
103#endif // QUAZIP_QUAZIODEVICE_H
virtual bool flush()
Flushes data waiting to be written.
Definition quaziodevice.cpp:315
QuaZIODevice(QIODevice *io, QObject *parent=nullptr)
Constructor.
Definition quaziodevice.cpp:156
bool open(QIODevice::OpenMode mode) override
Opens the device.
Definition quaziodevice.cpp:175
qint64 bytesAvailable() const override
Returns the number of the bytes buffered.
Definition quaziodevice.cpp:333
bool isSequential() const override
Returns true.
Definition quaziodevice.cpp:320
bool atEnd() const override
Returns true iff the end of the compressed stream is reached.
Definition quaziodevice.cpp:325
void close() override
Closes this device, but not the underlying one.
Definition quaziodevice.cpp:202
QIODevice * getIoDevice() const
Returns the underlying device.
Definition quaziodevice.cpp:170
qint64 writeData(const char *data, qint64 maxSize) override
Implementation of QIODevice::writeData().
Definition quaziodevice.cpp:279
qint64 readData(char *data, qint64 maxSize) override
Implementation of QIODevice::readData().
Definition quaziodevice.cpp:218