From c11ecf0fd10641218326ae384e80413ba3cdf46c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 27 May 2009 17:42:51 +0000 Subject: 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 --- src/serialisation/Serialiser.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/serialisation/Serialiser.cpp') diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index 286873e8..ac18455e 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -56,6 +56,9 @@ namespace Ingen { namespace Serialisation { +#define META_PREFIX "#" + + Serialiser::Serialiser(Shared::World& world, SharedPtr store) : _root_path("/") , _store(store) @@ -247,7 +250,7 @@ Serialiser::class_rdf_node(const Path& path) return Redland::Resource(_model->world(), _base_uri); else return Redland::Resource(_model->world(), - string("#") + path.substr(_root_path.base().length())); + string(META_PREFIX) + path.relative_to_base(_root_path).chop_start("/")); } @@ -263,7 +266,8 @@ Serialiser::serialise(SharedPtr object) throw (std::logic_error) const Redland::Resource patch_id(_model->world(), _base_uri); serialise_patch(patch, patch_id); } else { - const Redland::Resource patch_id(_model->world(), string("#") + patch->path().substr(1)); + const Redland::Resource patch_id(_model->world(), + string(META_PREFIX) + patch->path().chop_start("/")); serialise_patch(patch, patch_id); serialise_node(patch, patch_id, instance_rdf_node(patch->path())); } @@ -323,7 +327,8 @@ Serialiser::serialise_patch(SharedPtr patch, const Redland::Node& SharedPtr patch = PtrCast(n->second); SharedPtr node = PtrCast(n->second); if (patch) { - const Redland::Resource class_id(_model->world(),string("#") + patch->path().substr(1)); + const Redland::Resource class_id(_model->world(), + string(META_PREFIX) + patch->path().chop_start("/")); const Redland::Node node_id(instance_rdf_node(n->second->path())); _model->add_statement(patch_id, "ingen:node", node_id); serialise_patch(patch, class_id); -- cgit v1.2.1