From 76466bde179e9b0d58b1586fb3f4ed40dedbdc13 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 18 Aug 2008 06:26:24 +0000 Subject: Fix loading / importing patches at root and in subpatches. git-svn-id: http://svn.drobilla.net/lad/ingen@1430 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/serialisation/Parser.cpp | 42 ++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'src/libs/serialisation/Parser.cpp') diff --git a/src/libs/serialisation/Parser.cpp b/src/libs/serialisation/Parser.cpp index 6d90499a..0e83b858 100644 --- a/src/libs/serialisation/Parser.cpp +++ b/src/libs/serialisation/Parser.cpp @@ -63,7 +63,7 @@ Parser::parse_document( Ingen::Shared::CommonInterface* target, const Glib::ustring& document_uri, Glib::ustring object_uri, - boost::optional parent, + boost::optional engine_base, boost::optional symbol, boost::optional data) { @@ -74,7 +74,7 @@ Parser::parse_document( else cout << "Parsing " << object_uri << " from " << document_uri << endl; - return parse(world, target, model, document_uri, object_uri, parent, symbol, data);; + return parse(world, target, model, document_uri, object_uri, engine_base, symbol, data);; } @@ -85,7 +85,7 @@ Parser::parse_string( const Glib::ustring& str, const Glib::ustring& base_uri, boost::optional object_uri, - boost::optional parent, + boost::optional engine_base, boost::optional symbol, boost::optional data) { @@ -96,10 +96,10 @@ Parser::parse_string( else cout << "Parsing all objects found in string (base " << base_uri << ")" << endl; - bool ret = parse(world, target, model, base_uri, object_uri, parent, symbol, data); + bool ret = parse(world, target, model, base_uri, object_uri, engine_base, symbol, data); if (ret) { const Glib::ustring subject = Glib::ustring("<") + base_uri + Glib::ustring(">"); - parse_connections(world, target, model, base_uri, subject, parent ? parent.get() : "/"); + parse_connections(world, target, model, base_uri, subject, (engine_base ? (string)engine_base.get() : "/")); } return ret; @@ -113,7 +113,7 @@ Parser::parse( Redland::Model& model, Glib::ustring base_uri, boost::optional object_uri, - boost::optional parent, + boost::optional engine_base, boost::optional symbol, boost::optional data) { @@ -164,7 +164,7 @@ Parser::parse( continue; if (rdf_class == patch_class) { - ret = parse_patch(world, target, model, base_uri, subject.to_c_string(), path, data); + ret = parse_patch(world, target, model, base_uri, subject.to_c_string(), engine_base.get(), data); if (ret) target->set_variable(path, "ingen:document", Atom(base_uri.c_str())); } else if (rdf_class == node_class) { @@ -193,12 +193,14 @@ Parser::parse_patch( Redland::Model& model, const Glib::ustring& base_uri, const Glib::ustring& object_uri, - Raul::Path patch_path, + Glib::ustring engine_base, boost::optional data=boost::optional()) { std::set created; uint32_t patch_poly = 0; + cout << "PARSE PATCH: " << base_uri << " - " << object_uri << " - " << engine_base << endl; + /* Use parameter overridden polyphony, if given */ if (data) { GraphObject::Variables::iterator poly_param = data.get().find("ingen:polyphony"); @@ -226,7 +228,23 @@ Parser::parse_patch( patch_poly = static_cast(poly_node.to_int()); } - if (patch_path != "/") + cout << "XXXXXXXXXX " << engine_base << endl; + cout << "YYYYYYYYYY " << uri_relative_to_base(base_uri, object_uri) << endl; + string symbol = uri_relative_to_base(base_uri, object_uri); + symbol = symbol.substr(0, symbol.find(".")); + cout << "SSSSSSSSSS " << symbol << endl; + cout << "BBBBBBBBBBB " << engine_base << endl; + Path patch_path("/"); + if (engine_base == "") + patch_path = "/"; + else if (engine_base[engine_base.length()-1] == '/') + patch_path = Path(engine_base + symbol); + else + patch_path = (Path)engine_base; + + cout << "!!!!!!!!!!!!!!!!!!! PATCH PATH: " << patch_path << endl; + + if (patch_path != engine_base && patch_path != "/") target->new_patch(patch_path, patch_poly); /* Plugin nodes */ @@ -391,7 +409,7 @@ Parser::parse_node( Redland::Model& model, const Glib::ustring& base_uri, const Glib::ustring& subject, - Raul::Path path, + const Raul::Path& path, boost::optional data=boost::optional()) { /* Get plugin */ @@ -425,7 +443,7 @@ Parser::parse_port( Redland::Model& model, const Glib::ustring& base_uri, const Glib::ustring& subject, - Raul::Path path, + const Raul::Path& path, boost::optional data) { Redland::Query query(*world->rdf_world, Glib::ustring( @@ -501,7 +519,7 @@ Parser::parse_variables( Redland::Model& model, const Glib::ustring& base_uri, const Glib::ustring& subject, - Raul::Path path, + const Raul::Path& path, boost::optional data=boost::optional()) { Redland::Query query(*world->rdf_world, Glib::ustring( -- cgit v1.2.1