Chris@148: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
Chris@148: 
Chris@148: /*
Chris@148:     Sonic Visualiser
Chris@148:     An audio file viewer and annotation editor.
Chris@148:     Centre for Digital Music, Queen Mary, University of London.
Chris@148:     This file copyright 2006 Chris Cannam.
Chris@148:     
Chris@148:     This program is free software; you can redistribute it and/or
Chris@148:     modify it under the terms of the GNU General Public License as
Chris@148:     published by the Free Software Foundation; either version 2 of the
Chris@148:     License, or (at your option) any later version.  See the file
Chris@148:     COPYING included with this distribution for more information.
Chris@148: */
Chris@148: 
Chris@148: #ifndef _BZIP_FILE_DEVICE_H_
Chris@148: #define _BZIP_FILE_DEVICE_H_
Chris@148: 
Chris@148: #include <QIODevice>
Chris@148: 
Chris@148: #include <bzlib.h>
Chris@148: 
Chris@148: class BZipFileDevice : public QIODevice
Chris@148: {
Chris@148:     Q_OBJECT
Chris@148: 
Chris@148: public:
Chris@148:     BZipFileDevice(QString fileName);
Chris@148:     virtual ~BZipFileDevice();
Chris@148:     
Chris@148:     virtual bool open(OpenMode mode);
Chris@148:     virtual void close();
Chris@148: 
Chris@207:     virtual bool isOK() const;
Chris@207: 
Chris@148:     virtual bool isSequential() const { return true; }
Chris@148: 
Chris@148: protected:
Chris@148:     virtual qint64 readData(char *data, qint64 maxSize);
Chris@148:     virtual qint64 writeData(const char *data, qint64 maxSize);
Chris@148: 
Chris@148:     QString m_fileName;
Chris@148: 
Chris@148:     FILE *m_file;
Chris@148:     BZFILE *m_bzFile;
Chris@148:     bool m_atEnd;
Chris@207:     bool m_ok;
Chris@148: };
Chris@148: 
Chris@148: #endif