|
@@ -7,18 +7,21 @@
|
|
#pragma once
|
|
#pragma once
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#include "yaml-cpp/node/node.h"
|
|
|
|
-#include "yaml-cpp/node/iterator.h"
|
|
|
|
|
|
+#include "yaml-cpp/exceptions.h"
|
|
#include "yaml-cpp/node/detail/memory.h"
|
|
#include "yaml-cpp/node/detail/memory.h"
|
|
#include "yaml-cpp/node/detail/node.h"
|
|
#include "yaml-cpp/node/detail/node.h"
|
|
-#include "yaml-cpp/exceptions.h"
|
|
|
|
|
|
+#include "yaml-cpp/node/iterator.h"
|
|
|
|
+#include "yaml-cpp/node/node.h"
|
|
|
|
+#include <sstream>
|
|
#include <string>
|
|
#include <string>
|
|
|
|
|
|
namespace YAML {
|
|
namespace YAML {
|
|
-inline Node::Node() : m_isValid(true), m_pNode(NULL) {}
|
|
|
|
|
|
+inline Node::Node()
|
|
|
|
+ : m_isValid(true), m_invalidKey{}, m_pMemory(nullptr), m_pNode(nullptr) {}
|
|
|
|
|
|
inline Node::Node(NodeType::value type)
|
|
inline Node::Node(NodeType::value type)
|
|
: m_isValid(true),
|
|
: m_isValid(true),
|
|
|
|
+ m_invalidKey{},
|
|
m_pMemory(new detail::memory_holder),
|
|
m_pMemory(new detail::memory_holder),
|
|
m_pNode(&m_pMemory->create_node()) {
|
|
m_pNode(&m_pMemory->create_node()) {
|
|
m_pNode->set_type(type);
|
|
m_pNode->set_type(type);
|
|
@@ -27,6 +30,7 @@ inline Node::Node(NodeType::value type)
|
|
template <typename T>
|
|
template <typename T>
|
|
inline Node::Node(const T& rhs)
|
|
inline Node::Node(const T& rhs)
|
|
: m_isValid(true),
|
|
: m_isValid(true),
|
|
|
|
+ m_invalidKey{},
|
|
m_pMemory(new detail::memory_holder),
|
|
m_pMemory(new detail::memory_holder),
|
|
m_pNode(&m_pMemory->create_node()) {
|
|
m_pNode(&m_pMemory->create_node()) {
|
|
Assign(rhs);
|
|
Assign(rhs);
|
|
@@ -34,24 +38,26 @@ inline Node::Node(const T& rhs)
|
|
|
|
|
|
inline Node::Node(const detail::iterator_value& rhs)
|
|
inline Node::Node(const detail::iterator_value& rhs)
|
|
: m_isValid(rhs.m_isValid),
|
|
: m_isValid(rhs.m_isValid),
|
|
|
|
+ m_invalidKey(rhs.m_invalidKey),
|
|
m_pMemory(rhs.m_pMemory),
|
|
m_pMemory(rhs.m_pMemory),
|
|
m_pNode(rhs.m_pNode) {}
|
|
m_pNode(rhs.m_pNode) {}
|
|
|
|
|
|
-inline Node::Node(const Node& rhs)
|
|
|
|
- : m_isValid(rhs.m_isValid),
|
|
|
|
- m_pMemory(rhs.m_pMemory),
|
|
|
|
- m_pNode(rhs.m_pNode) {}
|
|
|
|
|
|
+inline Node::Node(const Node&) = default;
|
|
|
|
+
|
|
|
|
+inline Node::Node(Zombie)
|
|
|
|
+ : m_isValid(false), m_invalidKey{}, m_pMemory{}, m_pNode(nullptr) {}
|
|
|
|
|
|
-inline Node::Node(Zombie) : m_isValid(false), m_pNode(NULL) {}
|
|
|
|
|
|
+inline Node::Node(Zombie, const std::string& key)
|
|
|
|
+ : m_isValid(false), m_invalidKey(key), m_pMemory{}, m_pNode(nullptr) {}
|
|
|
|
|
|
inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory)
|
|
inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory)
|
|
- : m_isValid(true), m_pMemory(pMemory), m_pNode(&node) {}
|
|
|
|
|
|
+ : m_isValid(true), m_invalidKey{}, m_pMemory(pMemory), m_pNode(&node) {}
|
|
|
|
|
|
-inline Node::~Node() {}
|
|
|
|
|
|
+inline Node::~Node() = default;
|
|
|
|
|
|
inline void Node::EnsureNodeExists() const {
|
|
inline void Node::EnsureNodeExists() const {
|
|
if (!m_isValid)
|
|
if (!m_isValid)
|
|
- throw InvalidNode();
|
|
|
|
|
|
+ throw InvalidNode(m_invalidKey);
|
|
if (!m_pNode) {
|
|
if (!m_pNode) {
|
|
m_pMemory.reset(new detail::memory_holder);
|
|
m_pMemory.reset(new detail::memory_holder);
|
|
m_pNode = &m_pMemory->create_node();
|
|
m_pNode = &m_pMemory->create_node();
|
|
@@ -68,14 +74,14 @@ inline bool Node::IsDefined() const {
|
|
|
|
|
|
inline Mark Node::Mark() const {
|
|
inline Mark Node::Mark() const {
|
|
if (!m_isValid) {
|
|
if (!m_isValid) {
|
|
- throw InvalidNode();
|
|
|
|
|
|
+ throw InvalidNode(m_invalidKey);
|
|
}
|
|
}
|
|
return m_pNode ? m_pNode->mark() : Mark::null_mark();
|
|
return m_pNode ? m_pNode->mark() : Mark::null_mark();
|
|
}
|
|
}
|
|
|
|
|
|
inline NodeType::value Node::Type() const {
|
|
inline NodeType::value Node::Type() const {
|
|
if (!m_isValid)
|
|
if (!m_isValid)
|
|
- throw InvalidNode();
|
|
|
|
|
|
+ throw InvalidNode(m_invalidKey);
|
|
return m_pNode ? m_pNode->type() : NodeType::Null;
|
|
return m_pNode ? m_pNode->type() : NodeType::Null;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -104,6 +110,8 @@ struct as_if<std::string, S> {
|
|
const Node& node;
|
|
const Node& node;
|
|
|
|
|
|
std::string operator()(const S& fallback) const {
|
|
std::string operator()(const S& fallback) const {
|
|
|
|
+ if (node.Type() == NodeType::Null)
|
|
|
|
+ return "null";
|
|
if (node.Type() != NodeType::Scalar)
|
|
if (node.Type() != NodeType::Scalar)
|
|
return fallback;
|
|
return fallback;
|
|
return node.Scalar();
|
|
return node.Scalar();
|
|
@@ -132,6 +140,8 @@ struct as_if<std::string, void> {
|
|
const Node& node;
|
|
const Node& node;
|
|
|
|
|
|
std::string operator()() const {
|
|
std::string operator()() const {
|
|
|
|
+ if (node.Type() == NodeType::Null)
|
|
|
|
+ return "null";
|
|
if (node.Type() != NodeType::Scalar)
|
|
if (node.Type() != NodeType::Scalar)
|
|
throw TypedBadConversion<std::string>(node.Mark());
|
|
throw TypedBadConversion<std::string>(node.Mark());
|
|
return node.Scalar();
|
|
return node.Scalar();
|
|
@@ -142,7 +152,7 @@ struct as_if<std::string, void> {
|
|
template <typename T>
|
|
template <typename T>
|
|
inline T Node::as() const {
|
|
inline T Node::as() const {
|
|
if (!m_isValid)
|
|
if (!m_isValid)
|
|
- throw InvalidNode();
|
|
|
|
|
|
+ throw InvalidNode(m_invalidKey);
|
|
return as_if<T, void>(*this)();
|
|
return as_if<T, void>(*this)();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -155,32 +165,28 @@ inline T Node::as(const S& fallback) const {
|
|
|
|
|
|
inline const std::string& Node::Scalar() const {
|
|
inline const std::string& Node::Scalar() const {
|
|
if (!m_isValid)
|
|
if (!m_isValid)
|
|
- throw InvalidNode();
|
|
|
|
- return m_pNode ? m_pNode->scalar() : detail::node_data::empty_scalar;
|
|
|
|
|
|
+ throw InvalidNode(m_invalidKey);
|
|
|
|
+ return m_pNode ? m_pNode->scalar() : detail::node_data::empty_scalar();
|
|
}
|
|
}
|
|
|
|
|
|
inline const std::string& Node::Tag() const {
|
|
inline const std::string& Node::Tag() const {
|
|
if (!m_isValid)
|
|
if (!m_isValid)
|
|
- throw InvalidNode();
|
|
|
|
- return m_pNode ? m_pNode->tag() : detail::node_data::empty_scalar;
|
|
|
|
|
|
+ throw InvalidNode(m_invalidKey);
|
|
|
|
+ return m_pNode ? m_pNode->tag() : detail::node_data::empty_scalar();
|
|
}
|
|
}
|
|
|
|
|
|
inline void Node::SetTag(const std::string& tag) {
|
|
inline void Node::SetTag(const std::string& tag) {
|
|
- if (!m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
EnsureNodeExists();
|
|
EnsureNodeExists();
|
|
m_pNode->set_tag(tag);
|
|
m_pNode->set_tag(tag);
|
|
}
|
|
}
|
|
|
|
|
|
inline EmitterStyle::value Node::Style() const {
|
|
inline EmitterStyle::value Node::Style() const {
|
|
if (!m_isValid)
|
|
if (!m_isValid)
|
|
- throw InvalidNode();
|
|
|
|
|
|
+ throw InvalidNode(m_invalidKey);
|
|
return m_pNode ? m_pNode->style() : EmitterStyle::Default;
|
|
return m_pNode ? m_pNode->style() : EmitterStyle::Default;
|
|
}
|
|
}
|
|
|
|
|
|
inline void Node::SetStyle(EmitterStyle::value style) {
|
|
inline void Node::SetStyle(EmitterStyle::value style) {
|
|
- if (!m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
EnsureNodeExists();
|
|
EnsureNodeExists();
|
|
m_pNode->set_style(style);
|
|
m_pNode->set_style(style);
|
|
}
|
|
}
|
|
@@ -188,7 +194,7 @@ inline void Node::SetStyle(EmitterStyle::value style) {
|
|
// assignment
|
|
// assignment
|
|
inline bool Node::is(const Node& rhs) const {
|
|
inline bool Node::is(const Node& rhs) const {
|
|
if (!m_isValid || !rhs.m_isValid)
|
|
if (!m_isValid || !rhs.m_isValid)
|
|
- throw InvalidNode();
|
|
|
|
|
|
+ throw InvalidNode(m_invalidKey);
|
|
if (!m_pNode || !rhs.m_pNode)
|
|
if (!m_pNode || !rhs.m_pNode)
|
|
return false;
|
|
return false;
|
|
return m_pNode->is(*rhs.m_pNode);
|
|
return m_pNode->is(*rhs.m_pNode);
|
|
@@ -196,15 +202,20 @@ inline bool Node::is(const Node& rhs) const {
|
|
|
|
|
|
template <typename T>
|
|
template <typename T>
|
|
inline Node& Node::operator=(const T& rhs) {
|
|
inline Node& Node::operator=(const T& rhs) {
|
|
- if (!m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
Assign(rhs);
|
|
Assign(rhs);
|
|
return *this;
|
|
return *this;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+inline Node& Node::operator=(const Node& rhs) {
|
|
|
|
+ if (is(rhs))
|
|
|
|
+ return *this;
|
|
|
|
+ AssignNode(rhs);
|
|
|
|
+ return *this;
|
|
|
|
+}
|
|
|
|
+
|
|
inline void Node::reset(const YAML::Node& rhs) {
|
|
inline void Node::reset(const YAML::Node& rhs) {
|
|
if (!m_isValid || !rhs.m_isValid)
|
|
if (!m_isValid || !rhs.m_isValid)
|
|
- throw InvalidNode();
|
|
|
|
|
|
+ throw InvalidNode(m_invalidKey);
|
|
m_pMemory = rhs.m_pMemory;
|
|
m_pMemory = rhs.m_pMemory;
|
|
m_pNode = rhs.m_pNode;
|
|
m_pNode = rhs.m_pNode;
|
|
}
|
|
}
|
|
@@ -212,44 +223,27 @@ inline void Node::reset(const YAML::Node& rhs) {
|
|
template <typename T>
|
|
template <typename T>
|
|
inline void Node::Assign(const T& rhs) {
|
|
inline void Node::Assign(const T& rhs) {
|
|
if (!m_isValid)
|
|
if (!m_isValid)
|
|
- throw InvalidNode();
|
|
|
|
|
|
+ throw InvalidNode(m_invalidKey);
|
|
AssignData(convert<T>::encode(rhs));
|
|
AssignData(convert<T>::encode(rhs));
|
|
}
|
|
}
|
|
|
|
|
|
template <>
|
|
template <>
|
|
inline void Node::Assign(const std::string& rhs) {
|
|
inline void Node::Assign(const std::string& rhs) {
|
|
- if (!m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
EnsureNodeExists();
|
|
EnsureNodeExists();
|
|
m_pNode->set_scalar(rhs);
|
|
m_pNode->set_scalar(rhs);
|
|
}
|
|
}
|
|
|
|
|
|
inline void Node::Assign(const char* rhs) {
|
|
inline void Node::Assign(const char* rhs) {
|
|
- if (!m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
EnsureNodeExists();
|
|
EnsureNodeExists();
|
|
m_pNode->set_scalar(rhs);
|
|
m_pNode->set_scalar(rhs);
|
|
}
|
|
}
|
|
|
|
|
|
inline void Node::Assign(char* rhs) {
|
|
inline void Node::Assign(char* rhs) {
|
|
- if (!m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
EnsureNodeExists();
|
|
EnsureNodeExists();
|
|
m_pNode->set_scalar(rhs);
|
|
m_pNode->set_scalar(rhs);
|
|
}
|
|
}
|
|
|
|
|
|
-inline Node& Node::operator=(const Node& rhs) {
|
|
|
|
- if (!m_isValid || !rhs.m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
- if (is(rhs))
|
|
|
|
- return *this;
|
|
|
|
- AssignNode(rhs);
|
|
|
|
- return *this;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
inline void Node::AssignData(const Node& rhs) {
|
|
inline void Node::AssignData(const Node& rhs) {
|
|
- if (!m_isValid || !rhs.m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
EnsureNodeExists();
|
|
EnsureNodeExists();
|
|
rhs.EnsureNodeExists();
|
|
rhs.EnsureNodeExists();
|
|
|
|
|
|
@@ -258,8 +252,8 @@ inline void Node::AssignData(const Node& rhs) {
|
|
}
|
|
}
|
|
|
|
|
|
inline void Node::AssignNode(const Node& rhs) {
|
|
inline void Node::AssignNode(const Node& rhs) {
|
|
- if (!m_isValid || !rhs.m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
|
|
+ if (!m_isValid)
|
|
|
|
+ throw InvalidNode(m_invalidKey);
|
|
rhs.EnsureNodeExists();
|
|
rhs.EnsureNodeExists();
|
|
|
|
|
|
if (!m_pNode) {
|
|
if (!m_pNode) {
|
|
@@ -276,7 +270,7 @@ inline void Node::AssignNode(const Node& rhs) {
|
|
// size/iterator
|
|
// size/iterator
|
|
inline std::size_t Node::size() const {
|
|
inline std::size_t Node::size() const {
|
|
if (!m_isValid)
|
|
if (!m_isValid)
|
|
- throw InvalidNode();
|
|
|
|
|
|
+ throw InvalidNode(m_invalidKey);
|
|
return m_pNode ? m_pNode->size() : 0;
|
|
return m_pNode ? m_pNode->size() : 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -309,13 +303,11 @@ inline iterator Node::end() {
|
|
template <typename T>
|
|
template <typename T>
|
|
inline void Node::push_back(const T& rhs) {
|
|
inline void Node::push_back(const T& rhs) {
|
|
if (!m_isValid)
|
|
if (!m_isValid)
|
|
- throw InvalidNode();
|
|
|
|
|
|
+ throw InvalidNode(m_invalidKey);
|
|
push_back(Node(rhs));
|
|
push_back(Node(rhs));
|
|
}
|
|
}
|
|
|
|
|
|
inline void Node::push_back(const Node& rhs) {
|
|
inline void Node::push_back(const Node& rhs) {
|
|
- if (!m_isValid || !rhs.m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
EnsureNodeExists();
|
|
EnsureNodeExists();
|
|
rhs.EnsureNodeExists();
|
|
rhs.EnsureNodeExists();
|
|
|
|
|
|
@@ -323,99 +315,49 @@ inline void Node::push_back(const Node& rhs) {
|
|
m_pMemory->merge(*rhs.m_pMemory);
|
|
m_pMemory->merge(*rhs.m_pMemory);
|
|
}
|
|
}
|
|
|
|
|
|
-// helpers for indexing
|
|
|
|
-namespace detail {
|
|
|
|
-template <typename T>
|
|
|
|
-struct to_value_t {
|
|
|
|
- explicit to_value_t(const T& t_) : t(t_) {}
|
|
|
|
- const T& t;
|
|
|
|
- typedef const T& return_type;
|
|
|
|
-
|
|
|
|
- const T& operator()() const { return t; }
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-template <>
|
|
|
|
-struct to_value_t<const char*> {
|
|
|
|
- explicit to_value_t(const char* t_) : t(t_) {}
|
|
|
|
- const char* t;
|
|
|
|
- typedef std::string return_type;
|
|
|
|
-
|
|
|
|
- const std::string operator()() const { return t; }
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-template <>
|
|
|
|
-struct to_value_t<char*> {
|
|
|
|
- explicit to_value_t(char* t_) : t(t_) {}
|
|
|
|
- const char* t;
|
|
|
|
- typedef std::string return_type;
|
|
|
|
-
|
|
|
|
- const std::string operator()() const { return t; }
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-template <std::size_t N>
|
|
|
|
-struct to_value_t<char[N]> {
|
|
|
|
- explicit to_value_t(const char* t_) : t(t_) {}
|
|
|
|
- const char* t;
|
|
|
|
- typedef std::string return_type;
|
|
|
|
-
|
|
|
|
- const std::string operator()() const { return t; }
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-// converts C-strings to std::strings so they can be copied
|
|
|
|
-template <typename T>
|
|
|
|
-inline typename to_value_t<T>::return_type to_value(const T& t) {
|
|
|
|
- return to_value_t<T>(t)();
|
|
|
|
-}
|
|
|
|
|
|
+template<typename Key>
|
|
|
|
+std::string key_to_string(const Key& key) {
|
|
|
|
+ return streamable_to_string<Key, is_streamable<std::stringstream, Key>::value>().impl(key);
|
|
}
|
|
}
|
|
|
|
|
|
// indexing
|
|
// indexing
|
|
template <typename Key>
|
|
template <typename Key>
|
|
inline const Node Node::operator[](const Key& key) const {
|
|
inline const Node Node::operator[](const Key& key) const {
|
|
- if (!m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
EnsureNodeExists();
|
|
EnsureNodeExists();
|
|
- detail::node* value = static_cast<const detail::node&>(*m_pNode)
|
|
|
|
- .get(detail::to_value(key), m_pMemory);
|
|
|
|
|
|
+ detail::node* value =
|
|
|
|
+ static_cast<const detail::node&>(*m_pNode).get(key, m_pMemory);
|
|
if (!value) {
|
|
if (!value) {
|
|
- return Node(ZombieNode);
|
|
|
|
|
|
+ return Node(ZombieNode, key_to_string(key));
|
|
}
|
|
}
|
|
return Node(*value, m_pMemory);
|
|
return Node(*value, m_pMemory);
|
|
}
|
|
}
|
|
|
|
|
|
template <typename Key>
|
|
template <typename Key>
|
|
inline Node Node::operator[](const Key& key) {
|
|
inline Node Node::operator[](const Key& key) {
|
|
- if (!m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
EnsureNodeExists();
|
|
EnsureNodeExists();
|
|
- detail::node& value = m_pNode->get(detail::to_value(key), m_pMemory);
|
|
|
|
|
|
+ detail::node& value = m_pNode->get(key, m_pMemory);
|
|
return Node(value, m_pMemory);
|
|
return Node(value, m_pMemory);
|
|
}
|
|
}
|
|
|
|
|
|
template <typename Key>
|
|
template <typename Key>
|
|
inline bool Node::remove(const Key& key) {
|
|
inline bool Node::remove(const Key& key) {
|
|
- if (!m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
EnsureNodeExists();
|
|
EnsureNodeExists();
|
|
- return m_pNode->remove(detail::to_value(key), m_pMemory);
|
|
|
|
|
|
+ return m_pNode->remove(key, m_pMemory);
|
|
}
|
|
}
|
|
|
|
|
|
inline const Node Node::operator[](const Node& key) const {
|
|
inline const Node Node::operator[](const Node& key) const {
|
|
- if (!m_isValid || !key.m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
EnsureNodeExists();
|
|
EnsureNodeExists();
|
|
key.EnsureNodeExists();
|
|
key.EnsureNodeExists();
|
|
m_pMemory->merge(*key.m_pMemory);
|
|
m_pMemory->merge(*key.m_pMemory);
|
|
detail::node* value =
|
|
detail::node* value =
|
|
static_cast<const detail::node&>(*m_pNode).get(*key.m_pNode, m_pMemory);
|
|
static_cast<const detail::node&>(*m_pNode).get(*key.m_pNode, m_pMemory);
|
|
if (!value) {
|
|
if (!value) {
|
|
- return Node(ZombieNode);
|
|
|
|
|
|
+ return Node(ZombieNode, key_to_string(key));
|
|
}
|
|
}
|
|
return Node(*value, m_pMemory);
|
|
return Node(*value, m_pMemory);
|
|
}
|
|
}
|
|
|
|
|
|
inline Node Node::operator[](const Node& key) {
|
|
inline Node Node::operator[](const Node& key) {
|
|
- if (!m_isValid || !key.m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
EnsureNodeExists();
|
|
EnsureNodeExists();
|
|
key.EnsureNodeExists();
|
|
key.EnsureNodeExists();
|
|
m_pMemory->merge(*key.m_pMemory);
|
|
m_pMemory->merge(*key.m_pMemory);
|
|
@@ -424,8 +366,6 @@ inline Node Node::operator[](const Node& key) {
|
|
}
|
|
}
|
|
|
|
|
|
inline bool Node::remove(const Node& key) {
|
|
inline bool Node::remove(const Node& key) {
|
|
- if (!m_isValid || !key.m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
EnsureNodeExists();
|
|
EnsureNodeExists();
|
|
key.EnsureNodeExists();
|
|
key.EnsureNodeExists();
|
|
return m_pNode->remove(*key.m_pNode, m_pMemory);
|
|
return m_pNode->remove(*key.m_pNode, m_pMemory);
|
|
@@ -434,15 +374,12 @@ inline bool Node::remove(const Node& key) {
|
|
// map
|
|
// map
|
|
template <typename Key, typename Value>
|
|
template <typename Key, typename Value>
|
|
inline void Node::force_insert(const Key& key, const Value& value) {
|
|
inline void Node::force_insert(const Key& key, const Value& value) {
|
|
- if (!m_isValid)
|
|
|
|
- throw InvalidNode();
|
|
|
|
EnsureNodeExists();
|
|
EnsureNodeExists();
|
|
- m_pNode->force_insert(detail::to_value(key), detail::to_value(value),
|
|
|
|
- m_pMemory);
|
|
|
|
|
|
+ m_pNode->force_insert(key, value, m_pMemory);
|
|
}
|
|
}
|
|
|
|
|
|
// free functions
|
|
// free functions
|
|
inline bool operator==(const Node& lhs, const Node& rhs) { return lhs.is(rhs); }
|
|
inline bool operator==(const Node& lhs, const Node& rhs) { return lhs.is(rhs); }
|
|
-}
|
|
|
|
|
|
+} // namespace YAML
|
|
|
|
|
|
#endif // NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
|
#endif // NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|