KIO
klimitediodevice.h
Go to the documentation of this file.00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2001, 2002, 2007 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., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef klimitediodevice_h 00020 #define klimitediodevice_h 00021 00022 #include <kdebug.h> 00023 #include <QtCore/QIODevice> 00031 class KLimitedIODevice : public QIODevice 00032 { 00033 public: 00041 KLimitedIODevice( QIODevice *dev, int start, int length ); 00042 virtual ~KLimitedIODevice() {} 00043 00044 virtual bool isSequential() const; 00045 00046 virtual bool open( QIODevice::OpenMode m ); 00047 virtual void close(); 00048 00049 virtual qint64 size() const; 00050 00051 virtual qint64 readData ( char * data, qint64 maxlen ); 00052 virtual qint64 writeData ( const char *, qint64 ) { return -1; } // unsupported 00053 virtual int putChar( int ) { return -1; } // unsupported 00054 00055 //virtual qint64 pos() const { return m_dev->pos() - m_start; } 00056 virtual bool seek( qint64 pos ); 00057 virtual qint64 bytesAvailable() const; 00058 private: 00059 QIODevice* m_dev; 00060 qint64 m_start; 00061 qint64 m_length; 00062 }; 00063 00064 #endif