annotate rdf/PluginRDFIndexer.h @ 461:2019d89ebcf9

* Some work on querying and cacheing plugin RDF from a central index
author Chris Cannam
date Fri, 17 Oct 2008 15:26:29 +0000
parents ef14acd6d102
children c9b055f84326
rev   line source
Chris@439 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@439 2
Chris@439 3 /*
Chris@439 4 Sonic Visualiser
Chris@439 5 An audio file viewer and annotation editor.
Chris@439 6 Centre for Digital Music, Queen Mary, University of London.
Chris@439 7 This file copyright 2008 QMUL.
Chris@439 8
Chris@439 9 This program is free software; you can redistribute it and/or
Chris@439 10 modify it under the terms of the GNU General Public License as
Chris@439 11 published by the Free Software Foundation; either version 2 of the
Chris@439 12 License, or (at your option) any later version. See the file
Chris@439 13 COPYING included with this distribution for more information.
Chris@439 14 */
Chris@439 15
Chris@439 16 #ifndef _PLUGIN_RDF_INDEXER_H_
Chris@439 17 #define _PLUGIN_RDF_INDEXER_H_
Chris@439 18
Chris@439 19 #include <QString>
Chris@456 20 #include <QStringList>
Chris@461 21 #include <QMutex>
Chris@439 22 #include <map>
Chris@439 23 #include <set>
Chris@439 24
Chris@439 25 class FileSource;
Chris@439 26
Chris@439 27 class PluginRDFIndexer
Chris@439 28 {
Chris@439 29 public:
Chris@439 30 static PluginRDFIndexer *getInstance();
Chris@439 31
Chris@461 32 /**
Chris@461 33 * Index all URLs obtained from index files defined in the current
Chris@461 34 * settings. This is not done automatically because it may incur
Chris@461 35 * significant processing and networking effort. It could be
Chris@461 36 * called from a background thread at startup, for example.
Chris@461 37 *
Chris@461 38 * Note that this class has a single mutex, so other functions
Chris@461 39 * will block if called from a different thread while this one is
Chris@461 40 * running.
Chris@461 41 */
Chris@461 42 bool indexConfiguredURLs();
Chris@461 43
Chris@456 44 bool indexURL(QString url); // in addition to "installed" URLs
Chris@456 45
Chris@439 46 QString getURIForPluginId(QString pluginId);
Chris@439 47 QString getIdForPluginURI(QString uri);
Chris@439 48 QString getDescriptionURLForPluginId(QString pluginId);
Chris@439 49 QString getDescriptionURLForPluginURI(QString uri);
Chris@439 50
Chris@456 51 QStringList getIndexedPluginIds();
Chris@456 52
Chris@439 53 ~PluginRDFIndexer();
Chris@439 54
Chris@439 55 protected:
Chris@439 56 PluginRDFIndexer();
Chris@461 57 QMutex m_mutex;
Chris@457 58 std::set<FileSource *> m_sources;
Chris@439 59 typedef std::map<QString, QString> StringMap;
Chris@439 60 StringMap m_uriToIdMap;
Chris@439 61 StringMap m_idToUriMap;
Chris@439 62 StringMap m_idToDescriptionMap;
Chris@439 63 bool indexFile(QString path);
Chris@439 64 static PluginRDFIndexer *m_instance;
Chris@461 65 void expireCacheMaybe(QString);
Chris@439 66 };
Chris@439 67
Chris@439 68 #endif
Chris@439 69