summaryrefslogtreecommitdiffstats
path: root/src/serialisation
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-12 15:56:21 +0000
committerDavid Robillard <d@drobilla.net>2012-08-12 15:56:21 +0000
commit21b1e2e485d9fa954ca742965d000f3273fcb862 (patch)
tree8f316c5adbf6d387d64ee895b862dae21614524a /src/serialisation
parent65a81eec8943dc0504b8b8755f9866ee4993372c (diff)
downloadingen-21b1e2e485d9fa954ca742965d000f3273fcb862.tar.gz
ingen-21b1e2e485d9fa954ca742965d000f3273fcb862.tar.bz2
ingen-21b1e2e485d9fa954ca742965d000f3273fcb862.zip
Stricter symbol construction and conversion.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4670 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/serialisation')
-rw-r--r--src/serialisation/Parser.cpp4
-rw-r--r--src/serialisation/Serialiser.cpp13
2 files changed, 9 insertions, 8 deletions
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index b8d0adbc..8407429f 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -167,7 +167,7 @@ get_port(Ingen::World* world,
LOG(error) << "Port " << subject << " has no symbol" << endl;
return -1;
}
- const Symbol port_sym = s->second.get_string();
+ const Symbol port_sym(s->second.get_string());
const Path port_path = parent.child(port_sym);
record = make_pair(port_path, props);
@@ -330,7 +330,7 @@ parse_patch(Ingen::World* world,
const Glib::ustring base_uri = model.base_uri().to_string();
- Raul::Symbol symbol = "_";
+ Raul::Symbol symbol("_");
if (a_symbol) {
symbol = *a_symbol;
} else {
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp
index 5ad62e7c..9e01eaf7 100644
--- a/src/serialisation/Serialiser.cpp
+++ b/src/serialisation/Serialiser.cpp
@@ -328,26 +328,27 @@ Serialiser::Impl::serialise_patch(SharedPtr<const GraphObject> patch,
const URIs& uris = _world.uris();
// Always write a symbol (required by Ingen)
- string symbol;
+ Raul::Symbol symbol("_");
GraphObject::Properties::const_iterator s = patch->properties().find(uris.lv2_symbol);
if (s == patch->properties().end()
|| !s->second.type() == _world.forge().String
|| !Symbol::is_valid(s->second.get_string())) {
- symbol = Glib::path_get_basename(_model->base_uri().to_c_string());
- symbol = Symbol::symbolify(symbol.substr(0, symbol.find('.')));
+ const std::string base = Glib::path_get_basename(
+ _model->base_uri().to_c_string());
+ symbol = Symbol::symbolify(base.substr(0, base.find('.')));
_model->add_statement(
patch_id,
Sord::Curie(world, "lv2:symbol"),
- Sord::Literal(world, symbol));
+ Sord::Literal(world, symbol.c_str()));
} else {
- symbol = s->second.get_string();
+ symbol = Raul::Symbol::symbolify(s->second.get_string());
}
// If the patch has no doap:name (required by LV2), use the symbol
if (patch->properties().find(uris.doap_name) == patch->properties().end())
_model->add_statement(patch_id,
Sord::URI(world, uris.doap_name.str()),
- Sord::Literal(world, symbol));
+ Sord::Literal(world, symbol.c_str()));
const GraphObject::Properties props = patch->properties(Resource::INTERNAL);
serialise_properties(patch_id, props);