QuaZip quazip-1-4
Public Member Functions | Protected Member Functions | Friends | List of all members
QuaZIODevice Class Reference

A class to compress/decompress QIODevice. More...

#include <quaziodevice.h>

Inheritance diagram for QuaZIODevice:
Inheritance graph
[legend]
Collaboration diagram for QuaZIODevice:
Collaboration graph
[legend]

Public Member Functions

 QuaZIODevice (QIODevice *io, QObject *parent=nullptr)
 Constructor.
 
 ~QuaZIODevice () override
 Destructor.
 
virtual bool flush ()
 Flushes data waiting to be written.
 
bool open (QIODevice::OpenMode mode) override
 Opens the device.
 
void close () override
 Closes this device, but not the underlying one.
 
QIODevicegetIoDevice () const
 Returns the underlying device.
 
bool isSequential () const override
 Returns true.
 
bool atEnd () const override
 Returns true iff the end of the compressed stream is reached.
 
qint64 bytesAvailable () const override
 Returns the number of the bytes buffered.
 
- Public Member Functions inherited from QIODevice
virtual const QMetaObjectmetaObject () const const
 
virtual void * qt_metacast (const char *)
 
virtual int qt_metacall (QMetaObject::Call, int, void **)
 
 QIODevice (QObject *parent)
 
QIODevice::OpenMode openMode () const const
 
void setTextModeEnabled (bool enabled)
 
bool isTextModeEnabled () const const
 
bool isOpen () const const
 
bool isReadable () const const
 
bool isWritable () const const
 
virtual bool isSequential () const const
 
int readChannelCount () const const
 
int writeChannelCount () const const
 
int currentReadChannel () const const
 
void setCurrentReadChannel (int channel)
 
int currentWriteChannel () const const
 
void setCurrentWriteChannel (int channel)
 
virtual bool open (QIODevice::OpenMode mode)
 
virtual void close ()
 
virtual qint64 pos () const const
 
virtual qint64 size () const const
 
virtual bool seek (qint64 pos)
 
virtual bool atEnd () const const
 
virtual bool reset ()
 
virtual qint64 bytesAvailable () const const
 
virtual qint64 bytesToWrite () const const
 
qint64 read (char *data, qint64 maxSize)
 
QByteArray read (qint64 maxSize)
 
QByteArray readAll ()
 
qint64 readLine (char *data, qint64 maxSize)
 
QByteArray readLine (qint64 maxSize)
 
virtual bool canReadLine () const const
 
void startTransaction ()
 
void commitTransaction ()
 
void rollbackTransaction ()
 
bool isTransactionStarted () const const
 
qint64 write (const char *data, qint64 maxSize)
 
qint64 write (const char *data)
 
qint64 write (const QByteArray &byteArray)
 
qint64 peek (char *data, qint64 maxSize)
 
QByteArray peek (qint64 maxSize)
 
qint64 skip (qint64 maxSize)
 
virtual bool waitForReadyRead (int msecs)
 
virtual bool waitForBytesWritten (int msecs)
 
void ungetChar (char c)
 
bool putChar (char c)
 
bool getChar (char *c)
 
QString errorString () const const
 
void readyRead ()
 
void channelReadyRead (int channel)
 
void bytesWritten (qint64 bytes)
 
void channelBytesWritten (int channel, qint64 bytes)
 
void aboutToClose ()
 
void readChannelFinished ()
 
- Public Member Functions inherited from QObject
virtual const QMetaObjectmetaObject () const const
 
virtual void * qt_metacast (const char *)
 
virtual int qt_metacall (QMetaObject::Call, int, void **)
 
 QObject (QObject *parent)
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
QString objectName () const const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
bool signalsBlocked () const const
 
bool blockSignals (bool block)
 
QThreadthread () const const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
const QObjectList & children () const const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
void dumpObjectTree () const const
 
void dumpObjectInfo () const const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const const
 
QList< QByteArraydynamicPropertyNames () const const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
bool inherits (const char *className) const const
 
void deleteLater ()
 

Protected Member Functions

qint64 readData (char *data, qint64 maxSize) override
 Implementation of QIODevice::readData().
 
