From 3f906920e4d448441c442be1ce6c7376e33d4237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Thu, 21 Mar 2019 19:28:56 +0100 Subject: cam: options: Add support for repeatable options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a flag to indicate if an option can be repeatable. If an option is repeatable it must be accessed thru the array interface, even if it's only specified once by the user. Also update the usage generator to indicate which options are repeatable. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/cam/options.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/cam/options.h') diff --git a/src/cam/options.h b/src/cam/options.h index e0ff50af..6e3ef62e 100644 --- a/src/cam/options.h +++ b/src/cam/options.h @@ -36,6 +36,7 @@ struct Option { const char *argumentName; const char *help; KeyValueParser *keyValueParser; + bool isArray; bool hasShortOption() const { return isalnum(opt); } bool hasLongOption() const { return name != nullptr; } @@ -126,9 +127,9 @@ public: bool addOption(int opt, OptionType type, const char *help, const char *name = nullptr, OptionArgument argument = ArgumentNone, - const char *argumentName = nullptr); + const char *argumentName = nullptr, bool array = false); bool addOption(int opt, KeyValueParser *parser, const char *help, - const char *name = nullptr); + const char *name = nullptr, bool array = false); Options parse(int argc, char *argv[]); void usage(); -- cgit v1.2.1