summaryrefslogtreecommitdiff
path: root/src/cam/options.h
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-03-22 02:11:22 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-03-27 15:06:02 +0100
commit2a608965f8cb4bb93522e9b22af840c688ec12a1 (patch)
treeac39a3ffa45695faad2a3b6c6c5c1e76c2372b3d /src/cam/options.h
parentaf45435014aad8497fbb71d9be53ab3f890a22e4 (diff)
cam: options: Add an array data type to OptionValue
To allow specifying the same argument option multiple times a new type of OptionValue is needed. As parsing of options is an iterative process there is a need to append options as they are parsed so instead of setting values using the constructor a new addValue() method is used. 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.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cam/options.h b/src/cam/options.h
index b33a90fc..e0ff50af 100644
--- a/src/cam/options.h
+++ b/src/cam/options.h
@@ -10,6 +10,7 @@
#include <ctype.h>
#include <list>
#include <map>
+#include <vector>
class KeyValueParser;
class OptionValue;
@@ -84,6 +85,7 @@ public:
ValueInteger,
ValueString,
ValueKeyValue,
+ ValueArray,
};
OptionValue();
@@ -92,21 +94,26 @@ public:
OptionValue(const std::string &value);
OptionValue(const KeyValueParser::Options &value);
+ void addValue(const OptionValue &value);
+
ValueType type() const { return type_; }
operator int() const;
operator std::string() const;
operator KeyValueParser::Options() const;
+ operator std::vector<OptionValue>() const;
int toInteger() const;
std::string toString() const;
KeyValueParser::Options toKeyValues() const;
+ std::vector<OptionValue> toArray() const;
private:
ValueType type_;
int integer_;
std::string string_;
KeyValueParser::Options keyValues_;
+ std::vector<OptionValue> array_;
};
class OptionsParser