ezconfig
Create C++ Objects from Yaml and Json
Loading...
Searching...
No Matches
include
ezconfig
yaml_types
enum.hpp
1
// Copyright (c) 2023 Petter Nilsson. MIT License. https://github.com/pettni/ezconfig
2
3
#pragma once
4
5
#include <magic_enum/magic_enum.hpp>
6
#include <yaml-cpp/yaml.h>
7
8
#include "enum_fwd.hpp"
9
10
template
<ezconfig::ScopedEnum T>
11
bool
YAML::convert<T>::decode
(
const
Node & yaml, T & obj)
12
{
13
auto
maybe_val = magic_enum::enum_cast<T>(yaml.as<std::string>());
14
if
(maybe_val.has_value()) {
15
obj = maybe_val.value();
16
return
true
;
17
}
18
return
false
;
19
}
YAML::convert
Definition
stl_fwd.hpp:18
Generated by
1.12.0