Mercurial > hg > svcore
comparison data/fileio/DataFileReaderFactory.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 | 48e9f538e6e9 |
| children |
comparison
equal
deleted
inserted
replaced
| 1490:9ab8e5ec4731 | 1491:1dc64d3d323c |
|---|---|
| 11 published by the Free Software Foundation; either version 2 of the | 11 published by the Free Software Foundation; either version 2 of the |
| 12 License, or (at your option) any later version. See the file | 12 License, or (at your option) any later version. See the file |
| 13 COPYING included with this distribution for more information. | 13 COPYING included with this distribution for more information. |
| 14 */ | 14 */ |
| 15 | 15 |
| 16 #ifndef _DATA_FILE_READER_FACTORY_H_ | 16 #ifndef SV_DATA_FILE_READER_FACTORY_H |
| 17 #define _DATA_FILE_READER_FACTORY_H_ | 17 #define SV_DATA_FILE_READER_FACTORY_H |
| 18 | 18 |
| 19 #include <QString> | 19 #include <QString> |
| 20 | 20 |
| 21 #include "CSVFormat.h" | 21 #include "CSVFormat.h" |
| 22 #include "MIDIFileReader.h" | 22 #include "MIDIFileReader.h" |
| 23 | 23 |
| 24 class DataFileReader; | 24 class DataFileReader; |
| 25 class Model; | 25 class Model; |
| 26 class ProgressReporter; | |
| 26 | 27 |
| 27 class DataFileReaderFactory | 28 class DataFileReaderFactory |
| 28 { | 29 { |
| 29 public: | 30 public: |
| 30 enum Exception { ImportCancelled }; | 31 enum Exception { ImportCancelled }; |
| 46 * Note that this function is non-interactive -- the user is not | 47 * Note that this function is non-interactive -- the user is not |
| 47 * asked for file format preferences. | 48 * asked for file format preferences. |
| 48 */ | 49 */ |
| 49 static DataFileReader *createReader(QString path, | 50 static DataFileReader *createReader(QString path, |
| 50 MIDIFileImportPreferenceAcquirer *, | 51 MIDIFileImportPreferenceAcquirer *, |
| 51 sv_samplerate_t mainModelSampleRate); | 52 sv_samplerate_t mainModelSampleRate, |
| 53 ProgressReporter *reporter = 0); | |
| 52 | 54 |
| 53 /** | 55 /** |
| 54 * Read the given path, if a suitable reader is available. | 56 * Read the given path, if a suitable reader is available. |
| 55 * Return NULL if no reader succeeded in reading this file. | 57 * Return NULL if no reader succeeded in reading this file. |
| 56 * | 58 * |
| 58 * asked for file format preferences. If the CSV file reader is | 60 * asked for file format preferences. If the CSV file reader is |
| 59 * used, it is with default format. | 61 * used, it is with default format. |
| 60 */ | 62 */ |
| 61 static Model *load(QString path, | 63 static Model *load(QString path, |
| 62 MIDIFileImportPreferenceAcquirer *acquirer, | 64 MIDIFileImportPreferenceAcquirer *acquirer, |
| 63 sv_samplerate_t mainModelSampleRate); | 65 sv_samplerate_t mainModelSampleRate, |
| 66 ProgressReporter *reporter = 0); | |
| 64 | 67 |
| 65 /** | 68 /** |
| 66 * Read the given path, if a suitable reader is available. | 69 * Read the given path, if a suitable reader is available. |
| 67 * Return NULL if no reader succeeded in reading this file. | 70 * Return NULL if no reader succeeded in reading this file. |
| 68 * Do not attempt the general CSV reader. | 71 * Do not attempt the general CSV reader. |
| 69 */ | 72 */ |
| 70 static Model *loadNonCSV(QString path, | 73 static Model *loadNonCSV(QString path, |
| 71 MIDIFileImportPreferenceAcquirer *acquirer, | 74 MIDIFileImportPreferenceAcquirer *acquirer, |
| 72 sv_samplerate_t mainModelSampleRate); | 75 sv_samplerate_t mainModelSampleRate, |
| 76 ProgressReporter *reporter = 0); | |
| 73 | 77 |
| 74 /** | 78 /** |
| 75 * Read the given path using the CSV reader with the given format. | 79 * Read the given path using the CSV reader with the given format. |
| 76 * Return NULL if it failed in reading this file. | 80 * Return NULL if it failed in reading this file. |
| 77 */ | 81 */ |
| 78 static Model *loadCSV(QString path, | 82 static Model *loadCSV(QString path, |
| 79 CSVFormat format, | 83 CSVFormat format, |
| 80 sv_samplerate_t mainModelSampleRate); | 84 sv_samplerate_t mainModelSampleRate, |
| 85 ProgressReporter *reporter = 0); | |
| 81 | 86 |
| 82 protected: | 87 protected: |
| 83 static DataFileReader *createReader(QString path, bool csv, | 88 static DataFileReader *createReader(QString path, bool csv, |
| 84 MIDIFileImportPreferenceAcquirer *, | 89 MIDIFileImportPreferenceAcquirer *, |
| 85 CSVFormat format, | 90 CSVFormat format, |
| 86 sv_samplerate_t mainModelSampleRate); | 91 sv_samplerate_t mainModelSampleRate, |
| 92 ProgressReporter *reporter = 0); | |
| 87 }; | 93 }; |
| 88 | 94 |
| 89 #endif | 95 #endif |
| 90 | 96 |
