KCompressionDevice

Search for usage in LXR

#include <KCompressionDevice>

Inheritance diagram for KCompressionDevice:

Public Types

enum  CompressionType {
  GZip , BZip2 , Xz , None ,
  Zstd
}
 
- Public Types inherited from QObject
typedef  QObjectList
 
- Public Types inherited from QIODeviceBase
typedef  OpenMode
 
enum  OpenModeFlag
 

Public Member Functions

 KCompressionDevice (const QString &fileName)
 
 KCompressionDevice (const QString &fileName, CompressionType type)
 
 KCompressionDevice (QIODevice *inputDevice, bool autoDeleteInputDevice, CompressionType type)
 
 ~KCompressionDevice () override
 
bool atEnd () const override
 
void close () override
 
CompressionType compressionType () const
 
QFileDevice::FileError error () const
 
bool open (QIODevice::OpenMode mode) override
 
bool seek (qint64) override
 
void setOrigFileName (const QByteArray &fileName)
 
void setSkipHeaders ()
 
- Public Member Functions inherited from QIODevice
 QIODevice (QObject *parent)
 
void aboutToClose ()
 
virtual qint64 bytesAvailable () const const
 
virtual qint64 bytesToWrite () const const
 
void bytesWritten (qint64 bytes)
 
virtual bool canReadLine () const const
 
void channelBytesWritten (int channel, qint64 bytes)
 
void channelReadyRead (int channel)
 
void commitTransaction ()
 
int currentReadChannel () const const
 
int currentWriteChannel () const const
 
QString errorString () const const
 
bool getChar (char *c)
 
bool isOpen () const const
 
bool isReadable () const const
 
virtual bool isSequential () const const
 
bool isTextModeEnabled () const const
 
bool isTransactionStarted () const const
 
bool isWritable () const const
 
QIODeviceBase::OpenMode openMode () const const
 
qint64 peek (char *data, qint64 maxSize)
 
QByteArray peek (qint64 maxSize)
 
virtual qint64 pos () const const
 
bool putChar (char c)
 
qint64 read (char *data, qint64 maxSize)
 
QByteArray read (qint64 maxSize)
 
QByteArray readAll ()
 
int readChannelCount () const const
 
void readChannelFinished ()
 
qint64 readLine (char *data, qint64 maxSize)
 
QByteArray readLine (qint64 maxSize)
 
void readyRead ()
 
virtual bool reset ()
 
void rollbackTransaction ()
 
void setCurrentReadChannel (int channel)
 
void setCurrentWriteChannel (int channel)
 
void setTextModeEnabled (bool enabled)
 
virtual qint64 size () const const
 
qint64 skip (qint64 maxSize)
 
void startTransaction ()
 
void ungetChar (char c)
 
virtual bool waitForBytesWritten (int msecs)
 
virtual bool waitForReadyRead (int msecs)
 
qint64 write (const char *data)
 
qint64 write (const char *data, qint64 maxSize)
 
qint64 write (const QByteArray &data)
 
int writeChannelCount () const const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo () const const
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType)
 
QThreadthread () const const
 

Static Public Member Functions

static CompressionType compressionTypeForMimeType (const QString &mimetype)
 
static KFilterBasefilterForCompressionType (CompressionType type)
 
- Static Public Member Functions inherited from QObject
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 *context, Functor functor, 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)
 
bool disconnect (const QMetaObject::Connection &connection)
 
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 QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 

Protected Member Functions

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

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Public Attributes inherited from QIODeviceBase
 Append
 
 ExistingOnly
 
 NewOnly
 
 NotOpen
 
 ReadOnly
 
 ReadWrite
 
 Text
 
 Truncate
 
 Unbuffered
 
 WriteOnly
 

Detailed Description

A class for reading and writing compressed data onto a device (e.g.

file, but other usages are possible, like a buffer or a socket).

Use this class to read/write compressed files.

Definition at line 30 of file kcompressiondevice.h.

Member Enumeration Documentation

◆ CompressionType

Enumerator
Zstd 
Since
5.82

Definition at line 34 of file kcompressiondevice.h.

Constructor & Destructor Documentation

◆ KCompressionDevice() [1/3]

KCompressionDevice::KCompressionDevice ( QIODevice * inputDevice,
bool autoDeleteInputDevice,
CompressionType type )

Constructs a KCompressionDevice for a given CompressionType (e.g.

GZip, BZip2 etc.).

