summaryrefslogtreecommitdiffstats
path: root/src/plugin.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-12-16 04:59:14 +0000
committerDavid Robillard <d@drobilla.net>2011-12-16 04:59:14 +0000
commitb8eb516e97042ca9559aaa506becf504180df0a8 (patch)
tree26fdb669e20b70b9927c1bd62723c48b6947dddc /src/plugin.c
parent3af74220b27e5b5b2bfa7061eb773d0a563d2600 (diff)
downloadlilv-b8eb516e97042ca9559aaa506becf504180df0a8.tar.gz
lilv-b8eb516e97042ca9559aaa506becf504180df0a8.tar.bz2
lilv-b8eb516e97042ca9559aaa506becf504180df0a8.zip
Fix lilv_world_find_nodes to work with wildcard subjects.
Add lilv_plugin_get_related to get resources related to plugins that are not directly rdfs:seeAlso linked (e.g. presets). Add lilv_world_load_resource for related resources (e.g. presets). Print presets in lv2info. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3877 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/plugin.c')
-rw-r--r--src/plugin.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/plugin.c b/src/plugin.c
index f8cf054..b305291 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -828,6 +828,35 @@ lilv_plugin_get_uis(const LilvPlugin* p)
}
}
+LILV_API
+LilvNodes*
+lilv_plugin_get_related(const LilvPlugin* plugin, const LilvNode* type)
+{
+ LilvWorld* const world = plugin->world;
+ LilvNodes* const related = lilv_world_find_nodes(
+ world, NULL, world->lv2_applies_to_val, lilv_plugin_get_uri(plugin));
+
+ if (!type) {
+ return related;
+ }
+
+ LilvNodes* matches = lilv_nodes_new();
+ LILV_FOREACH(nodes, i, related) {
+ LilvNode* node = lilv_collection_get(related, i);
+ SordIter* titer = lilv_world_query_internal(
+ world, node->val.uri_val, world->rdf_a_node, type->val.uri_val);
+ if (!sord_iter_end(titer)) {
+ zix_tree_insert(matches,
+ lilv_node_new_from_node(world, node->val.uri_val),
+ NULL);
+ }
+ sord_iter_free(titer);
+ }
+
+ lilv_nodes_free(related);
+ return matches;
+}
+
static size_t
file_sink(const void* buf, size_t len, void* stream)
{