ezconfig
Create C++ Objects from Yaml and Json
Loading...
Searching...
No Matches
yaml_fwd.hpp
Go to the documentation of this file.
1// Copyright (c) 2023 Petter Nilsson. MIT License. https://github.com/pettni/ezconfig
2
10#pragma once
11
12#include "factory.hpp"
13#include "macro.hpp"
14
16namespace YAML {
17class Node;
18template<typename T>
19struct convert;
20}; // namespace YAML
21
22namespace ezconfig::yaml {
23
24template<typename T>
25concept Constructible = ::ezconfig::Constructible<T, const YAML::Node &>;
26
38template<typename Base>
39std::unique_ptr<Base> Create(const YAML::Node & y);
40
41} // namespace ezconfig::yaml
42
57#define EZ_YAML_DECLARE(Base) EZ_FACTORY_DECLARE(Base, const YAML::Node &)
58
62template<ezconfig::yaml::Constructible Base>
63struct YAML::convert<std::shared_ptr<Base>>
64{
65 static bool decode(const YAML::Node & y, std::shared_ptr<Base> & ptr);
66};
67
71template<ezconfig::yaml::Constructible Base>
72struct YAML::convert<std::unique_ptr<Base>>
73{
74 static bool decode(const YAML::Node & y, std::unique_ptr<Base> & ptr);
75};
Factory base class.
YAML forward declarations.
Definition yaml_fwd.hpp:16