diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-03-23 06:05:46 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-03-27 18:26:15 +0200 |
commit | f8386836dfda04c626e63ba9d64c1a4f63867dfa (patch) | |
tree | 087c476c791cca82602f19fec0d372ba1e7abbbf /src/cam/options.h | |
parent | 3f906920e4d448441c442be1ce6c7376e33d4237 (diff) |
cam: Separate options valid() and empty()
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 <laurent.pinchart@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/cam/options.h')
-rw-r--r-- | src/cam/options.h | 5 |
1 files changed, 4 insertions, 1 deletions
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<typename T> 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<T, OptionValue> values_; + bool valid_; }; class KeyValueParser |