mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-10 21:11:18 +00:00
Major switch from Value -> Node. The library compiles with the new API, but tests are still oldies, and don't compile
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
#ifndef VALUE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
#define VALUE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
#ifndef NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
#define NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
|
||||
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#include "yaml-cpp/value/detail/node.h"
|
||||
#include "yaml-cpp/value/detail/node_data.h"
|
||||
#include "yaml-cpp/node/detail/node.h"
|
||||
#include "yaml-cpp/node/detail/node_data.h"
|
||||
|
||||
namespace YAML
|
||||
{
|
||||
@@ -17,7 +17,7 @@ namespace YAML
|
||||
template<typename Key>
|
||||
inline node& node_data::get(const Key& key, shared_memory_holder pMemory) const
|
||||
{
|
||||
if(m_type != ValueType::Map)
|
||||
if(m_type != NodeType::Map)
|
||||
return pMemory->create_node();
|
||||
|
||||
for(node_map::const_iterator it=m_map.begin();it!=m_map.end();++it) {
|
||||
@@ -34,16 +34,16 @@ namespace YAML
|
||||
// TODO: check if 'key' is index-like, and we're a sequence
|
||||
|
||||
switch(m_type) {
|
||||
case ValueType::Undefined:
|
||||
case ValueType::Null:
|
||||
case ValueType::Scalar:
|
||||
m_type = ValueType::Map;
|
||||
case NodeType::Undefined:
|
||||
case NodeType::Null:
|
||||
case NodeType::Scalar:
|
||||
m_type = NodeType::Map;
|
||||
m_map.clear();
|
||||
break;
|
||||
case ValueType::Sequence:
|
||||
case NodeType::Sequence:
|
||||
convert_sequence_to_map(pMemory);
|
||||
break;
|
||||
case ValueType::Map:
|
||||
case NodeType::Map:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace YAML
|
||||
template<typename Key>
|
||||
inline bool node_data::remove(const Key& key, shared_memory_holder pMemory)
|
||||
{
|
||||
if(m_type != ValueType::Map)
|
||||
if(m_type != NodeType::Map)
|
||||
return false;
|
||||
|
||||
for(node_map::iterator it=m_map.begin();it!=m_map.end();++it) {
|
||||
@@ -78,7 +78,7 @@ namespace YAML
|
||||
inline bool node_data::equals(node& node, const T& rhs, shared_memory_holder pMemory)
|
||||
{
|
||||
T lhs;
|
||||
if(convert<T>::decode(Value(node, pMemory), lhs))
|
||||
if(convert<T>::decode(Node(node, pMemory), lhs))
|
||||
return lhs == rhs;
|
||||
return false;
|
||||
}
|
||||
@@ -86,11 +86,11 @@ namespace YAML
|
||||
template<typename T>
|
||||
inline node& node_data::convert_to_node(const T& rhs, shared_memory_holder pMemory)
|
||||
{
|
||||
Value value = convert<T>::encode(rhs);
|
||||
Node value = convert<T>::encode(rhs);
|
||||
pMemory->merge(*value.m_pMemory);
|
||||
return *value.m_pNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // VALUE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
#endif // NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
|
@@ -7,8 +7,8 @@
|
||||
|
||||
|
||||
#include "yaml-cpp/dll.h"
|
||||
#include "yaml-cpp/value/ptr.h"
|
||||
#include "yaml-cpp/value/detail/node_iterator.h"
|
||||
#include "yaml-cpp/node/ptr.h"
|
||||
#include "yaml-cpp/node/detail/node_iterator.h"
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "yaml-cpp/value/ptr.h"
|
||||
#include "yaml-cpp/node/ptr.h"
|
||||
#include <set>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#ifndef VALUE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
#define VALUE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
#ifndef NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
#define NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
|
||||
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||
#pragma once
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
|
||||
#include "yaml-cpp/dll.h"
|
||||
#include "yaml-cpp/value/type.h"
|
||||
#include "yaml-cpp/value/ptr.h"
|
||||
#include "yaml-cpp/value/detail/node_ref.h"
|
||||
#include "yaml-cpp/node/type.h"
|
||||
#include "yaml-cpp/node/ptr.h"
|
||||
#include "yaml-cpp/node/detail/node_ref.h"
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
namespace YAML
|
||||
@@ -24,14 +24,14 @@ namespace YAML
|
||||
bool is(const node& rhs) const { return m_pRef == rhs.m_pRef; }
|
||||
const node_ref *ref() const { return m_pRef.get(); }
|
||||
|
||||
ValueType::value type() const { return m_pRef->type(); }
|
||||
NodeType::value type() const { return m_pRef->type(); }
|
||||
|
||||
const std::string& scalar() const { return m_pRef->scalar(); }
|
||||
|
||||
void set_ref(const node& rhs) { m_pRef = rhs.m_pRef; }
|
||||
void set_data(const node& rhs) { m_pRef->set_data(*rhs.m_pRef); }
|
||||
|
||||
void set_type(ValueType::value type) { m_pRef->set_type(type); }
|
||||
void set_type(NodeType::value type) { m_pRef->set_type(type); }
|
||||
void set_null() { m_pRef->set_null(); }
|
||||
void set_scalar(const std::string& scalar) { m_pRef->set_scalar(scalar); }
|
||||
|
||||
@@ -65,4 +65,4 @@ namespace YAML
|
||||
}
|
||||
}
|
||||
|
||||
#endif // VALUE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
#endif // NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
|
@@ -7,9 +7,9 @@
|
||||
|
||||
|
||||
#include "yaml-cpp/dll.h"
|
||||
#include "yaml-cpp/value/iterator.h"
|
||||
#include "yaml-cpp/value/ptr.h"
|
||||
#include "yaml-cpp/value/type.h"
|
||||
#include "yaml-cpp/node/iterator.h"
|
||||
#include "yaml-cpp/node/ptr.h"
|
||||
#include "yaml-cpp/node/type.h"
|
||||
#include <boost/utility.hpp>
|
||||
#include <list>
|
||||
#include <utility>
|
||||
@@ -24,11 +24,11 @@ namespace YAML
|
||||
public:
|
||||
node_data();
|
||||
|
||||
void set_type(ValueType::value type);
|
||||
void set_type(NodeType::value type);
|
||||
void set_null();
|
||||
void set_scalar(const std::string& scalar);
|
||||
|
||||
ValueType::value type() const { return m_isDefined ? m_type : ValueType::Undefined; }
|
||||
NodeType::value type() const { return m_isDefined ? m_type : NodeType::Undefined; }
|
||||
const std::string& scalar() const { return m_scalar; }
|
||||
|
||||
// size/iterator
|
||||
@@ -67,7 +67,7 @@ namespace YAML
|
||||
|
||||
private:
|
||||
bool m_isDefined;
|
||||
ValueType::value m_type;
|
||||
NodeType::value m_type;
|
||||
|
||||
// scalar
|
||||
std::string m_scalar;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
|
||||
#include "yaml-cpp/dll.h"
|
||||
#include "yaml-cpp/value/ptr.h"
|
||||
#include "yaml-cpp/node/ptr.h"
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <list>
|
||||
|
@@ -7,9 +7,9 @@
|
||||
|
||||
|
||||
#include "yaml-cpp/dll.h"
|
||||
#include "yaml-cpp/value/type.h"
|
||||
#include "yaml-cpp/value/ptr.h"
|
||||
#include "yaml-cpp/value/detail/node_data.h"
|
||||
#include "yaml-cpp/node/type.h"
|
||||
#include "yaml-cpp/node/ptr.h"
|
||||
#include "yaml-cpp/node/detail/node_data.h"
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
namespace YAML
|
||||
@@ -21,12 +21,12 @@ namespace YAML
|
||||
public:
|
||||
node_ref() {}
|
||||
|
||||
ValueType::value type() const { return m_pData ? m_pData->type() : ValueType::Undefined; }
|
||||
NodeType::value type() const { return m_pData ? m_pData->type() : NodeType::Undefined; }
|
||||
const std::string& scalar() const { return m_pData ? m_pData->scalar() : node_data::empty_scalar; }
|
||||
|
||||
void set_data(const node_ref& rhs) { m_pData = rhs.m_pData; }
|
||||
|
||||
void set_type(ValueType::value type) { ensure_data_exists(); m_pData->set_type(type); }
|
||||
void set_type(NodeType::value type) { ensure_data_exists(); m_pData->set_type(type); }
|
||||
void set_null() { ensure_data_exists(); m_pData->set_null(); }
|
||||
void set_scalar(const std::string& scalar) { ensure_data_exists(); m_pData->set_scalar(scalar); }
|
||||
|
||||
|
Reference in New Issue
Block a user