Mercurial > hg > svcore
annotate data/fileio/BZipFileDevice.h @ 316:3a6725f285d6
* Make RemoteFile far more pervasive, and use it for local files as well
so that we can handle both transparently. Make it shallow copy with
reference counting, so it can be used by value without having to worry
about the cache file lifetime. Use RemoteFile for MainWindow file-open
functions, etc
author | Chris Cannam |
---|---|
date | Thu, 18 Oct 2007 15:31:20 +0000 |
parents | 8ee6cf529c4e |
children | b3cb0edc25cd |
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@207 | 34 virtual bool isOK() const; |
Chris@207 | 35 |
Chris@148 | 36 virtual bool isSequential() const { return true; } |
Chris@148 | 37 |
Chris@148 | 38 protected: |
Chris@148 | 39 virtual qint64 readData(char *data, qint64 maxSize); |
Chris@148 | 40 virtual qint64 writeData(const char *data, qint64 maxSize); |
Chris@148 | 41 |
Chris@148 | 42 QString m_fileName; |
Chris@148 | 43 |
Chris@148 | 44 FILE *m_file; |
Chris@148 | 45 BZFILE *m_bzFile; |
Chris@148 | 46 bool m_atEnd; |
Chris@207 | 47 bool m_ok; |
Chris@148 | 48 }; |
Chris@148 | 49 |
Chris@148 | 50 #endif |