[09/36] libcamera: yaml_parser: Rename Container to ValueContainer
diff mbox series

Message ID 20260113000808.15395-10-laurent.pinchart@ideasonboard.com
State New
Headers show
Series
  • libcamera: Global configuration file improvements
Related show

Commit Message

Laurent Pinchart Jan. 13, 2026, 12:07 a.m. UTC
The YamlObject class defines two private types, Container and
ListContainer. The format is an alias to std::vector<Value>, and is used
to store child elements. The latter hasn't been used since commit
38987e165c28 ("libcamera: yaml_parser: Preserve order of items in
dictionary").

To prepare for upcoming reworks that will use the name 'Container' as a
template parameter, rename Container to ValueContainer for clarity, and
drop the unused ListContainer type.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/internal/yaml_parser.h | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Barnabás Pőcze Jan. 13, 2026, 4:06 p.m. UTC | #1
2026. 01. 13. 1:07 keltezéssel, Laurent Pinchart írta:
> The YamlObject class defines two private types, Container and
> ListContainer. The format is an alias to std::vector<Value>, and is used
> to store child elements. The latter hasn't been used since commit
> 38987e165c28 ("libcamera: yaml_parser: Preserve order of items in
> dictionary").
> 
> To prepare for upcoming reworks that will use the name 'Container' as a
> template parameter, rename Container to ValueContainer for clarity, and
> drop the unused ListContainer type.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---

To me `Container` also seems like a perfectly fine name.

Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>


>   include/libcamera/internal/yaml_parser.h | 13 ++++++-------
>   1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h
> index 8c7916565946..03d6a05e2d0f 100644
> --- a/include/libcamera/internal/yaml_parser.h
> +++ b/include/libcamera/internal/yaml_parser.h
> @@ -36,8 +36,7 @@ private:
>   		std::unique_ptr<YamlObject> value;
>   	};
>   
> -	using Container = std::vector<Value>;
> -	using ListContainer = std::vector<std::unique_ptr<YamlObject>>;
> +	using ValueContainer = std::vector<Value>;
>   
>   public:
>   #ifndef __DOXYGEN__
> @@ -48,7 +47,7 @@ public:
>   		using difference_type = std::ptrdiff_t;
>   		using iterator_category = std::forward_iterator_tag;
>   
> -		Iterator(typename Container::const_iterator it)
> +		Iterator(typename ValueContainer::const_iterator it)
>   			: it_(it)
>   		{
>   		}
> @@ -77,14 +76,14 @@ public:
>   		}
>   
>   	protected:
> -		Container::const_iterator it_;
> +		ValueContainer::const_iterator it_;
>   	};
>   
>   	template<typename Iterator>
>   	class Adapter
>   	{
>   	public:
> -		Adapter(const Container &container)
> +		Adapter(const ValueContainer &container)
>   			: container_(container)
>   		{
>   		}
> @@ -100,7 +99,7 @@ public:
>   		}
>   
>   	protected:
> -		const Container &container_;
> +		const ValueContainer &container_;
>   	};
>   
>   	class ListIterator : public Iterator<ListIterator>
> @@ -232,7 +231,7 @@ private:
>   	Type type_;
>   
>   	std::string value_;
> -	Container list_;
> +	ValueContainer list_;
>   	std::map<std::string, YamlObject *, std::less<>> dictionary_;
>   };
>

Patch
diff mbox series

diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h
index 8c7916565946..03d6a05e2d0f 100644
--- a/include/libcamera/internal/yaml_parser.h
+++ b/include/libcamera/internal/yaml_parser.h
@@ -36,8 +36,7 @@  private:
 		std::unique_ptr<YamlObject> value;
 	};
 
-	using Container = std::vector<Value>;
-	using ListContainer = std::vector<std::unique_ptr<YamlObject>>;
+	using ValueContainer = std::vector<Value>;
 
 public:
 #ifndef __DOXYGEN__
@@ -48,7 +47,7 @@  public:
 		using difference_type = std::ptrdiff_t;
 		using iterator_category = std::forward_iterator_tag;
 
-		Iterator(typename Container::const_iterator it)
+		Iterator(typename ValueContainer::const_iterator it)
 			: it_(it)
 		{
 		}
@@ -77,14 +76,14 @@  public:
 		}
 
 	protected:
-		Container::const_iterator it_;
+		ValueContainer::const_iterator it_;
 	};
 
 	template<typename Iterator>
 	class Adapter
 	{
 	public:
-		Adapter(const Container &container)
+		Adapter(const ValueContainer &container)
 			: container_(container)
 		{
 		}
@@ -100,7 +99,7 @@  public:
 		}
 
 	protected:
-		const Container &container_;
+		const ValueContainer &container_;
 	};
 
 	class ListIterator : public Iterator<ListIterator>
@@ -232,7 +231,7 @@  private:
 	Type type_;
 
 	std::string value_;
-	Container list_;
+	ValueContainer list_;
 	std::map<std::string, YamlObject *, std::less<>> dictionary_;
 };