From 577570aa55b2ca0eba7759d13624b179275d65b8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 12 Aug 2015 15:21:10 +0000 Subject: Fix URI comparison issues. Fixes issue #1074. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5704 a436a847-0d15-0410-975c-d299462d15a1 --- ingen/URIs.hpp | 18 +++++++++++++++--- src/client/PluginModel.cpp | 4 ++-- src/gui/ObjectMenu.cpp | 2 +- src/server/GraphPlugin.hpp | 4 ++-- src/server/InternalPlugin.cpp | 2 +- src/server/LV2Plugin.cpp | 2 +- src/server/OutputPort.cpp | 2 +- src/server/events/CreateGraph.cpp | 2 +- 8 files changed, 24 insertions(+), 12 deletions(-) diff --git a/ingen/URIs.hpp b/ingen/URIs.hpp index a10cd30c..d38b840e 100644 --- a/ingen/URIs.hpp +++ b/ingen/URIs.hpp @@ -47,8 +47,8 @@ public: struct Quark : public Raul::URI { Quark(Ingen::Forge& forge, URIMap* map, const char* str); - operator LV2_URID() const { return urid.get(); } - operator Atom() const { return urid; } + operator LV2_URID() const { return urid.get(); } + explicit operator Atom() const { return urid; } inline bool operator==(const Atom& rhs) const { if (rhs.type() == urid.type()) { @@ -59,6 +59,10 @@ public: return false; } + inline bool operator!=(const Atom& rhs) const { + return !operator==(rhs); + } + Atom urid; Atom uri; }; @@ -181,6 +185,14 @@ public: const Quark time_speed; }; +inline bool operator==(const Atom& a, const URIs::Quark& b) { + return b == a; +} + +inline bool operator!=(const Atom& a, const URIs::Quark& b) { + return b != a; +} + } // namespace Ingen -#endif // INGEN_LV2URIMAP_HPP +#endif // INGEN_URIS_HPP diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 3a1f3a9a..93a48acf 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -50,9 +50,9 @@ PluginModel::PluginModel(URIs& uris, { if (!_type.is_valid()) { if (uri.find("ingen-internals") != string::npos) { - _type = uris.ingen_Internal; + _type = uris.ingen_Internal.urid; } else { - _type = uris.lv2_Plugin; // Assume LV2 and hope for the best... + _type = uris.lv2_Plugin.urid; // Assume LV2 and hope for the best... } } diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index fd6bd9aa..5f287d15 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -94,7 +94,7 @@ ObjectMenu::on_menu_learn() { _app->interface()->set_property(_object->uri(), _app->uris().midi_binding, - _app->uris().patch_wildcard); + _app->uris().patch_wildcard.urid); } void diff --git a/src/server/GraphPlugin.hpp b/src/server/GraphPlugin.hpp index e18e173a..7d365383 100644 --- a/src/server/GraphPlugin.hpp +++ b/src/server/GraphPlugin.hpp @@ -36,7 +36,7 @@ public: const Raul::URI& uri, const Raul::Symbol& symbol, const std::string& name) - : PluginImpl(uris, uris.ingen_Graph, uri) + : PluginImpl(uris, uris.ingen_Graph.urid, uri) {} BlockImpl* instantiate(BufferFactory& bufs, @@ -49,7 +49,7 @@ public: } const Raul::Symbol symbol() const { return Raul::Symbol("graph"); } - const std::string name() const { return "Ingen Graph"; } + const std::string name() const { return "Ingen Graph"; } private: const std::string _symbol; diff --git a/src/server/InternalPlugin.cpp b/src/server/InternalPlugin.cpp index 647823f7..075bc67d 100644 --- a/src/server/InternalPlugin.cpp +++ b/src/server/InternalPlugin.cpp @@ -35,7 +35,7 @@ using namespace Internals; InternalPlugin::InternalPlugin(URIs& uris, const Raul::URI& uri, const Raul::Symbol& symbol) - : PluginImpl(uris, uris.ingen_Internal, uri) + : PluginImpl(uris, uris.ingen_Internal.urid, uri) , _symbol(symbol) { set_property(uris.rdf_type, uris.ingen_Internal); diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp index d88689ca..3b7c9b18 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -32,7 +32,7 @@ namespace Server { LV2Plugin::LV2Plugin(SPtr lv2_info, const Raul::URI& uri) : PluginImpl(lv2_info->world().uris(), - lv2_info->world().uris().lv2_Plugin, + lv2_info->world().uris().lv2_Plugin.urid, uri) , _lilv_plugin(NULL) , _lv2_info(lv2_info) diff --git a/src/server/OutputPort.cpp b/src/server/OutputPort.cpp index eb36abde..70acfd63 100644 --- a/src/server/OutputPort.cpp +++ b/src/server/OutputPort.cpp @@ -39,7 +39,7 @@ OutputPort::OutputPort(BufferFactory& bufs, : PortImpl(bufs, parent, symbol, index, poly, type, buffer_type, value, buffer_size) { if (parent->graph_type() != Node::GraphType::GRAPH) { - add_property(bufs.uris().rdf_type, bufs.uris().lv2_OutputPort); + add_property(bufs.uris().rdf_type, bufs.uris().lv2_OutputPort.urid); } setup_buffers(bufs, poly, false); diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index 2b31d595..d0115a4d 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -99,7 +99,7 @@ CreateGraph::pre_process() // Create a new graph _graph = new GraphImpl(_engine, symbol, ext_poly, _parent, _engine.driver()->sample_rate(), int_poly); - _graph->add_property(uris.rdf_type, uris.ingen_Graph); + _graph->add_property(uris.rdf_type, uris.ingen_Graph.urid); _graph->add_property(uris.rdf_type, Resource::Property(uris.ingen_Block, Resource::Graph::EXTERNAL)); -- cgit v1.2.1