diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-07-26 04:33:19 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-07-28 13:47:13 +0300 |
commit | feb8c9be78474599f85f37ae733e564a4bda4e06 (patch) | |
tree | 1a33fdfa4f75b8a8798f341506ab36b5bc27fab0 /Documentation/api-html | |
parent | 22ffeae04de2e7ce6b2476a35233c790beafb67f (diff) |
libcamera: yaml_parser: Replace ok flag to get() with std::optional
The YamlObject::get() function takes a default value and an optional
bool ok flag to handle parsing errors. This ad-hoc mechanism complicates
error handling in callers.
A better API is possible by dropping the default value and ok flag and
returning an std::optional. Not only does it simplify the calls, it also
lets callers handle errors through the standard std::optional class
instead of the current ad-hoc mechanism.
Provide a get() wrapper around std::optional::value_or() to further
simplify callers that don't need any specific error handling.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'Documentation/api-html')
0 files changed, 0 insertions, 0 deletions