diff options
author | David Robillard <d@drobilla.net> | 2011-03-10 07:20:34 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-03-10 07:20:34 +0000 |
commit | 4f0ea64bf84fc2532e5104fc1bc5d6ccf76d3fff (patch) | |
tree | 4fc91a5c6fb37f1267587513d216feee2787972c /src/collections.c | |
parent | 509579ed2b7a99b2056136a3faafa7ef11d3a57d (diff) | |
download | lilv-4f0ea64bf84fc2532e5104fc1bc5d6ccf76d3fff.tar.gz lilv-4f0ea64bf84fc2532e5104fc1bc5d6ccf76d3fff.tar.bz2 lilv-4f0ea64bf84fc2532e5104fc1bc5d6ccf76d3fff.zip |
Hide as many collection details as possible while keeping generic iterator / SLV2_FOREACH API.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@3064 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/collections.c')
-rw-r--r-- | src/collections.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/collections.c b/src/collections.c index bdbf640..4c3ae5e 100644 --- a/src/collections.c +++ b/src/collections.c @@ -165,3 +165,71 @@ slv2_iter_end(SLV2Iter i) { return !i || g_sequence_iter_is_end((GSequenceIter*)i); } + +#define SLV2_COLLECTION_IMPL(prefix, CT, ET) \ +SLV2_API \ +unsigned \ +prefix##_size(CT collection) { \ + return slv2_collection_size(collection); \ +} \ +\ +SLV2_API \ +SLV2Iter \ +prefix##_begin(CT collection) { \ + return slv2_collection_begin(collection); \ +} \ +\ +SLV2_API \ +ET \ +prefix##_get(CT collection, SLV2Iter i) { \ + return (ET)slv2_collection_get(collection, i); \ +} \ +\ +SLV2_DEPRECATED \ +SLV2_API \ +ET \ +prefix##_get_at(CT collection, unsigned index) { \ + return (ET)slv2_collection_get_at(collection, index); \ +} + +SLV2_COLLECTION_IMPL(slv2_plugin_classes, SLV2PluginClasses, SLV2PluginClass) +SLV2_COLLECTION_IMPL(slv2_scale_points, SLV2ScalePoints, SLV2ScalePoint) +SLV2_COLLECTION_IMPL(slv2_uis, SLV2UIs, SLV2UI) +SLV2_COLLECTION_IMPL(slv2_values, SLV2Values, SLV2Value) +SLV2_COLLECTION_IMPL(slv2_plugins, SLV2Plugins, SLV2Plugin) + +SLV2_API +void +slv2_plugin_classes_free(SLV2PluginClasses collection) { + slv2_collection_free(collection); +} + +SLV2_API +void +slv2_scale_points_free(SLV2ScalePoints collection) { + slv2_collection_free(collection); +} + +SLV2_API +void +slv2_uis_free(SLV2UIs collection) { + slv2_collection_free(collection); +} + +SLV2_API +void +slv2_values_free(SLV2Values collection) { + slv2_collection_free(collection); +} + +SLV2_API +void +slv2_plugins_free(SLV2World world, SLV2Plugins plugins){ +} + +SLV2_API +SLV2Value +slv2_values_get_first(SLV2Values collection) { + return (SLV2Value)slv2_collection_get(collection, + slv2_collection_begin(collection)); +} |