libcamera: yaml_parser: Add functions to add children

Add YamlObject::add() functions to add children to a list or dictionary
object. This will be used by the YamlParserContext to replace direct
access to YamlObject member variables to decouple the two classes.

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-17 23:53:10 +03:00
parent 6657a19247
commit f59a6f6857
2 changed files with 59 additions and 1 deletions
+4 -1
View File
@@ -28,7 +28,7 @@ class YamlObject
{
private:
struct Value {
Value(std::string &&k, std::unique_ptr<YamlObject> &&v)
Value(std::string k, std::unique_ptr<YamlObject> &&v)
: key(std::move(k)), value(std::move(v))
{
}
@@ -197,6 +197,9 @@ public:
bool contains(std::string_view key) const;
const YamlObject &operator[](std::string_view key) const;
YamlObject *add(std::unique_ptr<YamlObject> &&child);
YamlObject *add(std::string key, std::unique_ptr<YamlObject> &&child);
private:
LIBCAMERA_DISABLE_COPY_AND_MOVE(YamlObject)