Show a patch.

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

{
    "id": 12818,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/12818/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12818/",
    "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": "<20210707021941.20804-6-laurent.pinchart@ideasonboard.com>",
    "date": "2021-07-07T02:19:16",
    "name": "[libcamera-devel,05/30] cam: options: Add optionName() function to Option structure",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "076f06ff3fe01cc09c7bd31720aaffb6b557fbe5",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/12818/mbox/",
    "series": [
        {
            "id": 2213,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2213/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2213",
            "date": "2021-07-07T02:19:12",
            "name": "Multi-camera support in the cam application",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2213/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12818/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12818/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 A0A2AC3225\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  7 Jul 2021 02:20:41 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 688FD68525;\n\tWed,  7 Jul 2021 04:20:37 +0200 (CEST)",
            "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 53BA060283\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Jul 2021 04:20:33 +0200 (CEST)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DF16C466\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Jul 2021 04:20:32 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Nm3X9gmL\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1625624433;\n\tbh=QZV16aILc/N0AioU69NdxiW/J11pb7kiPy9BBHKbM8E=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Nm3X9gmLuIavvqy0YXnWOzR7lcjKHzB9RdckV4D2FnlISQ6BXqBQMxPAAQTfYc9DU\n\tVtSFlC0Ec7yg5VDi/Xrkg/vYoHVMr+E6SZEo2TieuaUpYHPwgbIyw6vLyTyzczfhF4\n\tGxYykr/UGfzLMXJ8mqa1cQ9G/0cb9W2E/MAhBg/M=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed,  7 Jul 2021 05:19:16 +0300",
        "Message-Id": "<20210707021941.20804-6-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "In-Reply-To": "<20210707021941.20804-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20210707021941.20804-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 05/30] cam: options: Add optionName()\n\tfunction to Option structure",
        "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": "Add an Option::optionName() function that returns a string describing\nthe option name, with leading dashes. As a result,\nOptionsParser::parseValueError() function becomes a single-line function\nand can be inlined in its caller.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/cam/options.cpp | 32 ++++++++++++++++++--------------\n src/cam/options.h   |  2 --\n 2 files changed, 18 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/src/cam/options.cpp b/src/cam/options.cpp\nindex da218c4644d3..2f71860d0466 100644\n--- a/src/cam/options.cpp\n+++ b/src/cam/options.cpp\n@@ -100,6 +100,7 @@ struct Option {\n \tbool hasShortOption() const { return isalnum(opt); }\n \tbool hasLongOption() const { return name != nullptr; }\n \tconst char *typeName() const;\n+\tstd::string optionName() const;\n };\n \n /**\n@@ -125,6 +126,20 @@ const char *Option::typeName() const\n \treturn \"unknown\";\n }\n \n+/**\n+ * \\brief Retrieve a string describing the option name, with leading dashes\n+ * \\return A string describing the option name, as a long option identifier\n+ * (double dash) if the option has a name, or a short option identifier (single\n+ * dash) otherwise\n+ */\n+std::string Option::optionName() const\n+{\n+\tif (name)\n+\t\treturn \"--\" + std::string(name);\n+\telse\n+\t\treturn \"-\" + std::string(1, opt);\n+}\n+\n /* -----------------------------------------------------------------------------\n  * OptionBase<T>\n  */\n@@ -866,7 +881,9 @@ OptionsParser::Options OptionsParser::parse(int argc, char **argv)\n \n \t\tconst Option &option = *optionsMap_[c];\n \t\tif (!options.parseValue(c, option, optarg)) {\n-\t\t\tparseValueError(option);\n+\t\t\tstd::cerr << \"Can't parse \" << option.typeName()\n+\t\t\t\t  << \" argument for option \" << option.optionName()\n+\t\t\t\t  << std::endl;\n \t\t\tusage();\n \t\t\treturn options;\n \t\t}\n@@ -953,16 +970,3 @@ void OptionsParser::usage()\n \t\t\toption.keyValueParser->usage(indent);\n \t}\n }\n-\n-void OptionsParser::parseValueError(const Option &option)\n-{\n-\tstd::string optionName;\n-\n-\tif (option.name)\n-\t\toptionName = \"--\" + std::string(option.name);\n-\telse\n-\t\toptionName = \"-\" + std::string(1, option.opt);\n-\n-\tstd::cerr << \"Can't parse \" << option.typeName()\n-\t\t  << \" argument for option \" << optionName << std::endl;\n-}\ndiff --git a/src/cam/options.h b/src/cam/options.h\nindex a3b18bb6c4ea..0b8bb172d184 100644\n--- a/src/cam/options.h\n+++ b/src/cam/options.h\n@@ -95,8 +95,6 @@ public:\n \tvoid usage();\n \n private:\n-\tvoid parseValueError(const Option &option);\n-\n \tstd::list<Option> options_;\n \tstd::map<unsigned int, Option *> optionsMap_;\n };\n",
    "prefixes": [
        "libcamera-devel",
        "05/30"
    ]
}