Files
OpenVulkano/openVulkanoCpp/Extensions/YamlCppConverters.hpp
2023-09-29 14:43:11 +02:00

32 lines
596 B
C++

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#pragma once
#include <yaml-cpp/yaml.h>
#include <libstud/uuid.hxx>
namespace YAML
{
template<>
struct convert<stud::uuid>
{
static Node encode(const stud::uuid& uuid)
{
return Node(uuid.string());
}
static bool decode(const Node& node, stud::uuid& uuid)
{
if (node.IsScalar())
{
uuid.assign(node.Scalar());
return true;
}
return false;
}
};
}