diff options
Diffstat (limited to 'slv2/slv2.h')
-rw-r--r-- | slv2/slv2.h | 89 |
1 files changed, 54 insertions, 35 deletions
diff --git a/slv2/slv2.h b/slv2/slv2.h index 5ea2bf2..96f4662 100644 --- a/slv2/slv2.h +++ b/slv2/slv2.h @@ -307,37 +307,24 @@ slv2_value_as_bool(SLV2Value value); @{ */ -/* Iter */ +/* Collections */ typedef void* SLV2Iter; - -/** Increment @a i to point at the next element in the collection. */ -SLV2_API -SLV2Iter -slv2_iter_next(SLV2Iter i); - -/** Return true iff @a i is at the end of the collection. */ -SLV2_API -bool -slv2_iter_end(SLV2Iter i); - -/* Collection */ - typedef void* SLV2Collection; -SLV2_API -SLV2Iter -slv2_collection_begin(SLV2Collection collection); - -SLV2_API -void* -slv2_collection_get(SLV2Collection collection, - SLV2Iter i); - -#define SLV2_FOREACH(iter, collection) \ - for (SLV2Iter (iter) = slv2_collection_begin(collection); \ - !slv2_iter_end(iter); \ - (iter) = slv2_iter_next(iter)) +/** + Iterate over each element of a collection. + @code + SLV2_FOREACH(plugin_classes, i, classes) { + SLV2PluginClass c = slv2_plugin_classes_get(classes, i); + // ... + } + @endcode +*/ +#define SLV2_FOREACH(colltype, iter, collection) \ + for (SLV2Iter (iter) = slv2_ ## colltype ## _begin(collection); \ + !slv2_ ## colltype ## _is_end(collection, iter); \ + (iter) = slv2_ ## colltype ## _next(collection, iter)) /* SLV2PluginClasses */ @@ -357,6 +344,14 @@ SLV2_API SLV2PluginClass slv2_plugin_classes_get(SLV2PluginClasses collection, SLV2Iter i); +SLV2_API +SLV2Iter +slv2_plugin_classes_next(SLV2PluginClasses collection, SLV2Iter i); + +SLV2_API +bool +slv2_plugin_classes_is_end(SLV2PluginClasses collection, SLV2Iter i); + SLV2_DEPRECATED SLV2_API SLV2PluginClass @@ -365,10 +360,6 @@ slv2_plugin_classes_get_at(SLV2PluginClasses collection, unsigned index); /* SLV2ScalePoints */ SLV2_API -SLV2ScalePoints -slv2_scale_points_new(void); - -SLV2_API void slv2_scale_points_free(SLV2ScalePoints collection); @@ -384,6 +375,14 @@ SLV2_API SLV2ScalePoint slv2_scale_points_get(SLV2ScalePoints collection, SLV2Iter i); +SLV2_API +SLV2Iter +slv2_scale_points_next(SLV2ScalePoints collection, SLV2Iter i); + +SLV2_API +bool +slv2_scale_points_is_end(SLV2ScalePoints collection, SLV2Iter i); + SLV2_DEPRECATED SLV2_API SLV2ScalePoint @@ -407,6 +406,14 @@ SLV2_API SLV2UI slv2_uis_get(SLV2UIs collection, SLV2Iter i); +SLV2_API +SLV2Iter +slv2_uis_next(SLV2UIs collection, SLV2Iter i); + +SLV2_API +bool +slv2_uis_is_end(SLV2UIs collection, SLV2Iter i); + SLV2_DEPRECATED SLV2_API SLV2UI @@ -415,10 +422,6 @@ slv2_uis_get_at(SLV2UIs collection, unsigned index); /* Values */ SLV2_API -SLV2ScalePoints -slv2_values_new(void); - -SLV2_API void slv2_values_free(SLV2Values collection); @@ -435,6 +438,14 @@ SLV2Value slv2_values_get(SLV2Values collection, SLV2Iter i); SLV2_API +SLV2Iter +slv2_values_next(SLV2Values collection, SLV2Iter i); + +SLV2_API +bool +slv2_values_is_end(SLV2Values collection, SLV2Iter i); + +SLV2_API SLV2Value slv2_values_get_first(SLV2Values collection); @@ -457,6 +468,14 @@ SLV2_API SLV2Plugin slv2_plugins_get(SLV2Plugins collection, SLV2Iter i); +SLV2_API +SLV2Iter +slv2_plugins_next(SLV2Plugins collection, SLV2Iter i); + +SLV2_API +bool +slv2_plugins_is_end(SLV2Plugins collection, SLV2Iter i); + SLV2_DEPRECATED SLV2_API SLV2Plugin |