summaryrefslogtreecommitdiffstats
path: root/src/serialisation/Parser.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-05-27 17:42:51 +0000
committerDavid Robillard <d@drobilla.net>2009-05-27 17:42:51 +0000
commitc11ecf0fd10641218326ae384e80413ba3cdf46c (patch)
tree52ea61f88167a2e7eacc8fa5ff0ee39ee25b2e7e /src/serialisation/Parser.cpp
parent8feac4ed0e764c677d4d208377e956c6db94d2dd (diff)
downloadingen-c11ecf0fd10641218326ae384e80413ba3cdf46c.tar.gz
ingen-c11ecf0fd10641218326ae384e80413ba3cdf46c.tar.bz2
ingen-c11ecf0fd10641218326ae384e80413ba3cdf46c.zip
Remove 'new_patch', 'new_node', and 'new_port' from interface in favour of generic 'put'.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2011 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/serialisation/Parser.cpp')
-rw-r--r--src/serialisation/Parser.cpp40
1 files changed, 27 insertions, 13 deletions
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index 732307b5..f290de5f 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -424,7 +424,10 @@ Parser::parse_patch(
/* Create patch */
Path patch_path(patch_path_str);
- target->new_patch(patch_path, patch_poly);
+ Resource::Properties props;
+ props.insert(make_pair("rdf:type", Raul::Atom(Raul::Atom::URI, "ingen:Patch")));
+ props.insert(make_pair("ingen:polyphony", Raul::Atom(int32_t(patch_poly))));
+ target->put(patch_path, props);
/* Find patches in document */
@@ -521,7 +524,10 @@ Parser::parse_patch(
if (type_i == types.end())
continue;
const Path node_path(relative_uri(base_uri, i->first, true));
- target->new_node(node_path, type_i->second);
+ Resource::Properties props;
+ props.insert(make_pair("rdf:type", Raul::Atom(Raul::Atom::URI, "ingen:Node")));
+ props.insert(make_pair("rdf:instanceOf", Raul::Atom(Raul::Atom::URI, type_i->second)));
+ target->put(node_path, props);
Glib::Mutex::Lock lock(world->rdf_world->mutex());
for (Properties::iterator j = i->second.begin(); j != i->second.end(); ++j) {
const string key = world->rdf_world->prefixes().qualify(j->first);
@@ -572,7 +578,8 @@ Parser::parse_patch(
Redland::Node& port = (*i)["port"];
Redland::Node& type = (*i)["type"];
if (port.type() == Redland::Node::RESOURCE && type.type() == Redland::Node::RESOURCE) {
- types.insert(make_pair(port.to_string(), type.to_string()));
+ types.insert(make_pair(port.to_string(),
+ world->rdf_world->prefixes().qualify(type.to_string())));
patch_ports.insert(make_pair(port.to_string(), Properties()));
}
}
@@ -599,16 +606,16 @@ Parser::parse_patch(
for (Objects::iterator i = patch_ports.begin(); i != patch_ports.end(); ++i) {
Glib::Mutex::Lock lock(world->rdf_world->mutex());
const Path port_path(relative_uri(base_uri, i->first, true));
- Properties::iterator types_begin = i->second.find("rdf:type");
- if (types_begin == i->second.end()) {
+ std::pair<Properties::iterator,Properties::iterator> types_range
+ = i->second.equal_range("rdf:type");
+ if (types_range.first == i->second.end()) {
cerr << "WARNING: Patch port has no types" << endl;
continue;
}
- Properties::iterator types_end = i->second.upper_bound("rdf:type");
bool is_input = false;
bool is_output = false;
Redland::Node* type = 0;
- for (Properties::iterator t = types_begin; t != types_end; ++t) {
+ for (Properties::iterator t = types_range.first; t != types_range.second; ++t) {
if (t->second.to_string() == NS_LV2 "InputPort") {
is_input = true;
} else if (t->second.to_string() == NS_LV2 "OutputPort") {
@@ -624,11 +631,9 @@ Parser::parse_patch(
cerr << "ERROR: Corrupt patch port" << endl;
continue;
}
- const string type_str = world->rdf_world->prefixes().qualify(type->to_string());
- target->new_port(port_path, type_str, 0, is_output);
- for (Properties::iterator j = i->second.begin(); j != i->second.end(); ++j) {
- target->set_property(port_path, j->first, AtomRDF::node_to_atom(j->second));
- }
+
+ cerr << "FIXME: PARSE PATCH" << endl;
+ //target->put(port_path, i->second);
}
parse_connections(world, target, model, subject, "/");
@@ -685,7 +690,12 @@ Parser::parse_node(
return boost::optional<Path>();
}
- target->new_node(path, world->rdf_world->expand_uri(plugin_node.to_c_string()));
+ const string plugin_uri = world->rdf_world->expand_uri(plugin_node.to_c_string());
+ Resource::Properties props;
+ props.insert(make_pair("rdf:type", Raul::Atom(Raul::Atom::URI, "ingen:Node")));
+ props.insert(make_pair("rdf:instanceOf", Raul::Atom(Raul::Atom::URI, plugin_uri)));
+ target->put(path, props);
+
parse_variables(world, target, model, subject, path, data);
return path;
}
@@ -700,6 +710,7 @@ Parser::parse_port(
const Raul::Path& path,
boost::optional<GraphObject::Properties> data)
{
+#if 0
const Glib::ustring subject = subject_node.to_turtle_token();
Redland::Query query(*world->rdf_world, Glib::ustring(
@@ -728,6 +739,9 @@ Parser::parse_port(
parse_variables(world, target, model, subject_node, path, data);
return path;
+#endif
+ cerr << "PARSE PORT" << endl;
+ return boost::optional<Path>();
}