mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Fixed linker error on Visual Studio with a shared lib by moving the static methods node_data::equals to an instance method on node.
This commit is contained in:
@@ -56,6 +56,19 @@ struct get_idx<Key, typename boost::enable_if<boost::is_signed<Key> >::type> {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline bool node::equals(const T& rhs, shared_memory_holder pMemory) {
|
||||
T lhs;
|
||||
if (convert<T>::decode(Node(*this, pMemory), lhs)) {
|
||||
return lhs == rhs;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool node::equals(const char* rhs, shared_memory_holder pMemory) {
|
||||
return equals<std::string>(rhs, pMemory);
|
||||
}
|
||||
|
||||
// indexing
|
||||
template <typename Key>
|
||||
inline node* node_data::get(const Key& key,
|
||||
@@ -75,8 +88,9 @@ inline node* node_data::get(const Key& key,
|
||||
}
|
||||
|
||||
for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
|
||||
if (equals(*it->first, key, pMemory))
|
||||
if (it->first->equals(key, pMemory)) {
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -102,8 +116,9 @@ inline node& node_data::get(const Key& key, shared_memory_holder pMemory) {
|
||||
}
|
||||
|
||||
for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
|
||||
if (equals(*it->first, key, pMemory))
|
||||
if (it->first->equals(key, pMemory)) {
|
||||
return *it->second;
|
||||
}
|
||||
}
|
||||
|
||||
node& k = convert_to_node(key, pMemory);
|
||||
@@ -148,20 +163,6 @@ inline void node_data::force_insert(const Key& key, const Value& value,
|
||||
insert_map_pair(k, v);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline bool node_data::equals(node& node, const T& rhs,
|
||||
shared_memory_holder pMemory) {
|
||||
T lhs;
|
||||
if (convert<T>::decode(Node(node, pMemory), lhs))
|
||||
return lhs == rhs;
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool node_data::equals(node& node, const char* rhs,
|
||||
shared_memory_holder pMemory) {
|
||||
return equals<std::string>(node, rhs, pMemory);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline node& node_data::convert_to_node(const T& rhs,
|
||||
shared_memory_holder pMemory) {
|
||||
|
@@ -31,6 +31,10 @@ class node : private boost::noncopyable {
|
||||
const std::string& tag() const { return m_pRef->tag(); }
|
||||
EmitterStyle::value style() const { return m_pRef->style(); }
|
||||
|
||||
template <typename T>
|
||||
bool equals(const T& rhs, shared_memory_holder pMemory);
|
||||
bool equals(const char* rhs, shared_memory_holder pMemory);
|
||||
|
||||
void mark_defined() {
|
||||
if (is_defined())
|
||||
return;
|
||||
|
@@ -92,10 +92,6 @@ class YAML_CPP_API node_data : private boost::noncopyable {
|
||||
void convert_to_map(shared_memory_holder pMemory);
|
||||
void convert_sequence_to_map(shared_memory_holder pMemory);
|
||||
|
||||
template <typename T>
|
||||
static bool equals(node& node, const T& rhs, shared_memory_holder pMemory);
|
||||
static bool equals(node& node, const char* rhs, shared_memory_holder pMemory);
|
||||
|
||||
template <typename T>
|
||||
static node& convert_to_node(const T& rhs, shared_memory_holder pMemory);
|
||||
|
||||
|
@@ -30,6 +30,7 @@ class YAML_CPP_API Node {
|
||||
friend class NodeBuilder;
|
||||
friend class NodeEvents;
|
||||
friend struct detail::iterator_value;
|
||||
friend class detail::node;
|
||||
friend class detail::node_data;
|
||||
template <typename>
|
||||
friend class detail::iterator_base;
|
||||
|
Reference in New Issue
Block a user