#include "yaml-cpp/node/convert.h" #include "yaml-cpp/node/impl.h" #include namespace { // we're not gonna mess with the mess that is all the isupper/etc. functions bool IsLower(char ch) { return 'a' <= ch && ch <= 'z'; } bool IsUpper(char ch) { return 'A' <= ch && ch <= 'Z'; } char ToLower(char ch) { return IsUpper(ch) ? ch + 'a' - 'A' : ch; } std::string tolower(const std::string& str) { std::string s(str); std::transform(s.begin(), s.end(), s.begin(), ToLower); return s; } template bool IsEntirely(const std::string& str, T func) { for(std::size_t i=0;i::decode(const Node& node, bool& rhs) { if(!node.IsScalar()) return false; // we can't use iostream bool extraction operators as they don't // recognize all possible values in the table below (taken from // http://yaml.org/type/bool.html) static const struct { std::string truename, falsename; } names[] = { { "y", "n" }, { "yes", "no" }, { "true", "false" }, { "on", "off" }, }; if(!IsFlexibleCase(node.Scalar())) return false; for(unsigned i=0;i