diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2020-04-27 15:00:07 +0200 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2020-05-01 12:24:07 +0200 |
commit | cdf7fbe35e60e9341809446a66a3e0637a74d743 (patch) | |
tree | 12f7b6711ab617325d110e0dddbce68a29a47f53 | |
parent | e66d4f382317c1339cc46071f558affd1582062b (diff) |
cam: options: Add public method to invalidate options
Extend OptionsBase<T> with a public invalidate() method. This allows for
further examination of the options and if found unsuitable be
invalidated. The intended user for this new interface are subclasses of
KeyValueParser.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r-- | src/cam/options.cpp | 6 | ||||
-rw-r--r-- | src/cam/options.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/cam/options.cpp b/src/cam/options.cpp index 2c56eacf..77b3cc1f 100644 --- a/src/cam/options.cpp +++ b/src/cam/options.cpp @@ -65,6 +65,12 @@ const OptionValue &OptionsBase<T>::operator[](const T &opt) const } template<typename T> +void OptionsBase<T>::invalidate() +{ + valid_ = false; +} + +template<typename T> bool OptionsBase<T>::parseValue(const T &opt, const Option &option, const char *optarg) { diff --git a/src/cam/options.h b/src/cam/options.h index ad5c93a4..18486619 100644 --- a/src/cam/options.h +++ b/src/cam/options.h @@ -54,6 +54,8 @@ public: bool isSet(const T &opt) const; const OptionValue &operator[](const T &opt) const; + void invalidate(); + private: friend class KeyValueParser; friend class OptionsParser; |