annotate data/fileio/CSVFileReader.h @ 1488:53fa8d57b728 import-audio-data

Add wave model as possible target for CSV import
author Chris Cannam
date Thu, 28 Jun 2018 14:49:46 +0100
parents 1bf38a4b91c4
children 1dc64d3d323c
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@1362 16 #ifndef SV_CSV_FILE_READER_H
Chris@1362 17 #define SV_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@1488 38 CSVFileReader(QString path, CSVFormat format,
Chris@1488 39 sv_samplerate_t mainModelSampleRate);
Chris@1009 40
Chris@1009 41 /**
Chris@1009 42 * Construct a CSVFileReader to read from the given
Chris@1009 43 * QIODevice. Caller retains ownership of the QIODevice: the
Chris@1009 44 * CSVFileReader will not close or delete it and it must outlive
Chris@1009 45 * the CSVFileReader.
Chris@1009 46 */
Chris@1488 47 CSVFileReader(QIODevice *device, CSVFormat format,
Chris@1488 48 sv_samplerate_t mainModelSampleRate);
Chris@1009 49
Chris@148 50 virtual ~CSVFileReader();
Chris@148 51
Chris@148 52 virtual bool isOK() const;
Chris@148 53 virtual QString getError() const;
Chris@1009 54
Chris@148 55 virtual Model *load() const;
Chris@148 56
Chris@148 57 protected:
Chris@392 58 CSVFormat m_format;
Chris@1009 59 QIODevice *m_device;
Chris@1009 60 bool m_ownDevice;
Chris@1030 61 QString m_filename;
Chris@148 62 QString m_error;
Chris@631 63 mutable int m_warnings;
Chris@1047 64 sv_samplerate_t m_mainModelSampleRate;
Chris@631 65
Chris@1047 66 sv_frame_t convertTimeValue(QString, int lineno, sv_samplerate_t sampleRate,
Chris@1038 67 int windowSize) const;
Chris@148 68 };
Chris@148 69
Chris@148 70
Chris@148 71 #endif
Chris@148 72