summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-05-29 01:32:44 +0000
committerDavid Robillard <d@drobilla.net>2009-05-29 01:32:44 +0000
commit92a48b741ca3eb8698e6ae8f4f6923583d42cd66 (patch)
tree9efe883f128818d399298930ff7ae411d9ff8b71 /src
parent085f5e9c5eec12171596c47c0b70f6634dbc1402 (diff)
downloadingen-92a48b741ca3eb8698e6ae8f4f6923583d42cd66.tar.gz
ingen-92a48b741ca3eb8698e6ae8f4f6923583d42cd66.tar.bz2
ingen-92a48b741ca3eb8698e6ae8f4f6923583d42cd66.zip
Make connection parsing consistent with other parse methods.
Connection updates via HTTP. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2046 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/client/HTTPClientReceiver.cpp5
-rw-r--r--src/engine/HTTPEngineReceiver.cpp4
-rw-r--r--src/gui/PatchCanvas.cpp2
-rw-r--r--src/serialisation/Parser.cpp18
-rw-r--r--src/serialisation/Parser.hpp2
5 files changed, 16 insertions, 15 deletions
diff --git a/src/client/HTTPClientReceiver.cpp b/src/client/HTTPClientReceiver.cpp
index be1b6238..285e797c 100644
--- a/src/client/HTTPClientReceiver.cpp
+++ b/src/client/HTTPClientReceiver.cpp
@@ -99,7 +99,7 @@ HTTPClientReceiver::Listener::Listener(HTTPClientReceiver* receiver, const std::
void
HTTPClientReceiver::update(const std::string& str)
{
- cout << _parser->parse_update(_world, _target.get(), str, "");
+ cout << _parser->parse_update(_world, _target.get(), str, _url);
}
void
@@ -150,8 +150,7 @@ HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, voi
Glib::Mutex::Lock lock(me->_mutex);
me->_target->response_ok(0);
me->_parser->parse_string(me->_world, me->_target.get(),
- Glib::ustring(msg->response_body->data),
- Glib::ustring(""));
+ Glib::ustring(msg->response_body->data), me->_url);
}
} else if (path == "/patch") {
diff --git a/src/engine/HTTPEngineReceiver.cpp b/src/engine/HTTPEngineReceiver.cpp
index b2d3ca99..d4c0ac1e 100644
--- a/src/engine/HTTPEngineReceiver.cpp
+++ b/src/engine/HTTPEngineReceiver.cpp
@@ -124,7 +124,7 @@ HTTPEngineReceiver::message_callback(SoupServer* server, SoupMessage* msg, const
SharedPtr<Serialiser> serialiser = me->_engine.world()->serialiser;
- const string base_uri = "";
+ const string base_uri = "path:/";
const char* mime_type = "text/plain";
if (!strcmp(msg->method, SOUP_METHOD_PUT)) {
@@ -232,7 +232,7 @@ HTTPEngineReceiver::message_callback(SoupServer* server, SoupMessage* msg, const
return;
}
- parser->parse_string(me->_engine.world(), me, msg->request_body->data, "");
+ parser->parse_string(me->_engine.world(), me, msg->request_body->data, base_uri);
// Load object
soup_message_set_status(msg, SOUP_STATUS_NOT_IMPLEMENTED);
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp
index 2cc6ea24..26eff17c 100644
--- a/src/gui/PatchCanvas.cpp
+++ b/src/gui/PatchCanvas.cpp
@@ -315,7 +315,7 @@ PatchCanvas::add_plugin(SharedPtr<PluginModel> p)
if (_internal_menu && p->type() == Plugin::Internal) {
_internal_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(p->human_name(),
sigc::bind(sigc::mem_fun(this, &PatchCanvas::load_plugin), p)));
- } else if (_plugin_menu && p->type() == Plugin::LV2) {
+ } else if (_plugin_menu && p->type() == Plugin::LV2 && p->slv2_plugin()) {
SLV2PluginClass pc = slv2_plugin_get_class(p->slv2_plugin());
SLV2Value class_uri = slv2_plugin_class_get_uri(pc);
const char* class_uri_str = slv2_value_as_string(class_uri);
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index 50e00439..c3137e05 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -133,11 +133,11 @@ Parser::parse_string(
cout << "Parsing " << (data_path ? data_path->str() : "*") << " from string";
if (base_uri != "")
- cout << "(base " << base_uri << ")";
+ cout << " (base " << base_uri << ")";
cout << endl;
bool ret = parse(world, target, model, base_uri, data_path, parent, symbol, data);
- const Glib::ustring subject = Glib::ustring("<") + base_uri + Glib::ustring(">");
+ Redland::Resource subject(*world->rdf_world, base_uri);
parse_connections(world, target, model, subject, parent ? *parent : "/");
return ret;
@@ -182,14 +182,16 @@ Parser::parse_update(
const Redland::Node& val_node((*i)["o"]);
const Atom a(AtomRDF::node_to_atom(val_node));
if (obj_uri.find(":") == string::npos)
- obj_uri = "path:" + obj_uri;
+ obj_uri = Path(obj_uri).str();
+ obj_uri = relative_uri(base_uri, obj_uri, true);
if (key != "")
- target->set_property(obj_uri, key, a);
+ target->set_property(string("path:") + obj_uri, key, a);
}
// Connections
- //parse_connections(world, target, model, base_uri, "/");
+ Redland::Resource subject(*world->rdf_world, base_uri);
+ parse_connections(world, target, model, subject, "/");
// Port values
query = Redland::Query(*world->rdf_world,
@@ -592,7 +594,7 @@ Parser::parse_patch(
}
parse_properties(world, target, model, subject_node, patch_path, data);
- parse_connections(world, target, model, subject, "/");
+ parse_connections(world, target, model, subject_node, "/");
/* Enable */
@@ -661,12 +663,12 @@ Parser::parse_connections(
Ingen::Shared::World* world,
Ingen::Shared::CommonInterface* target,
Redland::Model& model,
- const Glib::ustring& subject,
+ const Redland::Node& subject,
const Raul::Path& parent)
{
Redland::Query query(*world->rdf_world, Glib::ustring(
"SELECT DISTINCT ?src ?dst WHERE {\n")
- + subject + " ingen:connection ?connection .\n"
+ + subject.to_turtle_token() + " ingen:connection ?connection .\n"
"?connection ingen:source ?src ;\n"
" ingen:destination ?dst .\n"
"}");
diff --git a/src/serialisation/Parser.hpp b/src/serialisation/Parser.hpp
index 07855826..a5ab9400 100644
--- a/src/serialisation/Parser.hpp
+++ b/src/serialisation/Parser.hpp
@@ -107,7 +107,7 @@ private:
Ingen::Shared::World* world,
Ingen::Shared::CommonInterface* target,
Redland::Model& model,
- const Glib::ustring& subject,
+ const Redland::Node& subject,
const Raul::Path& patch);
};