diff options
author | David Robillard <d@drobilla.net> | 2012-06-12 21:46:22 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-06-12 21:46:22 +0000 |
commit | 071e36b69b5bcc203f70179580c8bed924b7305b (patch) | |
tree | 6af0c15841b20ae8ca5d020a7423d80a7c432fc3 /src/serialisation | |
parent | 9923f2bc2a0731c111dbf614223ed81dee3e91f5 (diff) | |
download | ingen-071e36b69b5bcc203f70179580c8bed924b7305b.tar.gz ingen-071e36b69b5bcc203f70179580c8bed924b7305b.tar.bz2 ingen-071e36b69b5bcc203f70179580c8bed924b7305b.zip |
Add "expose" (to parent) operation for ports.
Partially implments #39. Export all the way to root has a few issues, I am
considering this functionality good enough for now.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4496 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/serialisation')
-rw-r--r-- | src/serialisation/Serialiser.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index 4d715f7a..1d22ce75 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -77,9 +77,8 @@ struct Serialiser::Impl { Resource::Graph context, const Sord::Node& id); - void serialise_properties(const GraphObject* o, - Resource::Graph context, - Sord::Node id); + void serialise_properties(Sord::Node id, + const Resource::Properties& props); void write_bundle(SharedPtr<const Patch> patch, const std::string& uri); @@ -371,7 +370,8 @@ Serialiser::Impl::serialise_patch(SharedPtr<const Patch> patch, Sord::URI(world, uris.doap_name.str()), Sord::Literal(world, symbol)); - serialise_properties(patch.get(), Resource::INTERNAL, patch_id); + const GraphObject::Properties props = patch->properties(Resource::INTERNAL); + serialise_properties(patch_id, props); for (Store::const_iterator n = _world.store()->children_begin(patch); n != _world.store()->children_end(patch); ++n) { @@ -458,7 +458,8 @@ Serialiser::Impl::serialise_node(SharedPtr<const Node> node, Sord::Curie(_model->world(), "lv2:symbol"), Sord::Literal(_model->world(), node->path().symbol())); - serialise_properties(node.get(), Resource::EXTERNAL, node_id); + const GraphObject::Properties props = node->properties(Resource::EXTERNAL); + serialise_properties(node_id, props); for (uint32_t i = 0; i < node->num_ports(); ++i) { Port* const p = node->port(i); @@ -491,7 +492,12 @@ Serialiser::Impl::serialise_port(const Port* port, Sord::Curie(world, "lv2:symbol"), Sord::Literal(world, port->path().symbol())); - serialise_properties(port, context, port_id); + GraphObject::Properties props = port->properties(context); + if (context == Resource::INTERNAL) { + props.insert(make_pair(_world.uris().lv2_default, port->value())); + } + + serialise_properties(port_id, props); } void @@ -541,12 +547,9 @@ skip_property(const Sord::Node& predicate) } void -Serialiser::Impl::serialise_properties(const GraphObject* o, - Ingen::Resource::Graph context, - Sord::Node id) +Serialiser::Impl::serialise_properties(Sord::Node id, + const GraphObject::Properties& props) { - const GraphObject::Properties props = o->properties(context); - LV2_URID_Map* map = &_world.uri_map().urid_map_feature()->urid_map; LV2_URID_Unmap* unmap = &_world.uri_map().urid_unmap_feature()->urid_unmap; Sratom* sratom = sratom_new(map); |