Patch Detail
Show a patch.
GET /api/patches/15684/?format=api
{ "id": 15684, "url": "https://patchwork.libcamera.org/api/patches/15684/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15684/", "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": "<20220419124220.1877877-1-hanlinchen@chromium.org>", "date": "2022-04-19T12:42:19", "name": "[libcamera-devel,v3,1/2] libcamera: Add operator<< for classes in geometry", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "b84cfe1f9468f743fce646fa39c349f6a3a39b8b", "submitter": { "id": 98, "url": "https://patchwork.libcamera.org/api/people/98/?format=api", "name": "Hanlin Chen", "email": "hanlinchen@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15684/mbox/", "series": [ { "id": 3058, "url": "https://patchwork.libcamera.org/api/series/3058/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3058", "date": "2022-04-19T12:42:19", "name": "[libcamera-devel,v3,1/2] libcamera: Add operator<< for classes in geometry", "version": 3, "mbox": "https://patchwork.libcamera.org/series/3058/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15684/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15684/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 2D2D9C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Apr 2022 12:42:29 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7A91265642;\n\tTue, 19 Apr 2022 14:42:28 +0200 (CEST)", "from mail-pg1-x536.google.com (mail-pg1-x536.google.com\n\t[IPv6:2607:f8b0:4864:20::536])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 798176563C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Apr 2022 14:42:27 +0200 (CEST)", "by mail-pg1-x536.google.com with SMTP id h5so23478372pgc.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Apr 2022 05:42:27 -0700 (PDT)", "from localhost ([2401:fa00:1:17:4ede:fa5e:4144:1dec])\n\tby smtp.gmail.com with UTF8SMTPSA id\n\th18-20020a63c012000000b0039cc3c323f7sm16379511pgg.33.2022.04.19.05.42.24\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tTue, 19 Apr 2022 05:42:25 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1650372148;\n\tbh=FtZApUuuaGBA1nv/G4tob3dmLouKS6gzFFhI4YzbMiI=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=Wo/Jw+W4FkkEUQehPA2GxrIQ8OX1Z7y7PwJYqwjgVm8FwT+kSgwHhgjHAgRfWZbB0\n\tyMWXpMCKEo8imqXmLWN+g920Xk84seKxkmXIAbsSR9dAdqguCQfFWQ0jhIgb0RdIqh\n\tM0+ldOpLlbUkqaHT9SxIBNbkGO9quDIRsRro074AGx1qgrzFzAemT1oWL5CoIKdcf/\n\to+YBSbiL0EwKzAavaiQBkmY+OqFf4631UMaITYjFCqL+XkuQww3szqihLe6T3woEzi\n\tF/Ls1Z7KWzHLWUHr5HUgD5uHW7QRjpLYeMxnD9B3FCJkMo00Huc9GxlGIcIN40GHfh\n\tq5pZp/ZLoFLRg==", "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=1PyDkodJrR+yZb5khfd49jr5/l6XJ9CiLBElYg2JRGM=;\n\tb=KmaAvhAjk5pzyiPLvyprg4R6AjIKptti/tXQ40Af+3KK9O4YfQ6FpFeh2GfXTrh3yF\n\tPZFe3eCgetBbJYf3tPYsDY77CUezg4MO+wOqpl9SQ2dsgaMHnWs2PzXy5KHuTQ0seLWm\n\tWXNYx5bbM2G5OorsZW3f6kaCTQbfwJe1qTqs0=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"KmaAvhAj\"; \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=1PyDkodJrR+yZb5khfd49jr5/l6XJ9CiLBElYg2JRGM=;\n\tb=wpAzoaRhui+vTeQ1W7VBZcduTrS44rT+/fDrP8hIUvfaA1AGUyLUv99dVfHnkcemmW\n\tHTOuMUiNAVFvRFtEGTx/9rcp/EfhmDZ4anUjsWtwVVcsuF/By2zo6i1czCaCwHLvllI6\n\t2hsGrsyDG9hFg88oP/z/m3ShzCUSz46jrgngcFzIPFV0OQwqvm12Tf/bGOKn6j+l6F1l\n\ts+3Leco0lexSuR0QE1088VW1yTplFZ5bMqbuKq36FW99eFa0gK2rEST2payGI6eG6BT3\n\tWMSlKuQdhtHA5TBKu5oPp6ZM0VXc6UyplgPOlLu90Ws5Ljs4K2IHQDfvrK2HSDytg6f7\n\t+dYA==", "X-Gm-Message-State": "AOAM531/gQxiVkXkQ7/X3g50VcKPVlw0IILM9xHucha+F/e6rE4RV2fi\n\tn2Jy3kGk9KpFuaOiWxmaqqIqawzLKkwlSA==", "X-Google-Smtp-Source": "ABdhPJy1kLvunGW2kHFahqXkvZyBihZSq/oF+OT9mfpfyIIRwN8d9Kg0ywwvejT8T6pyxpKL30FVKQ==", "X-Received": "by 2002:a05:6a00:1702:b0:50a:8181:fed3 with SMTP id\n\th2-20020a056a00170200b0050a8181fed3mr7567635pfc.60.1650372145575; \n\tTue, 19 Apr 2022 05:42:25 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 19 Apr 2022 20:42:19 +0800", "Message-Id": "<20220419124220.1877877-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 v3 1/2] libcamera: Add operator<< for\n\tclasses in 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>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/geometry.h | 8 +++++\n src/libcamera/geometry.cpp | 65 +++++++++++++++++++++++++++++++-----\n 2 files changed, 65 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..da08045e 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,18 @@ 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 a text representation of a Point into an output stream\n+ * \\param[in] out The output stream\n+ * \\param[in] p The point\n+ * \\return The output stream \\a out\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 +135,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 +442,18 @@ bool operator<(const Size &lhs, const Size &rhs)\n * \\sa bool operator<(const Size &lhs, const Size &rhs)\n */\n \n+/**\n+ * \\brief Insert a text representation of a Size into an output stream\n+ * \\param[in] out The output stream\n+ * \\param[in] sr The size\n+ * \\return The output stream \\a out\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 +554,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 +574,20 @@ 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 a text representation of a SizeRange into an output stream\n+ * \\param[in] out The output stream\n+ * \\param[in] sr The size range\n+ * \\return The output stream \\a out\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 +662,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 +833,16 @@ 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 a text representation of a Rectangle into an output stream\n+ * \\param[in] out The output stream\n+ * \\param[in] r The rectangle\n+ * \\return The output stream \\a out\n+ */\n+std::ostream &operator<<(std::ostream &out, const Rectangle &r)\n+{\n+\tout << \"(\" << r.x << \"x\" << r.y << \")/\" << r.width << \"x\" << r.height;\n+\treturn out;\n+}\n+\n } /* namespace libcamera */\n", "prefixes": [ "libcamera-devel", "v3", "1/2" ] }