annotate data/fileio/CSVFileReader.h @ 1195:c118d2022ffa spectrogram-minor-refactor

Scale range matching
author Chris Cannam
date Mon, 01 Aug 2016 15:06:16 +0100
parents 815f82508f96
children 1bf38a4b91c4
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 _CSV_FILE_READER_H_
Chris@148 17 #define _CSV_FILE_READER_H_
Chris@148 18
Chris@148 19 #include "DataFileReader.h"
Chris@148 20
Chris@392 21 #include "CSVFormat.h"
Chris@392 22
Chris@1038 23 #include "base/BaseTypes.h"
Chris@1038 24
Chris@148 25 #include <QList>
Chris@148 26 #include <QStringList>
Chris@1116 27 #include <QIODevice>
Chris@148 28
Chris@148 29 class QFile;
Chris@148 30
Chris@148 31 class CSVFileReader : public DataFileReader
Chris@148 32 {
Chris@148 33 public:
Chris@1009 34 /**
Chris@1009 35 * Construct a CSVFileReader to read the CSV file at the given
Chris@1009 36 * path, with the given format.
Chris@1009 37 */
Chris@1047 38 CSVFileReader(QString path, CSVFormat format, sv_samplerate_t mainModelSampleRate);
Chris@1009 39
Chris@1009 40 /**
Chris@1009 41 * Construct a CSVFileReader to read from the given
Chris@1009 42 * QIODevice. Caller retains ownership of the QIODevice: the
Chris@1009 43 * CSVFileReader will not close or delete it and it must outlive
Chris@1009 44 * the CSVFileReader.
Chris@1009 45 */
Chris@1047 46 CSVFileReader(QIODevice *device, CSVFormat format, sv_samplerate_t mainModelSampleRate);
Chris@1009 47
Chris@148 48 virtual ~CSVFileReader();
Chris@148 49
Chris@148 50 virtual bool isOK() const;
Chris@148 51 virtual QString getError() const;
Chris@1009 52
Chris@148 53 virtual Model *load() const;
Chris@148 54
Chris@148 55 protected:
Chris@392 56 CSVFormat m_format;
Chris@1009 57 QIODevice *m_device;
Chris@1009 58 bool m_ownDevice;
Chris@1030 59 QString m_filename;
Chris@148 60 QString m_error;
Chris@631 61 mutable int m_warnings;
Chris@1047 62 sv_samplerate_t m_mainModelSampleRate;
Chris@631 63
Chris@1047 64 sv_frame_t convertTimeValue(QString, int lineno, sv_samplerate_t sampleRate,
Chris@1038 65 int windowSize) const;
Chris@148 66 };
Chris@148 67
Chris@148 68
Chris@148 69 #endif
Chris@148 70