KFilterDev

#include <KFilterDev>

Inheritance diagram for KFilterDev:

Public Member Functions

 KFilterDev (const QString &fileName)
 
- Public Member Functions inherited from KCompressionDevice
 KCompressionDevice (QIODevice *inputDevice, bool autoDeleteInputDevice, CompressionType type)
 
 KCompressionDevice (const QString &fileName, CompressionType type)
 
virtual ~KCompressionDevice ()
 
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
 
QIODevice::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 ()
 
QByteArray readLine (qint64 maxSize)
 
qint64 readLine (char *data, 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 QByteArray &byteArray)
 
qint64 write (const char *data, qint64 maxSize)
 
int writeChannelCount () const const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
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 ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
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 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
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
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_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 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
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Static Public Member Functions

static CompressionType compressionTypeForMimeType (const QString &mimetype)
 
static KCompressionDevicedevice (QIODevice *inDevice, const QString &mimetype, bool autoDeleteInDevice=true)
 
static KCompressionDevicedeviceForFile (const QString &fileName, const QString &mimetype=QString(), bool forceFilter=false)
 
- Static Public Member Functions inherited from KCompressionDevice
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 *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 QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Public Types inherited from KCompressionDevice
enum  CompressionType { GZip, BZip2, Xz, None }
 
- Public Types inherited from QIODevice
enum  OpenModeFlag
 
- Properties inherited from QObject
 objectName
 
- Public Attributes inherited from QIODevice
 Append
 
 ExistingOnly
 
 NewOnly
 
 NotOpen
 
typedef OpenMode
 
 ReadOnly
 
 ReadWrite
 
 Text
 
 Truncate
 
 Unbuffered
 
 WriteOnly
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from KCompressionDevice
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 (QIODevice::OpenMode openMode)
 
- 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)
 

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).

To simply read/write compressed files, see deviceForFile.

KFilterDev adds MIME type support to KCompressionDevice, and also provides compatibility methods for KDE 4 code.

Author
David Faure faure[email protected]@kde[email protected].org

Definition at line 29 of file kfilterdev.h.

Constructor & Destructor Documentation

KFilterDev::KFilterDev ( const QString fileName)
Since
5.0 Constructs a KFilterDev for a given FileName.
Parameters
fileNamethe name of the file to filter.

Definition at line 38 of file kfilterdev.cpp.

Member Function Documentation

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

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

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

Definition at line 43 of file kfilterdev.cpp.

static KCompressionDevice* KFilterDev::device ( QIODevice inDevice,
const QString mimetype,
bool  autoDeleteInDevice = true 
)
inlinestatic
Deprecated:
Since 5.0, use KCompressionDevice

Use: KCompressionDevice::CompressionType type = KFilterDev::compressionTypeForMimeType(mimeType); KCompressionDevice flt(&file, false, type); instead of: QIODevice *flt = KFilterDev::device(&file, mimeType, false);

Creates an i/o device that is able to read from the QIODevice inDevice, whether the data is compressed or not. Available compression filters (gzip/bzip2 etc.) will automatically be used.

The compression filter to be used is determined mimetype . Pass "application/x-gzip" or "application/x-bzip" to use the corresponding decompression filter.

Warning: application/x-bzip may not be available. In that case 0 will be returned !

The returned QIODevice has to be deleted after using.

Parameters
inDeviceinput device. Won't be deleted if autoDeleteInDevice = false
mimetypethe mime type for the filter
autoDeleteInDeviceif true, inDevice will be deleted automatically
Returns
a KCompressionDevice that filters the original stream. Must be deleted after using

Definition at line 134 of file kfilterdev.h.

static KCompressionDevice* KFilterDev::deviceForFile ( const QString fileName,
const QString mimetype = QString(),
bool  forceFilter = false 
)
inlinestatic
Deprecated:
Since 5.0, use the constructor instead (if mimetype is empty), or KCompressionDevice (if the mimetype is known).

Use: KFilterDev dev(fileName) instead of: QIODevice * dev = KFilterDev::deviceForFile(fileName);

If the mimetype was specified explicitly, use: KCompressionDevice dev(fileName, KCompressionDevice::GZip); instead of: QIODevice * dev = KFilterDev::deviceForFile(fileName, "application/gzip");

Creates an i/o device that is able to read from fileName, whether it's compressed or not. Available compression filters (gzip/bzip2 etc.) will automatically be used.

The compression filter to be used is determined from the fileName if mimetype is empty. Pass "application/x-gzip" or "application/x-bzip" to force the corresponding decompression filter, if available.

Warning: application/x-bzip may not be available. In that case a QFile opened on the compressed data will be returned ! Use KFilterBase::findFilterByMimeType and code similar to what deviceForFile is doing, to better control what's happening.

The returned QIODevice has to be deleted after using.

Parameters
fileNamethe name of the file to filter
mimetypethe mime type of the file to filter, or QString() if unknown
forceFilterif true, the function will either find a compression filter, or return 0. If false, it will always return a QIODevice. If no filter is available it will return a simple QFile. This can be useful if the file is usable without a filter.
Returns
if a filter has been found, the KCompressionDevice for the filter. If the filter does not exist, the return value depends on forceFilter. The returned KCompressionDevice has to be deleted after using.

Definition at line 87 of file kfilterdev.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Sep 23 2020 23:03:07 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.