summaryrefslogtreecommitdiffstats
path: root/src/serialisation
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-06-13 04:02:21 +0000
committerDavid Robillard <d@drobilla.net>2012-06-13 04:02:21 +0000
commit13389895cab38a75860988d27705d8f4e7b34309 (patch)
tree66932d74d8d77051d048e5289b82b1db437819c9 /src/serialisation
parentbd83a49443a9ad64155794f4c85d6829ab678bf9 (diff)
downloadingen-13389895cab38a75860988d27705d8f4e7b34309.tar.gz
ingen-13389895cab38a75860988d27705d8f4e7b34309.tar.bz2
ingen-13389895cab38a75860988d27705d8f4e7b34309.zip
Fix saving of control bindings.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4500 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/serialisation')
-rw-r--r--src/serialisation/Serialiser.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp
index 1d22ce75..8f82ed5f 100644
--- a/src/serialisation/Serialiser.cpp
+++ b/src/serialisation/Serialiser.cpp
@@ -60,8 +60,14 @@ struct Serialiser::Impl {
explicit Impl(Shared::World& world)
: _root_path("/")
, _world(world)
+ , _model(NULL)
+ , _sratom(sratom_new(&_world.uri_map().urid_map_feature()->urid_map))
{}
+ ~Impl() {
+ sratom_free(_sratom);
+ }
+
enum Mode { TO_FILE, TO_STRING };
void start_to_filename(const std::string& filename);
@@ -101,6 +107,7 @@ struct Serialiser::Impl {
std::string _base_uri;
Shared::World& _world;
Sord::Model* _model;
+ Sratom* _sratom;
};
Serialiser::Serialiser(Shared::World& world)
@@ -550,25 +557,23 @@ void
Serialiser::Impl::serialise_properties(Sord::Node id,
const GraphObject::Properties& props)
{
- 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);
SerdNode base = serd_node_from_string(SERD_URI,
(const uint8_t*)_base_uri.c_str());
SerdEnv* env = serd_env_new(&base);
SordInserter* inserter = sord_inserter_new(_model->c_obj(), env);
- sratom_set_sink(sratom, _base_uri.c_str(),
+ sratom_set_sink(_sratom, _base_uri.c_str(),
(SerdStatementSink)sord_inserter_write_statement, NULL,
inserter);
- sratom_set_pretty_numbers(sratom, true);
+ sratom_set_pretty_numbers(_sratom, true);
typedef GraphObject::Properties::const_iterator iterator;
for (iterator v = props.begin(); v != props.end(); ++v) {
const Sord::URI key(_model->world(), v->first.str());
if (!skip_property(key)) {
- sratom_write(sratom, unmap, 0,
+ sratom_write(_sratom, unmap, 0,
sord_node_to_serd_node(id.c_obj()),
sord_node_to_serd_node(key.c_obj()),
v->second.type(), v->second.size(), v->second.get_body());
@@ -577,7 +582,6 @@ Serialiser::Impl::serialise_properties(Sord::Node id,
sord_inserter_free(inserter);
serd_env_free(env);
- sratom_free(sratom);
}
} // namespace Serialisation