Chris@439: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@439: Chris@439: /* Chris@439: Sonic Visualiser Chris@439: An audio file viewer and annotation editor. Chris@439: Centre for Digital Music, Queen Mary, University of London. Chris@439: This file copyright 2008 QMUL. Chris@439: Chris@439: This program is free software; you can redistribute it and/or Chris@439: modify it under the terms of the GNU General Public License as Chris@439: published by the Free Software Foundation; either version 2 of the Chris@439: License, or (at your option) any later version. See the file Chris@439: COPYING included with this distribution for more information. Chris@439: */ Chris@439: Chris@1581: #ifndef SV_PLUGIN_RDF_INDEXER_H Chris@1581: #define SV_PLUGIN_RDF_INDEXER_H Chris@439: Chris@439: #include Chris@456: #include Chris@461: #include Chris@439: #include Chris@439: #include Chris@439: Chris@725: namespace Dataquay { Chris@725: class BasicStore; Chris@725: } Chris@725: Chris@439: class PluginRDFIndexer Chris@439: { Chris@439: public: Chris@439: static PluginRDFIndexer *getInstance(); Chris@439: Chris@461: /** Chris@461: * Index all URLs obtained from index files defined in the current Chris@477: * settings. In contrast to indexing URLs that are installed Chris@477: * locally alongside plugins, this is not done automatically Chris@477: * because it may incur significant processing and networking Chris@477: * effort. It could be called from a background thread at Chris@477: * startup, for example. Chris@461: * Chris@461: * Note that this class has a single mutex, so other functions Chris@461: * will block if called from a different thread while this one is Chris@461: * running. Chris@461: */ Chris@461: bool indexConfiguredURLs(); Chris@461: Chris@456: bool indexURL(QString url); // in addition to "installed" URLs Chris@456: Chris@439: QString getURIForPluginId(QString pluginId); Chris@439: QString getIdForPluginURI(QString uri); Chris@439: Chris@456: QStringList getIndexedPluginIds(); Chris@456: Chris@1844: /** Chris@1844: * Perform various checks for consistency of RDF definitions, Chris@1844: * printing warnings to stderr/logfile as appropriate. Chris@1844: */ Chris@1844: void performConsistencyChecks(); Chris@1844: Chris@725: const Dataquay::BasicStore *getIndex(); Chris@725: Chris@439: ~PluginRDFIndexer(); Chris@439: Chris@439: protected: Chris@439: PluginRDFIndexer(); Chris@461: QMutex m_mutex; Chris@477: Chris@439: typedef std::map StringMap; Chris@439: StringMap m_uriToIdMap; Chris@439: StringMap m_idToUriMap; Chris@477: Chris@477: void indexInstalledURLs(); Chris@489: Chris@489: bool pullFile(QString path); Chris@489: bool pullURL(QString urlString); Chris@489: bool reindex(); Chris@1844: Chris@725: Dataquay::BasicStore *m_index; Chris@725: Chris@439: static PluginRDFIndexer *m_instance; Chris@439: }; Chris@439: Chris@439: #endif Chris@439: