From patchwork Sat Jun 4 18:59:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 16165 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 EEEF9C327A for ; Sat, 4 Jun 2022 19:00:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 070626564C; Sat, 4 Jun 2022 21:00:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1654369216; bh=v1mnG3JXPIC1r12cJ7UCp9XicED3HrFTGWy07p9m4bQ=; 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=uB0K26aBQZJI+0J1oKYBrrcaTkhLIFFLLenA+kRJxX5+U7tStIfZ7AGmYHkveg4fZ FhugbqeiPHIhhgJyJaOD8uRafEVjr9c7jTTViBAXMsW+QkcoKEiL1MflD++QfHgsc9 M+YftH9SIsQ54ni0VlxfMt57sQuXKSzWduz9+l9wMJnYD+OamNBrUD7S81L1D2bYnt nE71yXQ5qx1Tvv2R4NyBgx3ZeB9ugr3nW9BTGpZ4dj19zWiMWFUPPPgmonJJuWqgY9 ovwYGAlTbKnUqKZqdHPPwHwDA8efzuuwArH10bhwq0/timEq83WBM3ZErQFn+yxYbu Qbn7d/O6+Gl/A== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C154A65639 for ; Sat, 4 Jun 2022 21:00:14 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="JNa1WUlg"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (85-76-79-203-nat.elisa-mobile.fi [85.76.79.203]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 000BD6D4; Sat, 4 Jun 2022 21:00:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1654369214; bh=v1mnG3JXPIC1r12cJ7UCp9XicED3HrFTGWy07p9m4bQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JNa1WUlgMeAWiTOJ19lyXn30tpoMc2uEV8vW9ZWOFqPU0+72QU34vYMQcsovTUo3V qmIeoiYAmmvFUMkRWSXBksiVv8WkH/C6BVbZGW2QBEPeTgSV+LJxzDxYCkN9C0u7kO RaOq45sDpQcg/zTXj6OU0ScqSON69X9DCB98bBbs= To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Jun 2022 21:59:35 +0300 Message-Id: <20220604185939.29163-11-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220604185939.29163-1-laurent.pinchart@ideasonboard.com> References: <20220604185939.29163-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v2 10/14] 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 | 9 --------- 3 files changed, 32 deletions(-) diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h index e142cde0fb6f..d0ddb5f682b2 100644 --- a/include/libcamera/internal/yaml_parser.h +++ b/include/libcamera/internal/yaml_parser.h @@ -179,7 +179,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 9cdb370d0f2e..97104ac118a8 100644 --- a/src/libcamera/yaml_parser.cpp +++ b/src/libcamera/yaml_parser.cpp @@ -332,28 +332,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, _] : list_) - 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 6dfec49d6be0..bd92869a4cb3 100644 --- a/test/yaml-parser.cpp +++ b/test/yaml-parser.cpp @@ -489,15 +489,6 @@ protected: i++; } - auto memeberNames = dictObj.memberNames(); - - if (memeberNames[0] != "a" || - memeberNames[1] != "c" || - memeberNames[2] != "b") { - cerr << "Dictionary object fail to parse member names" << std::endl; - return TestFail; - } - /* Test leveled objects */ auto &level1Obj = (*root)["level1"];