annotate data/fileio/BZipFileDevice.h @ 205:05154c7bb90b

* Basics of an approximate way of managing memory that we've committed to using but haven't allocated yet
author Chris Cannam
date Fri, 15 Dec 2006 18:05:31 +0000
parents 1a42221a1522
children 8ee6cf529c4e
rev   line source
Chris@148 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@148 2
Chris@148 3 /*
Chris@148 4 Sonic Visualiser
Chris@148 5 An audio file viewer and annotation editor.
Chris@148 6 Centre for Digital Music, Queen Mary, University of London.
Chris@148 7 This file copyright 2006 Chris Cannam.
Chris@148 8
Chris@148 9 This program is free software; you can redistribute it and/or
Chris@148 10 modify it under the terms of the GNU General Public License as
Chris@148 11 published by the Free Software Foundation; either version 2 of the
Chris@148 12 License, or (at your option) any later version. See the file
Chris@148 13 COPYING included with this distribution for more information.
Chris@148 14 */
Chris@148 15
Chris@148 16 #ifndef _BZIP_FILE_DEVICE_H_
Chris@148 17 #define _BZIP_FILE_DEVICE_H_
Chris@148 18
Chris@148 19 #include <QIODevice>
Chris@148 20
Chris@148 21 #include <bzlib.h>
Chris@148 22
Chris@148 23 class BZipFileDevice : public QIODevice
Chris@148 24 {
Chris@148 25 Q_OBJECT
Chris@148 26
Chris@148 27 public:
Chris@148 28 BZipFileDevice(QString fileName);
Chris@148 29 virtual ~BZipFileDevice();
Chris@148 30
Chris@148 31 virtual bool open(OpenMode mode);
Chris@148 32 virtual void close();
Chris@148 33
Chris@148 34 virtual bool isSequential() const { return true; }
Chris@148 35
Chris@148 36 protected:
Chris@148 37 virtual qint64 readData(char *data, qint64 maxSize);
Chris@148 38 virtual qint64 writeData(const char *data, qint64 maxSize);
Chris@148 39
Chris@148 40 QString m_fileName;
Chris@148 41
Chris@148 42 FILE *m_file;
Chris@148 43 BZFILE *m_bzFile;
Chris@148 44 bool m_atEnd;
Chris@148 45 };
Chris@148 46
Chris@148 47 #endif