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 --- src/port.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/port.c') diff --git a/src/port.c b/src/port.c index 00896df..48d87dd 100644 --- a/src/port.c +++ b/src/port.c @@ -126,6 +126,21 @@ lilv_port_get_value(const LilvPlugin* p, lilv_node_as_node(predicate)); } +LILV_API +LilvNode* +lilv_port_get(const LilvPlugin* p, + const LilvPort* port, + const LilvNode* predicate) +{ + LilvNodes* values = lilv_port_get_value(p, port, predicate); + + LilvNode* value = lilv_node_duplicate( + values ? lilv_nodes_get_first(values) : NULL); + + lilv_nodes_free(values); + return value; +} + LILV_API uint32_t lilv_port_get_index(const LilvPlugin* p, -- cgit v1.2.1