From 36c22be51af07fc96a9168684949b82b8f6e325c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 10 Feb 2013 08:56:33 +0000 Subject: Add lilv_world_ask() for easily checking if a statement exists. Add lilv_world_get() and lilv_port_get() for easily getting one value. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5053 a436a847-0d15-0410-975c-d299462d15a1 --- lilv/lilv.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'lilv') diff --git a/lilv/lilv.h b/lilv/lilv.h index 6719e67..f2dd17a 100644 --- a/lilv/lilv.h +++ b/lilv/lilv.h @@ -649,6 +649,21 @@ lilv_world_find_nodes(LilvWorld* world, const LilvNode* predicate, const LilvNode* object); +/** + Find a single node that matches a pattern. + Exactly one of @p subject, @p predicate, @p object must be NULL. + This function is equivalent to + lilv_nodes_get_first(lilv_world_find_nodes(...)) but simplifies the common + case of only wanting a single value. + @return the first matching node, or NULL if no matches are found. +*/ +LILV_API +LilvNode* +lilv_world_get(LilvWorld* world, + const LilvNode* subject, + const LilvNode* predicate, + const LilvNode* object); + /** Return true iff a statement matching a certain pattern exists. @@ -1057,6 +1072,19 @@ lilv_port_get_value(const LilvPlugin* plugin, const LilvPort* port, const LilvNode* predicate); +/** + Get a single property value of a port. + + This is equivalent to lilv_nodes_get_first(lilv_port_get_value(...)) but is + simpler to use in the common case of only caring about one value. The + caller is responsible for freeing the returned node. +*/ +LILV_API +LilvNode* +lilv_port_get(const LilvPlugin* plugin, + const LilvPort* port, + const LilvNode* predicate); + /** Return the LV2 port properties of a port. */ -- cgit v1.2.1