{"id":12823,"url":"https://patchwork.libcamera.org/api/patches/12823/?format=json","web_url":"https://patchwork.libcamera.org/patch/12823/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","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-11-laurent.pinchart@ideasonboard.com>","date":"2021-07-07T02:19:21","name":"[libcamera-devel,10/30] cam: options: Drop some OptionValue cast operators","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"b1e482f1e275e2c6b867cb6e7abc22f4d7ffd162","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12823/mbox/","series":[{"id":2213,"url":"https://patchwork.libcamera.org/api/series/2213/?format=json","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/12823/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12823/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 7E1F3C3225\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  7 Jul 2021 02:20:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D1A6368512;\n\tWed,  7 Jul 2021 04:20:40 +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 26AB668508\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Jul 2021 04:20:35 +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 A5F5C2E4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Jul 2021 04:20:34 +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=\"o0CvLPq7\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1625624434;\n\tbh=1aoeUVPG4qUKB+hsuQ6bpcP/VWRYCTygG8RcynjpN/Q=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=o0CvLPq7S/aMFVE/jdJWqcrqiH9JeUjV5fUbF0MaSN/Fm2o+KZHUIhtLj6tdLG3l2\n\tQbr3RW+S36pxjfj5ggsO0OMncCk0CXHNGZ0M0qkxL6l0H/eSbfcvN0CeOE1dNlK7me\n\tTAQZJnzBq1yseiXjWU+xLnTubmikHbtixxiJe0CE=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  7 Jul 2021 05:19:21 +0300","Message-Id":"<20210707021941.20804-11-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 10/30] cam: options: Drop some OptionValue\n\tcast operators","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":"While OptionValue cast operators to int and std::string allow useful\nshortcut syntaxes, the cast operators to KeyValueParser::Options and\nstd::vector<OptionValue> are less useful. A an explicit static_cast call\nwould be more cumbersome to write than an explicit .toKeyValues() or\ntoArray(), and implicit cast hide too much of what's going on.\n\nDrop those two cast operators, and replace the only implicit cast\noccurrence with .toKeyValues(). While at it, drop the local opts\nvariable in StreamKeyValueParser::roles() as it isn't used.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/cam/options.cpp        | 20 --------------------\n src/cam/options.h          |  2 --\n src/cam/stream_options.cpp |  3 +--\n 3 files changed, 1 insertion(+), 24 deletions(-)","diff":"diff --git a/src/cam/options.cpp b/src/cam/options.cpp\nindex d7f9f741c731..319fab6143c5 100644\n--- a/src/cam/options.cpp\n+++ b/src/cam/options.cpp\n@@ -604,26 +604,6 @@ OptionValue::operator std::string() const\n \treturn toString();\n }\n \n-/**\n- * \\brief Cast the value to a key-value list\n- * \\return The option value as a KeyValueParser::Options, or an empty list if\n- * the value type isn't ValueType::ValueKeyValue\n- */\n-OptionValue::operator KeyValueParser::Options() const\n-{\n-\treturn toKeyValues();\n-}\n-\n-/**\n- * \\brief Cast the value to an array\n- * \\return The option value as a std::vector of OptionValue, or an empty vector\n- * if the value type isn't ValueType::ValueArray\n- */\n-OptionValue::operator std::vector<OptionValue>() const\n-{\n-\treturn toArray();\n-}\n-\n /**\n  * \\brief Retrieve the value as an int\n  * \\return The option value as an int, or 0 if the value type isn't\ndiff --git a/src/cam/options.h b/src/cam/options.h\nindex e894822c0061..210e502a24e1 100644\n--- a/src/cam/options.h\n+++ b/src/cam/options.h\n@@ -138,8 +138,6 @@ public:\n \n \toperator int() const;\n \toperator std::string() const;\n-\toperator KeyValueParser::Options() const;\n-\toperator std::vector<OptionValue>() const;\n \n \tint toInteger() const;\n \tstd::string toString() const;\ndiff --git a/src/cam/stream_options.cpp b/src/cam/stream_options.cpp\nindex c58272c23d25..b90dbb97f087 100644\n--- a/src/cam/stream_options.cpp\n+++ b/src/cam/stream_options.cpp\n@@ -48,11 +48,10 @@ StreamRoles StreamKeyValueParser::roles(const OptionValue &values)\n \n \tStreamRoles roles;\n \tfor (auto const &value : streamParameters) {\n-\t\tKeyValueParser::Options opts = value.toKeyValues();\n \t\tStreamRole role;\n \n \t\t/* If role is invalid or not set default to viewfinder. */\n-\t\tif (!parseRole(&role, value))\n+\t\tif (!parseRole(&role, value.toKeyValues()))\n \t\t\trole = StreamRole::Viewfinder;\n \n \t\troles.push_back(role);\n","prefixes":["libcamera-devel","10/30"]}