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:
beder
2011-09-10 17:57:23 -05:00
parent 8fd372b0db
commit e905b74232
30 changed files with 387 additions and 364 deletions

View File

@@ -1,12 +1,12 @@
#ifndef VALUE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define VALUE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#ifndef NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define NODE_CONVERT_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/value.h"
#include "yaml-cpp/node/node.h"
#include <map>
#include <sstream>
@@ -15,12 +15,12 @@ namespace YAML
// std::string
template<>
struct convert<std::string> {
static Value encode(const std::string& rhs) {
return Value(rhs);
static Node encode(const std::string& rhs) {
return Node(rhs);
}
static bool decode(const Value& value, std::string& rhs) {
if(value.Type() != ValueType::Scalar)
static bool decode(const Node& value, std::string& rhs) {
if(value.Type() != NodeType::Scalar)
return false;
rhs = value.scalar();
return true;
@@ -30,14 +30,14 @@ namespace YAML
#define YAML_DEFINE_CONVERT_STREAMABLE(type)\
template<>\
struct convert<type> {\
static Value encode(const type& rhs) {\
static Node encode(const type& rhs) {\
std::stringstream stream;\
stream << rhs;\
return Value(stream.str());\
return Node(stream.str());\
}\
\
static bool decode(const Value& value, type& rhs) {\
if(value.Type() != ValueType::Scalar)\
static bool decode(const Node& value, type& rhs) {\
if(value.Type() != NodeType::Scalar)\
return false;\
std::stringstream stream(value.scalar());\
stream >> rhs;\
@@ -65,18 +65,18 @@ namespace YAML
template<typename K, typename V>
struct convert<std::map<K, V> > {
static Value encode(const std::map<K, V>& rhs) {
Value value(ValueType::Map);
static Node encode(const std::map<K, V>& rhs) {
Node value(NodeType::Map);
for(typename std::map<K, V>::const_iterator it=rhs.begin();it!=rhs.end();++it)
value[it->first] = it->second;
return value;
}
static bool decode(const Value& value, std::map<K, V>& rhs) {
static bool decode(const Node& value, std::map<K, V>& rhs) {
rhs.clear();
return false;
}
};
}
#endif // VALUE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#endif // NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@@ -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

View File

@@ -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>

View File

@@ -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>

View File

@@ -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

View File

@@ -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;

View File

@@ -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>

View File

@@ -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); }

View File

@@ -1,5 +1,5 @@
#ifndef VALUE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define VALUE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#ifndef NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define NODE_EMIT_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
@@ -11,11 +11,11 @@
namespace YAML
{
class Emitter;
class Value;
class Node;
Emitter& operator << (Emitter& out, const foo& value);
std::ostream& operator << (std::ostream& out, const Value& value);
Emitter& operator << (Emitter& out, const Node& node);
std::ostream& operator << (std::ostream& out, const Node& node);
}
#endif // VALUE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#endif // NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@@ -1,54 +1,54 @@
#ifndef VALUE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define VALUE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#ifndef NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define NODE_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/value.h"
#include "yaml-cpp/value/iterator.h"
#include "yaml-cpp/value/detail/memory.h"
#include "yaml-cpp/value/detail/node.h"
#include "yaml-cpp/node/node.h"
#include "yaml-cpp/node/iterator.h"
#include "yaml-cpp/node/detail/memory.h"
#include "yaml-cpp/node/detail/node.h"
#include <string>
namespace YAML
{
inline Value::Value(): m_pMemory(new detail::memory_holder), m_pNode(&m_pMemory->create_node())
inline Node::Node(): m_pMemory(new detail::memory_holder), m_pNode(&m_pMemory->create_node())
{
}
inline Value::Value(ValueType::value type): m_pMemory(new detail::memory_holder), m_pNode(&m_pMemory->create_node())
inline Node::Node(NodeType::value type): m_pMemory(new detail::memory_holder), m_pNode(&m_pMemory->create_node())
{
m_pNode->set_type(type);
}
template<typename T>
inline Value::Value(const T& rhs): m_pMemory(new detail::memory_holder), m_pNode(&m_pMemory->create_node())
inline Node::Node(const T& rhs): m_pMemory(new detail::memory_holder), m_pNode(&m_pMemory->create_node())
{
Assign(rhs);
}
inline Value::Value(const Value& rhs): m_pMemory(rhs.m_pMemory), m_pNode(rhs.m_pNode)
inline Node::Node(const Node& rhs): m_pMemory(rhs.m_pMemory), m_pNode(rhs.m_pNode)
{
}
inline Value::Value(detail::node& node, detail::shared_memory_holder pMemory): m_pMemory(pMemory), m_pNode(&node)
inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory): m_pMemory(pMemory), m_pNode(&node)
{
}
inline Value::~Value()
inline Node::~Node()
{
}
inline ValueType::value Value::Type() const
inline NodeType::value Node::Type() const
{
return m_pNode->type();
}
// access
template<typename T>
inline const T Value::as() const
inline const T Node::as() const
{
T t;
if(convert<T>::decode(*this, t))
@@ -57,54 +57,54 @@ namespace YAML
}
template<>
inline const std::string Value::as() const
inline const std::string Node::as() const
{
if(Type() != ValueType::Scalar)
if(Type() != NodeType::Scalar)
throw std::runtime_error("Unable to convert to string, not a scalar");
return scalar();
}
inline const std::string& Value::scalar() const
inline const std::string& Node::scalar() const
{
return m_pNode->scalar();
}
// assignment
inline bool Value::is(const Value& rhs) const
inline bool Node::is(const Node& rhs) const
{
return m_pNode->is(*rhs.m_pNode);
}
template<typename T>
inline Value& Value::operator=(const T& rhs)
inline Node& Node::operator=(const T& rhs)
{
Assign(rhs);
return *this;
}
template<typename T>
inline void Value::Assign(const T& rhs)
inline void Node::Assign(const T& rhs)
{
AssignData(convert<T>::encode(rhs));
}
template<>
inline void Value::Assign(const std::string& rhs)
inline void Node::Assign(const std::string& rhs)
{
m_pNode->set_scalar(rhs);
}
inline void Value::Assign(const char *rhs)
inline void Node::Assign(const char *rhs)
{
m_pNode->set_scalar(rhs);
}
inline void Value::Assign(char *rhs)
inline void Node::Assign(char *rhs)
{
m_pNode->set_scalar(rhs);
}
inline Value& Value::operator=(const Value& rhs)
inline Node& Node::operator=(const Node& rhs)
{
if(is(rhs))
return *this;
@@ -112,13 +112,13 @@ namespace YAML
return *this;
}
inline void Value::AssignData(const Value& rhs)
inline void Node::AssignData(const Node& rhs)
{
m_pNode->set_data(*rhs.m_pNode);
m_pMemory->merge(*rhs.m_pMemory);
}
inline void Value::AssignNode(const Value& rhs)
inline void Node::AssignNode(const Node& rhs)
{
m_pNode->set_ref(*rhs.m_pNode);
m_pMemory->merge(*rhs.m_pMemory);
@@ -126,39 +126,39 @@ namespace YAML
}
// size/iterator
inline std::size_t Value::size() const
inline std::size_t Node::size() const
{
return m_pNode->size();
}
inline const_iterator Value::begin() const
inline const_iterator Node::begin() const
{
return const_iterator(m_pNode->begin(), m_pMemory);
}
inline iterator Value::begin()
inline iterator Node::begin()
{
return iterator(m_pNode->begin(), m_pMemory);
}
inline const_iterator Value::end() const
inline const_iterator Node::end() const
{
return const_iterator(m_pNode->end(), m_pMemory);
}
inline iterator Value::end()
inline iterator Node::end()
{
return iterator(m_pNode->end(), m_pMemory);
}
// sequence
template<typename T>
inline void Value::append(const T& rhs)
inline void Node::append(const T& rhs)
{
append(Value(rhs));
append(Node(rhs));
}
inline void Value::append(const Value& rhs)
inline void Node::append(const Node& rhs)
{
m_pNode->append(*rhs.m_pNode, m_pMemory);
m_pMemory->merge(*rhs.m_pMemory);
@@ -166,87 +166,87 @@ namespace YAML
// indexing
template<typename Key>
inline const Value Value::operator[](const Key& key) const
inline const Node Node::operator[](const Key& key) const
{
detail::node& value = static_cast<const detail::node&>(*m_pNode).get(key, m_pMemory);
return Value(value, m_pMemory);
return Node(value, m_pMemory);
}
template<typename Key>
inline Value Value::operator[](const Key& key)
inline Node Node::operator[](const Key& key)
{
detail::node& value = m_pNode->get(key, m_pMemory);
return Value(value, m_pMemory);
return Node(value, m_pMemory);
}
template<typename Key>
inline bool Value::remove(const Key& key)
inline bool Node::remove(const Key& key)
{
return m_pNode->remove(key, m_pMemory);
}
inline const Value Value::operator[](const Value& key) const
inline const Node Node::operator[](const Node& key) const
{
detail::node& value = static_cast<const detail::node&>(*m_pNode).get(*key.m_pNode, m_pMemory);
return Value(value, m_pMemory);
return Node(value, m_pMemory);
}
inline Value Value::operator[](const Value& key)
inline Node Node::operator[](const Node& key)
{
detail::node& value = m_pNode->get(*key.m_pNode, m_pMemory);
return Value(value, m_pMemory);
return Node(value, m_pMemory);
}
inline bool Value::remove(const Value& key)
inline bool Node::remove(const Node& key)
{
return m_pNode->remove(*key.m_pNode, m_pMemory);
}
inline const Value Value::operator[](const char *key) const
inline const Node Node::operator[](const char *key) const
{
return operator[](std::string(key));
}
inline Value Value::operator[](const char *key)
inline Node Node::operator[](const char *key)
{
return operator[](std::string(key));
}
inline bool Value::remove(const char *key)
inline bool Node::remove(const char *key)
{
return remove(std::string(key));
}
inline const Value Value::operator[](char *key) const
inline const Node Node::operator[](char *key) const
{
return operator[](static_cast<const char *>(key));
}
inline Value Value::operator[](char *key)
inline Node Node::operator[](char *key)
{
return operator[](static_cast<const char *>(key));
}
inline bool Value::remove(char *key)
inline bool Node::remove(char *key)
{
return remove(static_cast<const char *>(key));
}
// free functions
inline int compare(const Value& lhs, const Value& rhs)
inline int compare(const Node& lhs, const Node& rhs)
{
return 0;
}
inline bool operator<(const Value& lhs, const Value& rhs)
inline bool operator<(const Node& lhs, const Node& rhs)
{
return false;
}
inline bool is(const Value& lhs, const Value& rhs)
inline bool is(const Node& lhs, const Node& rhs)
{
return lhs.is(rhs);
}
}
#endif // VALUE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#endif // NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@@ -7,9 +7,9 @@
#include "yaml-cpp/dll.h"
#include "yaml-cpp/value/value.h"
#include "yaml-cpp/value/detail/iterator_fwd.h"
#include "yaml-cpp/value/detail/iterator.h"
#include "yaml-cpp/node/node.h"
#include "yaml-cpp/node/detail/iterator_fwd.h"
#include "yaml-cpp/node/detail/iterator.h"
#include <list>
#include <utility>
#include <vector>
@@ -17,10 +17,10 @@
namespace YAML
{
namespace detail {
struct iterator_value: public Value, std::pair<Value, Value> {
struct iterator_value: public Node, std::pair<Node, Node> {
iterator_value() {}
explicit iterator_value(const Value& rhs): Value(rhs) {}
explicit iterator_value(const Value& key, const Value& value): std::pair<Value, Value>(key, value) {}
explicit iterator_value(const Node& rhs): Node(rhs) {}
explicit iterator_value(const Node& key, const Node& value): std::pair<Node, Node>(key, value) {}
};
}
}

View File

@@ -0,0 +1,96 @@
#ifndef NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define NODE_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
#endif
#include "yaml-cpp/dll.h"
#include "yaml-cpp/node/ptr.h"
#include "yaml-cpp/node/type.h"
#include "yaml-cpp/node/detail/iterator_fwd.h"
#include <stdexcept>
namespace YAML
{
class Node
{
public:
friend class NodeBuilder;
friend class NodeEvents;
friend class detail::node_data;
template<typename, typename, typename> friend class detail::iterator_base;
Node();
explicit Node(NodeType::value type);
template<typename T> explicit Node(const T& rhs);
Node(const Node& rhs);
~Node();
NodeType::value Type() const;
// access
template<typename T> const T as() const;
const std::string& scalar() const;
// assignment
bool is(const Node& rhs) const;
template<typename T> Node& operator=(const T& rhs);
Node& operator=(const Node& rhs);
// size/iterator
std::size_t size() const;
const_iterator begin() const;
iterator begin();
const_iterator end() const;
iterator end();
// sequence
template<typename T> void append(const T& rhs);
void append(const Node& rhs);
// indexing
template<typename Key> const Node operator[](const Key& key) const;
template<typename Key> Node operator[](const Key& key);
template<typename Key> bool remove(const Key& key);
const Node operator[](const Node& key) const;
Node operator[](const Node& key);
bool remove(const Node& key);
const Node operator[](const char *key) const;
Node operator[](const char *key);
bool remove(const char *key);
const Node operator[](char *key) const;
Node operator[](char *key);
bool remove(char *key);
private:
explicit Node(detail::node& node, detail::shared_memory_holder pMemory);
template<typename T> void Assign(const T& rhs);
void Assign(const char *rhs);
void Assign(char *rhs);
void AssignData(const Node& rhs);
void AssignNode(const Node& rhs);
private:
detail::shared_memory_holder m_pMemory;
detail::node *m_pNode;
};
int compare(const Node& lhs, const Node& rhs);
bool operator<(const Node& lhs, const Node& rhs);
bool is(const Node& lhs, const Node& rhs);
template<typename T>
struct convert;
}
#endif // NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@@ -10,11 +10,11 @@
namespace YAML
{
class Value;
class Node;
Value Parse(const std::string& input);
Value Parse(const char *input);
Value Parse(std::istream& input);
Node Parse(const std::string& input);
Node Parse(const char *input);
Node Parse(std::istream& input);
}
#endif // VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@@ -8,7 +8,7 @@
namespace YAML
{
struct ValueType { enum value { Undefined, Null, Scalar, Sequence, Map }; };
struct NodeType { enum value { Undefined, Null, Scalar, Sequence, Map }; };
}
#endif // VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@@ -1,96 +0,0 @@
#ifndef VALUE_VALUE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define VALUE_VALUE_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/dll.h"
#include "yaml-cpp/value/ptr.h"
#include "yaml-cpp/value/type.h"
#include "yaml-cpp/value/detail/iterator_fwd.h"
#include <stdexcept>
namespace YAML
{
class Value
{
public:
friend class ValueBuilder;
friend class ValueEvents;
friend class detail::node_data;
template<typename, typename, typename> friend class detail::iterator_base;
Value();
explicit Value(ValueType::value type);
template<typename T> explicit Value(const T& rhs);
Value(const Value& rhs);
~Value();
ValueType::value Type() const;
// access
template<typename T> const T as() const;
const std::string& scalar() const;
// assignment
bool is(const Value& rhs) const;
template<typename T> Value& operator=(const T& rhs);
Value& operator=(const Value& rhs);
// size/iterator
std::size_t size() const;
const_iterator begin() const;
iterator begin();
const_iterator end() const;
iterator end();
// sequence
template<typename T> void append(const T& rhs);
void append(const Value& rhs);
// indexing
template<typename Key> const Value operator[](const Key& key) const;
template<typename Key> Value operator[](const Key& key);
template<typename Key> bool remove(const Key& key);
const Value operator[](const Value& key) const;
Value operator[](const Value& key);
bool remove(const Value& key);
const Value operator[](const char *key) const;
Value operator[](const char *key);
bool remove(const char *key);
const Value operator[](char *key) const;
Value operator[](char *key);
bool remove(char *key);
private:
explicit Value(detail::node& node, detail::shared_memory_holder pMemory);
template<typename T> void Assign(const T& rhs);
void Assign(const char *rhs);
void Assign(char *rhs);
void AssignData(const Value& rhs);
void AssignNode(const Value& rhs);
private:
detail::shared_memory_holder m_pMemory;
detail::node *m_pNode;
};
int compare(const Value& lhs, const Value& rhs);
bool operator<(const Value& lhs, const Value& rhs);
bool is(const Value& lhs, const Value& rhs);
template<typename T>
struct convert;
}
#endif // VALUE_VALUE_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@@ -32,7 +32,10 @@ namespace YAML
void Load(std::istream& in);
bool HandleNextDocument(EventHandler& eventHandler);
#if YAML_CPP_OLD_API
bool GetNextDocument(Node& document);
#endif
void PrintTokens(std::ostream& out);
private:

View File

@@ -1,17 +0,0 @@
#ifndef VALUE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define VALUE_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/value.h"
#include "yaml-cpp/value/impl.h"
#include "yaml-cpp/value/convert.h"
#include "yaml-cpp/value/iterator.h"
#include "yaml-cpp/value/detail/impl.h"
#include "yaml-cpp/value/parse.h"
#include "yaml-cpp/value/emit.h"
#endif // VALUE_H_62B23520_7C8E_11DE_8A39_0800200C9A66

View File

@@ -7,11 +7,26 @@
#include "yaml-cpp/parser.h"
#include "yaml-cpp/node.h"
#include "yaml-cpp/stlnode.h"
#include "yaml-cpp/iterator.h"
#include "yaml-cpp/emitter.h"
#include "yaml-cpp/stlemitter.h"
#include "yaml-cpp/exceptions.h"
#ifdef YAML_CPP_OLD_API
#include "yaml-cpp/old-api/node.h"
#include "yaml-cpp/old-api/stlnode.h"
#include "yaml-cpp/old-api/iterator.h"
#else
#include "yaml-cpp/node/node.h"
#include "yaml-cpp/node/impl.h"
#include "yaml-cpp/node/convert.h"
#include "yaml-cpp/node/iterator.h"
#include "yaml-cpp/node/detail/impl.h"
#include "yaml-cpp/node/parse.h"
#include "yaml-cpp/node/emit.h"
#endif // YAML_CPP_OLD_API
#endif // YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66