QuaZip quazip-1-6
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
31class QuaZIODevicePrivate;
32
34
39class QUAZIP_EXPORT QuaZIODevice: public QIODevice {
40 friend class QuaZIODevicePrivate;
41 Q_OBJECT
42public:
44
48 QuaZIODevice(QIODevice *io, QObject *parent = nullptr);
50 ~QuaZIODevice() override;
52
72 virtual bool flush();
74
78 bool open(QIODevice::OpenMode mode) override;
80
84 void close() override;
86 QIODevice *getIoDevice() const;
88 bool isSequential() const override;
90 bool atEnd() const override;
92 qint64 bytesAvailable() const override;
93protected:
95 qint64 readData(char *data, qint64 maxSize) override;
97 qint64 writeData(const char *data, qint64 maxSize) override;
98private:
99 QuaZIODevicePrivate *d{};
100};
101#endif // QUAZIP_QUAZIODEVICE_H
virtual bool flush()
Flushes data waiting to be written.
Definition quaziodevice.cpp:318
QuaZIODevice(QIODevice *io, QObject *parent=nullptr)
Constructor.
Definition quaziodevice.cpp:159
bool open(QIODevice::OpenMode mode) override
Opens the device.
Definition quaziodevice.cpp:178
qint64 bytesAvailable() const override
Returns the number of the bytes buffered.
Definition quaziodevice.cpp:336
bool isSequential() const override
Returns true.
Definition quaziodevice.cpp:323
bool atEnd() const override
Returns true iff the end of the compressed stream is reached.
Definition quaziodevice.cpp:328
void close() override
Closes this device, but not the underlying one.
Definition quaziodevice.cpp:205
QIODevice * getIoDevice() const
Returns the underlying device.
Definition quaziodevice.cpp:173
qint64 writeData(const char *data, qint64 maxSize) override
Implementation of QIODevice::writeData().
Definition quaziodevice.cpp:282
qint64 readData(char *data, qint64 maxSize) override
Implementation of QIODevice::readData().
Definition quaziodevice.cpp:221