yaml-cpp/include/conversion.h

31 lines
738 B
C
Raw Normal View History

#pragma once
2009-07-30 02:27:20 +04:00
#ifndef CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#include "null.h"
#include "traits.h"
#include <string>
#include <sstream>
namespace YAML
{
inline bool Convert(const std::string& input, std::string& output) {
output = input;
return true;
}
2009-07-16 00:47:51 +04:00
bool Convert(const std::string& input, bool& output);
bool Convert(const std::string& input, _Null& output);
2009-11-11 00:23:52 +03:00
template <typename T>
inline bool Convert(const std::string& input, T& output, typename enable_if<is_numeric<T> >::type * = 0) {
2009-11-11 00:23:52 +03:00
std::stringstream stream(input);
stream.unsetf(std::ios::dec);
return stream >> output;
}
}
2009-07-30 02:27:20 +04:00
#endif // CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66