From e1ea99192e10149e0cac7a93f98fbec20e7cedb2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 3 Apr 2015 17:10:58 +0000 Subject: Use lv2:prototype and deprecate ingen:prototype. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5652 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/events/CreateBlock.cpp | 18 +++++++++++++++--- src/server/events/CreateGraph.cpp | 8 ++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'src/server') diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index e14a3356..3ea009a4 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -69,9 +69,20 @@ CreateBlock::pre_process() return Event::pre_process_done(Status::PARENT_NOT_FOUND, _path.parent()); } - // Get prototype URI - const iterator t = _properties.find(uris.ingen_prototype); + // Map old ingen:prototype to new lv2:prototype + auto range = _properties.equal_range(uris.ingen_prototype); + for (auto i = range.first; i != range.second;) { + const auto& value = i->second; + auto next = i; + next = _properties.erase(i); + _properties.insert(std::make_pair(uris.lv2_prototype, i->second)); + i = next; + } + + // Get prototype + iterator t = _properties.find(uris.lv2_prototype); if (t == _properties.end() || t->second.type() != uris.forge.URI) { + // Missing/invalid prototype return Event::pre_process_done(Status::BAD_REQUEST); } @@ -98,7 +109,8 @@ CreateBlock::pre_process() /* Replace prototype with the ancestor's. This is less informative, but the client expects an actual LV2 plugin as prototype. */ _properties.erase(uris.ingen_prototype); - _properties.insert(std::make_pair(uris.ingen_prototype, + _properties.erase(uris.lv2_prototype); + _properties.insert(std::make_pair(uris.lv2_prototype, uris.forge.alloc_uri(ancestor->plugin()->uri()))); } else { // Prototype is a plugin diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index 06445a6b..b9661a13 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -76,8 +76,12 @@ CreateGraph::pre_process() const Raul::Symbol symbol((_path.is_root()) ? "root" : _path.symbol()); - // Create graph based on prototype - const iterator t = _properties.find(uris.ingen_prototype); + // Get graph prototype + iterator t = _properties.find(uris.lv2_prototype); + if (t == _properties.end()) { + t = _properties.find(uris.lv2_prototype); + } + if (t != _properties.end() && Raul::URI::is_valid(t->second.ptr()) && Node::uri_is_path(Raul::URI(t->second.ptr()))) { -- cgit v1.2.1