From patchwork Wed Jul 7 02:19:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12822 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 17B7DBD794 for ; Wed, 7 Jul 2021 02:20:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5EA9068508; Wed, 7 Jul 2021 04:20:39 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Telmcv1A"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BB3556850B for ; Wed, 7 Jul 2021 04:20:34 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 51F1F466 for ; Wed, 7 Jul 2021 04:20:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1625624434; bh=0ottbuWo/y+fVqmSnUM4bxnkf4AhDbIHUgARJhcD0jk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Telmcv1AJhXQfRJCyLHwFAj62tgQI3y3YIjmlFJgrBkJSJL3C9HGpYoVSpNrpxAyd SdfpGWPHthaAD0nBPZcifI9/ED129WxCTlLNYTXeil96C9BGsX+aAEz7nd0Qae/pMB WDPCkuB2ObBH8+edhUzUMJfwXGk+YcmoumlcungU= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Wed, 7 Jul 2021 05:19:20 +0300 Message-Id: <20210707021941.20804-10-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210707021941.20804-1-laurent.pinchart@ideasonboard.com> References: <20210707021941.20804-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 09/30] cam: options: Support parent-child relationship between 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add support for creating a tree-based hiearchy of options instead of a flat list. This is useful to support options that need to be interpreted in the context of a particular occurrence of an array option. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/cam/options.cpp | 217 ++++++++++++++++++++++++++++++++++++++------ src/cam/options.h | 14 ++- 2 files changed, 199 insertions(+), 32 deletions(-) diff --git a/src/cam/options.cpp b/src/cam/options.cpp index 4a88c38fb154..d7f9f741c731 100644 --- a/src/cam/options.cpp +++ b/src/cam/options.cpp @@ -79,6 +79,12 @@ * \var Option::isArray * \brief Whether the option can appear once or multiple times * + * \var Option::parent + * \brief The parent option + * + * \var Option::children + * \brief List of child options, storing all options whose parent is this option + * * \fn Option::hasShortOption() * \brief Tell if the option has a short option specifier (e.g. `-f`) * \return True if the option has a short option specifier, false otherwise @@ -96,6 +102,8 @@ struct Option { const char *help; KeyValueParser *keyValueParser; bool isArray; + Option *parent; + std::list