annotate data/fileio/DataFileReaderFactory.h @ 316:3a6725f285d6

* Make RemoteFile far more pervasive, and use it for local files as well so that we can handle both transparently. Make it shallow copy with reference counting, so it can be used by value without having to worry about the cache file lifetime. Use RemoteFile for MainWindow file-open functions, etc
author Chris Cannam
date Thu, 18 Oct 2007 15:31:20 +0000
parents 14e0f60435b8
children 183ee2a55fc7
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 _DATA_FILE_READER_FACTORY_H_
Chris@148 17 #define _DATA_FILE_READER_FACTORY_H_
Chris@148 18
Chris@148 19 #include <QString>
Chris@148 20
Chris@148 21 class DataFileReader;
Chris@148 22 class Model;
Chris@148 23
Chris@148 24 class DataFileReaderFactory
Chris@148 25 {
Chris@148 26 public:
Chris@308 27 enum Exception { ImportCancelled };
Chris@308 28
Chris@148 29 /**
Chris@148 30 * Return the file extensions that we have data file readers for,
Chris@148 31 * in a format suitable for use with QFileDialog. For example,
Chris@148 32 * "*.csv *.xml".
Chris@148 33 */
Chris@148 34 static QString getKnownExtensions();
Chris@148 35
Chris@148 36 /**
Chris@148 37 * Return a data file reader initialised to the file at the
Chris@148 38 * given path, or NULL if no suitable reader for this path is
Chris@148 39 * available or the file cannot be opened.
Chris@148 40 * Caller owns the returned object and must delete it after use.
Chris@148 41 */
Chris@148 42 static DataFileReader *createReader(QString path,
Chris@148 43 size_t mainModelSampleRate);
Chris@148 44
Chris@148 45 /**
Chris@148 46 * Read the given path, if a suitable reader is available.
Chris@148 47 * Return NULL if no reader succeeded in reading this file.
Chris@148 48 */
Chris@148 49 static Model *load(QString path, size_t mainModelSampleRate);
Chris@148 50 };
Chris@148 51
Chris@148 52 #endif
Chris@148 53