Mercurial > hg > svcore
diff rdf/PluginRDFDescription.cpp @ 1845:6f626cfdba51
Pull out Provider struct
author | Chris Cannam |
---|---|
date | Mon, 20 Apr 2020 18:45:47 +0100 |
parents | 5b1b03c1d8d4 |
children | 9762a7f084a0 |
line wrap: on
line diff
--- a/rdf/PluginRDFDescription.cpp Mon Apr 20 15:42:51 2020 +0100 +++ b/rdf/PluginRDFDescription.cpp Mon Apr 20 18:45:47 2020 +0100 @@ -80,28 +80,10 @@ return m_pluginMaker; } -QString -PluginRDFDescription::getPluginInfoURL() const +Provider +PluginRDFDescription::getPluginProvider() const { - return m_pluginInfoURL; -} - -QString -PluginRDFDescription::getPluginDownloadURL() const -{ - return m_pluginDownloadURL; -} - -std::set<PluginRDFDescription::DownloadType> -PluginRDFDescription::getPluginDownloadTypes() const -{ - return m_pluginDownloadTypes; -} - -std::map<QString, PluginRDFDescription::Pack> -PluginRDFDescription::getPluginFoundInPacks() const -{ - return m_pluginFoundInPacks; + return m_provider; } QStringList @@ -234,7 +216,7 @@ (Triple(plugin, index->expand("foaf:page"), Node())); if (n.type == Node::URI && n.value != "") { - m_pluginInfoURL = n.value; + m_provider.infoUrl = n.value; } // There may be more than one library node claiming this @@ -261,19 +243,19 @@ (Triple(libn, index->expand("foaf:page"), Node())); if (n.type == Node::URI && n.value != "") { - m_pluginInfoURL = n.value; + m_provider.infoUrl = n.value; } n = index->complete (Triple(libn, index->expand("doap:download-page"), Node())); if (n.type == Node::URI && n.value != "") { - m_pluginDownloadURL = n.value; + m_provider.downloadUrl = n.value; n = index->complete (Triple(libn, index->expand("vamp:has_source"), Node())); if (n.type == Node::Literal && n.value == "true") { - m_pluginDownloadTypes.insert(DownloadSourceCode); + m_provider.downloadTypes.insert(Provider::DownloadSourceCode); } Nodes binaries = index->match @@ -283,13 +265,13 @@ for (Node bin: binaries) { if (bin.type != Node::Literal) continue; if (bin.value == "linux32") { - m_pluginDownloadTypes.insert(DownloadLinux32); + m_provider.downloadTypes.insert(Provider::DownloadLinux32); } else if (bin.value == "linux64") { - m_pluginDownloadTypes.insert(DownloadLinux64); + m_provider.downloadTypes.insert(Provider::DownloadLinux64); } else if (bin.value == "win32") { - m_pluginDownloadTypes.insert(DownloadWindows); + m_provider.downloadTypes.insert(Provider::DownloadWindows); } else if (bin.value == "osx") { - m_pluginDownloadTypes.insert(DownloadMac); + m_provider.downloadTypes.insert(Provider::DownloadMac); } } } @@ -304,20 +286,21 @@ for (Node packn: packs) { if (packn.type != Node::URI) continue; - Pack pack; + QString packName; + QString packUrl; n = index->complete (Triple(packn, index->expand("dc:title"), Node())); if (n.type == Node::Literal) { - pack.name = n.value; + packName = n.value; } n = index->complete (Triple(packn, index->expand("foaf:page"), Node())); if (n.type == Node::URI) { - pack.downloadURL = n.value; + packUrl = n.value; } - if (pack.name != "" && pack.downloadURL != "") { - m_pluginFoundInPacks[packn.value] = pack; + if (packName != "" && packUrl != "") { + m_provider.foundInPacks[packName] = packUrl; } } } @@ -329,16 +312,16 @@ SVCERR << " * name: " << m_pluginName << endl; SVCERR << " * description: " << m_pluginDescription << endl; SVCERR << " * maker: " << m_pluginMaker << endl; - SVCERR << " * info url: <" << m_pluginInfoURL << ">" << endl; - SVCERR << " * download url: <" << m_pluginDownloadURL << ">" << endl; + SVCERR << " * info url: <" << m_provider.infoUrl << ">" << endl; + SVCERR << " * download url: <" << m_provider.downloadUrl << ">" << endl; SVCERR << " * download types:" << endl; - for (auto t: m_pluginDownloadTypes) { + for (auto t: m_provider.downloadTypes) { SVCERR << " * " << int(t) << endl; } SVCERR << " * packs:" << endl; - for (auto t: m_pluginFoundInPacks) { - SVCERR << " * " << t.first << " { name: " << t.second.name - << ", download url: " << t.second.downloadURL << " }" << endl; + for (auto t: m_provider.foundInPacks) { + SVCERR << " * " << t.first + << ", download url: <" << t.second << ">" << endl; } SVCERR << endl; #endif