1 #ifndef NODEIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
2 #define NODEIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
4 #if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
9 #include "yaml-cpp/nodeutil.h"
14 // implementation of templated things
16 inline const T
Node::to() const {
23 inline void operator >> (const Node
& node
, T
& value
) {
24 if(!ConvertScalar(node
, value
))
25 throw InvalidScalar(node
.m_mark
);
29 inline const Node
*Node::FindValue(const T
& key
) const {
32 case NodeType::Scalar
:
33 throw BadDereference();
34 case NodeType::Sequence
:
35 return FindFromNodeAtIndex(*this, key
);
37 return FindValueForKey(key
);
40 throw BadDereference();
44 inline const Node
*Node::FindValueForKey(const T
& key
) const {
45 for(Iterator it
=begin();it
!=end();++it
) {
47 if(it
.first().Read(t
)) {
57 inline const Node
& Node::GetValue(const T
& key
) const {
58 if(const Node
*pValue
= FindValue(key
))
60 throw MakeTypedKeyNotFound(m_mark
, key
);
64 inline const Node
& Node::operator [] (const T
& key
) const {
68 inline const Node
*Node::FindValue(const char *key
) const {
69 return FindValue(std::string(key
));
72 inline const Node
& Node::operator [] (const char *key
) const {
73 return GetValue(std::string(key
));
77 #endif // NODEIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66