qint64 writeData (const char *data, qint64 maxSize) override
 Implementation of QIODevice::writeData().
 
- Protected Member Functions inherited from QIODevice
virtual qint64 readData (char *data, qint64 maxSize)=0
 
virtual qint64 readLineData (char *data, qint64 maxSize)
 
virtual qint64 writeData (const char *data, qint64 maxSize)=0
 
void setOpenMode (QIODevice::OpenMode openMode)
 
void setErrorString (const QString &str)
 
- Protected Member Functions inherited from QObject
QObjectsender () const const
 
int senderSignalIndex () const const
 
int receivers (const char *signal) const const
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 

Friends

class QuaZIODevicePrivate
 

Additional Inherited Members

- Static Public Member Functions inherited from QIODevice
QString tr (const char *s, const char *c, int n)
 
QString trUtf8 (const char *s, const char *c, int n)
 
- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
- Public Attributes inherited from QIODevice
typedef OpenMode
 
- Properties inherited from QObject
 objectName
 

Detailed Description

A class to compress/decompress QIODevice.

This class can be used to compress any data written to QIODevice or decompress it back. Compressing data sent over a QTcpSocket is a good example.

Constructor & Destructor Documentation

◆ QuaZIODevice()

QuaZIODevice::QuaZIODevice ( QIODevice io,
QObject parent = nullptr 
)

Constructor.

Parameters
ioThe QIODevice to read/write.
parentThe parent object, as per QObject logic.

References QObject::connect(), and QIODevice::readyRead().

Member Function Documentation

◆ flush()

bool QuaZIODevice::flush ( )
virtual

Flushes data waiting to be written.

Unfortunately, as QIODevice doesn't support flush() by itself, the only thing this method does is write the compressed data into the device using Z_SYNC_FLUSH mode. If you need the compressed data to actually be flushed from the buffer of the underlying QIODevice, you need to call its flush() method as well, providing it supports it (like QTcpSocket does). Example:

QuaZIODevice dev(&sock);
dev.open(QIODevice::Write);
dev.write(yourDataGoesHere);
dev.flush();
sock->flush(); // this actually sends data to network
A class to compress/decompress QIODevice.
Definition: quaziodevice.h:41

This may change in the future versions of QuaZip by implementing an ugly hack: trying to cast the QIODevice using qobject_cast to known flush()-supporting subclasses, and calling flush if the resulting pointer is not zero.

◆ open()

bool QuaZIODevice::open ( QIODevice::OpenMode  mode)
overridevirtual

Opens the device.

Parameters
modeNeither QIODevice::ReadWrite nor QIODevice::Append are not supported.

Reimplemented from QIODevice.

References QString::fromLocal8Bit(), QIODevice::open(), QIODevice::setErrorString(), and QIODevice::tr().

◆ close()

void QuaZIODevice::close ( )
overridevirtual

Closes this device, but not the underlying one.

The underlying QIODevice is not closed in case you want to write something else to it.

Reimplemented from QIODevice.

References QIODevice::close(), QString::fromLocal8Bit(), QIODevice::openMode(), and QIODevice::setErrorString().

Referenced by ~QuaZIODevice().

◆ isSequential()

bool QuaZIODevice::isSequential ( ) const
overridevirtual

Returns true.

Reimplemented from QIODevice.

◆ atEnd()

bool QuaZIODevice::atEnd ( ) const
overridevirtual

Returns true iff the end of the compressed stream is reached.

Reimplemented from QIODevice.

References QIODevice::bytesAvailable(), and QIODevice::openMode().

◆ bytesAvailable()

qint64 QuaZIODevice::bytesAvailable ( ) const
overridevirtual

Returns the number of the bytes buffered.

Reimplemented from QIODevice.

References QIODevice::bytesAvailable().

◆ readData()

qint64 QuaZIODevice::readData ( char *  data,
qint64  maxSize 
)
overrideprotectedvirtual

◆ writeData()

qint64 QuaZIODevice::writeData ( const char *  data,
qint64  maxSize 
)
overrideprotectedvirtual

The documentation for this class was generated from the following files: