Show a patch.

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

{
    "id": 15683,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/15683/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15683/",
    "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": "<20220418121909.470519-1-hanlinchen@chromium.org>",
    "date": "2022-04-18T12:19:09",
    "name": "[libcamera-devel,v2] libcamera: Add operator<< for classes in geometry",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "8a27efe4e74deb253a89a45351c284fa6b77ba36",
    "submitter": {
        "id": 98,
        "url": "https://patchwork.libcamera.org/api/1.1/people/98/?format=api",
        "name": "Hanlin Chen",
        "email": "hanlinchen@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/15683/mbox/",
    "series": [
        {
            "id": 3057,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3057/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3057",
            "date": "2022-04-18T12:19:09",
            "name": "[libcamera-devel,v2] libcamera: Add operator<< for classes in geometry",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3057/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15683/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15683/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 A6F79C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Apr 2022 12:19:17 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0C65565640;\n\tMon, 18 Apr 2022 14:19:17 +0200 (CEST)",
            "from mail-pl1-x629.google.com (mail-pl1-x629.google.com\n\t[IPv6:2607:f8b0:4864:20::629])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D73956563F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Apr 2022 14:19:14 +0200 (CEST)",
            "by mail-pl1-x629.google.com with SMTP id d15so12183425pll.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Apr 2022 05:19:14 -0700 (PDT)",
            "from localhost ([2401:fa00:1:17:9775:a6e9:7655:6686])\n\tby smtp.gmail.com with UTF8SMTPSA id\n\tn14-20020a17090a394e00b001c670d67b8esm12996230pjf.32.2022.04.18.05.19.12\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tMon, 18 Apr 2022 05:19:12 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1650284357;\n\tbh=IHRbArZENtCk/9GGSIqukwg7vP9eUMyTjAYQ9udG8SA=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=PkqEajs3chlr8+cFBwh8EwFtsHaKma/RAGopgM/TRh0vS+srgmRBPtQNN9K6DDS7n\n\tkwPL1mkzcczVioSkCIW68LrtQyyAWjQd52El2LTDhRp/FisIkK8pEAB2gyx8jQJSq6\n\tEnWqaT+5TUx5KBY5OAcFdmb53bdL++cuKHRJZUJsn9xzrbhcY+3lx1VIS73mkhyZR9\n\tuDfS82Y0PCCBy+NRjzVoVzFt/PhhS8Clb6ce9zU9GA00OK1W6D+npN+96IYsTFZE2E\n\t31vZ+JKYn/hyo/X0EeoV5kUVvN2vmpDlcNroN9uBVi+yUOxGI+84XXdmaknp6cebIH\n\tn9iX7z3uGcKWA==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; h=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=tvhcZdLPX+KLjwsmlR1o9jk+2FLwanNO6rI9kHfyUs8=;\n\tb=fp6Tp7+wDisIcC1ixjc8zvdTUureixq6DOMU6lwBVsRc8KgCCaf19A4rElEfr/5JZj\n\tYfb/x9iJMNhfKBI00+0bvyLvuke8E6eIh7sT6l5MEtFaCoLKnSiP2SwnX3tGQc4FHZcI\n\tamAUOLJoc4PBq4Ky2GxjFYWQFh2jOAn8dCYtg="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"fp6Tp7+w\"; \n\tdkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=tvhcZdLPX+KLjwsmlR1o9jk+2FLwanNO6rI9kHfyUs8=;\n\tb=l/IiS87Lso+t3QM3Zt3+s507jMAaaYMaUtbIvwpgveTY/gCj9SP1pxPkzBnuif0Zf7\n\tEIxYx5Gqm/Z/zd/cJ04C8FdlFP5l60CjKcG1Xh2OU7UYP9Xv4OzRn0dD0xUNo61zMKuM\n\tXH7+ns6ZxV5dUpYqixkfGOPYm5/QLZmEa4edsz+3LFbOKYhVr2y3k0gmHbCKUBfb6H1r\n\tysyY1owyDCN6i3yd4c+q7U1fRW3LPJfcBxX7o9FdM+Uj57neJKWjB/8F1W/L1Pcq89Dp\n\tgJWzT1bPgnxxEOHLoEty7ZS3+836KbeagB2QhfPMbpV7YvoF5tx62du92ds2N+T7Tsvs\n\tC5Mw==",
        "X-Gm-Message-State": "AOAM532uHv1JBKpJDcrOerACG/dUOf4O1A+eVClqPVaWbJ9pwOPsDTkl\n\tXvhNVLtPlAcuieyHVglORWO/LzRtSCCPTA==",
        "X-Google-Smtp-Source": "ABdhPJzRHXPAZVMZn1eYVlvv3LFjrYdKI2T8/Hzzd5+cBN0AmamkMRR9Xt0K1GhrnS8MqSDtCvd9fA==",
        "X-Received": "by 2002:a17:902:bc43:b0:158:a253:b4f1 with SMTP id\n\tt3-20020a170902bc4300b00158a253b4f1mr10463899plz.10.1650284353142; \n\tMon, 18 Apr 2022 05:19:13 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 18 Apr 2022 20:19:09 +0800",
        "Message-Id": "<20220418121909.470519-1-hanlinchen@chromium.org>",
        "X-Mailer": "git-send-email 2.36.0.rc0.470.gd361397f0d-goog",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2] libcamera: Add operator<< for classes\n\tin geometry",
        "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": "Han-Lin Chen via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Han-Lin Chen <hanlinchen@chromium.org>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Add operator<< for geometry classes for easier logging.\n\nSigned-off-by: Han-Lin Chen <hanlinchen@chromium.org>\n---\n include/libcamera/geometry.h |  8 +++++\n src/libcamera/geometry.cpp   | 57 +++++++++++++++++++++++++++++++-----\n 2 files changed, 57 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\nindex 7838b679..d4a144bc 100644\n--- a/include/libcamera/geometry.h\n+++ b/include/libcamera/geometry.h\n@@ -46,6 +46,8 @@ static inline bool operator!=(const Point &lhs, const Point &rhs)\n \treturn !(lhs == rhs);\n }\n \n+std::ostream &operator<<(std::ostream &out, const Point &p);\n+\n class Size\n {\n public:\n@@ -192,6 +194,8 @@ static inline bool operator>=(const Size &lhs, const Size &rhs)\n \treturn !(lhs < rhs);\n }\n \n+std::ostream &operator<<(std::ostream &out, const Size &s);\n+\n class SizeRange\n {\n public:\n@@ -232,6 +236,8 @@ static inline bool operator!=(const SizeRange &lhs, const SizeRange &rhs)\n \treturn !(lhs == rhs);\n }\n \n+std::ostream &operator<<(std::ostream &out, const SizeRange &sr);\n+\n class Rectangle\n {\n public:\n@@ -291,4 +297,6 @@ static inline bool operator!=(const Rectangle &lhs, const Rectangle &rhs)\n \treturn !(lhs == rhs);\n }\n \n+std::ostream &operator<<(std::ostream &out, const Rectangle &r);\n+\n } /* namespace libcamera */\ndiff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\nindex cb3c2de1..a0696c51 100644\n--- a/src/libcamera/geometry.cpp\n+++ b/src/libcamera/geometry.cpp\n@@ -56,8 +56,7 @@ namespace libcamera {\n const std::string Point::toString() const\n {\n \tstd::stringstream ss;\n-\n-\tss << \"(\" << x << \",\" << y << \")\";\n+\tss << *this;\n \n \treturn ss.str();\n }\n@@ -83,6 +82,16 @@ bool operator==(const Point &lhs, const Point &rhs)\n  * \\return True if the two points are not equal, false otherwise\n  */\n \n+/**\n+ * \\brief Insert operation for Point with ostream\n+ * \\return The input std::ostream\n+ */\n+std::ostream &operator<<(std::ostream &out, const Point &p)\n+{\n+\tout << \"(\" << p.x << \", \" << p.y << \")\";\n+\treturn out;\n+}\n+\n /**\n  * \\struct Size\n  * \\brief Describe a two-dimensional size\n@@ -124,7 +133,10 @@ bool operator==(const Point &lhs, const Point &rhs)\n  */\n const std::string Size::toString() const\n {\n-\treturn std::to_string(width) + \"x\" + std::to_string(height);\n+\tstd::stringstream ss;\n+\tss << *this;\n+\n+\treturn ss.str();\n }\n \n /**\n@@ -428,6 +440,16 @@ bool operator<(const Size &lhs, const Size &rhs)\n  * \\sa bool operator<(const Size &lhs, const Size &rhs)\n  */\n \n+/**\n+ * \\brief Insert operation for Size with ostream\n+ * \\return The input std::ostream\n+ */\n+std::ostream &operator<<(std::ostream &out, const Size &s)\n+{\n+\tout << s.width << \"x\" << s.height;\n+\treturn out;\n+}\n+\n /**\n  * \\struct SizeRange\n  * \\brief Describe a range of sizes\n@@ -528,9 +550,7 @@ bool SizeRange::contains(const Size &size) const\n std::string SizeRange::toString() const\n {\n \tstd::stringstream ss;\n-\n-\tss << \"(\" << min.toString() << \")-(\" << max.toString() << \")/(+\"\n-\t   << hStep << \",+\" << vStep << \")\";\n+\tss << *this;\n \n \treturn ss.str();\n }\n@@ -550,6 +570,18 @@ bool operator==(const SizeRange &lhs, const SizeRange &rhs)\n  * \\return True if the two size ranges are not equal, false otherwise\n  */\n \n+/**\n+ * \\brief Insert operation for SizeRange with ostream\n+ * \\return The input std::ostream\n+ */\n+std::ostream &operator<<(std::ostream &out, const SizeRange &sr)\n+{\n+\tout << \"(\" << sr.min << \")-(\" << sr.max << \")/(+\"\n+\t    << sr.hStep << \",+\" << sr.vStep << \")\";\n+\n+\treturn out;\n+}\n+\n /**\n  * \\struct Rectangle\n  * \\brief Describe a rectangle's position and dimensions\n@@ -624,8 +656,7 @@ bool operator==(const SizeRange &lhs, const SizeRange &rhs)\n const std::string Rectangle::toString() const\n {\n \tstd::stringstream ss;\n-\n-\tss << \"(\" << x << \"x\" << y << \")/\" << width << \"x\" << height;\n+\tss << *this;\n \n \treturn ss.str();\n }\n@@ -796,4 +827,14 @@ bool operator==(const Rectangle &lhs, const Rectangle &rhs)\n  * \\return True if the two rectangles are not equal, false otherwise\n  */\n \n+/**\n+ * \\brief Insert operation for Rectangle with ostream\n+ * \\return The input std::ostream\n+ */\n+std::ostream &operator<<(std::ostream &out, const Rectangle &r)\n+{\n+\tout << \"(\" << r.x << \", \" << r.y << \")/\" << r.width << \"x\" << r.height;\n+\treturn out;\n+}\n+\n } /* namespace libcamera */\n",
    "prefixes": [
        "libcamera-devel",
        "v2"
    ]
}