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/client/ClientStore.cpp | 51 ++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'src/client/ClientStore.cpp') 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)); -- cgit v1.2.1