From patchwork Thu Jun 16 14:24:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 16241 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 D653AC3276 for ; Thu, 16 Jun 2022 14:24:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 706F165635; Thu, 16 Jun 2022 16:24:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655389466; bh=ZttNfuLXQgYgSHWyV79OsPjjYDVeCxtqYKq4DxCSCuo=; 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=L4xGPbGyZnybSTMvNra57qTVPRMIosuEG0GYYgvVV3lEklJxNk+P6v7xIGW1d+wdr 9IHF4KYQ5KTvukaR0T0bI+4UcfSd8h3NZSHUpHy9tvDgZ1pfRvc+NqGZrjc3MBo8c4 XEJkZwamijT7vmFBVyJso79QeoYMf94X9stvifqRqP8KbjrQVHOLKffOV3fiRv8ZkH M0/PoCJXkz18MHYcboIwdjRFZTASQ9t58Qpi2doNxJrzQgOxppPfA66B0vxbI1zNwO rW8hQXBKFDxXF0xslKVmmaL1Le0OJfi8JI63/3Y2uZrEn9UFn0QiVehOwrpo1W+bEk g1LDFVOpFmAng== 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 D282A65635 for ; Thu, 16 Jun 2022 16:24:21 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="aTyfIj8Z"; dkim-atps=neutral Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D97FD415; Thu, 16 Jun 2022 16:24:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1655389461; bh=ZttNfuLXQgYgSHWyV79OsPjjYDVeCxtqYKq4DxCSCuo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aTyfIj8ZkwG7e20Dwna2k/lk0AyY88eTVIclh6/b2tfFamxMBCTkSwqkuclhWJ5/X okmk4ymcORzXsPNsIsGkpRNS6v0wAmJ/UTRjyjZlqmR7HBLG5Ex4TBQzRlnqoPkNNg pwKXZQvV1jZBK79DHZlPFcIf0uMUP0fbAZBVNYVU= To: libcamera-devel@lists.libcamera.org Date: Thu, 16 Jun 2022 17:24:01 +0300 Message-Id: <20220616142403.20723-6-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220616142403.20723-1-laurent.pinchart@ideasonboard.com> References: <20220616142403.20723-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 5/7] 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 Reviewed-by: Jacopo Mondi Reviewed-by: Han-Lin Chen --- 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 8edd32354184..811be1affcc0 100644 --- a/include/libcamera/internal/yaml_parser.h +++ b/include/libcamera/internal/yaml_parser.h @@ -172,7 +172,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 4df7e5a33d47..9b6e70cbfcf3 100644 --- a/src/libcamera/yaml_parser.cpp +++ b/src/libcamera/yaml_parser.cpp @@ -335,28 +335,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 ab6e9a01c0fe..38f848232fa6 100644 --- a/test/yaml-parser.cpp +++ b/test/yaml-parser.cpp @@ -500,16 +500,6 @@ protected: /* Make sure utils::map_keys() works on the adapter. */ (void)utils::map_keys(dictObj.asDict()); - 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"];