diff options
author | David Robillard <d@drobilla.net> | 2011-02-11 23:37:12 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-02-11 23:37:12 +0000 |
commit | 0b6bdcce6cea21909553a334629a5b3d004bd553 (patch) | |
tree | 7fa15be6af1700e9169656467d3adcd0856fee05 /slv2 | |
parent | 81d2d2f3abcec251d910358bb2751d5e1ee12985 (diff) | |
download | lilv-0b6bdcce6cea21909553a334629a5b3d004bd553.tar.gz lilv-0b6bdcce6cea21909553a334629a5b3d004bd553.tar.bz2 lilv-0b6bdcce6cea21909553a334629a5b3d004bd553.zip |
Add support for boolean values.
Replace slv2_world_filter_language with extensible option system
(slv2_world_set_option).
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2923 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'slv2')
-rw-r--r-- | slv2/value.h | 26 | ||||
-rw-r--r-- | slv2/world.h | 11 |
2 files changed, 35 insertions, 2 deletions
diff --git a/slv2/value.h b/slv2/value.h index 541c3de..84c5b94 100644 --- a/slv2/value.h +++ b/slv2/value.h @@ -62,6 +62,14 @@ SLV2_API SLV2Value slv2_value_new_float(SLV2World world, float val); +/** Create a new boolean value. + * + * Returned value must be freed by caller with slv2_value_free. + */ +SLV2_API +SLV2Value +slv2_value_new_bool(SLV2World world, bool val); + /** Free an SLV2Value. */ SLV2_API @@ -197,6 +205,24 @@ SLV2_API int slv2_value_as_int(SLV2Value value); +/** Return whether this value is a boolean. + * + * Time = O(1) + */ +SLV2_API +bool +slv2_value_is_bool(SLV2Value value); + +/** Return \a value as a bool. + * + * Valid to call only if slv2_value_is_bool(\a value) returns true. + * + * Time = O(1) + */ +SLV2_API +bool +slv2_value_as_bool(SLV2Value value); + /** @} */ #ifdef __cplusplus diff --git a/slv2/world.h b/slv2/world.h index 15dddf8..8bd4b35 100644 --- a/slv2/world.h +++ b/slv2/world.h @@ -52,14 +52,21 @@ SLV2_API SLV2World slv2_world_new(void); -/** Enable/disable language filtering for @a world. +/** Enable/disable language filtering. + * Language filtering applies to any functions that return (a) value(s). * With filtering enabled, SLV2 will automatically return the best value(s) * for the current LANG. With filtering disabled, all matching values will * be returned regardless of language tag. Filtering is enabled by default. */ +#define SLV2_OPTION_FILTER_LANG "http://drobilla.net/ns/slv2#filter-lang" + +/** Set an SLV2 option for @a world. + */ SLV2_API void -slv2_world_filter_language(SLV2World world, bool filter); +slv2_world_set_option(SLV2World world, + const char* uri, + const SLV2Value value); /** Destroy the world, mwahaha. * |