kio Library API Documentation

kfilterbase.h

00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2000 David Faure <faure@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00016 Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef __kfilterbase__h 00020 #define __kfilterbase__h 00021 00022 #include <qobject.h> 00023 #include <qstring.h> 00024 class QIODevice; 00025 00031 class KFilterBase : public QObject // needs to inherit QObject for KLibFactory::create 00032 { 00033 Q_OBJECT 00034 public: 00035 KFilterBase(); 00036 virtual ~KFilterBase(); 00037 00043 void setDevice( QIODevice * dev, bool autodelete = false ); 00044 // Note that this isn't in the constructor, because of KLibFactory::create, 00045 // but it should be called before using the filterbase ! 00046 00051 QIODevice * device() { return m_dev; } 00053 virtual void init( int mode ) = 0; 00055 virtual int mode() const = 0; 00057 virtual void terminate() {} 00059 virtual void reset() {} 00061 virtual bool readHeader() = 0; 00063 virtual bool writeHeader( const QCString & filename ) = 0; 00065 virtual void setOutBuffer( char * data, uint maxlen ) = 0; 00067 virtual void setInBuffer( const char * data, uint size ) = 0; 00069 virtual bool inBufferEmpty() const { return inBufferAvailable() == 0; } 00071 virtual int inBufferAvailable() const = 0; 00073 virtual bool outBufferFull() const { return outBufferAvailable() == 0; } 00075 virtual int outBufferAvailable() const = 0; 00076 00078 enum Result { OK, END, ERROR }; 00080 virtual Result uncompress() = 0; 00082 virtual Result compress( bool finish ) = 0; 00083 00090 static KFilterBase * findFilterByFileName( const QString & fileName ); 00091 00098 static KFilterBase * findFilterByMimeType( const QString & mimeType ); 00099 00100 protected: 00101 QIODevice * m_dev; 00102 bool m_bAutoDel; 00103 protected: 00104 virtual void virtual_hook( int id, void* data ); 00105 private: 00106 class KFilterBasePrivate; 00107 }; 00108 00109 #endif
KDE Logo
This file is part of the documentation for kio Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Aug 30 22:54:39 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003