conversion.h 738 Bytes
Newer Older
1
2
#pragma once

jbeder's avatar
jbeder committed
3
4
5
6
#ifndef CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66


7
#include "null.h"
8
#include "traits.h"
9
10
11
12
13
#include <string>
#include <sstream>

namespace YAML
{
14
	inline bool Convert(const std::string& input, std::string& output) {
15
16
17
		output = input;
		return true;
	}
jbeder's avatar
jbeder committed
18
	
19
20
21
	bool Convert(const std::string& input, bool& output);
	bool Convert(const std::string& input, _Null& output);
	
22
	template <typename T> 
23
	inline bool Convert(const std::string& input, T& output, typename enable_if<is_numeric<T> >::type * = 0) {
24
25
26
		std::stringstream stream(input);
		stream.unsetf(std::ios::dec);
		return stream >> output;
27
	}
28
}
jbeder's avatar
jbeder committed
29
30

#endif // CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66