WiP: write GeneralSettings to YAML

This commit is contained in:
Raphael Coeffic
2021-12-31 10:53:09 +01:00
parent 0e437ca492
commit c5d686a6f0
9 changed files with 261 additions and 72 deletions
+18 -1
View File
@@ -19,7 +19,6 @@
*/
#include "yaml_ops.h"
#include <algorithm>
YAML::Node operator >> (const YAML::Node& node, const YamlLookupTable& lut)
{
@@ -54,3 +53,21 @@ void operator >> (const YAML::Node& node, bool& value)
value = node.as<int>();
}
}
namespace YAML {
Node operator << (const YamlLookupTable& lut, const int& value)
{
const auto& it =
find_if(lut.begin(), lut.end(), [=](const YamlLookupTableElmt& elmt) {
if (elmt.first == value) return true;
return false;
});
if (it != lut.end()) {
return Node(it->second);
}
return Node();
}
}