2022-07-23 15:36:05 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <yaml-cpp/yaml.h>
|
|
|
|
|
|
2023-08-13 15:47:51 +01:00
|
|
|
class YamlUtilities
|
2022-07-23 15:36:05 +01:00
|
|
|
{
|
2023-08-13 15:47:51 +01:00
|
|
|
public:
|
|
|
|
|
template <typename Type>
|
|
|
|
|
static bool isCastable(const YAML::Node& node) {
|
|
|
|
|
try {
|
|
|
|
|
node.as<Type>();
|
|
|
|
|
return true;
|
2022-07-23 15:36:05 +01:00
|
|
|
|
2023-08-13 15:47:51 +01:00
|
|
|
} catch (YAML::BadConversion&) {
|
|
|
|
|
return false;
|
2022-07-23 15:36:05 +01:00
|
|
|
}
|
2023-08-13 15:47:51 +01:00
|
|
|
}
|
|
|
|
|
};
|