ezconfig
Create C++ Objects from Yaml and Json
Loading...
Searching...
No Matches
stl_fwd.hpp
1// Copyright (c) 2023 Petter Nilsson. MIT License. https://github.com/pettni/ezconfig
2
3#pragma once
4
5#include <filesystem>
6#include <map>
7#include <optional>
8#include <unordered_map>
9#include <variant>
10#include <vector>
11
12#include "../meta.hpp"
13
14namespace YAML {
15
16// forward declarations
17template<typename T>
18struct convert;
19
20class Node;
21
27template<typename T>
28struct convert<std::optional<T>>
29{
30 static bool decode(const Node & yaml, std::optional<T> & obj);
31 static Node encode(const std::optional<T> & rhs);
32};
33
37template<typename K, typename V, typename C, typename A>
38struct convert<std::unordered_map<K, V, C, A>>
39{
40 static bool decode(const Node & yaml, std::unordered_map<K, V, C, A> & obj);
41 static Node encode(const std::unordered_map<K, V, C, A> & rhs);
42};
43
47template<>
48struct convert<std::filesystem::path>
49{
50 static bool decode(const Node & yaml, std::filesystem::path & obj);
51 static Node encode(const std::filesystem::path & rhs);
52};
53
65template<intmax_t Num, intmax_t Den>
66struct convert<std::chrono::duration<int64_t, std::ratio<Num, Den>>>
67{
68 static bool decode(const Node & yaml, std::chrono::duration<int64_t, std::ratio<Num, Den>> & obj);
69 static Node encode(const std::chrono::duration<int64_t, std::ratio<Num, Den>> & rhs);
70};
71
72} // namespace YAML
YAML forward declarations.
Definition yaml_fwd.hpp:16