Show a patch.

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

{
    "id": 781,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/781/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/781/",
    "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": "<20190322015349.14934-4-niklas.soderlund@ragnatech.se>",
    "date": "2019-03-22T01:53:48",
    "name": "[libcamera-devel,RFC,3/4] cam: options: Add parsing of multiple instances of the same option",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "30106e837d8367810b9275f2bf2b8ce0249e1cbc",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/781/mbox/",
    "series": [
        {
            "id": 215,
            "url": "https://patchwork.libcamera.org/api/1.1/series/215/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=215",
            "date": "2019-03-22T01:53:45",
            "name": "cam: Extend to support configuration of multiple streams",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/215/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/781/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/781/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<niklas.soderlund@ragnatech.se>",
        "Received": [
            "from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 43BAE610B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Mar 2019 02:54:09 +0100 (CET)",
            "from bismarck.berto.se (unknown [89.233.230.99])\n\tby bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid 6069ab50-4c45-11e9-985a-005056917f90;\n\tFri, 22 Mar 2019 02:54:06 +0100 (CET)"
        ],
        "X-Halon-ID": "6069ab50-4c45-11e9-985a-005056917f90",
        "Authorized-sender": "niklas@soderlund.pp.se",
        "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 22 Mar 2019 02:53:48 +0100",
        "Message-Id": "<20190322015349.14934-4-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190322015349.14934-1-niklas.soderlund@ragnatech.se>",
        "References": "<20190322015349.14934-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC 3/4] cam: options: Add parsing of multiple\n\tinstances of the same option",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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>",
        "X-List-Received-Date": "Fri, 22 Mar 2019 01:54:10 -0000"
    },
    "content": "Add the ability to allow storing multiple instances of the same option.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/cam/options.cpp | 12 ++++++------\n src/cam/options.h   |  5 +++--\n 2 files changed, 9 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/src/cam/options.cpp b/src/cam/options.cpp\nindex 7995a9b359764ec7..e9dcd0c39cdc50ce 100644\n--- a/src/cam/options.cpp\n+++ b/src/cam/options.cpp\n@@ -96,7 +96,7 @@ bool OptionsBase<T>::parseValue(const T &opt, const Option &option,\n \t\tbreak;\n \t}\n \n-\tvalues_[opt] = value;\n+\tvalues_[opt] = option.array ? OptionValue(value, values_[opt]) : value;\n \treturn true;\n }\n \n@@ -128,7 +128,7 @@ bool KeyValueParser::addOption(const char *name, OptionType type,\n \t\treturn false;\n \n \toptionsMap_[name] = Option({ 0, type, name, argument, nullptr,\n-\t\t\t\t     help, nullptr });\n+\t\t\t\t     help, nullptr, false });\n \treturn true;\n }\n \n@@ -338,7 +338,7 @@ std::vector<OptionValue> OptionValue::toArray() const\n \n bool OptionsParser::addOption(int opt, OptionType type, const char *help,\n \t\t\t      const char *name, OptionArgument argument,\n-\t\t\t      const char *argumentName)\n+\t\t\t      const char *argumentName, bool array)\n {\n \t/*\n \t * Options must have at least a short or long name, and a text message.\n@@ -356,16 +356,16 @@ bool OptionsParser::addOption(int opt, OptionType type, const char *help,\n \t\treturn false;\n \n \toptions_.push_back(Option({ opt, type, name, argument, argumentName,\n-\t\t\t\t    help, nullptr }));\n+\t\t\t\t    help, nullptr, array }));\n \toptionsMap_[opt] = &options_.back();\n \treturn true;\n }\n \n bool OptionsParser::addOption(int opt, KeyValueParser *parser, const char *help,\n-\t\t\t      const char *name)\n+\t\t\t      const char *name, bool array)\n {\n \tif (!addOption(opt, OptionKeyValue, help, name, ArgumentRequired,\n-\t\t       \"key=value[,key=value,...]\"))\n+\t\t       \"key=value[,key=value,...]\", array))\n \t\treturn false;\n \n \toptions_.back().keyValueParser = parser;\ndiff --git a/src/cam/options.h b/src/cam/options.h\nindex 789ba36187dd1fc3..922db4650b49117d 100644\n--- a/src/cam/options.h\n+++ b/src/cam/options.h\n@@ -36,6 +36,7 @@ struct Option {\n \tconst char *argumentName;\n \tconst char *help;\n \tKeyValueParser *keyValueParser;\n+\tbool array;\n \n \tbool hasShortOption() const { return isalnum(opt); }\n \tbool hasLongOption() const { return name != nullptr; }\n@@ -125,9 +126,9 @@ public:\n \tbool addOption(int opt, OptionType type, const char *help,\n \t\t       const char *name = nullptr,\n \t\t       OptionArgument argument = ArgumentNone,\n-\t\t       const char *argumentName = nullptr);\n+\t\t       const char *argumentName = nullptr, bool array = false);\n \tbool addOption(int opt, KeyValueParser *parser, const char *help,\n-\t\t       const char *name = nullptr);\n+\t\t       const char *name = nullptr, bool array = false);\n \n \tOptions parse(int argc, char *argv[]);\n \tvoid usage();\n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "3/4"
    ]
}