kfilterbase.h
/* This file is part of the KDE libraries
Copyright (C) 2000 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __kfilterbase__h
#define __kfilterbase__h
#include <qobject.h>
#include <qstring.h>
#include <kdelibs_export.h>
#ifdef Q_WS_WIN
#undef ERROR //avoid conflicts
#endif
class QIODevice;
class KIO_EXPORT KFilterBase : public QObject // needs to inherit QObject for KLibFactory::create
{
Q_OBJECT
public:
KFilterBase();
virtual ~KFilterBase();
void setDevice( QIODevice * dev, bool autodelete = false );
// Note that this isn't in the constructor, because of KLibFactory::create,
// but it should be called before using the filterbase !
QIODevice * device() { return m_dev; }
virtual void init( int mode ) = 0;
virtual int mode() const = 0;
virtual void terminate() {}
virtual void reset() {}
virtual bool readHeader() = 0;
virtual bool writeHeader( const QCString & filename ) = 0;
virtual void setOutBuffer( char * data, uint maxlen ) = 0;
virtual void setInBuffer( const char * data, uint size ) = 0;
virtual bool inBufferEmpty() const { return inBufferAvailable() == 0; }
virtual int inBufferAvailable() const = 0;
virtual bool outBufferFull() const { return outBufferAvailable() == 0; }
virtual int outBufferAvailable() const = 0;
enum Result { OK, END, ERROR };
virtual Result uncompress() = 0;
virtual Result compress( bool finish ) = 0;
static KFilterBase * findFilterByFileName( const QString & fileName );
static KFilterBase * findFilterByMimeType( const QString & mimeType );
protected:
QIODevice * m_dev;
bool m_bAutoDel;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KFilterBasePrivate;
};
#endif
KFilterBase
This is the base class for compression filters such as gzip and bzip2.
Definition: kfilterbase.h:38
KFilterBase::device
QIODevice * device()
Returns the device on which the filter will work.
Definition: kfilterbase.h:58

KDE Home | KDE Accessibility Home | Description of Access Keys