Show a patch.

GET /api/patches/25748/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 25748,
    "url": "https://patchwork.libcamera.org/api/patches/25748/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/25748/",
    "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-29-laurent.pinchart@ideasonboard.com>",
    "date": "2026-01-13T00:08:00",
    "name": "[28/36] libcamera: value_node: Add mutable children accessors",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "93d3dfb6ee47c68326a7dd80277811a84d7e353c",
    "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/25748/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/25748/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/25748/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 A33A4C32DE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 Jan 2026 00:09:18 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3A8AB61FFB;\n\tTue, 13 Jan 2026 01:09:18 +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 90CF161FBB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Jan 2026 01:09:15 +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 E3F8EBCA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Jan 2026 01:08:49 +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=\"C75crtFw\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1768262930;\n\tbh=3Lf3x50+ATkUhpAAFRKWHCsJniBHxNzC3uzR9CcRQOM=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=C75crtFwKFBv5F/cXEKgkJt52KmVafxKyjw50/IcEgK2IWlZwY99jvmQqaMt87NAR\n\t2+I5qR6eudt1mi2wdv8awDjz/++COVQOVcx+XpKFQQuzOgCBoGyPTI8n2rw4TaYiAO\n\tNLoHIeDO/9NKbc0tlGokT5QlG2KL23pl7lvE6wNc=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH 28/36] libcamera: value_node: Add mutable children accessors",
        "Date": "Tue, 13 Jan 2026 02:08:00 +0200",
        "Message-ID": "<20260113000808.15395-29-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": "At two at() functions that return mutable pointer to child nodes, based\non an index for lists and a key for dictionaries.\n\nThe API differs from const children accessors that use operator[] and\nreturn a reference in order to allow better error handling: while the\nconst accessors return a reference to a global instance of an empty\nValueNode when the requested child doesn't exist, a mutable accessor\ncan't do the same without allowing modifying the empty global instance.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/value_node.h |  2 ++\n src/libcamera/value_node.cpp            | 41 +++++++++++++++++++++++++\n 2 files changed, 43 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/value_node.h b/include/libcamera/internal/value_node.h\nindex 56d200e1cf27..c285be4957ed 100644\n--- a/include/libcamera/internal/value_node.h\n+++ b/include/libcamera/internal/value_node.h\n@@ -228,9 +228,11 @@ public:\n \tConstDictAdapter asDict() const { return ConstDictAdapter{ list_ }; }\n \tConstListAdapter asList() const { return ConstListAdapter{ list_ }; }\n \n+\tValueNode *at(std::size_t index);\n \tconst ValueNode &operator[](std::size_t index) const;\n \n \tbool contains(std::string_view key) const;\n+\tValueNode *at(std::string_view key);\n \tconst ValueNode &operator[](std::string_view key) const;\n \n \tValueNode *add(std::unique_ptr<ValueNode> child);\ndiff --git a/src/libcamera/value_node.cpp b/src/libcamera/value_node.cpp\nindex 3c56b47bf79d..50b23284f930 100644\n--- a/src/libcamera/value_node.cpp\n+++ b/src/libcamera/value_node.cpp\n@@ -384,6 +384,24 @@ template struct ValueNode::Accessor<std::vector<std::string>>;\n  * \\return An adapter of unspecified type compatible with range-based for loops\n  */\n \n+/**\n+ * \\brief Retrieve the element from list ValueNode by index\n+ * \\param[in] index The element index\n+ *\n+ * This function retrieves an element of the ValueNode. Only ValueNode\n+ * instances of List type associate elements with index, calling this function\n+ * on other types of instances or with an invalid index returns a null pointer.\n+ *\n+ * \\return The ValueNode as an element of the list\n+ */\n+ValueNode *ValueNode::at(std::size_t index)\n+{\n+\tif (type_ != Type::List || index >= size())\n+\t\treturn nullptr;\n+\n+\treturn list_[index].value.get();\n+}\n+\n /**\n  * \\brief Retrieve the element from list ValueNode by index\n  * \\param[in] index The element index\n@@ -419,6 +437,29 @@ bool ValueNode::contains(std::string_view key) const\n \treturn dictionary_.find(key) != dictionary_.end();\n }\n \n+/**\n+ * \\brief Retrieve a member by key from the dictionary\n+ * \\param[in] key The element key\n+ *\n+ * This function retrieves a member of a ValueNode by \\a key. Only ValueNode\n+ * instances of Dictionary type associate elements with keys, calling this\n+ * function on other types of instances or with a nonexistent key returns a null\n+ * pointer.\n+ *\n+ * \\return The ValueNode corresponding to the \\a key member\n+ */\n+ValueNode *ValueNode::at(std::string_view key)\n+{\n+\tif (type_ != Type::Dictionary)\n+\t\treturn nullptr;\n+\n+\tauto iter = dictionary_.find(key);\n+\tif (iter == dictionary_.end())\n+\t\treturn nullptr;\n+\n+\treturn iter->second;\n+}\n+\n /**\n  * \\brief Retrieve a member by key from the dictionary\n  * \\param[in] key The element key\n",
    "prefixes": [
        "28/36"
    ]
}