From 2a608965f8cb4bb93522e9b22af840c688ec12a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Fri, 22 Mar 2019 02:11:22 +0100 Subject: cam: options: Add an array data type to OptionValue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Laurent Pinchart --- src/cam/options.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/cam/options.h') 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 #include #include +#include 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() const; int toInteger() const; std::string toString() const; KeyValueParser::Options toKeyValues() const; + std::vector toArray() const; private: ValueType type_; int integer_; std::string string_; KeyValueParser::Options keyValues_; + std::vector array_; }; class OptionsParser -- cgit v1.2.1