Show a patch.

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

{
    "id": 22183,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/22183/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/22183/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20241205163411.1160094-1-pobrn@protonmail.com>",
    "date": "2024-12-05T16:34:14",
    "name": "[v1,1/3] libcamera: yaml_parser: Add `YamlObject::find(key)`",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "b71575e228682909ef95fb80c93f7b25e6628b9e",
    "submitter": {
        "id": 133,
        "url": "https://patchwork.libcamera.org/api/1.1/people/133/?format=api",
        "name": "Pőcze Barnabás",
        "email": "pobrn@protonmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/22183/mbox/",
    "series": [
        {
            "id": 4852,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4852/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4852",
            "date": "2024-12-05T16:34:14",
            "name": "[v1,1/3] libcamera: yaml_parser: Add `YamlObject::find(key)`",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4852/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/22183/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/22183/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 686E4C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  5 Dec 2024 16:37:23 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A26CA6608C;\n\tThu,  5 Dec 2024 17:37:22 +0100 (CET)",
            "from mail-4316.protonmail.ch (mail-4316.protonmail.ch\n\t[185.70.43.16])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A76926608C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  5 Dec 2024 17:37:20 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=protonmail.com header.i=@protonmail.com\n\theader.b=\"g9xFj6m8\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n\ts=protonmail3; t=1733416640; x=1733675840;\n\tbh=HhTjhbMk2safotm4T9XMUDnMbUuHywURi1D29AvbZ6s=;\n\th=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date:\n\tSubject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector:\n\tList-Unsubscribe:List-Unsubscribe-Post;\n\tb=g9xFj6m8rRKKoUsxcFXqg7fTOhkOKP3xAR8nqkaD5VyauH5L5+Owq2ONy6yIN0MwR\n\tByoVDGDKhByjOutU/5E+MpxKK/kNh3eTv3+hwn+SqrWbVEKyP7wZHyvVb4m7VtgJuU\n\t5RS5fzPGOrB/zoHIYkV1trquMKhN1/J5tUPkhhA3Y85gaV0c2uHi+N2O09VvVFmJ3E\n\tMpssldJcaypGttEYOmO4wTQdRrnMp1+TYxms2D+ZALQY98fZ8HHKDkD9eBvUrWs28g\n\t2xCG+GeXZP3/xulFZ0HPGSxf+kadA0bni4TPaP6KZ97lfqIjZjjWqwQzxRYJHy1605\n\t5KFtlhGrAavTw==",
        "Date": "Thu, 05 Dec 2024 16:34:14 +0000",
        "To": "libcamera-devel@lists.libcamera.org",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>",
        "Subject": "[PATCH v1 1/3] libcamera: yaml_parser: Add `YamlObject::find(key)`",
        "Message-ID": "<20241205163411.1160094-1-pobrn@protonmail.com>",
        "Feedback-ID": "20568564:user:proton",
        "X-Pm-Message-ID": "bd17c12cf3c838d95659c315085fb7c008f3bb89",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=utf-8",
        "Content-Transfer-Encoding": "quoted-printable",
        "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": "This function is meant to replace `YamlObject::contains()`\nas it can be easily used for the same purpose, i.e. determining\nif a certain key exists in a dictionary, but it has the advantage\nthat the result, if any, is immediately available for use\nwithout having to do a second lookup.\n\nSigned-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n---\n include/libcamera/internal/yaml_parser.h |  1 +\n src/libcamera/yaml_parser.cpp            | 23 +++++++++++++++++++++++\n 2 files changed, 24 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h\nindex 8c791656..796e3e90 100644\n--- a/include/libcamera/internal/yaml_parser.h\n+++ b/include/libcamera/internal/yaml_parser.h\n@@ -209,6 +209,7 @@ public:\n \n \tbool contains(std::string_view key) const;\n \tconst YamlObject &operator[](std::string_view key) const;\n+\tconst YamlObject *find(std::string_view key) const;\n \n private:\n \tLIBCAMERA_DISABLE_COPY_AND_MOVE(YamlObject)\ndiff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp\nindex db256ec5..da8cb61f 100644\n--- a/src/libcamera/yaml_parser.cpp\n+++ b/src/libcamera/yaml_parser.cpp\n@@ -397,6 +397,29 @@ const YamlObject &YamlObject::operator[](std::string_view key) const\n \treturn *iter->second;\n }\n \n+/**\n+ * \\fn YamlObject::find(std::string_view key) const\n+ * \\brief Retrieve a member by name from the dictionary\n+ *\n+ * This function retrieves a member of a YamlObject by name. Only YamlObject\n+ * instances of Dictionary type associate elements with names, calling this\n+ * function on other types of instances or with a nonexistent key results in\n+ * \\a nullptr being returned.\n+ *\n+ * \\return The YamlObject corresponding to the \\a key member\n+ */\n+const YamlObject *YamlObject::find(std::string_view key) const\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 #ifndef __DOXYGEN__\n \n class YamlParserContext\n",
    "prefixes": [
        "v1",
        "1/3"
    ]
}