kfilterdev.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 #ifndef __kfilterdev_h 00019 #define __kfilterdev_h 00020 00021 #include <qiodevice.h> 00022 #include <qstring.h> 00023 00024 class QFile; 00025 class KFilterBase; 00026 00035 class KFilterDev : public QIODevice 00036 { 00037 public: 00043 KFilterDev( KFilterBase * filter, bool autodeleteFilterBase = false ); 00048 virtual ~KFilterDev(); 00049 00054 virtual bool open( int mode ); 00059 virtual void close(); 00060 virtual void flush(); 00061 00066 void setOrigFileName( const QCString & fileName ); 00067 00074 void setSkipHeaders(); 00075 00076 // Not implemented 00077 virtual QIODevice::Offset size() const; 00078 00079 virtual QIODevice::Offset at() const; 00083 virtual bool at( QIODevice::Offset ); 00084 00085 virtual bool atEnd() const; 00086 00087 virtual Q_LONG readBlock( char *data, Q_ULONG maxlen ); 00088 virtual Q_LONG writeBlock( const char *data, Q_ULONG len ); 00089 //int readLine( char *data, uint maxlen ); 00090 00091 virtual int getch(); 00092 virtual int putch( int ); 00093 virtual int ungetch( int ); 00094 00095 #ifndef KDE_NO_COMPAT 00096 00103 static QIODevice* createFilterDevice(KFilterBase* base, QFile* file); 00104 #endif 00105 00122 static QIODevice * deviceForFile( const QString & fileName, const QString & mimetype = QString::null, 00123 bool forceFilter = false ); 00124 00140 static QIODevice * device( QIODevice* inDevice, const QString & mimetype); 00141 // BIC: merge with device() method below, using default value for autoDeleteInDevice 00142 00159 static QIODevice * device( QIODevice* inDevice, const QString & mimetype, bool autoDeleteInDevice ); 00160 00161 private: 00162 KFilterBase *filter; 00163 class KFilterDevPrivate; 00164 KFilterDevPrivate * d; 00165 }; 00166 00167 00168 #endif