00001 #pragma once 00002 00003 #ifndef CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66 00004 #define CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66 00005 00006 00007 #include "null.h" 00008 #include "traits.h" 00009 #include <string> 00010 #include <sstream> 00011 00012 namespace YAML 00013 { 00014 inline bool Convert(const std::string& input, std::string& output) { 00015 output = input; 00016 return true; 00017 } 00018 00019 bool Convert(const std::string& input, bool& output); 00020 bool Convert(const std::string& input, _Null& output); 00021 00022 template <typename T> 00023 inline bool Convert(const std::string& input, T& output, typename enable_if<is_numeric<T> >::type * = 0) { 00024 std::stringstream stream(input); 00025 stream.unsetf(std::ios::dec); 00026 stream >> output; 00027 return !!stream; 00028 } 00029 } 00030 00031 #endif // CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66