libcamera: yaml_parser: Replace getList() with get() specializations

The YamlObject class has two member function templates to get values:
the get() function gets a scalar value, while the getList() function
gets a vector of scalar values.

As get() is a function template, we can provide specializations for
vector types. This makes the code more systematic, and therefore more
readable. Replace all getList() occurrences, and drop the getList()
function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
This commit is contained in:
Laurent Pinchart
2025-10-18 00:20:38 +03:00
parent 56e679ee09
commit 3a387cc81d
15 changed files with 64 additions and 103 deletions

View File

@@ -587,9 +587,9 @@ protected:
return TestFail;
}
const auto &values = firstElement.getList<uint16_t>();
const auto &values = firstElement.get<std::vector<uint16_t>>();
if (!values || values->size() != 2 || (*values)[0] != 1 || (*values)[1] != 2) {
cerr << "getList() failed to return correct vector" << std::endl;
cerr << "get() failed to return correct vector" << std::endl;
return TestFail;
}