From efe8e2311ee2fed881f95cc1e72825906d21c7c1 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 12 Aug 2012 23:42:17 +0000 Subject: Use ingen:root as the path for the root patch, opening up path space for engine/driver/etc. Strict conversion between Path and URI (Path no longer is-a URI). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4672 a436a847-0d15-0410-975c-d299462d15a1 --- src/AtomReader.cpp | 65 +++++++++++++++++++++++--------------- src/AtomWriter.cpp | 17 +++++----- src/Builder.cpp | 2 +- src/ClashAvoider.cpp | 23 ++++++++------ src/Store.cpp | 3 +- src/client/ClientStore.cpp | 51 ++++++++++++++---------------- src/client/ObjectModel.cpp | 2 +- src/client/PatchModel.cpp | 2 +- src/client/PluginModel.cpp | 6 ++-- src/client/PluginUI.cpp | 8 ++--- src/gui/BreadCrumbs.cpp | 4 +-- src/gui/ConnectWindow.cpp | 2 +- src/gui/LoadPluginWindow.cpp | 2 +- src/gui/NewSubpatchWindow.cpp | 4 +-- src/gui/NodeMenu.cpp | 2 +- src/gui/NodeModule.cpp | 12 +++---- src/gui/ObjectMenu.cpp | 8 ++--- src/gui/PatchBox.cpp | 11 ++++--- src/gui/PatchCanvas.cpp | 14 ++++---- src/gui/PatchPortModule.cpp | 2 +- src/gui/PatchTreeWindow.cpp | 2 +- src/gui/PatchView.cpp | 6 ++-- src/gui/PatchWindow.cpp | 1 - src/gui/Port.cpp | 4 +-- src/gui/PortMenu.cpp | 10 +++--- src/gui/PortPropertiesWindow.cpp | 4 +-- src/gui/PropertiesWindow.cpp | 6 ++-- src/gui/RenameWindow.cpp | 6 ++-- src/gui/SubpatchModule.cpp | 4 +-- src/gui/WindowFactory.cpp | 2 +- src/gui/ingen_gui_lv2.cpp | 12 +++---- src/ingen/main.cpp | 2 +- src/serialisation/Parser.cpp | 40 +++++++++++++++-------- src/serialisation/Serialiser.cpp | 4 +-- src/server/Broadcaster.cpp | 4 +-- src/server/Context.cpp | 2 +- src/server/Event.hpp | 5 +++ src/server/GraphObjectImpl.hpp | 2 +- src/server/JackDriver.cpp | 4 +-- src/server/LV2Node.cpp | 11 ++++--- src/server/NodeFactory.cpp | 2 +- src/server/events/Connect.cpp | 10 +++--- src/server/events/CreateNode.cpp | 12 +++---- src/server/events/CreatePatch.cpp | 2 +- src/server/events/CreatePort.cpp | 2 +- src/server/events/Delete.cpp | 11 +++---- src/server/events/Delta.cpp | 8 ++--- src/server/events/Get.cpp | 15 +++++---- src/server/events/Get.hpp | 1 - src/server/events/Move.cpp | 3 +- src/server/events/SetPortValue.cpp | 5 +-- src/server/util.hpp | 2 +- src/socket/SocketReader.cpp | 4 +-- src/socket/SocketWriter.cpp | 4 +-- 54 files changed, 245 insertions(+), 207 deletions(-) (limited to 'src') diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp index 77c5629e..127fec13 100644 --- a/src/AtomReader.cpp +++ b/src/AtomReader.cpp @@ -17,6 +17,7 @@ #include #include "ingen/AtomReader.hpp" +#include "ingen/GraphObject.hpp" #include "ingen/URIMap.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" #include "raul/Path.hpp" @@ -79,6 +80,17 @@ AtomReader::atom_to_uri(const LV2_Atom* atom) } } +boost::optional +AtomReader::atom_to_path(const LV2_Atom* atom) +{ + const char* uri_str = atom_to_uri(atom); + if (uri_str && Raul::URI::is_valid(uri_str) && + GraphObject::uri_is_path(uri_str)) { + return GraphObject::uri_to_path(uri_str); + } + return boost::optional(); +} + bool AtomReader::is_message(URIs& uris, const LV2_Atom* msg) { @@ -130,18 +142,14 @@ AtomReader::write(const LV2_Atom* msg) (LV2_URID)_uris.ingen_incidentTo, &incidentTo, NULL); - Raul::Atom tail_atom; - Raul::Atom head_atom; - Raul::Atom incidentTo_atom; - get_atom(tail, tail_atom); - get_atom(head, head_atom); - get_atom(incidentTo, incidentTo_atom); - if (tail_atom.is_valid() && head_atom.is_valid()) { - _iface.disconnect(Raul::Path(tail_atom.get_uri()), - Raul::Path(head_atom.get_uri())); - } else if (incidentTo_atom.is_valid()) { - _iface.disconnect_all(subject_uri, - Raul::Path(incidentTo_atom.get_uri())); + boost::optional subject_path(atom_to_path(subject)); + boost::optional tail_path(atom_to_path(tail)); + boost::optional head_path(atom_to_path(head)); + boost::optional other_path(atom_to_path(incidentTo)); + if (tail_path && head_path) { + _iface.disconnect(*tail_path, *head_path); + } else if (subject_path && other_path) { + _iface.disconnect_all(*subject_path, *other_path); } else { Raul::warn << "Delete of unknown object." << std::endl; return false; @@ -170,12 +178,13 @@ AtomReader::write(const LV2_Atom* msg) return false; } - Raul::Atom tail_atom; - Raul::Atom head_atom; - get_atom(tail, tail_atom); - get_atom(head, head_atom); - _iface.connect(Raul::Path(tail_atom.get_uri()), - Raul::Path(head_atom.get_uri())); + boost::optional tail_path(atom_to_path(tail)); + boost::optional head_path(atom_to_path(head)); + if (tail_path && head_path) { + _iface.connect(*tail_path, *head_path); + } else { + Raul::warn << "Edge has non-path tail or head" << std::endl; + } } else { Ingen::Resource::Properties props; get_props(body, props); @@ -199,8 +208,8 @@ AtomReader::write(const LV2_Atom* msg) _iface.set_property(subject_uri, _map.unmap_uri(p->key), val); } } else if (obj->body.otype == _uris.patch_Patch) { - if (!subject_uri) { - Raul::warn << "Put message has no subject" << std::endl; + if (!subject) { + Raul::warn << "Patch message has no subject" << std::endl; return false; } @@ -226,7 +235,7 @@ AtomReader::write(const LV2_Atom* msg) _iface.delta(subject_uri, remove_props, add_props); } else if (obj->body.otype == _uris.patch_Move) { - if (!subject_uri) { + if (!subject) { Raul::warn << "Move message has no subject" << std::endl; return false; } @@ -238,13 +247,19 @@ AtomReader::write(const LV2_Atom* msg) return false; } - const char* dest_uri = atom_to_uri(dest); - if (!dest_uri) { - Raul::warn << "Move message destination is not a URI" << std::endl; + boost::optional subject_path(atom_to_path(subject)); + if (!subject_path) { + Raul::warn << "Move message has non-path subject" << std::endl; + return false; + } + + boost::optional dest_path(atom_to_path(dest)); + if (!dest_path) { + Raul::warn << "Move message has non-path destination" << std::endl; return false; } - _iface.move(subject_uri, dest_uri); + _iface.move(*subject_path, *dest_path); } else if (obj->body.otype == _uris.patch_Response) { const LV2_Atom* request = NULL; const LV2_Atom* body = NULL; diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp index e310b572..58b10a5b 100644 --- a/src/AtomWriter.cpp +++ b/src/AtomWriter.cpp @@ -18,6 +18,7 @@ #include "ingen/AtomSink.hpp" #include "ingen/AtomWriter.hpp" +#include "ingen/GraphObject.hpp" #include "ingen/URIMap.hpp" #include "raul/Path.hpp" #include "serd/serd.h" @@ -107,14 +108,14 @@ AtomWriter::forge_properties(const Resource::Properties& properties) } void -AtomWriter::forge_edge(const Raul::URI& tail, const Raul::URI& head) +AtomWriter::forge_edge(const Raul::Path& tail, const Raul::Path& head) { LV2_Atom_Forge_Frame edge; lv2_atom_forge_blank(&_forge, &edge, 0, _uris.ingen_Edge); lv2_atom_forge_property_head(&_forge, _uris.ingen_tail, 0); - forge_uri(tail); + forge_uri(GraphObject::path_to_uri(tail)); lv2_atom_forge_property_head(&_forge, _uris.ingen_head, 0); - forge_uri(head); + forge_uri(GraphObject::path_to_uri(head)); lv2_atom_forge_pop(&_forge, &edge); } @@ -171,9 +172,9 @@ AtomWriter::move(const Raul::Path& old_path, LV2_Atom_Forge_Frame msg; lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Move); lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); - forge_uri(old_path); + forge_uri(GraphObject::path_to_uri(old_path)); lv2_atom_forge_property_head(&_forge, _uris.patch_destination, 0); - forge_uri(new_path); + forge_uri(GraphObject::path_to_uri(new_path)); } void @@ -192,7 +193,7 @@ AtomWriter::connect(const Raul::Path& tail, LV2_Atom_Forge_Frame msg; lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Put); lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); - forge_uri(Raul::Path::lca(tail, head)); + forge_uri(GraphObject::path_to_uri(Raul::Path::lca(tail, head))); lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); forge_edge(tail, head); lv2_atom_forge_pop(&_forge, &msg); @@ -219,13 +220,13 @@ AtomWriter::disconnect_all(const Raul::Path& parent_patch_path, lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Delete); lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); - forge_uri(parent_patch_path); + forge_uri(GraphObject::path_to_uri(parent_patch_path)); lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); LV2_Atom_Forge_Frame edge; lv2_atom_forge_blank(&_forge, &edge, 0, _uris.ingen_Edge); lv2_atom_forge_property_head(&_forge, _uris.ingen_incidentTo, 0); - forge_uri(path); + forge_uri(GraphObject::path_to_uri(path)); lv2_atom_forge_pop(&_forge, &edge); lv2_atom_forge_pop(&_forge, &msg); diff --git a/src/Builder.cpp b/src/Builder.cpp index eab33cdf..f0edd438 100644 --- a/src/Builder.cpp +++ b/src/Builder.cpp @@ -35,7 +35,7 @@ Builder::Builder(URIs& uris, Interface& interface) void Builder::build(SharedPtr object) { - _interface.put(object->path(), object->properties()); + _interface.put(object->uri(), object->properties()); } void diff --git a/src/ClashAvoider.cpp b/src/ClashAvoider.cpp index 2a00c33e..6a21da2c 100644 --- a/src/ClashAvoider.cpp +++ b/src/ClashAvoider.cpp @@ -31,10 +31,11 @@ namespace Ingen { const Raul::URI ClashAvoider::map_uri(const Raul::URI& in) { - if (Raul::Path::is_path(in)) - return map_path(in.str()); - else + if (GraphObject::uri_is_path(in)) { + return GraphObject::path_to_uri(map_path(GraphObject::uri_to_path(in))); + } else { return in; + } } const Raul::Path @@ -44,7 +45,7 @@ ClashAvoider::map_path(const Raul::Path& in) unsigned offset = 0; bool has_offset = false; - const size_t pos = in.find_last_of('_'); + const size_t pos = in.str().find_last_of('_'); if (pos != string::npos && pos != (in.length()-1)) { const std::string trailing = in.substr(pos + 1); has_offset = (sscanf(trailing.c_str(), "%u", &offset) > 0); @@ -53,10 +54,12 @@ ClashAvoider::map_path(const Raul::Path& in) Raul::debug << "OFFSET: " << offset << endl; // Path without _n suffix - Raul::Path base_path = in; - if (has_offset) - base_path = base_path.substr(0, base_path.find_last_of('_')); + std::string base_path_str = in.str(); + if (has_offset) { + base_path_str = base_path_str.substr(0, base_path_str.find_last_of('_')); + } + Raul::Path base_path(base_path_str); Raul::debug << "BASE: " << base_path << endl; SymbolMap::iterator m = _symbol_map.find(in); @@ -72,7 +75,8 @@ ClashAvoider::map_path(const Raul::Path& in) Raul::debug << "CHECK: " << parent << endl; SymbolMap::iterator p = _symbol_map.find(parent); if (p != _symbol_map.end()) { - const Raul::Path mapped = p->second.base() + in.substr(parent.base().length()); + const Raul::Path mapped = p->second.base() + + in.substr(parent.base().length()); InsertRecord i = _symbol_map.insert(make_pair(in, mapped)); Raul::debug << " (2) " << i.first->second << endl; return i.first->second; @@ -198,8 +202,7 @@ ClashAvoider::set_property(const Raul::URI& subject, void ClashAvoider::del(const Raul::URI& uri) { - if (Raul::Path::is_path(uri)) - _target.del(map_path(Raul::Path(uri.str()))); + _target.del(map_uri(uri)); } } // namespace Ingen diff --git a/src/Store.cpp b/src/Store.cpp index 7036312b..e18608c3 100644 --- a/src/Store.cpp +++ b/src/Store.cpp @@ -30,7 +30,8 @@ void Store::add(GraphObject* o) { if (find(o->path()) != end()) { - Raul::error << "[Store] Attempt to add duplicate object " << o->path() << endl; + Raul::error << "[Store] Attempt to add duplicate object " + << o->path() << endl; return; } diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 8844b320..2c20ec14 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -184,10 +184,11 @@ ClientStore::object(const Raul::Path& path) const SharedPtr ClientStore::_resource(const Raul::URI& uri) { - if (Raul::Path::is_path(uri)) - return _object(uri.str()); - else + if (GraphObject::uri_is_path(uri)) { + return _object(GraphObject::uri_to_path(uri)); + } else { return _plugin(uri); + } } SharedPtr @@ -213,8 +214,9 @@ ClientStore::add_plugin(SharedPtr pm) void ClientStore::del(const Raul::URI& uri) { - if (!Raul::Path::is_path(uri)) + if (!GraphObject::uri_is_path(uri)) { return; + } const Raul::Path path(uri.str()); SharedPtr removed = remove_object(path); @@ -253,7 +255,7 @@ ClientStore::move(const Raul::Path& old_path, const Raul::Path& new_path) + child_old_path.substr(old_path.length() + 1); LOG(Raul::info)(Raul::fmt("Renamed %1% to %2%\n") - % child_old_path % child_new_path); + % child_old_path.c_str() % child_new_path.c_str()); PtrCast(i->second)->set_path(child_new_path); i->first = child_new_path; } @@ -295,12 +297,13 @@ ClientStore::put(const Raul::URI& uri, } } - if (!Raul::Path::is_valid(uri.str())) { - LOG(Raul::error) << "Bad path `" << uri.str() << "'" << endl; + if (!GraphObject::uri_is_path(uri)) { + LOG(Raul::error)(Raul::fmt("Put for unknown subject <%1%>\n") + % uri.c_str()); return; } - const Raul::Path path(uri.str()); + const Raul::Path path(GraphObject::uri_to_path(uri)); SharedPtr obj = PtrCast(_object(path)); if (obj) { @@ -335,7 +338,8 @@ ClientStore::put(const Raul::URI& uri, n->set_properties(properties); add_object(n); } else { - LOG(Raul::warn)(Raul::fmt("Node %1% has no plugin\n") % path); + LOG(Raul::warn)(Raul::fmt("Node %1% has no plugin\n") + % path.c_str()); } } else if (is_port) { PortModel::Direction pdir = (is_output) @@ -353,7 +357,7 @@ ClientStore::put(const Raul::URI& uri, } } else { LOG(Raul::warn)(Raul::fmt("Ignoring object %1% with unknown type\n") - % path); + % path.c_str()); } } @@ -376,19 +380,21 @@ ClientStore::delta(const Raul::URI& uri, LOG(Raul::info) << "}" << endl; #endif - if (!Raul::Path::is_valid(uri.str())) { - LOG(Raul::error) << "Bad path `" << uri.str() << "'" << endl; + if (!GraphObject::uri_is_path(uri)) { + LOG(Raul::error)(Raul::fmt("Delta for unknown subject <%1%>\n") + % uri.c_str()); return; } - const Raul::Path path(uri.str()); + const Raul::Path path(GraphObject::uri_to_path(uri)); SharedPtr obj = _object(path); if (obj) { obj->remove_properties(remove); obj->add_properties(add); } else { - LOG(Raul::warn)(Raul::fmt("Failed to find object `%1%'\n") % path); + LOG(Raul::warn)(Raul::fmt("Failed to find object `%1%'\n") + % path.c_str()); } } @@ -399,7 +405,7 @@ ClientStore::set_property(const Raul::URI& subject_uri, { if (subject_uri == _uris.ingen_engine) { LOG(Raul::info)(Raul::fmt("Engine property <%1%> = %2%\n") - % predicate % _uris.forge.str(value)); + % predicate.c_str() % _uris.forge.str(value)); return; } SharedPtr subject = _resource(subject_uri); @@ -411,7 +417,7 @@ ClientStore::set_property(const Raul::URI& subject_uri, plugin->set_property(predicate, value); else LOG(Raul::warn)(Raul::fmt("Property <%1%> for unknown object %2%\n") - % predicate % subject_uri); + % predicate.c_str() % subject_uri.c_str()); } } @@ -471,18 +477,9 @@ ClientStore::connect(const Raul::Path& src_path, } void -ClientStore::disconnect(const Raul::Path& src, - const Raul::Path& dst) +ClientStore::disconnect(const Raul::Path& src_path, + const Raul::Path& dst_path) { - if (!Raul::Path::is_path(src) && !Raul::Path::is_path(dst)) { - std::cerr << "Bad disconnect notification " << src - << " => " << dst << std::endl; - return; - } - - const Raul::Path src_path(src.str()); - const Raul::Path dst_path(dst.str()); - SharedPtr tail = PtrCast(_object(src_path)); SharedPtr head = PtrCast(_object(dst_path)); diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index d6e8d115..6904e1f6 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -25,7 +25,7 @@ namespace Client { ObjectModel::ObjectModel(URIs& uris, const Raul::Path& path) : GraphObject(uris, path) , _path(path) - , _symbol((path == Raul::Path::root()) ? "root" : path.symbol()) + , _symbol((path == "/") ? "root" : path.symbol()) { } diff --git a/src/client/PatchModel.cpp b/src/client/PatchModel.cpp index bd2547b0..e87d8168 100644 --- a/src/client/PatchModel.cpp +++ b/src/client/PatchModel.cpp @@ -147,7 +147,7 @@ PatchModel::remove_edge(const GraphObject* tail, const GraphObject* head) _edges.erase(i); } else { Raul::warn(Raul::fmt("Failed to remove patch connection %1% => %2%\n") - % tail->path() % head->path()); + % tail->path().c_str() % head->path().c_str()); } } diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 460051a7..0fb3b859 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -90,10 +90,10 @@ PluginModel::get_property(const Raul::URI& key) const size_t first_delim = std::min(last_slash, last_hash); size_t last_delim = std::max(last_slash, last_hash); if (isalpha(uri.str()[last_delim + 1])) - symbol = uri.str().substr(last_delim + 1); + symbol = uri.substr(last_delim + 1); else - symbol = uri.str().substr(first_delim + 1, - last_delim - first_delim - 1); + symbol = uri.substr(first_delim + 1, + last_delim - first_delim - 1); } set_property(LV2_CORE__symbol, _uris.forge.alloc(symbol)); return get_property(key); diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index c6c3d926..5706c61c 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -42,7 +42,7 @@ lv2_ui_write(SuilController controller, const NodeModel::Ports& ports = ui->node()->ports(); if (port_index >= ports.size()) { Raul::error(Raul::fmt("%1% UI tried to write to invalid port %2%\n") - % ui->node()->plugin()->uri() % port_index); + % ui->node()->plugin()->uri().c_str() % port_index); return; } @@ -57,7 +57,7 @@ lv2_ui_write(SuilController controller, return; // do nothing (handle stupid plugin UIs that feed back) ui->world()->interface()->set_property( - port->path(), + port->uri(), uris.ingen_value, ui->world()->forge().make(*(const float*)buffer)); @@ -65,13 +65,13 @@ lv2_ui_write(SuilController controller, const LV2_Atom* atom = (const LV2_Atom*)buffer; Raul::Atom val = ui->world()->forge().alloc( atom->size, atom->type, LV2_ATOM_BODY_CONST(atom)); - ui->world()->interface()->set_property(port->path(), + ui->world()->interface()->set_property(port->uri(), uris.ingen_value, val); } else { Raul::warn(Raul::fmt("Unknown value format %1% from LV2 UI\n") - % format % ui->node()->plugin()->uri()); + % format % ui->node()->plugin()->uri().c_str()); } } diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp index c6c776d5..8dbb9e21 100644 --- a/src/gui/BreadCrumbs.cpp +++ b/src/gui/BreadCrumbs.cpp @@ -122,7 +122,7 @@ BreadCrumbs::build(Path path, SharedPtr view) root_but->set_active(root_but->path() == _active_path); Path working_path = "/"; - string suffix = path.chop_scheme().substr(1); + string suffix = path.substr(1); while (suffix.length() > 0) { if (suffix[0] == '/') suffix = suffix.substr(1); @@ -181,7 +181,7 @@ void BreadCrumbs::object_destroyed(const URI& uri) { for (std::list::iterator i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) { - if ((*i)->path() == uri) { + if ((*i)->path() == uri.c_str()) { // Remove all crumbs after the removed one (inclusive) for (std::list::iterator j = i; j != _breadcrumbs.end(); ) { BreadCrumb* bc = *j; diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index 81426620..3b683cf9 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -412,7 +412,7 @@ ConnectWindow::gtk_callback() } } } else if (_connect_stage == 2) { - _app->interface()->get(Path("/")); + _app->interface()->get(GraphObject::root_uri()); if (_widgets_loaded) _progress_label->set_text(string("Requesting root patch...")); ++_connect_stage; diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 5042423d..691da285 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -352,7 +352,7 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter) _app->forge().alloc_uri(plugin->uri().str()))); props.insert(make_pair(uris.ingen_polyphonic, _app->forge().make(polyphonic))); - _app->interface()->put(path, props); + _app->interface()->put(GraphObject::path_to_uri(path), props); if (_selection->get_selected_rows().size() == 1) { _name_offset = (_name_offset == 0) ? 2 : _name_offset + 1; diff --git a/src/gui/NewSubpatchWindow.cpp b/src/gui/NewSubpatchWindow.cpp index 7f3eab46..3c1546d5 100644 --- a/src/gui/NewSubpatchWindow.cpp +++ b/src/gui/NewSubpatchWindow.cpp @@ -102,12 +102,12 @@ NewSubpatchWindow::ok_clicked() props.insert(make_pair(_app->uris().rdf_type, _app->uris().ingen_Patch)); props.insert(make_pair(_app->uris().ingen_polyphony, _app->forge().make(int32_t(poly)))); props.insert(make_pair(_app->uris().ingen_enabled, _app->forge().make(bool(true)))); - _app->interface()->put(path, props, Resource::INTERNAL); + _app->interface()->put(GraphObject::path_to_uri(path), props, Resource::INTERNAL); // Set external (node perspective) properties props = _initial_data; props.insert(make_pair(_app->uris().rdf_type, _app->uris().ingen_Patch)); - _app->interface()->put(path, _initial_data, Resource::EXTERNAL); + _app->interface()->put(GraphObject::path_to_uri(path), _initial_data, Resource::EXTERNAL); hide(); } diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp index cb15342d..5c573d9b 100644 --- a/src/gui/NodeMenu.cpp +++ b/src/gui/NodeMenu.cpp @@ -156,7 +156,7 @@ NodeMenu::on_menu_randomize() nm->port_value_range(*i, min, max, _app->sample_rate()); const float val = g_random_double_range(0.0, 1.0) * (max - min) + min; _app->interface()->set_property( - (*i)->path(), + (*i)->uri(), _app->uris().ingen_value, _app->forge().make(val)); } diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 8e9f88e0..af63164f 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -211,9 +211,9 @@ void NodeModule::on_embed_gui_toggled(bool embed) { embed_gui(embed); - app().interface()->set_property(_node->path(), - app().uris().ingen_uiEmbedded, - app().forge().make(embed)); + app().interface()->set_property(_node->uri(), + app().uris().ingen_uiEmbedded, + app().forge().make(embed)); } void @@ -321,7 +321,7 @@ NodeModule::popup_gui() if (!_plugin_ui->is_resizable()) { _gui_window->set_resizable(false); } - _gui_window->set_title(_node->path().chop_scheme() + " UI - Ingen"); + _gui_window->set_title(_node->path().str() + " UI - Ingen"); _gui_window->set_role("plugin_ui"); _gui_window->add(*_gui_widget); _gui_widget->show_all(); @@ -333,7 +333,7 @@ NodeModule::popup_gui() return true; } else { - warn << "No LV2 GUI for " << _node->path().chop_scheme() << endl; + warn << "No LV2 GUI for " << _node->path() << endl; } } @@ -397,7 +397,7 @@ NodeModule::store_location(double ax, double ay) Resource::Properties add; add.insert(make_pair(uris.ingen_canvasX, x)); add.insert(make_pair(uris.ingen_canvasY, y)); - app().interface()->delta(_node->path(), remove, add); + app().interface()->delta(_node->uri(), remove, add); } } diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index 4fa99677..0cfb2482 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -93,7 +93,7 @@ ObjectMenu::init(App& app, SharedPtr object) void ObjectMenu::on_menu_learn() { - _app->interface()->set_property(_object->path(), + _app->interface()->set_property(_object->uri(), _app->uris().ingen_controlBinding, _app->uris().wildcard); } @@ -105,7 +105,7 @@ ObjectMenu::on_menu_unlearn() remove.insert(std::make_pair( _app->uris().ingen_controlBinding, _app->uris().wildcard)); - _app->interface()->delta(_object->path(), remove, Resource::Properties()); + _app->interface()->delta(_object->uri(), remove, Resource::Properties()); } void @@ -113,7 +113,7 @@ ObjectMenu::on_menu_polyphonic() { if (_enable_signal) _app->interface()->set_property( - _object->path(), + _object->uri(), _app->uris().ingen_polyphonic, _app->forge().make(bool(_polyphonic_menuitem->get_active()))); } @@ -131,7 +131,7 @@ ObjectMenu::property_changed(const URI& predicate, const Atom& value) void ObjectMenu::on_menu_destroy() { - _app->interface()->del(_object->path()); + _app->interface()->del(_object->uri()); } void diff --git a/src/gui/PatchBox.cpp b/src/gui/PatchBox.cpp index 7c9483f2..30330fd5 100644 --- a/src/gui/PatchBox.cpp +++ b/src/gui/PatchBox.cpp @@ -342,7 +342,7 @@ void PatchBox::show_status(const ObjectModel* model) { std::stringstream msg; - msg << model->path().chop_scheme(); + msg << model->path(); const PortModel* port = 0; const NodeModel* node = 0; @@ -362,7 +362,7 @@ void PatchBox::show_port_status(const PortModel* port, const Raul::Atom& value) { std::stringstream msg; - msg << port->path().chop_scheme(); + msg << port->path(); const NodeModel* parent = dynamic_cast(port->parent().get()); if (parent) { @@ -430,7 +430,7 @@ PatchBox::event_save() } else { _app->loader()->save_patch(_patch, document.get_uri()); _status_bar->push( - (boost::format("Saved %1% to %2%") % _patch->path().chop_scheme() + (boost::format("Saved %1% to %2%") % _patch->path().c_str() % document.get_uri()).str(), STATUS_CONTEXT_PATCH); } @@ -543,7 +543,7 @@ PatchBox::event_save_as() _app->forge().alloc_uri(uri.c_str()), Resource::EXTERNAL); _status_bar->push( - (boost::format("Saved %1% to %2%") % _patch->path().chop_scheme() + (boost::format("Saved %1% to %2%") % _patch->path().c_str() % filename).str(), STATUS_CONTEXT_PATCH); } @@ -583,7 +583,8 @@ PatchBox::event_draw() if (confirm) { _view->canvas()->export_dot(filename.c_str()); _status_bar->push( - (boost::format("Rendered %1% to %2%") % _patch->path() % filename).str(), + (boost::format("Rendered %1% to %2%") + % _patch->path().str() % filename).str(), STATUS_CONTEXT_PATCH); } } diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index 6e6667fc..eaab0b0c 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -616,11 +616,11 @@ destroy_node(GanvNode* node, void* data) NodeModule* node_module = dynamic_cast(module); if (node_module) { - app->interface()->del(node_module->node()->path()); + app->interface()->del(node_module->node()->uri()); } else { PatchPortModule* port_module = dynamic_cast(module); if (port_module) { - app->interface()->del(port_module->port()->path()); + app->interface()->del(port_module->port()->uri()); } } } @@ -716,14 +716,14 @@ PatchCanvas::paste() clipboard.set_plugins(_app.store()->plugins()); // mkdir -p - string to_create = _patch->path().chop_scheme().substr(1); + string to_create = _patch->path().substr(1); string created = "/"; Resource::Properties props; props.insert(make_pair(uris.rdf_type, uris.ingen_Patch)); props.insert(make_pair(uris.ingen_polyphony, _app.forge().make(int32_t(_patch->internal_poly())))); - clipboard.put(Path("/"), props); + clipboard.put(GraphObject::root_uri(), props); size_t first_slash; while (to_create != "/" && !to_create.empty() && (first_slash = to_create.find("/")) != string::npos) { @@ -734,7 +734,7 @@ PatchCanvas::paste() } if (!_patch->path().is_root()) - clipboard.put(_patch->path(), props); + clipboard.put(_patch->uri(), props); boost::optional parent; boost::optional symbol; @@ -817,7 +817,7 @@ PatchCanvas::menu_add_port(const string& sym_base, const string& name_base, _app.forge().make(int32_t(_patch->num_ports())))); props.insert(make_pair(uris.lv2_name, _app.forge().alloc(name.c_str()))); - _app.interface()->put(path, props); + _app.interface()->put(GraphObject::path_to_uri(path), props); } void @@ -843,7 +843,7 @@ PatchCanvas::load_plugin(WeakPtr weak_plugin) props.insert(make_pair(uris.rdf_type, uris.ingen_Node)); props.insert(make_pair(uris.ingen_prototype, uris.forge.alloc_uri(plugin->uri().str()))); - _app.interface()->put(path, props); + _app.interface()->put(GraphObject::path_to_uri(path), props); } /** Try to guess a suitable location for a new module. diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp index 5e57adb5..3ccf8d07 100644 --- a/src/gui/PatchPortModule.cpp +++ b/src/gui/PatchPortModule.cpp @@ -109,7 +109,7 @@ PatchPortModule::store_location(double ax, double ay) Resource::Property(x, Resource::INTERNAL))); add.insert(make_pair(uris.ingen_canvasY, Resource::Property(y, Resource::INTERNAL))); - app().interface()->delta(_model->path(), remove, add); + app().interface()->delta(_model->uri(), remove, add); } } diff --git a/src/gui/PatchTreeWindow.cpp b/src/gui/PatchTreeWindow.cpp index b6c67211..bd7b62b7 100644 --- a/src/gui/PatchTreeWindow.cpp +++ b/src/gui/PatchTreeWindow.cpp @@ -188,7 +188,7 @@ PatchTreeWindow::event_patch_enabled_toggled(const Glib::ustring& path_str) if (_enable_signal) _app->interface()->set_property( - pm->path(), + pm->uri(), _app->uris().ingen_enabled, _app->forge().make((bool)!pm->enabled())); } diff --git a/src/gui/PatchView.cpp b/src/gui/PatchView.cpp index 1e9e2d6a..0d2bf21b 100644 --- a/src/gui/PatchView.cpp +++ b/src/gui/PatchView.cpp @@ -163,7 +163,7 @@ PatchView::process_toggled() return; _app->interface()->set_property( - _patch->path(), + _patch->uri(), _app->uris().ingen_enabled, _app->forge().make((bool)_process_but->get_active())); } @@ -174,7 +174,7 @@ PatchView::poly_changed() const int poly = _poly_spin->get_value_as_int(); if (_enable_signal && poly != (int)_patch->internal_poly()) { _app->interface()->set_property( - _patch->path(), + _patch->uri(), _app->uris().ingen_polyphony, _app->forge().make(poly)); } @@ -183,7 +183,7 @@ PatchView::poly_changed() void PatchView::refresh_clicked() { - _app->interface()->get(_patch->path()); + _app->interface()->get(_patch->uri()); } void diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp index 0ee60760..9b3d1a97 100644 --- a/src/gui/PatchWindow.cpp +++ b/src/gui/PatchWindow.cpp @@ -38,7 +38,6 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, xml->get_widget_derived("patch_win_vbox", _box); - //set_title(_patch->path().chop_scheme() + " - Ingen"); set_title("Ingen"); } diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index f70e8576..5744a84d 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -151,7 +151,7 @@ Port::on_value_changed(GVariant* value) const Raul::Atom atom = _app.forge().make(float(g_variant_get_double(value))); if (atom != model()->value()) { Ingen::World* const world = _app.world(); - _app.interface()->set_property(model()->path(), + _app.interface()->set_property(model()->uri(), world->uris().ingen_value, atom); } @@ -175,7 +175,7 @@ Port::value_changed(const Atom& value) void Port::on_scale_point_activated(float f) { - _app.interface()->set_property(model()->path(), + _app.interface()->set_property(model()->uri(), _app.world()->uris().ingen_value, _app.world()->forge().make(f)); } diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index 9b1f8aa0..b2a7cc21 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -105,7 +105,7 @@ PortMenu::on_menu_set_min() SharedPtr model = PtrCast(_object); const Raul::Atom& value = model->get_property(uris.ingen_value); if (value.is_valid()) - _app->interface()->set_property(_object->path(), uris.lv2_minimum, value); + _app->interface()->set_property(_object->uri(), uris.lv2_minimum, value); } void @@ -115,7 +115,7 @@ PortMenu::on_menu_set_max() SharedPtr model = PtrCast(_object); const Raul::Atom& value = model->get_property(uris.ingen_value); if (value.is_valid()) - _app->interface()->set_property(_object->path(), uris.lv2_maximum, value); + _app->interface()->set_property(_object->uri(), uris.lv2_maximum, value); } void @@ -129,12 +129,12 @@ PortMenu::on_menu_reset_range() parent->default_port_value_range(model, min, max); if (!std::isnan(min)) - _app->interface()->set_property(_object->path(), + _app->interface()->set_property(_object->uri(), uris.lv2_minimum, _app->forge().make(min)); if (!std::isnan(max)) - _app->interface()->set_property(_object->path(), + _app->interface()->set_property(_object->uri(), uris.lv2_maximum, _app->forge().make(max)); } @@ -162,7 +162,7 @@ PortMenu::on_menu_expose() r.set_property(uris.ingen_canvasX, _app->forge().make(node_x + x_off)); r.set_property(uris.ingen_canvasY, _app->forge().make(node_y + y_off)); - _app->interface()->put(path, r.properties()); + _app->interface()->put(GraphObject::path_to_uri(path), r.properties()); if (port->is_input()) { _app->interface()->connect(path, _object->path()); diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp index 56996011..900c93c2 100644 --- a/src/gui/PortPropertiesWindow.cpp +++ b/src/gui/PortPropertiesWindow.cpp @@ -65,7 +65,7 @@ PortPropertiesWindow::present(SharedPtr pm) _port_model = pm; - set_title(pm->path().chop_scheme() + " Properties - Ingen"); + set_title(pm->path().str() + " Properties - Ingen"); float min = 0.0f, max = 1.0f; boost::shared_ptr parent = PtrCast(_port_model->parent()); @@ -158,7 +158,7 @@ PortPropertiesWindow::ok() props.insert( make_pair(uris.lv2_maximum, _app->forge().make(float(_max_spinner->get_value())))); - _app->interface()->put(_port_model->path(), props); + _app->interface()->put(_port_model->uri(), props); hide(); } diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index 1a4228b8..a79e2737 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -254,7 +254,7 @@ PropertiesWindow::set_object(SharedPtr model) reset(); _model = model; - set_title(model->path().chop_scheme() + " Properties - Ingen"); + set_title(model->path().str() + " Properties - Ingen"); World* world = _app->world(); @@ -506,7 +506,7 @@ PropertiesWindow::add_clicked() Resource::Properties properties; properties.insert(make_pair(key_uri.c_str(), value)); - _app->interface()->put(_model->path(), properties); + _app->interface()->put(_model->uri(), properties); } void @@ -531,7 +531,7 @@ PropertiesWindow::apply_clicked() } } - _app->interface()->put(_model->path(), properties); + _app->interface()->put(_model->uri(), properties); LOG(debug) << "}" << endl; } diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp index c770a087..31ebbf22 100644 --- a/src/gui/RenameWindow.cpp +++ b/src/gui/RenameWindow.cpp @@ -132,9 +132,9 @@ RenameWindow::ok_clicked() } if (!label.empty() && (!name_atom.is_valid() || label != name_atom.get_string())) { - _app->interface()->set_property(path, - uris.lv2_name, - _app->forge().alloc(label)); + _app->interface()->set_property(GraphObject::path_to_uri(path), + uris.lv2_name, + _app->forge().alloc(label)); } hide(); diff --git a/src/gui/SubpatchModule.cpp b/src/gui/SubpatchModule.cpp index 8b9dfe5e..dd09e992 100644 --- a/src/gui/SubpatchModule.cpp +++ b/src/gui/SubpatchModule.cpp @@ -80,7 +80,7 @@ SubpatchModule::store_location(double ax, double ay) Resource::Property(x, Resource::EXTERNAL))); add.insert(make_pair(uris.ingen_canvasY, Resource::Property(y, Resource::EXTERNAL))); - app().interface()->delta(_node->path(), remove, add); + app().interface()->delta(_node->uri(), remove, add); } } @@ -104,7 +104,7 @@ SubpatchModule::browse_to_patch() void SubpatchModule::menu_remove() { - app().interface()->del(_patch->path()); + app().interface()->del(_patch->uri()); } } // namespace GUI diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index 6042a190..0834f666 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -204,7 +204,7 @@ WindowFactory::present_load_plugin(SharedPtr patch, _load_plugin_win->set_default_size(width - width / 8, height / 2); } _load_plugin_win->set_title( - string("Load Plugin - ") + patch->path().chop_scheme() + " - Ingen"); + string("Load Plugin - ") + patch->path().str() + " - Ingen"); _load_plugin_win->present(patch, data); } diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp index 0e512801..069b8031 100644 --- a/src/gui/ingen_gui_lv2.cpp +++ b/src/gui/ingen_gui_lv2.cpp @@ -14,13 +14,13 @@ along with Ingen. If not, see . */ -#include "ingen/client/ClientStore.hpp" -#include "ingen/client/PatchModel.hpp" -#include "ingen/client/SigClientInterface.hpp" #include "ingen/AtomReader.hpp" #include "ingen/AtomSink.hpp" #include "ingen/AtomWriter.hpp" #include "ingen/World.hpp" +#include "ingen/client/ClientStore.hpp" +#include "ingen/client/PatchModel.hpp" +#include "ingen/client/SigClientInterface.hpp" #include "ingen/runtime_paths.hpp" #include "lv2/lv2plug.in/ns/extensions/ui/ui.h" @@ -135,17 +135,17 @@ instantiate(const LV2UI_Descriptor* descriptor, Ingen::Resource::Properties props; props.insert(std::make_pair(ui->app->uris().rdf_type, ui->app->uris().ingen_Patch)); - ui->app->store()->put("path:/", props); + ui->app->store()->put(Ingen::GraphObject::root_uri(), props); // Create a PatchBox for the root and set as the UI widget SharedPtr root = PtrCast( - ui->app->store()->object("path:/")); + ui->app->store()->object("/")); ui->view = Ingen::GUI::PatchBox::create(*ui->app, root); ui->view->unparent(); *widget = ui->view->gobj(); // Request the actual root patch - ui->world->interface()->get("path:/"); + ui->world->interface()->get(Ingen::GraphObject::root_uri()); return ui; } diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp index 5236120b..defba485 100644 --- a/src/ingen/main.cpp +++ b/src/ingen/main.cpp @@ -175,7 +175,7 @@ main(int argc, char** argv) conf.files().front(); engine_interface->get("ingen:plugins"); - engine_interface->get("path:/"); + engine_interface->get(GraphObject::root_uri()); world->parser()->parse_file( world, engine_interface.get(), path, parent, symbol); } diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index 8407429f..f5569460 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -279,7 +279,7 @@ parse_node(Ingen::World* world, Resource::Properties props = get_properties(world, model, subject); props.insert(make_pair(uris.rdf_type, uris.forge.alloc_uri(uris.ingen_Node.str()))); - target->put(path, props); + target->put(GraphObject::path_to_uri(path), props); } return path; } @@ -349,12 +349,13 @@ parse_patch(Ingen::World* world, // Create patch Path patch_path(patch_path_str); Resource::Properties props = get_properties(world, model, subject_node); - target->put(patch_path, props); + target->put(GraphObject::path_to_uri(patch_path), props); // For each node in this patch for (Sord::Iter n = model.find(subject_node, ingen_node, nil); !n.end(); ++n) { Sord::Node node = n.get_object(); - const Path node_path = patch_path.child(get_basename(node.to_string())); + const Path node_path = patch_path.child( + Raul::Symbol(get_basename(node.to_string()))); // Parse and create node parse_node(world, target, model, node, node_path, @@ -373,7 +374,8 @@ parse_patch(Ingen::World* world, } // Create port and/or set all port properties - target->put(port_record.first, port_record.second); + target->put(GraphObject::path_to_uri(port_record.first), + port_record.second); } } @@ -397,7 +399,8 @@ parse_patch(Ingen::World* world, // Create ports in order by index for (PortRecords::const_iterator i = ports.begin(); i != ports.end(); ++i) { - target->put(i->second.first, i->second.second); + target->put(GraphObject::path_to_uri(i->second.first), + i->second.second); } parse_edges(world, target, model, subject_node, patch_path); @@ -429,10 +432,19 @@ parse_edge(Ingen::World* world, return false; } - const Path tail_path( - parent.child(relative_uri(base_uri, t.get_object().to_string(), false))); - const Path head_path( - parent.child(relative_uri(base_uri, h.get_object().to_string(), false))); + const std::string tail_str = relative_uri( + base_uri, t.get_object().to_string(), true); + if (!Path::is_valid(tail_str)) { + LOG(error) << "Edge tail has invalid URI" << endl; + return false; + } + + const std::string head_str = relative_uri( + base_uri, h.get_object().to_string(), true); + if (!Path::is_valid(head_str)) { + LOG(error) << "Edge head has invalid URI" << endl; + return false; + } if (!(++t).end()) { LOG(error) << "Edge has multiple tails" << endl; @@ -442,7 +454,7 @@ parse_edge(Ingen::World* world, return false; } - target->connect(tail_path, head_path); + target->connect(Path(tail_str), Path(head_str)); return true; } @@ -539,7 +551,8 @@ parse(Ingen::World* world, ret = parse_node(world, target, model, s, path, data); } else if (types.find(in_port_class) != types.end() || types.find(out_port_class) != types.end()) { - parse_properties(world, target, model, s, path, data); + parse_properties( + world, target, model, s, GraphObject::path_to_uri(path), data); ret = path; } else if (types.find(edge_class) != types.end()) { Path parent_path(parent ? parent.get() : Path("/")); @@ -602,7 +615,7 @@ Parser::parse_file(Ingen::World* world, LOG(Raul::info)(Raul::fmt("Parsing %1%\n") % path); if (parent) - LOG(Raul::info)(Raul::fmt("Parent: %1%\n") % *parent); + LOG(Raul::info)(Raul::fmt("Parent: %1%\n") % parent->c_str()); if (symbol) LOG(Raul::info)(Raul::fmt("Symbol: %1%\n") % symbol->c_str()); @@ -611,7 +624,8 @@ Parser::parse_file(Ingen::World* world, = parse(world, target, model, path, subject, parent, symbol, data); if (parsed_path) { - target->set_property(*parsed_path, "http://drobilla.net/ns/ingen#document", + target->set_property(GraphObject::path_to_uri(*parsed_path), + "http://drobilla.net/ns/ingen#document", world->forge().alloc_uri(uri)); } else { LOG(Raul::warn)("Document URI lost\n"); diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index 9e01eaf7..bd7dfed5 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -277,7 +277,7 @@ Serialiser::Impl::path_rdf_node(const Path& path) assert(path == _root_path || path.is_child_of(_root_path)); const Path rel_path(path.relative_to_base(_root_path)); return Sord::URI(_model->world(), - rel_path.chop_scheme().substr(1).c_str(), + rel_path.substr(1).c_str(), _base_uri); } @@ -365,7 +365,7 @@ Serialiser::Impl::serialise_patch(SharedPtr patch, SerdURI base_uri; serd_uri_parse((const uint8_t*)_base_uri.c_str(), &base_uri); - const string sub_bundle_path = subpatch->path().chop_start("/") + ".ingen"; + const string sub_bundle_path = subpatch->path().substr(1) + ".ingen"; SerdURI subpatch_uri; SerdNode subpatch_node = serd_node_new_uri_from_string( diff --git a/src/server/Broadcaster.cpp b/src/server/Broadcaster.cpp index aa7b7aae..fe8ceae4 100644 --- a/src/server/Broadcaster.cpp +++ b/src/server/Broadcaster.cpp @@ -36,7 +36,7 @@ Broadcaster::register_client(const Raul::URI& uri, SharedPtr client) { Glib::Mutex::Lock lock(_clients_mutex); - LOG(Raul::info)(Raul::fmt("Registered client <%1%>\n") % uri); + LOG(Raul::info)(Raul::fmt("Registered client <%1%>\n") % uri.c_str()); _clients[uri] = client; } @@ -51,7 +51,7 @@ Broadcaster::unregister_client(const Raul::URI& uri) const size_t erased = _clients.erase(uri); if (erased > 0) { - LOG(Raul::info)(Raul::fmt("Unregistered client <%1%>\n") % uri); + LOG(Raul::info)(Raul::fmt("Unregistered client <%1%>\n") % uri.c_str()); } return (erased > 0); diff --git a/src/server/Context.cpp b/src/server/Context.cpp index 13c2c43f..846368d2 100644 --- a/src/server/Context.cpp +++ b/src/server/Context.cpp @@ -91,7 +91,7 @@ Context::emit_notifications(FrameTime end) const char* key = _engine.world()->uri_map().unmap_uri(note.key); if (key) { _engine.broadcaster()->set_property( - note.port->path(), key, value); + note.port->uri(), key, value); } else { Raul::error("Error unmapping notification key URI\n"); } diff --git a/src/server/Event.hpp b/src/server/Event.hpp index 5f2e99bb..e35e1895 100644 --- a/src/server/Event.hpp +++ b/src/server/Event.hpp @@ -23,6 +23,7 @@ #include "raul/Path.hpp" #include "raul/SharedPtr.hpp" +#include "ingen/GraphObject.hpp" #include "ingen/Interface.hpp" #include "ingen/Status.hpp" @@ -106,6 +107,10 @@ protected: return !st; } + inline bool pre_process_done(Status st, const Raul::Path& subject) { + return pre_process_done(st, GraphObject::path_to_uri(subject)); + } + /** Respond to the originating client. */ inline Status respond() { if (_request_client) { diff --git a/src/server/GraphObjectImpl.hpp b/src/server/GraphObjectImpl.hpp index fa9cb6b9..4e626692 100644 --- a/src/server/GraphObjectImpl.hpp +++ b/src/server/GraphObjectImpl.hpp @@ -54,7 +54,6 @@ class GraphObjectImpl : public GraphObject public: virtual ~GraphObjectImpl() {} - const Raul::URI& uri() const { return _path; } const Raul::Symbol& symbol() const { return _symbol; } GraphObject* graph_parent() const { return _parent; } @@ -67,6 +66,7 @@ public: if (new_sym[0] != '\0') { _symbol = Raul::Symbol(new_sym); } + set_uri(GraphObject::path_to_uri(new_path)); } const Raul::Atom& get_property(const Raul::URI& key) const; diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 8d4c13cc..e24bc13a 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -84,7 +84,7 @@ JackPort::create() if (_jack_port == NULL) { LOG(Raul::error)(Raul::fmt("Failed to register port %1%\n") - % _patch_port->path()); + % _patch_port->path().c_str()); throw JackDriver::PortRegistrationFailedException(); } } @@ -340,7 +340,7 @@ JackDriver::remove_port(ProcessContext& context, } } - LOG(Raul::warn)(Raul::fmt("Unable to find port %1%\n") % path); + LOG(Raul::warn)(Raul::fmt("Unable to find port %1%\n") % path.c_str()); return NULL; } diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp index 646a8bbf..21fd3c34 100644 --- a/src/server/LV2Node.cpp +++ b/src/server/LV2Node.cpp @@ -79,7 +79,7 @@ LV2Node::make_instance(URIs& uris, if (!inst) { Raul::error(Raul::fmt("Failed to instantiate <%1%>\n") - % _lv2_plugin->uri()); + % _lv2_plugin->uri().c_str()); return SharedPtr(); } @@ -124,7 +124,7 @@ LV2Node::make_instance(URIs& uris, % port->path());*/ } else { Raul::error(Raul::fmt("%1% auto-morphed to unknown type %2%\n") - % port->path() % type); + % port->path().c_str() % type); return SharedPtr(); } } @@ -295,7 +295,7 @@ LV2Node::instantiate(BufferFactory& bufs) lilv_nodes_free(sizes); Raul::info(Raul::fmt("Atom port %1% buffer size %2%\n") - % path() % port_buffer_size); + % path().c_str() % port_buffer_size); } enum { UNKNOWN, INPUT, OUTPUT } direction = UNKNOWN; @@ -307,7 +307,7 @@ LV2Node::instantiate(BufferFactory& bufs) if (port_type == PortType::UNKNOWN || direction == UNKNOWN) { Raul::error(Raul::fmt("<%1%> port %2% has unknown type or direction\n") - % _lv2_plugin->uri() % port_sym.c_str()); + % _lv2_plugin->uri().c_str() % port_sym.c_str()); ret = false; break; } @@ -423,7 +423,8 @@ LV2Node::work(uint32_t size, const void* data) if (_worker_iface) { LV2_Handle inst = lilv_instance_get_handle(instance(0)); if (_worker_iface->work(inst, work_respond, this, size, data)) { - Raul::error(Raul::fmt("Error calling %1% work method\n") % _path); + Raul::error(Raul::fmt("Error calling %1% work method\n") + % _path.c_str()); } } } diff --git a/src/server/NodeFactory.cpp b/src/server/NodeFactory.cpp index 4bf19036..502e5370 100644 --- a/src/server/NodeFactory.cpp +++ b/src/server/NodeFactory.cpp @@ -122,7 +122,7 @@ NodeFactory::load_lv2_plugins() const string uri(lilv_node_as_uri(lilv_plugin_get_uri(lv2_plug))); if (_plugins.find(uri) != _plugins.end()) { - Raul::warn(Raul::fmt("Already discovered <%s>\n") % uri); + Raul::warn(Raul::fmt("Already discovered <%s>\n") % uri.c_str()); continue; } diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index 39252a13..17b66192 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -57,27 +57,27 @@ Connect::pre_process() PortImpl* tail = _engine.engine_store()->find_port(_tail_path); PortImpl* head = _engine.engine_store()->find_port(_head_path); if (!tail) { - return Event::pre_process_done(PORT_NOT_FOUND, _tail_path.str()); + return Event::pre_process_done(PORT_NOT_FOUND, _tail_path); } else if (!head) { - return Event::pre_process_done(PORT_NOT_FOUND, _head_path.str()); + return Event::pre_process_done(PORT_NOT_FOUND, _head_path); } OutputPort* tail_output = dynamic_cast(tail); _head = dynamic_cast(head); if (!tail_output || !_head) { - return Event::pre_process_done(DIRECTION_MISMATCH, _head_path.str()); + return Event::pre_process_done(DIRECTION_MISMATCH, _head_path); } NodeImpl* const tail_node = tail->parent_node(); NodeImpl* const head_node = head->parent_node(); if (!tail_node || !head_node) { - return Event::pre_process_done(PARENT_NOT_FOUND, _head_path.str()); + return Event::pre_process_done(PARENT_NOT_FOUND, _head_path); } if (tail_node->parent() != head_node->parent() && tail_node != head_node->parent() && tail_node->parent() != head_node) { - return Event::pre_process_done(PARENT_DIFFERS, _head_path.str()); + return Event::pre_process_done(PARENT_DIFFERS, _head_path); } if (!EdgeImpl::can_connect(tail_output, _head)) { diff --git a/src/server/events/CreateNode.cpp b/src/server/events/CreateNode.cpp index 27b5ce50..0c3e34bf 100644 --- a/src/server/events/CreateNode.cpp +++ b/src/server/events/CreateNode.cpp @@ -66,16 +66,16 @@ CreateNode::pre_process() } if (_engine.engine_store()->find_object(_path)) { - return Event::pre_process_done(EXISTS, _path.str()); + return Event::pre_process_done(EXISTS, _path); } if (!(_patch = _engine.engine_store()->find_patch(_path.parent()))) { - return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent().str()); + return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent()); } PluginImpl* plugin = _engine.node_factory()->plugin(plugin_uri); if (!plugin) { - return Event::pre_process_done(PLUGIN_NOT_FOUND, plugin_uri); + return Event::pre_process_done(PLUGIN_NOT_FOUND, Raul::URI(plugin_uri)); } const iterator p = _properties.find(uris.ingen_polyphonic); @@ -89,7 +89,7 @@ CreateNode::pre_process() polyphonic, _patch, _engine))) { - return Event::pre_process_done(CREATION_FAILED, _path.str()); + return Event::pre_process_done(CREATION_FAILED, _path); } _node->properties().insert(_properties.begin(), _properties.end()); @@ -106,13 +106,13 @@ CreateNode::pre_process() _compiled_patch = _patch->compile(); } - _update.push_back(make_pair(_node->path(), _node->properties())); + _update.push_back(make_pair(_node->uri(), _node->properties())); for (uint32_t i = 0; i < _node->num_ports(); ++i) { const PortImpl* port = _node->port_impl(i); Resource::Properties pprops = port->properties(); pprops.erase(uris.ingen_value); pprops.insert(std::make_pair(uris.ingen_value, port->value())); - _update.push_back(std::make_pair(port->path(), pprops)); + _update.push_back(std::make_pair(port->uri(), pprops)); } return Event::pre_process_done(SUCCESS); diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp index 0fe613ba..9821902d 100644 --- a/src/server/events/CreatePatch.cpp +++ b/src/server/events/CreatePatch.cpp @@ -114,7 +114,7 @@ void CreatePatch::post_process() { if (!respond()) { - _engine.broadcaster()->put(_path, _update); + _engine.broadcaster()->put(GraphObject::path_to_uri(_path), _update); } } diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index df9ebb6e..f45c200b 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -180,7 +180,7 @@ void CreatePort::post_process() { if (!respond()) { - _engine.broadcaster()->put(_path, _update); + _engine.broadcaster()->put(GraphObject::path_to_uri(_path), _update); } delete _old_ports_array; diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index 5a88de9f..3121d6ad 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -50,8 +50,9 @@ Delete::Delete(Engine& engine, , _disconnect_event(NULL) , _lock(engine.engine_store()->lock(), Glib::NOT_LOCK) { - if (Raul::Path::is_path(uri)) - _path = Raul::Path(uri.str()); + if (GraphObject::uri_is_path(uri)) { + _path = GraphObject::uri_to_path(uri); + } } Delete::~Delete() @@ -62,9 +63,7 @@ Delete::~Delete() bool Delete::pre_process() { - if (_path.is_root() || - _path == "path:/control_in" || - _path == "path:/control_out") { + if (_path == "/" || _path == "/control_in" || _path == "/control_out") { return Event::pre_process_done(NOT_DELETABLE, _path); } @@ -170,7 +169,7 @@ Delete::post_process() if (_disconnect_event) { _disconnect_event->post_process(); } - _engine.broadcaster()->del(_path); + _engine.broadcaster()->del(_uri); _engine.broadcaster()->bundle_end(); } diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 91980837..18f35ab6 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -105,13 +105,13 @@ Delta::pre_process() { typedef Properties::const_iterator iterator; - const bool is_graph_object = Raul::Path::is_path(_subject); + const bool is_graph_object = GraphObject::uri_is_path(_subject); // Take a writer lock while we modify the store Glib::RWLock::WriterLock lock(_engine.engine_store()->lock()); _object = is_graph_object - ? _engine.engine_store()->find_object(Raul::Path(_subject.str())) + ? _engine.engine_store()->find_object(GraphObject::uri_to_path(_subject)) : static_cast(_engine.node_factory()->plugin(_subject)); if (!_object && (!is_graph_object || !_create)) { @@ -121,7 +121,7 @@ Delta::pre_process() const Ingen::URIs& uris = _engine.world()->uris(); if (is_graph_object && !_object) { - Raul::Path path(_subject.str()); + Raul::Path path(GraphObject::uri_to_path(_subject)); bool is_patch = false, is_node = false, is_port = false, is_output = false; Ingen::Resource::type(uris, _properties, is_patch, is_node, is_port, is_output); @@ -139,7 +139,7 @@ Delta::pre_process() if (_create_event) { _create_event->pre_process(); // Grab the object for applying properties, if the create-event succeeded - _object = _engine.engine_store()->find_object(Raul::Path(_subject.str())); + _object = _engine.engine_store()->find_object(path); } else { return Event::pre_process_done(BAD_OBJECT_TYPE, _subject); } diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index 8ffe9319..9ec581a1 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -16,6 +16,7 @@ #include +#include "ingen/GraphObject.hpp" #include "ingen/Interface.hpp" #include "Broadcaster.hpp" @@ -59,8 +60,8 @@ Get::pre_process() return Event::pre_process_done(SUCCESS); } else if (_uri == "ingen:engine") { return Event::pre_process_done(SUCCESS); - } else if (Raul::Path::is_valid(_uri.str())) { - _object = _engine.engine_store()->find_object(Raul::Path(_uri.str())); + } else if (GraphObject::uri_is_path(_uri)) { + _object = _engine.engine_store()->find_object(GraphObject::uri_to_path(_uri)); return Event::pre_process_done(_object ? SUCCESS : NOT_FOUND, _uri); } else { _plugin = _engine.node_factory()->plugin(_uri); @@ -76,9 +77,9 @@ send_port(Interface* client, const PortImpl* port) props.erase(port->bufs().uris().ingen_value); props.insert(std::make_pair(port->bufs().uris().ingen_value, port->value())); - client->put(port->path(), props); + client->put(port->uri(), props); } else { - client->put(port->path(), port->properties()); + client->put(port->uri(), port->properties()); } } @@ -89,7 +90,7 @@ send_node(Interface* client, const NodeImpl* node) if (plugin->type() == Plugin::Patch) { send_patch(client, (const PatchImpl*)node); } else { - client->put(node->path(), node->properties()); + client->put(node->uri(), node->properties()); for (size_t j = 0; j < node->num_ports(); ++j) { send_port(client, node->port_impl(j)); } @@ -99,11 +100,11 @@ send_node(Interface* client, const NodeImpl* node) static void send_patch(Interface* client, const PatchImpl* patch) { - client->put(patch->path(), + client->put(patch->uri(), patch->properties(Resource::INTERNAL), Resource::INTERNAL); - client->put(patch->path(), + client->put(patch->uri(), patch->properties(Resource::EXTERNAL), Resource::EXTERNAL); diff --git a/src/server/events/Get.hpp b/src/server/events/Get.hpp index fd1059ad..fa88237d 100644 --- a/src/server/events/Get.hpp +++ b/src/server/events/Get.hpp @@ -26,7 +26,6 @@ namespace Ingen { namespace Server { -class GraphObject; class PluginImpl; namespace Events { diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp index 483c77e7..5c16ca8b 100644 --- a/src/server/events/Move.cpp +++ b/src/server/events/Move.cpp @@ -80,7 +80,8 @@ Move::pre_process() if (child_old_path == _old_path) child_new_path = _new_path; else - child_new_path = Raul::Path(_new_path).base() + child_old_path.substr(_old_path.length()+1); + child_new_path = Raul::Path(_new_path).base() + + child_old_path.substr(_old_path.length() + 1); PtrCast(i->second)->set_path(child_new_path); i->first = child_new_path; diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index f3d68f9b..0f63ed53 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -104,7 +104,8 @@ SetPortValue::apply(Context& context) (const uint8_t*)_value.get_body())) { _port->raise_set_by_user_flag(); } else { - Raul::warn(Raul::fmt("Error writing to port %1%\n") % _port->path()); + Raul::warn(Raul::fmt("Error writing to port %1%\n") + % _port->path().c_str()); } } else { Raul::warn(Raul::fmt("Unknown value type %1%\n") % _value.type()); @@ -116,7 +117,7 @@ SetPortValue::post_process() { if (!respond()) { _engine.broadcaster()->set_property( - _port->path(), + _port->uri(), _engine.world()->uris().ingen_value, _value); } diff --git a/src/server/util.hpp b/src/server/util.hpp index 10c08d7f..54649c7e 100644 --- a/src/server/util.hpp +++ b/src/server/util.hpp @@ -84,7 +84,7 @@ set_denormal_flags() static inline std::string ingen_jack_port_name(const Raul::Path& path) { - return path.chop_start("/"); + return path.substr(1); } } // namespace Server diff --git a/src/socket/SocketReader.cpp b/src/socket/SocketReader.cpp index 7599038e..b73b9eb0 100644 --- a/src/socket/SocketReader.cpp +++ b/src/socket/SocketReader.cpp @@ -92,9 +92,9 @@ SocketReader::_run() Sord::World* world = _world.rdf_world(); LV2_URID_Map* map = &_world.uri_map().urid_map_feature()->urid_map; - // Use as base URI so e.g. will be a path + // Use as base URI so e.g. will be a path SordNode* base_uri = sord_new_uri( - world->c_obj(), (const uint8_t*)"path:"); + world->c_obj(), (const uint8_t*)"ingen:root/"); // Set up sratom and a forge to build LV2 atoms from model Sratom* sratom = sratom_new(map); diff --git a/src/socket/SocketWriter.cpp b/src/socket/SocketWriter.cpp index 8fa5ee05..f66606be 100644 --- a/src/socket/SocketWriter.cpp +++ b/src/socket/SocketWriter.cpp @@ -50,8 +50,8 @@ SocketWriter::SocketWriter(URIMap& map, , _uri(uri) , _socket(sock) { - // Use as base URI so e.g. will be a path - _base = serd_node_from_string(SERD_URI, (const uint8_t*)"path:"); + // Use as base URI so e.g. will be a path + _base = serd_node_from_string(SERD_URI, (const uint8_t*)"ingen:root/"); serd_uri_parse(_base.buf, &_base_uri); -- cgit v1.2.1