annotate data/fileio/CSVFileReader.h @ 1126:39019ce29178 tony-2.0-integration

Merge through to branch for Tony 2.0
author Chris Cannam
date Thu, 20 Aug 2015 14:54:21 +0100
parents e22bfe8ca248 7f8eb7379280
children 815f82508f96
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;
mail@1119 30 class QIODevice;
Chris@148 31
Chris@148 32 class CSVFileReader : public DataFileReader
Chris@148 33 {
Chris@148 34 public:
Chris@1009 35 /**
Chris@1009 36 * Construct a CSVFileReader to read the CSV file at the given
Chris@1009 37 * path, with the given format.
Chris@1009 38 */
Chris@1047 39 CSVFileReader(QString path, CSVFormat format, 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@1047 47 CSVFileReader(QIODevice *device, CSVFormat format, sv_samplerate_t mainModelSampleRate);
Chris@1009 48
Chris@148 49 virtual ~CSVFileReader();
Chris@148 50
Chris@148 51 virtual bool isOK() const;
Chris@148 52 virtual QString getError() const;
Chris@1009 53
Chris@148 54 virtual Model *load() const;
Chris@148 55
Chris@148 56 protected:
Chris@392 57 CSVFormat m_format;
Chris@1009 58 QIODevice *m_device;
Chris@1009 59 bool m_ownDevice;
Chris@1030 60 QString m_filename;
Chris@148 61 QString m_error;
Chris@631 62 mutable int m_warnings;
Chris@1047 63 sv_samplerate_t m_mainModelSampleRate;
Chris@631 64
Chris@1047 65 sv_frame_t convertTimeValue(QString, int lineno, sv_samplerate_t sampleRate,
Chris@1038 66 int windowSize) const;
Chris@148 67 };
Chris@148 68
Chris@148 69
Chris@148 70 #endif
Chris@148 71