Mercurial > hg > svcore
annotate data/fileio/BZipFileDevice.h @ 1778:59d9dcfd67c2
Replace the model used for the cache part of the peak-cache model with a simple vector of vectors. Avoids unnecessary locking in a class that is not thread-safe in any case. Also record whether the final column is actually truncated, rather than risk possible backward seeks to re-read it in the case where it simply might be
author | Chris Cannam |
---|---|
date | Wed, 11 Sep 2019 11:19:27 +0100 |
parents | c01cbe41aeb5 |
children |
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@1348 | 16 #ifndef SV_BZIP_FILE_DEVICE_H |
Chris@1348 | 17 #define SV_BZIP_FILE_DEVICE_H |
Chris@148 | 18 |
Chris@148 | 19 #include <QIODevice> |
Chris@1348 | 20 #include <QFile> |
Chris@148 | 21 |
Chris@148 | 22 #include <bzlib.h> |
Chris@148 | 23 |
Chris@148 | 24 class BZipFileDevice : public QIODevice |
Chris@148 | 25 { |
Chris@148 | 26 Q_OBJECT |
Chris@148 | 27 |
Chris@148 | 28 public: |
Chris@148 | 29 BZipFileDevice(QString fileName); |
Chris@148 | 30 virtual ~BZipFileDevice(); |
Chris@148 | 31 |
Chris@1580 | 32 bool open(OpenMode mode) override; |
Chris@1580 | 33 void close() override; |
Chris@148 | 34 |
Chris@207 | 35 virtual bool isOK() const; |
Chris@207 | 36 |
Chris@1580 | 37 bool isSequential() const override { return true; } |
Chris@148 | 38 |
Chris@148 | 39 protected: |
Chris@1580 | 40 qint64 readData(char *data, qint64 maxSize) override; |
Chris@1580 | 41 qint64 writeData(const char *data, qint64 maxSize) override; |
Chris@148 | 42 |
Chris@148 | 43 QString m_fileName; |
Chris@148 | 44 |
Chris@1348 | 45 QFile m_qfile; |
Chris@148 | 46 FILE *m_file; |
Chris@148 | 47 BZFILE *m_bzFile; |
Chris@148 | 48 bool m_atEnd; |
Chris@207 | 49 bool m_ok; |
Chris@148 | 50 }; |
Chris@148 | 51 |
Chris@148 | 52 #endif |