[libcamera-devel] [PATCH v2 2/5] cam: options: Add public method to invalided options
Niklas Söderlund
niklas.soderlund at ragnatech.se
Tue Apr 28 00:05:26 CEST 2020
Extend OptionsBase<T> with a public invalidate() method. This allows
sub-classes to continue the interpreting of parsed options and
invalidate them if they find problems with the result.
Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
---
src/cam/options.cpp | 6 ++++++
src/cam/options.h | 2 ++
2 files changed, 8 insertions(+)
diff --git a/src/cam/options.cpp b/src/cam/options.cpp
index 2c56eacf006e9857..77b3cc1f8c5a59e9 100644
--- a/src/cam/options.cpp
+++ b/src/cam/options.cpp
@@ -64,6 +64,12 @@ const OptionValue &OptionsBase<T>::operator[](const T &opt) const
return values_.find(opt)->second;
}
+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 5060fee0c26b896f..8ccbfee48f7ca0b5 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;
--
2.26.0
More information about the libcamera-devel
mailing list