Mercurial > hg > svcore
diff data/fileio/DataFileReaderFactory.h @ 392:183ee2a55fc7
* More work to abstract out interactive components used in the data library,
so that it does not need to depend on QtGui.
author | Chris Cannam |
---|---|
date | Fri, 14 Mar 2008 17:14:21 +0000 |
parents | 14e0f60435b8 |
children | 59e7fe1b1003 |
line wrap: on
line diff
--- a/data/fileio/DataFileReaderFactory.h Thu Mar 13 14:06:03 2008 +0000 +++ b/data/fileio/DataFileReaderFactory.h Fri Mar 14 17:14:21 2008 +0000 @@ -18,6 +18,9 @@ #include <QString> +#include "CSVFormat.h" +#include "MIDIFileReader.h" + class DataFileReader; class Model; @@ -37,16 +40,50 @@ * Return a data file reader initialised to the file at the * given path, or NULL if no suitable reader for this path is * available or the file cannot be opened. + * * Caller owns the returned object and must delete it after use. + * + * Note that this function is non-interactive -- the user is not + * asked for file format preferences. */ static DataFileReader *createReader(QString path, + MIDIFileImportPreferenceAcquirer *, size_t mainModelSampleRate); /** * Read the given path, if a suitable reader is available. * Return NULL if no reader succeeded in reading this file. + * + * Note that this function is non-interactive -- the user is not + * asked for file format preferences. If the CSV file reader is + * used, it is with default format. */ - static Model *load(QString path, size_t mainModelSampleRate); + static Model *load(QString path, + MIDIFileImportPreferenceAcquirer *acquirer, + size_t mainModelSampleRate); + + /** + * Read the given path, if a suitable reader is available. + * Return NULL if no reader succeeded in reading this file. + * Do not attempt the general CSV reader. + */ + static Model *loadNonCSV(QString path, + MIDIFileImportPreferenceAcquirer *acquirer, + size_t mainModelSampleRate); + + /** + * Read the given path using the CSV reader with the given format. + * Return NULL if it failed in reading this file. + */ + static Model *loadCSV(QString path, + CSVFormat format, + size_t mainModelSampleRate); + +protected: + static DataFileReader *createReader(QString path, bool csv, + MIDIFileImportPreferenceAcquirer *, + CSVFormat format, + size_t mainModelSampleRate); }; #endif