annotate data/fileio/CSVFileReader.h @ 706:579b2da21e7a

Make FileSource capable of handling resource files. Without this, we failed to open the silent resource file used as a placeholder in templates and thus failed to replace it with the proper file after loading the template -- the consequence was that (although the right audio file ended up being shown as the main model) any derived models were not regenerated
author Chris Cannam
date Fri, 07 Oct 2011 17:04:09 +0100
parents 3a5ee4b6c9ad
children 59e7fe1b1003
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@392 31 CSVFileReader(QString path, CSVFormat format, size_t 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@148 43 size_t m_mainModelSampleRate;
Chris@631 44
Chris@631 45 size_t convertTimeValue(QString, int lineno, size_t sampleRate,
Chris@631 46 size_t windowSize) const;
Chris@148 47 };
Chris@148 48
Chris@148 49
Chris@148 50 #endif
Chris@148 51