comparison 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
comparison
equal deleted inserted replaced
391:5858cc462d0a 392:183ee2a55fc7
16 #ifndef _DATA_FILE_READER_FACTORY_H_ 16 #ifndef _DATA_FILE_READER_FACTORY_H_
17 #define _DATA_FILE_READER_FACTORY_H_ 17 #define _DATA_FILE_READER_FACTORY_H_
18 18
19 #include <QString> 19 #include <QString>
20 20
21 #include "CSVFormat.h"
22 #include "MIDIFileReader.h"
23
21 class DataFileReader; 24 class DataFileReader;
22 class Model; 25 class Model;
23 26
24 class DataFileReaderFactory 27 class DataFileReaderFactory
25 { 28 {
35 38
36 /** 39 /**
37 * Return a data file reader initialised to the file at the 40 * Return a data file reader initialised to the file at the
38 * given path, or NULL if no suitable reader for this path is 41 * given path, or NULL if no suitable reader for this path is
39 * available or the file cannot be opened. 42 * available or the file cannot be opened.
43 *
40 * Caller owns the returned object and must delete it after use. 44 * Caller owns the returned object and must delete it after use.
45 *
46 * Note that this function is non-interactive -- the user is not
47 * asked for file format preferences.
41 */ 48 */
42 static DataFileReader *createReader(QString path, 49 static DataFileReader *createReader(QString path,
50 MIDIFileImportPreferenceAcquirer *,
43 size_t mainModelSampleRate); 51 size_t mainModelSampleRate);
44 52
45 /** 53 /**
46 * Read the given path, if a suitable reader is available. 54 * Read the given path, if a suitable reader is available.
47 * Return NULL if no reader succeeded in reading this file. 55 * Return NULL if no reader succeeded in reading this file.
56 *
57 * Note that this function is non-interactive -- the user is not
58 * asked for file format preferences. If the CSV file reader is
59 * used, it is with default format.
48 */ 60 */
49 static Model *load(QString path, size_t mainModelSampleRate); 61 static Model *load(QString path,
62 MIDIFileImportPreferenceAcquirer *acquirer,
63 size_t mainModelSampleRate);
64
65 /**
66 * Read the given path, if a suitable reader is available.
67 * Return NULL if no reader succeeded in reading this file.
68 * Do not attempt the general CSV reader.
69 */
70 static Model *loadNonCSV(QString path,
71 MIDIFileImportPreferenceAcquirer *acquirer,
72 size_t mainModelSampleRate);
73
74 /**
75 * Read the given path using the CSV reader with the given format.
76 * Return NULL if it failed in reading this file.
77 */
78 static Model *loadCSV(QString path,
79 CSVFormat format,
80 size_t mainModelSampleRate);
81
82 protected:
83 static DataFileReader *createReader(QString path, bool csv,
84 MIDIFileImportPreferenceAcquirer *,
85 CSVFormat format,
86 size_t mainModelSampleRate);
50 }; 87 };
51 88
52 #endif 89 #endif
53 90