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>
This commit is contained in:
Niklas Söderlund 2020-04-27 15:00:07 +02:00
parent e66d4f3823
commit cdf7fbe35e
2 changed files with 8 additions and 0 deletions

View file

@ -64,6 +64,12 @@ const OptionValue &OptionsBase<T>::operator[](const T &opt) const
return values_.find(opt)->second; return values_.find(opt)->second;
} }
template<typename T>
void OptionsBase<T>::invalidate()
{
valid_ = false;
}
template<typename T> template<typename T>
bool OptionsBase<T>::parseValue(const T &opt, const Option &option, bool OptionsBase<T>::parseValue(const T &opt, const Option &option,
const char *optarg) const char *optarg)

View file

@ -54,6 +54,8 @@ public:
bool isSet(const T &opt) const; bool isSet(const T &opt) const;
const OptionValue &operator[](const T &opt) const; const OptionValue &operator[](const T &opt) const;
void invalidate();
private: private:
friend class KeyValueParser; friend class KeyValueParser;
friend class OptionsParser; friend class OptionsParser;