diff options
author | Florian Sylvestre <fsylvestre@baylibre.com> | 2022-07-22 17:16:31 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-07-28 13:48:54 +0300 |
commit | 02e387e7b65252a9cd15b672a87f3bcc6be26399 (patch) | |
tree | 629d7f2879364f3278781853413ecea423b06edd /test/yaml-parser.cpp | |
parent | b4cbb5c38828de6854117a6cca8dfb65f1b365c4 (diff) |
libcamera: yaml_parser: Add getList() function
Allow to retrieve a YAML list of any already supported types in a
std::vector.
Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test/yaml-parser.cpp')
-rw-r--r-- | test/yaml-parser.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/yaml-parser.cpp b/test/yaml-parser.cpp index 78233176..9fd27866 100644 --- a/test/yaml-parser.cpp +++ b/test/yaml-parser.cpp @@ -518,6 +518,12 @@ protected: return TestFail; } + const auto &values = firstElement.getList<uint16_t>(); + if (!values || values->size() != 2 || (*values)[0] != 1 || (*values)[1] != 2) { + cerr << "getList() failed to return correct vector" << std::endl; + return TestFail; + } + auto &secondElement = level2Obj[1]; if (!secondElement.isDictionary() || !secondElement.contains("one") || |