summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-01-15 20:01:24 +0000
committerDavid Robillard <d@drobilla.net>2008-01-15 20:01:24 +0000
commitddba2b97ba27636f9f6f6ae1bef9781fb8ea5f0c (patch)
treefe82c3a7c0a54ae44c4ad117c901e7a08ea0e9a4
parent98cc3bd853c47f6cd1cf02cf14e00413993fd6f5 (diff)
downloadlilv-ddba2b97ba27636f9f6f6ae1bef9781fb8ea5f0c.tar.gz
lilv-ddba2b97ba27636f9f6f6ae1bef9781fb8ea5f0c.tar.bz2
lilv-ddba2b97ba27636f9f6f6ae1bef9781fb8ea5f0c.zip
SLV2 0.4.4.
git-svn-id: http://svn.drobilla.net/lad/slv2@1054 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--slv2/plugin.h12
-rw-r--r--src/plugin.c25
2 files changed, 37 insertions, 0 deletions
diff --git a/slv2/plugin.h b/slv2/plugin.h
index 3a386fc..e4e5984 100644
--- a/slv2/plugin.h
+++ b/slv2/plugin.h
@@ -194,6 +194,18 @@ slv2_plugin_get_value_for_subject(SLV2Plugin p,
const char* predicate);
+/** Return whether a feature is supported by a plugin.
+ *
+ * This will return true if the feature is an optional or required feature
+ * of the plugin.
+ *
+ * Time = Query
+ */
+bool
+slv2_plugin_has_feature(SLV2Plugin p,
+ const char* feature);
+
+
/** Get the LV2 Features supported (required or optionally) by a plugin.
*
* A feature is "supported" by a plugin if it is required OR optional.
diff --git a/src/plugin.c b/src/plugin.c
index bd7f89e..babb65a 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -528,6 +528,31 @@ slv2_plugin_get_latency_port(SLV2Plugin p)
return slv2_value_as_int(val);
}
+
+bool
+slv2_plugin_has_feature(SLV2Plugin p,
+ const char* feature)
+{
+ assert(feature);
+
+ const char* const query = slv2_strjoin(
+ "ASK {\n"
+ " { <> lv2:optionalFeature <", feature, "> }\n"
+ " UNION\n"
+ " { <> lv2:requiredFeature <", feature, "> }\n"
+ "}\n", NULL);
+
+
+ librdf_query_results* results = slv2_plugin_query(p, query);
+ assert(librdf_query_results_is_boolean(results));
+
+ const bool ret = results && (librdf_query_results_get_boolean(results) > 0);
+
+ librdf_free_query_results(results);
+
+ return ret;
+}
+
SLV2Values
slv2_plugin_get_supported_features(SLV2Plugin p)