Mercurial > hg > svcore
comparison data/fileio/CSVFileReader.h @ 1491:1dc64d3d323c import-audio-data
Support progress reporter for data file loads
author | Chris Cannam |
---|---|
date | Fri, 29 Jun 2018 13:44:53 +0100 |
parents | 53fa8d57b728 |
children | fbe8afdfa8a6 |
comparison
equal
deleted
inserted
replaced
1490:9ab8e5ec4731 | 1491:1dc64d3d323c |
---|---|
25 #include <QList> | 25 #include <QList> |
26 #include <QStringList> | 26 #include <QStringList> |
27 #include <QIODevice> | 27 #include <QIODevice> |
28 | 28 |
29 class QFile; | 29 class QFile; |
30 class ProgressReporter; | |
30 | 31 |
31 class CSVFileReader : public DataFileReader | 32 class CSVFileReader : public DataFileReader |
32 { | 33 { |
33 public: | 34 public: |
34 /** | 35 /** |
35 * Construct a CSVFileReader to read the CSV file at the given | 36 * Construct a CSVFileReader to read the CSV file at the given |
36 * path, with the given format. | 37 * path, with the given format. |
37 */ | 38 */ |
38 CSVFileReader(QString path, CSVFormat format, | 39 CSVFileReader(QString path, CSVFormat format, |
39 sv_samplerate_t mainModelSampleRate); | 40 sv_samplerate_t mainModelSampleRate, |
41 ProgressReporter *reporter = 0); | |
40 | 42 |
41 /** | 43 /** |
42 * Construct a CSVFileReader to read from the given | 44 * Construct a CSVFileReader to read from the given |
43 * QIODevice. Caller retains ownership of the QIODevice: the | 45 * QIODevice. Caller retains ownership of the QIODevice: the |
44 * CSVFileReader will not close or delete it and it must outlive | 46 * CSVFileReader will not close or delete it and it must outlive |
45 * the CSVFileReader. | 47 * the CSVFileReader. |
46 */ | 48 */ |
47 CSVFileReader(QIODevice *device, CSVFormat format, | 49 CSVFileReader(QIODevice *device, CSVFormat format, |
48 sv_samplerate_t mainModelSampleRate); | 50 sv_samplerate_t mainModelSampleRate, |
51 ProgressReporter *reporter = 0); | |
49 | 52 |
50 virtual ~CSVFileReader(); | 53 virtual ~CSVFileReader(); |
51 | 54 |
52 virtual bool isOK() const; | 55 virtual bool isOK() const; |
53 virtual QString getError() const; | 56 virtual QString getError() const; |
60 bool m_ownDevice; | 63 bool m_ownDevice; |
61 QString m_filename; | 64 QString m_filename; |
62 QString m_error; | 65 QString m_error; |
63 mutable int m_warnings; | 66 mutable int m_warnings; |
64 sv_samplerate_t m_mainModelSampleRate; | 67 sv_samplerate_t m_mainModelSampleRate; |
68 qint64 m_fileSize; | |
69 mutable qint64 m_readCount; | |
70 mutable int m_progress; | |
71 ProgressReporter *m_reporter; | |
65 | 72 |
66 sv_frame_t convertTimeValue(QString, int lineno, sv_samplerate_t sampleRate, | 73 sv_frame_t convertTimeValue(QString, int lineno, sv_samplerate_t sampleRate, |
67 int windowSize) const; | 74 int windowSize) const; |
68 }; | 75 }; |
69 | 76 |