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:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user