From patchwork Fri May 1 02:34:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 3644 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6FB6B6149A for ; Fri, 1 May 2020 04:34:43 +0200 (CEST) X-Halon-ID: 4f4eebda-8b54-11ea-89d0-0050569116f7 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2392.dip0.t-ipconnect.de [79.202.35.146]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id 4f4eebda-8b54-11ea-89d0-0050569116f7; Fri, 01 May 2020 04:34:41 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Fri, 1 May 2020 04:34:28 +0200 Message-Id: <20200501023432.90032-3-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200501023432.90032-1-niklas.soderlund@ragnatech.se> References: <20200501023432.90032-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/6] cam: options: Add public method to invalidate options X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 02:34:43 -0000 Extend OptionsBase 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 Reviewed-by: Laurent Pinchart --- 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::operator[](const T &opt) const return values_.find(opt)->second; } +template +void OptionsBase::invalidate() +{ + valid_ = false; +} + template bool OptionsBase::parseValue(const T &opt, const Option &option, const char *optarg) diff --git a/src/cam/options.h b/src/cam/options.h index ad5c93a4fabd089f..184866195eef990a 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;