Refactored the operator >> and Node::Read default functions, as well as the conversion functions, to more easily read new types as keys (this uncovered an error, in example 2.11 of the spec)

This commit is contained in:
Jesse Beder
2009-09-06 20:52:45 +00:00
parent 9a1f4f9a0d
commit e7ac6b3bf1
6 changed files with 137 additions and 41 deletions

View File

@@ -9,15 +9,6 @@
namespace YAML
{
// implementation of templated things
template <typename T>
inline bool Node::Read(T& value) const {
std::string scalar;
if(!GetScalar(scalar))
return false;
return Convert(scalar, value);
}
template <typename T>
inline const T Node::Read() const {
T value;
@@ -32,7 +23,7 @@ namespace YAML
template <typename T>
inline void operator >> (const Node& node, T& value) {
if(!node.Read(value))
if(!ConvertScalar(node, value))
throw InvalidScalar(node.m_mark);
}