comparison data/fileio/CachedFile.h @ 465:63b8ba45d953

* stub out persistent cacheing class, as I've decided I don't like the way things were going with trying to incorporate all this logic into the already too big FileSource class
author Chris Cannam
date Mon, 27 Oct 2008 11:53:35 +0000
parents
children f35bfa88f0b5
comparison
equal deleted inserted replaced
464:9525c9d7e54d 465:63b8ba45d953
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2008 QMUL.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #ifndef _CACHED_FILE_H_
17 #define _CACHED_FILE_H_
18
19 #include <QString>
20 #include <QUrl>
21 #include <QDateTime>
22
23 class ProgressReporter;
24
25 class CachedFile
26 {
27 public:
28 CachedFile(QUrl url, ProgressReporter *reporter = 0);
29
30 virtual ~CachedFile();
31
32 bool isOK() const;
33
34 QString getLocalFilename() const;
35
36 protected:
37 QUrl m_url;
38 QString m_localFilename;
39 bool m_ok;
40
41 void refresh();
42 bool retrieve();
43
44 QDateTime getLastRetrieval();
45 void updateLastRetrieval(bool successful);
46
47 static QString getCacheDirectory();
48 static QString getLocalFilenameFor(QUrl url);
49 };
50
51 #endif