Patch Detail
Show a patch.
GET /api/patches/25733/?format=api
{ "id": 25733, "url": "https://patchwork.libcamera.org/api/patches/25733/?format=api", "web_url": "https://patchwork.libcamera.org/patch/25733/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260113000808.15395-14-laurent.pinchart@ideasonboard.com>", "date": "2026-01-13T00:07:45", "name": "[13/36] libcamera: yaml_parser: Add functions to add children", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "cdf942b3a95c3c8c907dbd351b4a82b767a2881a", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/25733/mbox/", "series": [ { "id": 5703, "url": "https://patchwork.libcamera.org/api/series/5703/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5703", "date": "2026-01-13T00:07:32", "name": "libcamera: Global configuration file improvements", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5703/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/25733/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/25733/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 412FAC3285\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 Jan 2026 00:08:52 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DAB8F61FC8;\n\tTue, 13 Jan 2026 01:08:51 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8B96F61FA0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Jan 2026 01:08:49 +0100 (CET)", "from pendragon.ideasonboard.com (81-175-209-152.bb.dnainternet.fi\n\t[81.175.209.152])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id E7399F06\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Jan 2026 01:08:23 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"QWeiRx8w\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1768262904;\n\tbh=XVtOyYEbCFRCjvtXM9h5zxsGQ6SU/UvgTNZZGyL57k8=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=QWeiRx8w2wh6WM7WN+JEHarBetXO7CfRu7vGZJlNdort28RyMNy3+1mo3u7cJCIdd\n\tsufsol3YbQgY8uRWSTMA16GbyEznarYkQifbcvpOunXHiDIxguFopFHQAoI1k0t5Zu\n\ttExWwNVCiYvUx04DILOgxPgpDn3uiisiO8mldR1o=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH 13/36] libcamera: yaml_parser: Add functions to add children", "Date": "Tue, 13 Jan 2026 02:07:45 +0200", "Message-ID": "<20260113000808.15395-14-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.51.2", "In-Reply-To": "<20260113000808.15395-1-laurent.pinchart@ideasonboard.com>", "References": "<20260113000808.15395-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add YamlObject::add() functions to add children to a list or dictionary\nobject. This will be used by the YamlParserContext to replace direct\naccess to YamlObject member variables to decouple the two classes.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/yaml_parser.h | 3 ++\n src/libcamera/yaml_parser.cpp | 56 ++++++++++++++++++++++++\n 2 files changed, 59 insertions(+)", "diff": "diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h\nindex c98fe003c877..ede2c3de687c 100644\n--- a/include/libcamera/internal/yaml_parser.h\n+++ b/include/libcamera/internal/yaml_parser.h\n@@ -196,6 +196,9 @@ public:\n \tbool contains(std::string_view key) const;\n \tconst YamlObject &operator[](std::string_view key) const;\n \n+\tYamlObject *add(std::unique_ptr<YamlObject> child);\n+\tYamlObject *add(std::string key, std::unique_ptr<YamlObject> child);\n+\n private:\n \tLIBCAMERA_DISABLE_COPY_AND_MOVE(YamlObject)\n \ndiff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp\nindex 9b61d3e8fc50..7462e2d74179 100644\n--- a/src/libcamera/yaml_parser.cpp\n+++ b/src/libcamera/yaml_parser.cpp\n@@ -448,6 +448,62 @@ const YamlObject &YamlObject::operator[](std::string_view key) const\n \treturn *iter->second;\n }\n \n+/**\n+ * \\brief Add a child object to a list\n+ * \\param[in] child The child object\n+ *\n+ * Append the \\a child node as the last element of this node's children list.\n+ * This node must be empty, in which case it is converted to the Type::List\n+ * type, or be a list. Otherwise, the \\a child is discarded and the function\n+ * returns a nullptr.\n+ *\n+ * \\return A pointer to the child object if successfully added, nullptr\n+ * otherwise\n+ */\n+YamlObject *YamlObject::add(std::unique_ptr<YamlObject> child)\n+{\n+\tif (type_ == Type::Empty)\n+\t\ttype_ = Type::List;\n+\n+\tif (type_ != Type::List)\n+\t\treturn nullptr;\n+\n+\tValue &elem = list_.emplace_back(std::string{}, std::move(child));\n+\treturn elem.value.get();\n+}\n+\n+/**\n+ * \\brief Add a child object to a dictionary\n+ * \\param[in] key The dictionary key\n+ * \\param[in] child The child object\n+ *\n+ * Add the \\a child node with the given \\a key to this node's children. This\n+ * node must be empty, in which case it is converted to the Type::Dictionary\n+ * type, or be a dictionary. Otherwise, the \\a child is discarded and the\n+ * function returns a nullptr.\n+ *\n+ * Keys are unique. If a child with the same \\a key already exist, the \\a child\n+ * is discarded and the function returns a nullptr.\n+ *\n+ * \\return A pointer to the child object if successfully added, nullptr\n+ * otherwise\n+ */\n+YamlObject *YamlObject::add(std::string key, std::unique_ptr<YamlObject> child)\n+{\n+\tif (type_ == Type::Empty)\n+\t\ttype_ = Type::Dictionary;\n+\n+\tif (type_ != Type::Dictionary)\n+\t\treturn nullptr;\n+\n+\tif (dictionary_.find(key) != dictionary_.end())\n+\t\treturn nullptr;\n+\n+\tValue &elem = list_.emplace_back(std::move(key), std::move(child));\n+\tdictionary_.emplace(elem.key, elem.value.get());\n+\treturn elem.value.get();\n+}\n+\n #ifndef __DOXYGEN__\n \n class YamlParserContext\n", "prefixes": [ "13/36" ] }