libcamera: value_node: Add mutable adapters

The ValueNode class was initially designed to store read-only property
trees. It is useful to also provide mutable access. Add non-const
adapters and iterators and adapters. This allows obtaining a mutable
ValueNode instance when traversing a tree.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
This commit is contained in:
Laurent Pinchart
2025-10-17 21:53:34 +03:00
parent 49aa81b9ec
commit b25556c691
2 changed files with 34 additions and 8 deletions

View File

@@ -337,6 +337,11 @@ template struct ValueNode::Accessor<std::vector<uint32_t>>;
template struct ValueNode::Accessor<std::vector<std::string>>;
#endif /* __DOXYGEN__ */
/**
* \fn ValueNode::asDict()
* \copydoc ValueNode::asDict() const
*/
/**
* \fn ValueNode::asDict() const
* \brief Wrap a dictionary ValueNode in an adapter that exposes iterators
@@ -357,6 +362,11 @@ template struct ValueNode::Accessor<std::vector<std::string>>;
* \return An adapter of unspecified type compatible with range-based for loops
*/
/**
* \fn ValueNode::asList()
* \copydoc ValueNode::asList() const
*/
/**
* \fn ValueNode::asList() const
* \brief Wrap a list ValueNode in an adapter that exposes iterators