summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/internal/yaml_parser.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h
index 81cc0e25..06a41146 100644
--- a/include/libcamera/internal/yaml_parser.h
+++ b/include/libcamera/internal/yaml_parser.h
@@ -162,7 +162,10 @@ public:
std::size_t size() const;
template<typename T>
- std::optional<T> get() const;
+ std::optional<T> get() const
+ {
+ return Getter<T>{}.get(*this);
+ }
template<typename T, typename U>
T get(U &&defaultValue) const
@@ -199,6 +202,8 @@ public:
private:
LIBCAMERA_DISABLE_COPY_AND_MOVE(YamlObject)
+ template<typename T>
+ friend struct Getter;
friend class YamlParserContext;
enum class Type {
@@ -207,6 +212,11 @@ private:
Value,
};
+ template<typename T>
+ struct Getter {
+ std::optional<T> get(const YamlObject &obj) const;
+ };
+
Type type_;
std::string value_;