From fc46f2618332037a8c1b58fbce5d616033bff1c9 Mon Sep 17 00:00:00 2001 From: Dan Klein Date: Wed, 26 Aug 2015 15:05:58 +0300 Subject: Rearranged files and external libraries in two different locations, one for cpp (trex-core/external_libs) and one for python (trex-core/scripts/external_libs) --- external_libs/yaml-cpp/src/conversion.cpp | 89 +++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 external_libs/yaml-cpp/src/conversion.cpp (limited to 'external_libs/yaml-cpp/src/conversion.cpp') diff --git a/external_libs/yaml-cpp/src/conversion.cpp b/external_libs/yaml-cpp/src/conversion.cpp new file mode 100644 index 00000000..f81e1a0b --- /dev/null +++ b/external_libs/yaml-cpp/src/conversion.cpp @@ -0,0 +1,89 @@ +#include "yaml-cpp/conversion.h" +#include + +//////////////////////////////////////////////////////////////// +// Specializations for converting a string to specific types + +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