From c28f70ab84dcbc2a185b1dc9577ea97cb1042701 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 23 Nov 2012 03:39:05 +0000 Subject: Add va_list variant of lilv_plugin_get_num_ports_of_class() (#758). git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@4858 a436a847-0d15-0410-975c-d299462d15a1 --- lilv/lilv.h | 14 ++++++++++++++ lilv/lilvmm.hpp | 13 +++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'lilv') diff --git a/lilv/lilv.h b/lilv/lilv.h index 30bb3f5..5ef5e59 100644 --- a/lilv/lilv.h +++ b/lilv/lilv.h @@ -21,6 +21,7 @@ #ifndef LILV_LILV_H #define LILV_LILV_H +#include #include #include #include @@ -858,6 +859,19 @@ uint32_t lilv_plugin_get_num_ports_of_class(const LilvPlugin* p, const LilvNode* class_1, ...); +#ifndef SWIG +/** + Variant of lilv_plugin_get_num_ports_of_class() that takes a va_list. + + This function calls va_arg() on @p args but does not call va_end(). +*/ +LILV_API +uint32_t +lilv_plugin_get_num_ports_of_class_va(const LilvPlugin* p, + const LilvNode* class_1, + va_list args); +#endif + /** Return whether or not the plugin introduces (and reports) latency. The index of the latency port can be found with lilv_plugin_get_latency_port diff --git a/lilv/lilvmm.hpp b/lilv/lilvmm.hpp index 67fbbc4..2ce29f8 100644 --- a/lilv/lilvmm.hpp +++ b/lilv/lilvmm.hpp @@ -206,10 +206,15 @@ struct Plugin { me, min_values, max_values, def_values); } - inline unsigned get_num_ports_of_class(LilvNode* class_1, - LilvNode* class_2) { - // TODO: varargs - return lilv_plugin_get_num_ports_of_class(me, class_1, class_2, NULL); + inline unsigned get_num_ports_of_class(LilvNode* class_1, ...) { + va_list args; + va_start(args, class_1); + + const uint32_t count = lilv_plugin_get_num_ports_of_class_va( + me, class_1, args); + + va_end(args); + return count; } const LilvPlugin* me; -- cgit v1.2.1