summaryrefslogtreecommitdiff
path: root/src/cam/options.h
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-03-21 19:28:56 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-03-27 15:06:14 +0100
commit3f906920e4d448441c442be1ce6c7376e33d4237 (patch)
treedc9cc5085913c01d72d1e1e9b6e7c4afce6f0d80 /src/cam/options.h
parent2a608965f8cb4bb93522e9b22af840c688ec12a1 (diff)
cam: options: Add support for repeatable options
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 <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/cam/options.h')
-rw-r--r--src/cam/options.h5
1 files changed, 3 insertions, 2 deletions
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();