From f8386836dfda04c626e63ba9d64c1a4f63867dfa Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 23 Mar 2019 06:05:46 +0200 Subject: cam: Separate options valid() and empty() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An empty option list is not necessarily an error. Add a new empty() function to test the option list for emptiness, and modify the valid() function to only notify parsing errors. As a side effect this allows accessing partially parsed options, which may be useful in the future. Signed-off-by: Laurent Pinchart Acked-by: Jacopo Mondi Reviewed-by: Niklas Söderlund --- src/cam/options.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/cam/options.h') diff --git a/src/cam/options.h b/src/cam/options.h index 6e3ef62e..5e346b47 100644 --- a/src/cam/options.h +++ b/src/cam/options.h @@ -47,6 +47,9 @@ template class OptionsBase { public: + OptionsBase() : valid_(false) {} + + bool empty() const; bool valid() const; bool isSet(const T &opt) const; const OptionValue &operator[](const T &opt) const; @@ -56,9 +59,9 @@ private: friend class OptionsParser; bool parseValue(const T &opt, const Option &option, const char *value); - void clear(); std::map values_; + bool valid_; }; class KeyValueParser -- cgit v1.2.1