annotate data/fileio/CSVFileReader.h @ 1008:d9e0e59a1581

When using an aggregate model to pass data to a transform, zero-pad the shorter input to the duration of the longer rather than truncating the longer. (This is better behaviour for e.g. MATCH, and in any case the code was previously truncating incorrectly and ending up with garbage data at the end.)
author Chris Cannam
date Fri, 14 Nov 2014 13:51:33 +0000
parents 59e7fe1b1003
children e369dd281cf2
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@148 23 #include <QList>
Chris@148 24 #include <QStringList>
Chris@148 25
Chris@148 26 class QFile;
Chris@148 27
Chris@148 28 class CSVFileReader : public DataFileReader
Chris@148 29 {
Chris@148 30 public:
Chris@929 31 CSVFileReader(QString path, CSVFormat format, int mainModelSampleRate);
Chris@148 32 virtual ~CSVFileReader();
Chris@148 33
Chris@148 34 virtual bool isOK() const;
Chris@148 35 virtual QString getError() const;
Chris@148 36 virtual Model *load() const;
Chris@148 37
Chris@148 38 protected:
Chris@392 39 CSVFormat m_format;
Chris@148 40 QFile *m_file;
Chris@148 41 QString m_error;
Chris@631 42 mutable int m_warnings;
Chris@929 43 int m_mainModelSampleRate;
Chris@631 44
Chris@929 45 int convertTimeValue(QString, int lineno, int sampleRate,
Chris@929 46 int windowSize) const;
Chris@148 47 };
Chris@148 48
Chris@148 49
Chris@148 50 #endif
Chris@148 51