From 81e9fb3245bd461ebfee4cfa16d1792e48533f9e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 12 Mar 2012 06:59:48 +0000 Subject: Centralise atom creation in forge object. Aside from being more greppable and making realtime violations more obvious, this is a step towards using LV2 atoms internally (which needs a factory since the type numbers are dynamic). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4054 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/PluginModel.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src/client/PluginModel.cpp') diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 72326dd0..09a5abfb 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -51,14 +51,16 @@ PluginModel::PluginModel(Shared::URIs& uris, add_properties(properties); assert(_rdf_world); - add_property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", this->type_uri()); + add_property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", + this->type_uri()); LilvNode* plugin_uri = lilv_new_uri(_lilv_world, uri.c_str()); _lilv_plugin = lilv_plugins_get_by_uri(_lilv_plugins, plugin_uri); lilv_node_free(plugin_uri); - if (_type == Internal) + if (_type == Internal) { set_property("http://usefulinc.com/ns/doap#name", - Atom(uri.substr(uri.find_last_of('#') + 1).c_str())); + uris.forge.alloc(uri.substr(uri.find_last_of('#') + 1))); + } } const Atom& @@ -93,7 +95,8 @@ PluginModel::get_property(const URI& key) const else symbol = uri.str().substr(first_delim + 1, last_delim - first_delim - 1); } - set_property("http://lv2plug.in/ns/lv2core#symbol", symbol); + set_property("http://lv2plug.in/ns/lv2core#symbol", + _uris.forge.alloc(symbol)); return get_property(key); } @@ -105,16 +108,20 @@ PluginModel::get_property(const URI& key) const LILV_FOREACH(nodes, i, values) { const LilvNode* val = lilv_nodes_get(values, i); if (lilv_node_is_uri(val)) { - ret = set_property(key, Atom(Atom::URI, lilv_node_as_uri(val))); + ret = set_property( + key, _uris.forge.alloc(Atom::URI, lilv_node_as_uri(val))); break; } else if (lilv_node_is_string(val)) { - ret = set_property(key, lilv_node_as_string(val)); + ret = set_property(key, + _uris.forge.alloc(lilv_node_as_string(val))); break; } else if (lilv_node_is_float(val)) { - ret = set_property(key, Atom(lilv_node_as_float(val))); + ret = set_property(key, + _uris.forge.make(lilv_node_as_float(val))); break; } else if (lilv_node_is_int(val)) { - ret = set_property(key, Atom(lilv_node_as_int(val))); + ret = set_property(key, + _uris.forge.make(lilv_node_as_int(val))); break; } } -- cgit v1.2.1