Show a patch.

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

{
    "id": 16148,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/16148/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16148/",
    "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": "<20220604092422.77185-1-jacopo@jmondi.org>",
    "date": "2022-06-04T09:24:22",
    "name": "[libcamera-devel,v2] libcamera: request: Add operator<<()",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "c145e5fd75c5e26d570fdb4e00499ef1d34f331e",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16148/mbox/",
    "series": [
        {
            "id": 3159,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3159/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3159",
            "date": "2022-06-04T09:24:22",
            "name": "[libcamera-devel,v2] libcamera: request: Add operator<<()",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3159/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16148/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16148/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 7B876BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  4 Jun 2022 09:24:30 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8065B65631;\n\tSat,  4 Jun 2022 11:24:29 +0200 (CEST)",
            "from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 685336559A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  4 Jun 2022 11:24:28 +0200 (CEST)",
            "(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id D74ADFF806;\n\tSat,  4 Jun 2022 09:24:27 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1654334669;\n\tbh=dPlzdrnJoT70ePJbttXHgrVTXRJMziBvK1IHSsPFwmM=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=yoD1wFTvRETzKeFc6bBE/AK0FTE+YgAjABT1OyHYgi7OjtWBLpMLz0Qmj9OdvciH6\n\tFJBVflfLQ7mfz6faGdiWW6lsbqu+Sc6xRh3i9qkliUJRcXgKqWweFaNAfuOM18CB57\n\tpOt2tl+4aC0AKPzAEukHTx9zr46CnDdbkAqPetx7noeAmn2rBVd6p//AwyW4MSycId\n\trwuUVp7Qod5RKJBicRayWDtxmTKlSrdkMFgtYIACzDjB28lvhdooDQJm7499K/EBch\n\t/OyqWqEWiVFQ1XvIEREPfqLukE9k/KJx3iotDfhKPjGJI46OuNy1viRfGZksHC6rLN\n\tykFEFWBx976FQ==",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat,  4 Jun 2022 11:24:22 +0200",
        "Message-Id": "<20220604092422.77185-1-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.35.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2] libcamera: request: Add operator<<()",
        "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>",
        "From": "Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Jacopo Mondi <jacopo@jmondi.org>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "With the recent addition of operator<<() in most libcamera core classes\nto replace usage of the toString() function the Request class was left\nbehind.\n\nAdd operator<<() for the Request class and reimplement toString().\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\n---\nv2:\n- reimplement toString() using operator<<\n\n---\n include/libcamera/internal/request.h |  1 +\n include/libcamera/request.h          |  3 +++\n src/libcamera/request.cpp            | 20 ++++++++++++++++----\n 3 files changed, 20 insertions(+), 4 deletions(-)\n\n--\n2.35.1",
    "diff": "diff --git a/include/libcamera/internal/request.h b/include/libcamera/internal/request.h\nindex 1f2499896e23..9dadd6c60361 100644\n--- a/include/libcamera/internal/request.h\n+++ b/include/libcamera/internal/request.h\n@@ -44,6 +44,7 @@ public:\n\n private:\n \tfriend class PipelineHandler;\n+\tfriend std::ostream &operator<<(std::ostream &out, const Request &r);\n\n \tvoid doCancelRequest();\n \tvoid emitPrepareCompleted();\ndiff --git a/include/libcamera/request.h b/include/libcamera/request.h\nindex 1eb537e9b09b..dffde1536cad 100644\n--- a/include/libcamera/request.h\n+++ b/include/libcamera/request.h\n@@ -9,6 +9,7 @@\n\n #include <map>\n #include <memory>\n+#include <ostream>\n #include <stdint.h>\n #include <string>\n #include <unordered_set>\n@@ -75,4 +76,6 @@ private:\n \tStatus status_;\n };\n\n+std::ostream &operator<<(std::ostream &out, const Request &r);\n+\n } /* namespace libcamera */\ndiff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\nindex 5704972d86af..51d74b294d38 100644\n--- a/src/libcamera/request.cpp\n+++ b/src/libcamera/request.cpp\n@@ -582,16 +582,28 @@ bool Request::hasPendingBuffers() const\n std::string Request::toString() const\n {\n \tstd::stringstream ss;\n+\tss << *this;\n\n+\treturn ss.str();\n+}\n+\n+/**\n+ * \\brief Insert a text representation of a Request into an output stream\n+ * \\param[in] out The output stream\n+ * \\param[in] r The Request\n+ * \\return The output stream \\a out\n+ */\n+std::ostream &operator<<(std::ostream &out, const Request &r)\n+{\n \t/* Pending, Completed, Cancelled(X). */\n \tstatic const char *statuses = \"PCX\";\n\n \t/* Example Output: Request(55:P:1/2:6523524) */\n-\tss << \"Request(\" << sequence() << \":\" << statuses[status_] << \":\"\n-\t   << _d()->pending_.size() << \"/\" << bufferMap_.size() << \":\"\n-\t   << cookie_ << \")\";\n+\tout << \"Request(\" << r.sequence() << \":\" << statuses[r.status()] << \":\"\n+\t    << r._d()->pending_.size() << \"/\" << r.buffers().size() << \":\"\n+\t    << r.cookie() << \")\";\n\n-\treturn ss.str();\n+\treturn out;\n }\n\n } /* namespace libcamera */\n",
    "prefixes": [
        "libcamera-devel",
        "v2"
    ]
}