annotate rdf/PluginRDFIndexer.h @ 1844:5b1b03c1d8d4

Accept more than one library URI for a plugin; consistency checks for packs
author Chris Cannam
date Mon, 20 Apr 2020 15:42:51 +0100
parents ad5f892c0c4d
children
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@1581 16 #ifndef SV_PLUGIN_RDF_INDEXER_H
Chris@1581 17 #define SV_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@725 25 namespace Dataquay {
Chris@725 26 class BasicStore;
Chris@725 27 }
Chris@725 28
Chris@439 29 class PluginRDFIndexer
Chris@439 30 {
Chris@439 31 public:
Chris@439 32 static PluginRDFIndexer *getInstance();
Chris@439 33
Chris@461 34 /**
Chris@461 35 * Index all URLs obtained from index files defined in the current
Chris@477 36 * settings. In contrast to indexing URLs that are installed
Chris@477 37 * locally alongside plugins, this is not done automatically
Chris@477 38 * because it may incur significant processing and networking
Chris@477 39 * effort. It could be called from a background thread at
Chris@477 40 * startup, for example.
Chris@461 41 *
Chris@461 42 * Note that this class has a single mutex, so other functions
Chris@461 43 * will block if called from a different thread while this one is
Chris@461 44 * running.
Chris@461 45 */
Chris@461 46 bool indexConfiguredURLs();
Chris@461 47
Chris@456 48 bool indexURL(QString url); // in addition to "installed" URLs
Chris@456 49
Chris@439 50 QString getURIForPluginId(QString pluginId);
Chris@439 51 QString getIdForPluginURI(QString uri);
Chris@439 52
Chris@456 53 QStringList getIndexedPluginIds();
Chris@456 54
Chris@1844 55 /**
Chris@1844 56 * Perform various checks for consistency of RDF definitions,
Chris@1844 57 * printing warnings to stderr/logfile as appropriate.
Chris@1844 58 */
Chris@1844 59 void performConsistencyChecks();
Chris@1844 60
Chris@725 61 const Dataquay::BasicStore *getIndex();
Chris@725 62
Chris@439 63 ~PluginRDFIndexer();
Chris@439 64
Chris@439 65 protected:
Chris@439 66 PluginRDFIndexer();
Chris@461 67 QMutex m_mutex;
Chris@477 68
Chris@439 69 typedef std::map<QString, QString> StringMap;
Chris@439 70 StringMap m_uriToIdMap;
Chris@439 71 StringMap m_idToUriMap;
Chris@477 72
Chris@477 73 void indexInstalledURLs();
Chris@489 74
Chris@489 75 bool pullFile(QString path);
Chris@489 76 bool pullURL(QString urlString);
Chris@489 77 bool reindex();
Chris@1844 78
Chris@725 79 Dataquay::BasicStore *m_index;
Chris@725 80
Chris@439 81 static PluginRDFIndexer *m_instance;
Chris@439 82 };
Chris@439 83
Chris@439 84 #endif
Chris@439 85