From patchwork Tue May 24 22:58:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 16034 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 37F81C3256 for ; Tue, 24 May 2022 22:58:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CA88D6567B; Wed, 25 May 2022 00:58:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1653433116; bh=2nQl4KS4/oBh2PeoCRVpWrYuo4qMue8+OMbQmS8DqUY=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=u/cMl7QobJv9BkB+wA2ly7gAnxzblotbpgocw3FccHz41q1yDkcbnpgencl6OQd+x 2xX3C88EZvhVezUnB/Zh6n+MCmXS4TdokZvYZoTdTMstJkOvQtU4q4JHEN0gQH4Aqq t/bCryYGlMB2O3yBVsJcUvoxjAPEZisH+iiCTTp6SK8lO3Bmwy3p5F4k+FFooq58P0 ryUSlYMXr0+5ZHjpd6Fw1EAX4yyE0SIGtVm4JqAZ0U9j2n8+0uJenULUsHGxf0JNNA R5Jtwm0YbXOwKnmxuzQ0e5o/Oj0hz/d69pcToJ1qJvuf4n+PHfNn6QFMZHdouRkLZE CGL+WcVIwDngw== 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 4BD6465672 for ; Wed, 25 May 2022 00:58:29 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ZOQXJBmT"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (ip-109-40-241-133.web.vodafone.de [109.40.241.133]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BDA001051; Wed, 25 May 2022 00:58:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1653433109; bh=2nQl4KS4/oBh2PeoCRVpWrYuo4qMue8+OMbQmS8DqUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZOQXJBmTMP5EPdgLZtgoJUi60qSDkLy4YK8DDXi758AQgW1/heiEyQuwBlPW00SM2 SmCdhdC0m/2R0z2f2U/EUSKPz8Hx/UVQKWHQbkILEiNl1i4IRv8ZmZmJP794kyAT7K cJGwki2pHSeQrD/Bgqx6G8OdTvUg5TkLe1J4uC8M= To: libcamera-devel@lists.libcamera.org Date: Wed, 25 May 2022 01:58:12 +0300 Message-Id: <20220524225816.6830-9-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220524225816.6830-1-laurent.pinchart@ideasonboard.com> References: <20220524225816.6830-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 08/12] libcamera: yaml_parser: Remove memberNames() function 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-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Now that YamlObject supports iteration, the memberNames() function isn't useful anymore as it can be implemented using utils::map_keys() if really needed. Drop it. Signed-off-by: Laurent Pinchart --- include/libcamera/internal/yaml_parser.h | 1 - src/libcamera/yaml_parser.cpp | 22 ---------------------- test/yaml-parser.cpp | 10 ---------- 3 files changed, 33 deletions(-) diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h index 22ed87efdf8f..79537ff2ea7c 100644 --- a/include/libcamera/internal/yaml_parser.h +++ b/include/libcamera/internal/yaml_parser.h @@ -170,7 +170,6 @@ public: bool contains(const std::string &key) const; const YamlObject &operator[](const std::string &key) const; - std::vector memberNames() const; private: LIBCAMERA_DISABLE_COPY_AND_MOVE(YamlObject) diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp index a156df36e222..65b9a9097375 100644 --- a/src/libcamera/yaml_parser.cpp +++ b/src/libcamera/yaml_parser.cpp @@ -333,28 +333,6 @@ bool YamlObject::contains(const std::string &key) const return true; } -/** - * \fn YamlObject::memberNames() - * \brief Retrieve all member names of the dictionary - * - * This function retrieve member names of a YamlObject. Only YamlObject - * instances of Dictionary type associate elements with names, calling this - * function on other types of instances is invalid and results in undefined - * behaviour. - * - * \todo Replace this function with an iterator-based API - * - * \return A vector of string as the member names - */ -std::vector YamlObject::memberNames() const -{ - std::vector memberNames; - for (auto &[key, _] : dictionary_) - memberNames.push_back(key); - - return memberNames; -} - /** * \fn YamlObject::operator[](const std::string &key) const * \brief Retrieve a member by name from the dictionary diff --git a/test/yaml-parser.cpp b/test/yaml-parser.cpp index 7ad9936bb82b..3662e7144dfd 100644 --- a/test/yaml-parser.cpp +++ b/test/yaml-parser.cpp @@ -488,16 +488,6 @@ protected: i++; } - auto memeberNames = dictObj.memberNames(); - sort(memeberNames.begin(), memeberNames.end()); - - if (memeberNames[0] != "a" || - memeberNames[1] != "b" || - memeberNames[2] != "c") { - cerr << "Dictionary object fail to parse member names" << std::endl; - return TestFail; - } - /* Test leveled objects */ auto &level1Obj = (*root)["level1"];