Parameters
inputDeviceinput device.
autoDeleteInputDeviceif true, inputDevice will be deleted automatically
typethe CompressionType to use.

Definition at line 189 of file kcompressiondevice.cpp.

◆ KCompressionDevice() [2/3]

KCompressionDevice::KCompressionDevice ( const QString & fileName,
CompressionType type )

Constructs a KCompressionDevice for a given CompressionType (e.g.

GZip, BZip2 etc.).

Parameters
fileNamethe name of the file to filter.
typethe CompressionType to use.

Definition at line 200 of file kcompressiondevice.cpp.

◆ KCompressionDevice() [3/3]

KCompressionDevice::KCompressionDevice ( const QString & fileName)
explicit

Constructs a KCompressionDevice for a given fileName.

Parameters
fileNamethe name of the file to filter.
Since
5.85

Definition at line 213 of file kcompressiondevice.cpp.

◆ ~KCompressionDevice()

KCompressionDevice::~KCompressionDevice ( )
override

Destructs the KCompressionDevice.

Calls close() if the filter device is still open.

Definition at line 218 of file kcompressiondevice.cpp.

Member Function Documentation

◆ atEnd()

bool KCompressionDevice::atEnd ( ) const
overridevirtual

Reimplemented from QIODevice.

Definition at line 350 of file kcompressiondevice.cpp.

◆ close()

void KCompressionDevice::close ( )
overridevirtual

Close after reading or writing.

Reimplemented from QIODevice.

Definition at line 267 of file kcompressiondevice.cpp.

◆ compressionType()

KCompressionDevice::CompressionType KCompressionDevice::compressionType ( ) const

The compression actually used by this device.

If the support for the compression requested in the constructor is not available, then the device will use None.

Definition at line 227 of file kcompressiondevice.cpp.

◆ compressionTypeForMimeType()

KCompressionDevice::CompressionType KCompressionDevice::compressionTypeForMimeType ( const QString & mimetype)
static

Returns the compression type for the given MIME type, if possible.

Otherwise returns None. This handles simple cases like application/gzip, but also application/x-compressed-tar, and inheritance.

Since
5.85

Definition at line 105 of file kcompressiondevice.cpp.

◆ error()

QFileDevice::FileError KCompressionDevice::error ( ) const

Returns the error code from the last failing operation.

This is especially useful after calling close(), which unfortunately returns void (see https://bugreports.qt.io/browse/QTBUG-70033), to see if the flushing done by close was able to write all the data to disk.

Definition at line 289 of file kcompressiondevice.cpp.

◆ filterBase()

KFilterBase * KCompressionDevice::filterBase ( )
protected

Definition at line 514 of file kcompressiondevice.cpp.

◆ filterForCompressionType()

KFilterBase * KCompressionDevice::filterForCompressionType ( KCompressionDevice::CompressionType type)
static

Call this to create the appropriate filter for the CompressionType named type.

Parameters
typethe type of the compression filter
Returns
the filter for the type, or 0 if not found

Definition at line 160 of file kcompressiondevice.cpp.

◆ open()

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

Open for reading or writing.

Reimplemented from QIODevice.

Definition at line 232 of file kcompressiondevice.cpp.

◆ readData()

qint64 KCompressionDevice::readData ( char * data,
qint64 maxlen )
overrideprotectedvirtual

Implements QIODevice.

Definition at line 357 of file kcompressiondevice.cpp.

◆ seek()

bool KCompressionDevice::seek ( qint64 pos)
overridevirtual

That one can be quite slow, when going back.

Use with care.

Reimplemented from QIODevice.

Definition at line 294 of file kcompressiondevice.cpp.

◆ setOrigFileName()

void KCompressionDevice::setOrigFileName ( const QByteArray & fileName)

For writing gzip compressed files only: set the name of the original file, to be used in the gzip header.

Parameters
fileNamethe name of the original file

Definition at line 504 of file kcompressiondevice.cpp.

◆ setSkipHeaders()

void KCompressionDevice::setSkipHeaders ( )

Call this let this device skip the gzip headers when reading/writing.

This way KCompressionDevice (with gzip filter) can be used as a direct wrapper around zlib - this is used by KZip.

Definition at line 509 of file kcompressiondevice.cpp.

◆ writeData()

qint64 KCompressionDevice::writeData ( const char * data,
qint64 len )
overrideprotectedvirtual

Implements QIODevice.

Definition at line 431 of file kcompressiondevice.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:48:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.