summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-01-04 19:45:31 +0000
committerDavid Robillard <d@drobilla.net>2012-01-04 19:45:31 +0000
commit84ee3d3636f642df74cec72541416a387e730842 (patch)
treed9d0ced31601c618509ec037c84cce0b2d816192 /src
parent7823f743ee0c748ff4ced56838cd737516d857ab (diff)
downloadlilv-84ee3d3636f642df74cec72541416a387e730842.tar.gz
lilv-84ee3d3636f642df74cec72541416a387e730842.tar.bz2
lilv-84ee3d3636f642df74cec72541416a387e730842.zip
Consistently use SordNode for internal URIs.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3916 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/lilv_internal.h10
-rw-r--r--src/plugin.c24
-rw-r--r--src/port.c4
-rw-r--r--src/world.c22
4 files changed, 34 insertions, 26 deletions
diff --git a/src/lilv_internal.h b/src/lilv_internal.h
index 7191daa..75c08de 100644
--- a/src/lilv_internal.h
+++ b/src/lilv_internal.h
@@ -130,17 +130,22 @@ struct LilvWorldImpl {
LilvPlugins* plugins;
LilvNodes* loaded_files;
SordNode* dc_replaces_node;
+ SordNode* doap_name_node;
SordNode* dyn_manifest_node;
SordNode* lv2_appliesTo_node;
SordNode* lv2_binary_node;
SordNode* lv2_default_node;
+ SordNode* lv2_extensionData_node;
SordNode* lv2_index_node;
SordNode* lv2_maximum_node;
SordNode* lv2_minimum_node;
+ SordNode* lv2_name_node;
+ SordNode* lv2_optionalFeature_node;
SordNode* lv2_plugin_node;
SordNode* lv2_port_node;
SordNode* lv2_portproperty_node;
SordNode* lv2_reportslatency_node;
+ SordNode* lv2_requiredFeature_node;
SordNode* lv2_specification_node;
SordNode* lv2_symbol_node;
SordNode* pset_value_node;
@@ -155,11 +160,6 @@ struct LilvWorldImpl {
SordNode* xsd_decimal_node;
SordNode* xsd_double_node;
SordNode* xsd_integer_node;
- LilvNode* doap_name_val;
- LilvNode* lv2_extensionData_val;
- LilvNode* lv2_name_val;
- LilvNode* lv2_optionalFeature_val;
- LilvNode* lv2_requiredFeature_val;
LilvOptions opt;
};
diff --git a/src/plugin.c b/src/plugin.c
index 2bb70c4..1daf23d 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -392,6 +392,15 @@ lilv_plugin_get_class(const LilvPlugin* const_p)
return p->plugin_class;
}
+static LilvNodes*
+lilv_plugin_get_value_internal(const LilvPlugin* p,
+ const SordNode* predicate)
+{
+ lilv_plugin_load_if_necessary(p);
+ return lilv_world_query_values_internal(
+ p->world, p->plugin_uri->val.uri_val, predicate, NULL);
+}
+
LILV_API
bool
lilv_plugin_verify(const LilvPlugin* plugin)
@@ -404,7 +413,8 @@ lilv_plugin_verify(const LilvPlugin* plugin)
}
lilv_nodes_free(results);
- results = lilv_plugin_get_value(plugin, plugin->world->doap_name_val);
+ results = lilv_plugin_get_value_internal(plugin,
+ plugin->world->doap_name_node);
if (!results) {
return false;
}
@@ -425,8 +435,8 @@ LILV_API
LilvNode*
lilv_plugin_get_name(const LilvPlugin* plugin)
{
- LilvNodes* results = lilv_plugin_get_value(plugin,
- plugin->world->doap_name_val);
+ LilvNodes* results = lilv_plugin_get_value_internal(
+ plugin, plugin->world->doap_name_node);
LilvNode* ret = NULL;
if (results) {
@@ -647,14 +657,14 @@ LILV_API
LilvNodes*
lilv_plugin_get_optional_features(const LilvPlugin* p)
{
- return lilv_plugin_get_value(p, p->world->lv2_optionalFeature_val);
+ return lilv_plugin_get_value_internal(p, p->world->lv2_optionalFeature_node);
}
LILV_API
LilvNodes*
lilv_plugin_get_required_features(const LilvPlugin* p)
{
- return lilv_plugin_get_value(p, p->world->lv2_requiredFeature_val);
+ return lilv_plugin_get_value_internal(p, p->world->lv2_requiredFeature_node);
}
LILV_API
@@ -670,7 +680,7 @@ lilv_plugin_has_extension_data(const LilvPlugin* p,
SordIter* iter = lilv_world_query_internal(
p->world,
p->plugin_uri->val.uri_val,
- p->world->lv2_extensionData_val->val.uri_val,
+ p->world->lv2_extensionData_node,
uri->val.uri_val);
if (iter) {
@@ -685,7 +695,7 @@ LILV_API
LilvNodes*
lilv_plugin_get_extension_data(const LilvPlugin* p)
{
- return lilv_plugin_get_value(p, p->world->lv2_extensionData_val);
+ return lilv_plugin_get_value_internal(p, p->world->lv2_extensionData_node);
}
LILV_API
diff --git a/src/port.c b/src/port.c
index 2c1b5c7..727911a 100644
--- a/src/port.c
+++ b/src/port.c
@@ -141,8 +141,8 @@ LilvNode*
lilv_port_get_name(const LilvPlugin* p,
const LilvPort* port)
{
- LilvNodes* results = lilv_port_get_value(p, port,
- p->world->lv2_name_val);
+ LilvNodes* results = lilv_port_get_value_by_node(
+ p, port, p->world->lv2_name_node);
LilvNode* ret = NULL;
if (results) {
diff --git a/src/world.c b/src/world.c
index 8151a73..1bf357a 100644
--- a/src/world.c
+++ b/src/world.c
@@ -50,20 +50,24 @@ lilv_world_new(void)
#define NS_PSET "http://lv2plug.in/ns/ext/presets#"
#define NEW_URI(uri) sord_new_uri(world->world, (const uint8_t*)uri)
-#define NEW_URI_VAL(uri) lilv_new_uri(world, (const char*)(uri));
world->dc_replaces_node = NEW_URI(NS_DCTERMS "replaces");
+ world->doap_name_node = NEW_URI(LILV_NS_DOAP "name");
world->dyn_manifest_node = NEW_URI(NS_DYNMAN "DynManifest");
world->lv2_appliesTo_node = NEW_URI(LILV_NS_LV2 "appliesTo");
world->lv2_binary_node = NEW_URI(LILV_NS_LV2 "binary");
world->lv2_default_node = NEW_URI(LILV_NS_LV2 "default");
+ world->lv2_extensionData_node = NEW_URI(LILV_NS_LV2 "extensionData");
world->lv2_index_node = NEW_URI(LILV_NS_LV2 "index");
world->lv2_maximum_node = NEW_URI(LILV_NS_LV2 "maximum");
world->lv2_minimum_node = NEW_URI(LILV_NS_LV2 "minimum");
+ world->lv2_name_node = NEW_URI(LILV_NS_LV2 "name");
+ world->lv2_optionalFeature_node = NEW_URI(LILV_NS_LV2 "optionalFeature");
world->lv2_plugin_node = NEW_URI(LILV_NS_LV2 "Plugin");
world->lv2_port_node = NEW_URI(LILV_NS_LV2 "port");
world->lv2_portproperty_node = NEW_URI(LILV_NS_LV2 "portProperty");
world->lv2_reportslatency_node = NEW_URI(LILV_NS_LV2 "reportsLatency");
+ world->lv2_requiredFeature_node = NEW_URI(LILV_NS_LV2 "requiredFeature");
world->lv2_specification_node = NEW_URI(LILV_NS_LV2 "Specification");
world->lv2_symbol_node = NEW_URI(LILV_NS_LV2 "symbol");
world->pset_value_node = NEW_URI(NS_PSET "value");
@@ -79,12 +83,6 @@ lilv_world_new(void)
world->xsd_double_node = NEW_URI(LILV_NS_XSD "double");
world->xsd_integer_node = NEW_URI(LILV_NS_XSD "integer");
- world->doap_name_val = NEW_URI_VAL(LILV_NS_DOAP "name");
- world->lv2_extensionData_val = NEW_URI_VAL(LILV_NS_LV2 "extensionData");
- world->lv2_name_val = NEW_URI_VAL(LILV_NS_LV2 "name");
- world->lv2_optionalFeature_val = NEW_URI_VAL(LILV_NS_LV2 "optionalFeature");
- world->lv2_requiredFeature_val = NEW_URI_VAL(LILV_NS_LV2 "requiredFeature");
-
world->lv2_plugin_class = lilv_plugin_class_new(
world, NULL, world->lv2_plugin_node, "Plugin");
assert(world->lv2_plugin_class);
@@ -112,17 +110,22 @@ lilv_world_free(LilvWorld* world)
world->lv2_plugin_class = NULL;
sord_node_free(world->world, world->dc_replaces_node);
+ sord_node_free(world->world, world->doap_name_node);
sord_node_free(world->world, world->dyn_manifest_node);
sord_node_free(world->world, world->lv2_appliesTo_node);
sord_node_free(world->world, world->lv2_binary_node);
sord_node_free(world->world, world->lv2_default_node);
+ sord_node_free(world->world, world->lv2_extensionData_node);
sord_node_free(world->world, world->lv2_index_node);
sord_node_free(world->world, world->lv2_maximum_node);
sord_node_free(world->world, world->lv2_minimum_node);
+ sord_node_free(world->world, world->lv2_name_node);
+ sord_node_free(world->world, world->lv2_optionalFeature_node);
sord_node_free(world->world, world->lv2_plugin_node);
sord_node_free(world->world, world->lv2_port_node);
sord_node_free(world->world, world->lv2_portproperty_node);
sord_node_free(world->world, world->lv2_reportslatency_node);
+ sord_node_free(world->world, world->lv2_requiredFeature_node);
sord_node_free(world->world, world->lv2_specification_node);
sord_node_free(world->world, world->lv2_symbol_node);
sord_node_free(world->world, world->pset_value_node);
@@ -137,11 +140,6 @@ lilv_world_free(LilvWorld* world)
sord_node_free(world->world, world->xsd_decimal_node);
sord_node_free(world->world, world->xsd_double_node);
sord_node_free(world->world, world->xsd_integer_node);
- lilv_node_free(world->doap_name_val);
- lilv_node_free(world->lv2_extensionData_val);
- lilv_node_free(world->lv2_name_val);
- lilv_node_free(world->lv2_optionalFeature_val);
- lilv_node_free(world->lv2_requiredFeature_val);
for (LilvSpec* spec = world->specs; spec;) {
LilvSpec* next = spec->next;