From 056f394151a48e9d129691fd7451a3d0bcbde3ba Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 3 Sep 2006 05:11:57 +0000 Subject: Saner (internal) query API, though still needs work. Preliminary (untested) support for host features/extensions/whatever. Documentation fixes and minor cleanups. git-svn-id: http://svn.drobilla.net/lad/libslv2@113 a436a847-0d15-0410-975c-d299462d15a1 --- slv2/plugin.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ slv2/query.h | 25 +++++++++++++++++-------- 2 files changed, 61 insertions(+), 8 deletions(-) (limited to 'slv2') diff --git a/slv2/plugin.h b/slv2/plugin.h index 57fa266..95d933e 100644 --- a/slv2/plugin.h +++ b/slv2/plugin.h @@ -179,6 +179,50 @@ slv2_plugin_has_latency(const SLV2Plugin* p); uint32_t slv2_plugin_get_latency_port(const SLV2Plugin* p); +#if 0 +/** Return whether or not a plugin supports the given host feature / extension. + * + * This will return true for both supported and required host features. + */ +bool +slv2_plugin_supports_feature(const SLV2Plugin* p, const char* feature_uri); + + +/** Return whether or not a plugin requires the given host feature / extension. + * + * If a plugin requires a feature, that feature MUST be passed to the plugin's + * instantiate method or the plugin will fail to instantiate. + */ +bool +slv2_plugin_requires_features(const SLV2Plugin* p, const char* feature_uri); +#endif + +/** Get a plugin's supported host features / extensions. + * + * This returns a list of all supported features (both required and optional). + */ +SLV2Property +slv2_plugin_get_supported_features(const SLV2Plugin* p); + + +/** Get a plugin's requires host features / extensions. + * + * All feature URI's returned by this call MUST be passed to the plugin's + * instantiate method for the plugin to instantiate successfully. + */ +SLV2Property +slv2_plugin_get_required_features(const SLV2Plugin* p); + + +/** Get a plugin's optional host features / extensions. + * + * If the feature URI's returned by this method are passed to the plugin's + * instantiate method, those features will be used by the function, otherwise + * the plugin will act as it would if it did not support that feature at all. + */ +SLV2Property +slv2_plugin_get_optional_features(const SLV2Plugin* p); + /** @} */ diff --git a/slv2/query.h b/slv2/query.h index 9f1c93d..a23df0e 100644 --- a/slv2/query.h +++ b/slv2/query.h @@ -74,23 +74,32 @@ char* slv2_query_lang_filter(const char* variable); -/** Run a SPARQL query on a plugin's data file. +/** Run a SPARQL query on a plugin's data file and return variable matches. * * Header from slv2query_header will be prepended to passed query string (so * the default prefixes will be already defined, you don't need to add them * yourself). * - * rasqal_init() must be called by the caller before calling this function. + * Returned is a list of all matches for the query variable \a var_name. */ -rasqal_query_results* -slv2_plugin_run_query(const SLV2Plugin* p, - const char* query_string); +SLV2Property +slv2_query_get_results(const SLV2Plugin* p, + const char* query_string, + const char* var_name); + +/** Run a SPARQL query on a plugin's data file and just count the matches. + * + * Header from slv2query_header will be prepended to passed query string (so + * the default prefixes will be already defined, you don't need to add them + * yourself). + * + * Returned is the total of all variable matches resulting from the query. + */ size_t -slv2_query_get_num_results(rasqal_query_results* results, const char* var_name); +slv2_query_count_results(const SLV2Plugin* p, + const char* query_string); -SLV2Property -slv2_query_get_results(rasqal_query_results* results, const char* var_name); /** Free an SLV2Property. */ void -- cgit v1.2.1