Commit ca5992b9 authored by Jesse Beder's avatar Jesse Beder
Browse files

Merged r444:449 from the node refactoring branch to the trunk

parent ced50538
#ifndef MAP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define MAP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
#include "content.h"
#include <map>
#include <memory>
namespace YAML
{
class Node;
class Map: public Content
{
private:
typedef std::map <Node *, Node *, ltnode> node_map;
public:
Map();
virtual ~Map();
void Clear();
virtual bool GetBegin(std::map <Node *, Node *, ltnode>::const_iterator& it) const;
virtual bool GetEnd(std::map <Node *, Node *, ltnode>::const_iterator& it) const;
virtual std::size_t GetSize() const;
virtual void Insert(std::auto_ptr<Node> pKey, std::auto_ptr<Node> pValue);
virtual void EmitEvents(AliasManager& am, EventHandler& eventHandler, const Mark& mark, const std::string& tag, anchor_t anchor) const;
virtual bool IsMap() const { return true; }
// ordering
virtual int Compare(Content *pContent);
virtual int Compare(Scalar *) { return 1; }
virtual int Compare(Sequence *) { return 1; }
virtual int Compare(Map *pMap);
private:
node_map m_data;
};
}
#endif // MAP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#include "yaml-cpp/node.h" #include "yaml-cpp/node.h"
#include "aliascontent.h"
#include "yaml-cpp/aliasmanager.h"
#include "content.h"
#include "yaml-cpp/emitfromevents.h"
#include "yaml-cpp/emitter.h"
#include "yaml-cpp/eventhandler.h"
#include "iterpriv.h" #include "iterpriv.h"
#include "map.h"
#include "nodebuilder.h" #include "nodebuilder.h"
#include "yaml-cpp/nodeproperties.h" #include "nodeownership.h"
#include "scalar.h"
#include "scanner.h" #include "scanner.h"
#include "sequence.h"
#include "tag.h" #include "tag.h"
#include "token.h" #include "token.h"
#include "yaml-cpp/aliasmanager.h"
#include "yaml-cpp/emitfromevents.h"
#include "yaml-cpp/emitter.h"
#include "yaml-cpp/eventhandler.h"
#include <cassert> #include <cassert>
#include <stdexcept> #include <stdexcept>
namespace YAML namespace YAML
{ {
// the ordering! bool ltnode::operator()(const Node *pNode1, const Node *pNode2) const {
bool ltnode::operator ()(const Node *pNode1, const Node *pNode2) const
{
return *pNode1 < *pNode2; return *pNode1 < *pNode2;
} }
Node::Node(): m_type(CT_NONE), m_pContent(0), m_alias(false), m_referenced(false) Node::Node(): m_pOwnership(new NodeOwnership), m_type(NodeType::Null)
{
}
Node::Node(NodeOwnership& owner): m_pOwnership(new NodeOwnership(&owner)), m_type(NodeType::Null)
{ {
m_pIdentity = this;
} }
Node::~Node() Node::~Node()
...@@ -37,14 +33,24 @@ namespace YAML ...@@ -37,14 +33,24 @@ namespace YAML
void Node::Clear() void Node::Clear()
{ {
delete m_pContent; m_pOwnership.reset(new NodeOwnership);
m_type = CT_NONE; m_type = NodeType::Null;
m_pContent = 0;
m_alias = false;
m_referenced = false;
m_tag.clear(); m_tag.clear();
m_scalarData.clear();
m_seqData.clear();
m_mapData.clear();
} }
bool Node::IsAliased() const
{
return m_pOwnership->IsAliased(*this);
}
Node& Node::CreateNode()
{
return m_pOwnership->Create();
}
std::auto_ptr<Node> Node::Clone() const std::auto_ptr<Node> Node::Clone() const
{ {
std::auto_ptr<Node> pNode(new Node); std::auto_ptr<Node> pNode(new Node);
...@@ -64,9 +70,10 @@ namespace YAML ...@@ -64,9 +70,10 @@ namespace YAML
void Node::EmitEvents(AliasManager& am, EventHandler& eventHandler) const void Node::EmitEvents(AliasManager& am, EventHandler& eventHandler) const
{ {
anchor_t anchor = NullAnchor; anchor_t anchor = NullAnchor;
if(m_referenced || m_alias) { if(IsAliased()) {
if(const Node *pOther = am.LookupReference(*this)) { anchor = am.LookupAnchor(*this);
eventHandler.OnAlias(m_mark, am.LookupAnchor(*pOther)); if(anchor) {
eventHandler.OnAlias(m_mark, anchor);
return; return;
} }
...@@ -74,93 +81,76 @@ namespace YAML ...@@ -74,93 +81,76 @@ namespace YAML
anchor = am.LookupAnchor(*this); anchor = am.LookupAnchor(*this);
} }
if(m_pContent) switch(m_type) {
m_pContent->EmitEvents(am, eventHandler, m_mark, GetTag(), anchor); case NodeType::Null:
else eventHandler.OnNull(m_mark, anchor);
eventHandler.OnNull(GetTag(), anchor);
}
void Node::Init(CONTENT_TYPE type, const Mark& mark, const std::string& tag)
{
Clear();
m_mark = mark;
m_type = type;
m_tag = tag;
m_alias = false;
m_pIdentity = this;
m_referenced = false;
switch(type) {
case CT_SCALAR:
m_pContent = new Scalar;
break; break;
case CT_SEQUENCE: case NodeType::Scalar:
m_pContent = new Sequence; eventHandler.OnScalar(m_mark, m_tag, anchor, m_scalarData);
break; break;
case CT_MAP: case NodeType::Sequence:
m_pContent = new Map; eventHandler.OnSequenceStart(m_mark, m_tag, anchor);
for(std::size_t i=0;i<m_seqData.size();i++)
m_seqData[i]->EmitEvents(am, eventHandler);
eventHandler.OnSequenceEnd();
break; break;
default: case NodeType::Map:
m_pContent = 0; eventHandler.OnMapStart(m_mark, m_tag, anchor);
for(node_map::const_iterator it=m_mapData.begin();it!=m_mapData.end();++it) {
it->first->EmitEvents(am, eventHandler);
it->second->EmitEvents(am, eventHandler);
}
eventHandler.OnMapEnd();
break; break;
} }
} }
void Node::InitNull(const std::string& tag) void Node::Init(NodeType::value type, const Mark& mark, const std::string& tag)
{ {
Clear(); Clear();
m_mark = mark;
m_type = type;
m_tag = tag; m_tag = tag;
m_alias = false;
m_pIdentity = this;
m_referenced = false;
} }
void Node::InitAlias(const Mark& mark, const Node& identity) void Node::MarkAsAliased()
{ {
Clear(); m_pOwnership->MarkAsAliased(*this);
m_mark = mark;
m_alias = true;
m_pIdentity = &identity;
if(identity.m_pContent) {
m_pContent = new AliasContent(identity.m_pContent);
m_type = identity.GetType();
}
identity.m_referenced = true;
} }
void Node::SetData(const std::string& data) void Node::SetScalarData(const std::string& data)
{ {
assert(m_pContent); // TODO: throw assert(m_type == NodeType::Scalar); // TODO: throw?
m_pContent->SetData(data); m_scalarData = data;
} }
void Node::Append(std::auto_ptr<Node> pNode) void Node::Append(Node& node)
{ {
assert(m_pContent); // TODO: throw assert(m_type == NodeType::Sequence); // TODO: throw?
m_pContent->Append(pNode); m_seqData.push_back(&node);
} }
void Node::Insert(std::auto_ptr<Node> pKey, std::auto_ptr<Node> pValue) void Node::Insert(Node& key, Node& value)
{ {
assert(m_pContent); // TODO: throw assert(m_type == NodeType::Map); // TODO: throw?
m_pContent->Insert(pKey, pValue); m_mapData[&key] = &value;
} }
// begin // begin
// Returns an iterator to the beginning of this (sequence or map). // Returns an iterator to the beginning of this (sequence or map).
Iterator Node::begin() const Iterator Node::begin() const
{ {
if(!m_pContent) switch(m_type) {
return Iterator(); case NodeType::Null:
case NodeType::Scalar:
std::vector <Node *>::const_iterator seqIter; return Iterator();
if(m_pContent->GetBegin(seqIter)) case NodeType::Sequence:
return Iterator(new IterPriv(seqIter)); return Iterator(std::auto_ptr<IterPriv>(new IterPriv(m_seqData.begin())));
case NodeType::Map:
std::map <Node *, Node *, ltnode>::const_iterator mapIter; return Iterator(std::auto_ptr<IterPriv>(new IterPriv(m_mapData.begin())));
if(m_pContent->GetBegin(mapIter)) }
return Iterator(new IterPriv(mapIter));
assert(false);
return Iterator(); return Iterator();
} }
...@@ -168,50 +158,62 @@ namespace YAML ...@@ -168,50 +158,62 @@ namespace YAML
// . Returns an iterator to the end of this (sequence or map). // . Returns an iterator to the end of this (sequence or map).
Iterator Node::end() const Iterator Node::end() const
{ {
if(!m_pContent) switch(m_type) {
return Iterator(); case NodeType::Null:
case NodeType::Scalar:
std::vector <Node *>::const_iterator seqIter; return Iterator();
if(m_pContent->GetEnd(seqIter)) case NodeType::Sequence:
return Iterator(new IterPriv(seqIter)); return Iterator(std::auto_ptr<IterPriv>(new IterPriv(m_seqData.end())));
case NodeType::Map:
std::map <Node *, Node *, ltnode>::const_iterator mapIter; return Iterator(std::auto_ptr<IterPriv>(new IterPriv(m_mapData.end())));
if(m_pContent->GetEnd(mapIter)) }
return Iterator(new IterPriv(mapIter));
assert(false);
return Iterator(); return Iterator();
} }
// size // size
// . Returns the size of this node, if it's a sequence node. // . Returns the size of a sequence or map node
// . Otherwise, returns zero. // . Otherwise, returns zero.
std::size_t Node::size() const std::size_t Node::size() const
{ {
if(!m_pContent) switch(m_type) {
return 0; case NodeType::Null:
case NodeType::Scalar:
return m_pContent->GetSize(); return 0;
case NodeType::Sequence:
return m_seqData.size();
case NodeType::Map:
return m_mapData.size();
}
assert(false);
return 0;
} }
const Node *Node::FindAtIndex(std::size_t i) const const Node *Node::FindAtIndex(std::size_t i) const
{ {
if(!m_pContent) if(m_type == NodeType::Sequence)
return 0; return m_seqData[i];
return 0;
return m_pContent->GetNode(i);
} }
bool Node::GetScalar(std::string& s) const bool Node::GetScalar(std::string& s) const
{ {
if(!m_pContent) { switch(m_type) {
if(m_tag.empty()) case NodeType::Null:
s = "~"; s = "~";
else return true;
s = ""; case NodeType::Scalar:
return true; s = m_scalarData;
return true;
case NodeType::Sequence:
case NodeType::Map:
return false;
} }
return m_pContent->GetScalar(s); assert(false);
return false;
} }
Emitter& operator << (Emitter& out, const Node& node) Emitter& operator << (Emitter& out, const Node& node)
...@@ -223,17 +225,41 @@ namespace YAML ...@@ -223,17 +225,41 @@ namespace YAML
int Node::Compare(const Node& rhs) const int Node::Compare(const Node& rhs) const
{ {
// Step 1: no content is the smallest if(m_type != rhs.m_type)
if(!m_pContent) { return rhs.m_type - m_type;
if(rhs.m_pContent)
return -1; switch(m_type) {
else case NodeType::Null:
return 0;
case NodeType::Scalar:
return m_scalarData.compare(rhs.m_scalarData);
case NodeType::Sequence:
if(m_seqData.size() < rhs.m_seqData.size())
return 1;
else if(m_seqData.size() > rhs.m_seqData.size())
return -1;
for(std::size_t i=0;i<m_seqData.size();i++)
if(int cmp = m_seqData[i]->Compare(*rhs.m_seqData[i]))
return cmp;
return 0;
case NodeType::Map:
if(m_mapData.size() < rhs.m_mapData.size())
return 1;
else if(m_mapData.size() > rhs.m_mapData.size())
return -1;
node_map::const_iterator it = m_mapData.begin();
node_map::const_iterator jt = rhs.m_mapData.begin();
for(;it!=m_mapData.end() && jt!=rhs.m_mapData.end();it++, jt++) {
if(int cmp = it->first->Compare(*jt->first))
return cmp;
if(int cmp = it->second->Compare(*jt->second))
return cmp;
}
return 0; return 0;
} }
if(!rhs.m_pContent)
return 1; assert(false);
return 0;
return m_pContent->Compare(rhs.m_pContent);
} }
bool operator < (const Node& n1, const Node& n2) bool operator < (const Node& n1, const Node& n2)
......
#include "nodebuilder.h" #include "nodebuilder.h"
#include "yaml-cpp/mark.h" #include "yaml-cpp/mark.h"
#include "yaml-cpp/node.h" #include "yaml-cpp/node.h"
#include "yaml-cpp/nodeproperties.h"
#include <cassert> #include <cassert>
namespace YAML namespace YAML
...@@ -25,32 +24,32 @@ namespace YAML ...@@ -25,32 +24,32 @@ namespace YAML
assert(m_finished); assert(m_finished);
} }
void NodeBuilder::OnNull(const std::string& tag, anchor_t anchor) void NodeBuilder::OnNull(const Mark& mark, anchor_t anchor)
{ {
Node& node = Push(anchor); Node& node = Push(anchor);
node.InitNull(tag); node.Init(NodeType::Null, mark, "");
Pop(); Pop();
} }
void NodeBuilder::OnAlias(const Mark& mark, anchor_t anchor) void NodeBuilder::OnAlias(const Mark& /*mark*/, anchor_t anchor)
{ {
Node& node = Push(); Node& node = *m_anchors[anchor];
node.InitAlias(mark, *m_anchors[anchor]); Insert(node);
Pop(); node.MarkAsAliased();
} }
void NodeBuilder::OnScalar(const Mark& mark, const std::string& tag, anchor_t anchor, const std::string& value) void NodeBuilder::OnScalar(const Mark& mark, const std::string& tag, anchor_t anchor, const std::string& value)
{ {
Node& node = Push(anchor); Node& node = Push(anchor);
node.Init(CT_SCALAR, mark, tag); node.Init(NodeType::Scalar, mark, tag);
node.SetData(value); node.SetScalarData(value);
Pop(); Pop();
} }
void NodeBuilder::OnSequenceStart(const Mark& mark, const std::string& tag, anchor_t anchor) void NodeBuilder::OnSequenceStart(const Mark& mark, const std::string& tag, anchor_t anchor)
{ {
Node& node = Push(anchor); Node& node = Push(anchor);
node.Init(CT_SEQUENCE, mark, tag); node.Init(NodeType::Sequence, mark, tag);
} }
void NodeBuilder::OnSequenceEnd() void NodeBuilder::OnSequenceEnd()
...@@ -61,7 +60,7 @@ namespace YAML ...@@ -61,7 +60,7 @@ namespace YAML
void NodeBuilder::OnMapStart(const Mark& mark, const std::string& tag, anchor_t anchor) void NodeBuilder::OnMapStart(const Mark& mark, const std::string& tag, anchor_t anchor)
{ {
Node& node = Push(anchor); Node& node = Push(anchor);
node.Init(CT_MAP, mark, tag); node.Init(NodeType::Map, mark, tag);
m_didPushKey.push(false); m_didPushKey.push(false);
} }
...@@ -85,14 +84,14 @@ namespace YAML ...@@ -85,14 +84,14 @@ namespace YAML
return m_root; return m_root;
} }
std::auto_ptr<Node> pNode(new Node); Node& node = m_root.CreateNode();
m_stack.push(pNode); m_stack.push(&node);
return m_stack.top(); return node;
} }
Node& NodeBuilder::Top() Node& NodeBuilder::Top()
{ {
return m_stack.empty() ? m_root : m_stack.top(); return m_stack.empty() ? m_root : *m_stack.top();
} }
void NodeBuilder::Pop() void NodeBuilder::Pop()
...@@ -103,36 +102,40 @@ namespace YAML ...@@ -103,36 +102,40 @@ namespace YAML
return; return;
} }
std::auto_ptr<Node> pNode = m_stack.pop(); Node& node = *m_stack.top();
Insert(pNode); m_stack.pop();
Insert(node);
} }
void NodeBuilder::Insert(std::auto_ptr<Node> pNode) void NodeBuilder::Insert(Node& node)
{ {
Node& node = Top(); Node& curTop = Top();
switch(node.GetType()) { switch(curTop.Type()) {
case CT_SEQUENCE: case NodeType::Null:
node.Append(pNode); case NodeType::Scalar:
assert(false);
break;
case NodeType::Sequence:
curTop.Append(node);
break; break;
case CT_MAP: case NodeType::Map:
assert(!m_didPushKey.empty()); assert(!m_didPushKey.empty());
if(m_didPushKey.top()) { if(m_didPushKey.top()) {
assert(!m_pendingKeys.empty()); assert(!m_pendingKeys.empty());
std::auto_ptr<Node> pKey = m_pendingKeys.pop(); Node& key = *m_pendingKeys.top();
node.Insert(pKey, pNode); m_pendingKeys.pop();
curTop.Insert(key, node);
m_didPushKey.top() = false; m_didPushKey.top() = false;
} else { } else {
m_pendingKeys.push(pNode); m_pendingKeys.push(&node);
m_didPushKey.top() = true; m_didPushKey.top() = true;
} }
break; break;
default:
assert(false);
} }
} }
void NodeBuilder::RegisterAnchor(anchor_t anchor, const Node& node) void NodeBuilder::RegisterAnchor(anchor_t anchor, Node& node)
{ {
if(anchor) { if(anchor) {
assert(anchor == m_anchors.size()); assert(anchor == m_anchors.size());
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
#endif #endif
#include "yaml-cpp/eventhandler.h" #include "yaml-cpp/eventhandler.h"
#include "ptr_stack.h"
#include <map> #include <map>
#include <memory> #include <memory>
#include <stack> #include <stack>
#include <vector>
namespace YAML namespace YAML
{ {
...@@ -24,7 +24,7 @@ namespace YAML ...@@ -24,7 +24,7 @@ namespace YAML
virtual void OnDocumentStart(const Mark& mark); virtual void OnDocumentStart(const Mark& mark);
virtual void OnDocumentEnd(); virtual void OnDocumentEnd();
virtual void OnNull(const std::string& tag, anchor_t anchor); virtual void OnNull(const Mark& mark, anchor_t anchor);
virtual void OnAlias(const Mark& mark, anchor_t anchor); virtual void OnAlias(const Mark& mark, anchor_t anchor);
virtual void OnScalar(const Mark& mark, const std::string& tag, anchor_t anchor, const std::string& value); virtual void OnScalar(const Mark& mark, const std::string& tag, anchor_t anchor, const std::string& value);
...@@ -40,19 +40,19 @@ namespace YAML ...@@ -40,19 +40,19 @@ namespace YAML
Node& Top(); Node& Top();
void Pop(); void Pop();
void Insert(std::auto_ptr<Node> pNode); void Insert(Node& node);
void RegisterAnchor(anchor_t anchor, const Node& node); void RegisterAnchor(anchor_t anchor, Node& node);
private: private:
Node& m_root; Node& m_root;
bool m_initializedRoot; bool m_initializedRoot;
bool m_finished; bool m_finished;
ptr_stack<Node> m_stack; std::stack<Node *> m_stack;
ptr_stack<Node> m_pendingKeys; std::stack<Node *> m_pendingKeys;
std::stack<bool> m_didPushKey; std::stack<bool> m_didPushKey;
typedef std::vector<const Node *> Anchors; typedef std::vector<Node *> Anchors;
Anchors m_anchors; Anchors m_anchors;
}; };
} }
......
#include "nodeownership.h"
#include "yaml-cpp/node.h"
namespace YAML
{
NodeOwnership::NodeOwnership(NodeOwnership *pOwner): m_pOwner(pOwner)
{
if(!m_pOwner)
m_pOwner = this;
}
NodeOwnership::~NodeOwnership()
{
}
Node& NodeOwnership::_Create()
{
m_nodes.push_back(std::auto_ptr<Node>(new Node));
return m_nodes.back();
}
void NodeOwnership::_MarkAsAliased(const Node& node)
{
m_aliasedNodes.insert(&node);
}
bool NodeOwnership::_IsAliased(const Node& node) const
{
return m_aliasedNodes.count(&node) > 0;
}
}
#ifndef NODE_OWNERSHIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define NODE_OWNERSHIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
#include "yaml-cpp/noncopyable.h"
#include "ptr_vector.h"
#include <set>
namespace YAML
{
class Node;
class NodeOwnership: private noncopyable
{
public:
explicit NodeOwnership(NodeOwnership *pOwner = 0);
~NodeOwnership();
Node& Create() { return m_pOwner->_Create(); }
void MarkAsAliased(const Node& node) { m_pOwner->_MarkAsAliased(node); }
bool IsAliased(const Node& node) const { return m_pOwner->_IsAliased(node); }
private:
Node& _Create();
void _MarkAsAliased(const Node& node);
bool _IsAliased(const Node& node) const;
private:
ptr_vector<Node> m_nodes;
std::set<const Node *> m_aliasedNodes;
NodeOwnership *m_pOwner;
};
}
#endif // NODE_OWNERSHIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#ifndef PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
#include "yaml-cpp/noncopyable.h"
#include <memory>
#include <vector>
namespace YAML {
template <typename T>
class ptr_vector: private YAML::noncopyable
{
public:
ptr_vector() {}
~ptr_vector() { clear(); }
void clear() {
for(unsigned i=0;i<m_data.size();i++)
delete m_data[i];
m_data.clear();
}
std::size_t size() const { return m_data.size(); }
bool empty() const { return m_data.empty(); }
void push_back(std::auto_ptr<T> t) {
m_data.push_back(NULL);
m_data.back() = t.release();
}
T& operator[](std::size_t i) { return *m_data[i]; }
const T& operator[](std::size_t i) const { return *m_data[i]; }
T& back() { return *m_data.back(); }
const T& back() const { return *m_data.back(); }
private:
std::vector<T*> m_data;
};
}
#endif // PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#include "scalar.h"
#include "yaml-cpp/eventhandler.h"
namespace YAML
{
Scalar::Scalar()
{
}
Scalar::~Scalar()
{
}
void Scalar::EmitEvents(AliasManager&, EventHandler& eventHandler, const Mark& mark, const std::string& tag, anchor_t anchor) const
{
eventHandler.OnScalar(mark, tag, anchor, m_data);
}
int Scalar::Compare(Content *pContent)
{
return -pContent->Compare(this);
}
int Scalar::Compare(Scalar *pScalar)
{
if(m_data < pScalar->m_data)
return -1;
else if(m_data > pScalar->m_data)
return 1;
else
return 0;
}
}
#ifndef SCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define SCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
#include "content.h"
#include <string>
namespace YAML
{
class Scalar: public Content
{
public:
Scalar();
virtual ~Scalar();
virtual void SetData(const std::string& data) { m_data = data; }
virtual bool IsScalar() const { return true; }
virtual void EmitEvents(AliasManager& am, EventHandler& eventHandler, const Mark& mark, const std::string& tag, anchor_t anchor) const;
// extraction
virtual bool GetScalar(std::string& scalar) const {
scalar = m_data;
return true;
}
// ordering
virtual int Compare(Content *pContent);
virtual int Compare(Scalar *pScalar);
virtual int Compare(Sequence *) { return -1; }
virtual int Compare(Map *) { return -1; }
protected:
std::string m_data;
};
}
#endif // SCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#include "sequence.h"
#include "yaml-cpp/eventhandler.h"
#include "yaml-cpp/node.h"
#include <stdexcept>
namespace YAML
{
Sequence::Sequence()
{
}
Sequence::~Sequence()
{
Clear();
}
void Sequence::Clear()
{
for(std::size_t i=0;i<m_data.size();i++)
delete m_data[i];
m_data.clear();
}
bool Sequence::GetBegin(std::vector <Node *>::const_iterator& it) const
{
it = m_data.begin();
return true;
}
bool Sequence::GetEnd(std::vector <Node *>::const_iterator& it) const
{
it = m_data.end();
return true;
}
Node *Sequence::GetNode(std::size_t i) const
{
if(i < m_data.size())
return m_data[i];
return 0;
}
std::size_t Sequence::GetSize() const
{
return m_data.size();
}
void Sequence::Append(std::auto_ptr<Node> pNode)
{
m_data.push_back(pNode.release());
}
void Sequence::EmitEvents(AliasManager& am, EventHandler& eventHandler, const Mark& mark, const std::string& tag, anchor_t anchor) const
{
eventHandler.OnSequenceStart(mark, tag, anchor);
for(std::size_t i=0;i<m_data.size();i++)
m_data[i]->EmitEvents(am, eventHandler);
eventHandler.OnSequenceEnd();
}
int Sequence::Compare(Content *pContent)
{
return -pContent->Compare(this);
}
int Sequence::Compare(Sequence *pSeq)
{
std::size_t n = m_data.size(), m = pSeq->m_data.size();
if(n < m)
return -1;
else if(n > m)
return 1;
for(std::size_t i=0;i<n;i++) {
int cmp = m_data[i]->Compare(*pSeq->m_data[i]);
if(cmp != 0)
return cmp;
}
return 0;
}
}
#ifndef SEQUENCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define SEQUENCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
#include "content.h"
#include <vector>
namespace YAML
{
class Node;
class Sequence: public Content
{
public:
Sequence();
virtual ~Sequence();
void Clear();
virtual bool GetBegin(std::vector <Node *>::const_iterator& it) const;
virtual bool GetEnd(std::vector <Node *>::const_iterator& it) const;
virtual Node *GetNode(std::size_t i) const;
virtual std::size_t GetSize() const;
virtual void Append(std::auto_ptr<Node> pNode);
virtual void EmitEvents(AliasManager& am, EventHandler& eventHandler, const Mark& mark, const std::string& tag, anchor_t anchor) const;
virtual bool IsSequence() const { return true; }
// ordering
virtual int Compare(Content *pContent);
virtual int Compare(Scalar *) { return 1; }
virtual int Compare(Sequence *pSeq);
virtual int Compare(Map *) { return -1; }
protected:
std::vector <Node *> m_data;
};
}
#endif // SEQUENCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
...@@ -48,7 +48,7 @@ namespace YAML ...@@ -48,7 +48,7 @@ namespace YAML
{ {
// an empty node *is* a possibility // an empty node *is* a possibility
if(m_scanner.empty()) { if(m_scanner.empty()) {
eventHandler.OnNull("", NullAnchor); eventHandler.OnNull(Mark::null(), NullAnchor);
return; return;
} }
...@@ -112,7 +112,10 @@ namespace YAML ...@@ -112,7 +112,10 @@ namespace YAML
break; break;
} }
eventHandler.OnNull(tag, anchor); if(tag == "?")
eventHandler.OnNull(mark, anchor);
else
eventHandler.OnScalar(mark, tag, anchor, "");
} }
void SingleDocParser::HandleSequence(EventHandler& eventHandler) void SingleDocParser::HandleSequence(EventHandler& eventHandler)
...@@ -147,7 +150,7 @@ namespace YAML ...@@ -147,7 +150,7 @@ namespace YAML
if(!m_scanner.empty()) { if(!m_scanner.empty()) {
const Token& token = m_scanner.peek(); const Token& token = m_scanner.peek();
if(token.type == Token::BLOCK_ENTRY || token.type == Token::BLOCK_SEQ_END) { if(token.type == Token::BLOCK_ENTRY || token.type == Token::BLOCK_SEQ_END) {
eventHandler.OnNull("", NullAnchor); eventHandler.OnNull(token.mark, NullAnchor);
continue; continue;
} }
} }
...@@ -224,7 +227,7 @@ namespace YAML ...@@ -224,7 +227,7 @@ namespace YAML
m_scanner.pop(); m_scanner.pop();
HandleNode(eventHandler); HandleNode(eventHandler);
} else { } else {
eventHandler.OnNull("", NullAnchor); eventHandler.OnNull(token.mark, NullAnchor);
} }
// now grab value (optional) // now grab value (optional)
...@@ -232,7 +235,7 @@ namespace YAML ...@@ -232,7 +235,7 @@ namespace YAML
m_scanner.pop(); m_scanner.pop();
HandleNode(eventHandler); HandleNode(eventHandler);
} else { } else {
eventHandler.OnNull("", NullAnchor); eventHandler.OnNull(token.mark, NullAnchor);
} }
} }
...@@ -261,7 +264,7 @@ namespace YAML ...@@ -261,7 +264,7 @@ namespace YAML
m_scanner.pop(); m_scanner.pop();
HandleNode(eventHandler); HandleNode(eventHandler);
} else { } else {
eventHandler.OnNull("", NullAnchor); eventHandler.OnNull(token.mark, NullAnchor);
} }
// now grab value (optional) // now grab value (optional)
...@@ -269,7 +272,7 @@ namespace YAML ...@@ -269,7 +272,7 @@ namespace YAML
m_scanner.pop(); m_scanner.pop();
HandleNode(eventHandler); HandleNode(eventHandler);
} else { } else {
eventHandler.OnNull("", NullAnchor); eventHandler.OnNull(token.mark, NullAnchor);
} }
// now eat the separator (or could be a map end, which we ignore - but if it's neither, then it's a bad node) // now eat the separator (or could be a map end, which we ignore - but if it's neither, then it's a bad node)
...@@ -289,6 +292,7 @@ namespace YAML ...@@ -289,6 +292,7 @@ namespace YAML
m_pCollectionStack->PushCollectionType(CollectionType::CompactMap); m_pCollectionStack->PushCollectionType(CollectionType::CompactMap);
// grab key // grab key
Mark mark = m_scanner.peek().mark;
m_scanner.pop(); m_scanner.pop();
HandleNode(eventHandler); HandleNode(eventHandler);
...@@ -297,7 +301,7 @@ namespace YAML ...@@ -297,7 +301,7 @@ namespace YAML
m_scanner.pop(); m_scanner.pop();
HandleNode(eventHandler); HandleNode(eventHandler);
} else { } else {
eventHandler.OnNull("", NullAnchor); eventHandler.OnNull(mark, NullAnchor);
} }
m_pCollectionStack->PopCollectionType(CollectionType::CompactMap); m_pCollectionStack->PopCollectionType(CollectionType::CompactMap);
...@@ -309,7 +313,7 @@ namespace YAML ...@@ -309,7 +313,7 @@ namespace YAML
m_pCollectionStack->PushCollectionType(CollectionType::CompactMap); m_pCollectionStack->PushCollectionType(CollectionType::CompactMap);
// null key // null key
eventHandler.OnNull("", NullAnchor); eventHandler.OnNull(m_scanner.peek().mark, NullAnchor);
// grab value // grab value
m_scanner.pop(); m_scanner.pop();
......
...@@ -698,7 +698,7 @@ namespace Test ...@@ -698,7 +698,7 @@ namespace Test
YAML::Node doc; YAML::Node doc;
parser.GetNextDocument(doc); parser.GetNextDocument(doc);
if(doc["a"] != 1) if(doc["a"] != 4)
return false; return false;
if(doc["b"] != 2) if(doc["b"] != 2)
return false; return false;
...@@ -729,10 +729,10 @@ namespace Test ...@@ -729,10 +729,10 @@ namespace Test
bool ExpectedTagValue(YAML::Node& node, const char* tag) bool ExpectedTagValue(YAML::Node& node, const char* tag)
{ {
if(node.GetTag() == tag) if(node.Tag() == tag)
return true; return true;
throw TagMismatch(node.GetTag(), tag); throw TagMismatch(node.Tag(), tag);
} }
bool DefaultPlainScalarTag() bool DefaultPlainScalarTag()
......
...@@ -481,16 +481,16 @@ namespace Test { ...@@ -481,16 +481,16 @@ namespace Test {
PARSE(doc, input); PARSE(doc, input);
YAML_ASSERT(doc.size() == 3); YAML_ASSERT(doc.size() == 3);
YAML_ASSERT(doc["not-date"].GetTag() == "tag:yaml.org,2002:str"); YAML_ASSERT(doc["not-date"].Tag() == "tag:yaml.org,2002:str");
YAML_ASSERT(doc["not-date"] == "2002-04-28"); YAML_ASSERT(doc["not-date"] == "2002-04-28");
YAML_ASSERT(doc["picture"].GetTag() == "tag:yaml.org,2002:binary"); YAML_ASSERT(doc["picture"].Tag() == "tag:yaml.org,2002:binary");
YAML_ASSERT(doc["picture"] == YAML_ASSERT(doc["picture"] ==
"R0lGODlhDAAMAIQAAP//9/X\n" "R0lGODlhDAAMAIQAAP//9/X\n"
"17unp5WZmZgAAAOfn515eXv\n" "17unp5WZmZgAAAOfn515eXv\n"
"Pz7Y6OjuDg4J+fn5OTk6enp\n" "Pz7Y6OjuDg4J+fn5OTk6enp\n"
"56enmleECcgggoBADs=\n" "56enmleECcgggoBADs=\n"
); );
YAML_ASSERT(doc["application specific tag"].GetTag() == "!something"); YAML_ASSERT(doc["application specific tag"].Tag() == "!something");
YAML_ASSERT(doc["application specific tag"] == YAML_ASSERT(doc["application specific tag"] ==
"The semantics of the tag\n" "The semantics of the tag\n"
"above may be different for\n" "above may be different for\n"
...@@ -519,15 +519,15 @@ namespace Test { ...@@ -519,15 +519,15 @@ namespace Test {
" text: Pretty vector drawing."; " text: Pretty vector drawing.";
PARSE(doc, input); PARSE(doc, input);
YAML_ASSERT(doc.GetTag() == "tag:clarkevans.com,2002:shape"); YAML_ASSERT(doc.Tag() == "tag:clarkevans.com,2002:shape");
YAML_ASSERT(doc.size() == 3); YAML_ASSERT(doc.size() == 3);
YAML_ASSERT(doc[0].GetTag() == "tag:clarkevans.com,2002:circle"); YAML_ASSERT(doc[0].Tag() == "tag:clarkevans.com,2002:circle");
YAML_ASSERT(doc[0].size() == 2); YAML_ASSERT(doc[0].size() == 2);
YAML_ASSERT(doc[0]["center"].size() == 2); YAML_ASSERT(doc[0]["center"].size() == 2);
YAML_ASSERT(doc[0]["center"]["x"] == 73); YAML_ASSERT(doc[0]["center"]["x"] == 73);
YAML_ASSERT(doc[0]["center"]["y"] == 129); YAML_ASSERT(doc[0]["center"]["y"] == 129);
YAML_ASSERT(doc[0]["radius"] == 7); YAML_ASSERT(doc[0]["radius"] == 7);
YAML_ASSERT(doc[1].GetTag() == "tag:clarkevans.com,2002:line"); YAML_ASSERT(doc[1].Tag() == "tag:clarkevans.com,2002:line");
YAML_ASSERT(doc[1].size() == 2); YAML_ASSERT(doc[1].size() == 2);
YAML_ASSERT(doc[1]["start"].size() == 2); YAML_ASSERT(doc[1]["start"].size() == 2);
YAML_ASSERT(doc[1]["start"]["x"] == 73); YAML_ASSERT(doc[1]["start"]["x"] == 73);
...@@ -535,7 +535,7 @@ namespace Test { ...@@ -535,7 +535,7 @@ namespace Test {
YAML_ASSERT(doc[1]["finish"].size() == 2); YAML_ASSERT(doc[1]["finish"].size() == 2);
YAML_ASSERT(doc[1]["finish"]["x"] == 89); YAML_ASSERT(doc[1]["finish"]["x"] == 89);
YAML_ASSERT(doc[1]["finish"]["y"] == 102); YAML_ASSERT(doc[1]["finish"]["y"] == 102);
YAML_ASSERT(doc[2].GetTag() == "tag:clarkevans.com,2002:label"); YAML_ASSERT(doc[2].Tag() == "tag:clarkevans.com,2002:label");
YAML_ASSERT(doc[2].size() == 3); YAML_ASSERT(doc[2].size() == 3);
YAML_ASSERT(doc[2]["start"].size() == 2); YAML_ASSERT(doc[2]["start"].size() == 2);
YAML_ASSERT(doc[2]["start"]["x"] == 73); YAML_ASSERT(doc[2]["start"]["x"] == 73);
...@@ -558,7 +558,7 @@ namespace Test { ...@@ -558,7 +558,7 @@ namespace Test {
"? Ken Griffey"; "? Ken Griffey";
PARSE(doc, input); PARSE(doc, input);
YAML_ASSERT(doc.GetTag() == "tag:yaml.org,2002:set"); YAML_ASSERT(doc.Tag() == "tag:yaml.org,2002:set");
YAML_ASSERT(doc.size() == 3); YAML_ASSERT(doc.size() == 3);
YAML_ASSERT(IsNull(doc["Mark McGwire"])); YAML_ASSERT(IsNull(doc["Mark McGwire"]));
YAML_ASSERT(IsNull(doc["Sammy Sosa"])); YAML_ASSERT(IsNull(doc["Sammy Sosa"]));
...@@ -579,7 +579,7 @@ namespace Test { ...@@ -579,7 +579,7 @@ namespace Test {
"- Ken Griffey: 58"; "- Ken Griffey: 58";
PARSE(doc, input); PARSE(doc, input);
YAML_ASSERT(doc.GetTag() == "tag:yaml.org,2002:omap"); YAML_ASSERT(doc.Tag() == "tag:yaml.org,2002:omap");
YAML_ASSERT(doc.size() == 3); YAML_ASSERT(doc.size() == 3);
YAML_ASSERT(doc[0].size() == 1); YAML_ASSERT(doc[0].size() == 1);
YAML_ASSERT(doc[0]["Mark McGwire"] == 65); YAML_ASSERT(doc[0]["Mark McGwire"] == 65);
...@@ -625,7 +625,7 @@ namespace Test { ...@@ -625,7 +625,7 @@ namespace Test {
" Billsmer @ 338-4338."; " Billsmer @ 338-4338.";
PARSE(doc, input); PARSE(doc, input);
YAML_ASSERT(doc.GetTag() == "tag:clarkevans.com,2002:invoice"); YAML_ASSERT(doc.Tag() == "tag:clarkevans.com,2002:invoice");
YAML_ASSERT(doc.size() == 8); YAML_ASSERT(doc.size() == 8);
YAML_ASSERT(doc["invoice"] == 34843); YAML_ASSERT(doc["invoice"] == 34843);
YAML_ASSERT(doc["date"] == "2001-01-23"); YAML_ASSERT(doc["date"] == "2001-01-23");
...@@ -1185,7 +1185,7 @@ namespace Test { ...@@ -1185,7 +1185,7 @@ namespace Test {
"!yaml!str \"foo\""; "!yaml!str \"foo\"";
PARSE(doc, input); PARSE(doc, input);
YAML_ASSERT(doc.GetTag() == "tag:yaml.org,2002:str"); YAML_ASSERT(doc.Tag() == "tag:yaml.org,2002:str");
YAML_ASSERT(doc == "foo"); YAML_ASSERT(doc == "foo");
return true; return true;
} }
...@@ -1223,11 +1223,11 @@ namespace Test { ...@@ -1223,11 +1223,11 @@ namespace Test {
"!foo \"bar\""; "!foo \"bar\"";
PARSE(doc, input); PARSE(doc, input);
YAML_ASSERT(doc.GetTag() == "!foo"); YAML_ASSERT(doc.Tag() == "!foo");
YAML_ASSERT(doc == "bar"); YAML_ASSERT(doc == "bar");
PARSE_NEXT(doc); PARSE_NEXT(doc);
YAML_ASSERT(doc.GetTag() == "tag:example.com,2000:app/foo"); YAML_ASSERT(doc.Tag() == "tag:example.com,2000:app/foo");
YAML_ASSERT(doc == "bar"); YAML_ASSERT(doc == "bar");
return true; return true;
} }
...@@ -1241,7 +1241,7 @@ namespace Test { ...@@ -1241,7 +1241,7 @@ namespace Test {
"!!int 1 - 3 # Interval, not integer"; "!!int 1 - 3 # Interval, not integer";
PARSE(doc, input); PARSE(doc, input);
YAML_ASSERT(doc.GetTag() == "tag:example.com,2000:app/int"); YAML_ASSERT(doc.Tag() == "tag:example.com,2000:app/int");
YAML_ASSERT(doc == "1 - 3"); YAML_ASSERT(doc == "1 - 3");
return true; return true;
} }
...@@ -1255,7 +1255,7 @@ namespace Test { ...@@ -1255,7 +1255,7 @@ namespace Test {
"!e!foo \"bar\""; "!e!foo \"bar\"";
PARSE(doc, input); PARSE(doc, input);
YAML_ASSERT(doc.GetTag() == "tag:example.com,2000:app/foo"); YAML_ASSERT(doc.Tag() == "tag:example.com,2000:app/foo");
YAML_ASSERT(doc == "bar"); YAML_ASSERT(doc == "bar");
return true; return true;
} }
...@@ -1273,11 +1273,11 @@ namespace Test { ...@@ -1273,11 +1273,11 @@ namespace Test {
"!m!light green"; "!m!light green";
PARSE(doc, input); PARSE(doc, input);
YAML_ASSERT(doc.GetTag() == "!my-light"); YAML_ASSERT(doc.Tag() == "!my-light");
YAML_ASSERT(doc == "fluorescent"); YAML_ASSERT(doc == "fluorescent");
PARSE_NEXT(doc); PARSE_NEXT(doc);
YAML_ASSERT(doc.GetTag() == "!my-light"); YAML_ASSERT(doc.Tag() == "!my-light");
YAML_ASSERT(doc == "green"); YAML_ASSERT(doc == "green");
return true; return true;
} }
...@@ -1292,7 +1292,7 @@ namespace Test { ...@@ -1292,7 +1292,7 @@ namespace Test {
PARSE(doc, input); PARSE(doc, input);
YAML_ASSERT(doc.size() == 1); YAML_ASSERT(doc.size() == 1);
YAML_ASSERT(doc[0].GetTag() == "tag:example.com,2000:app/foo"); YAML_ASSERT(doc[0].Tag() == "tag:example.com,2000:app/foo");
YAML_ASSERT(doc[0] == "bar"); YAML_ASSERT(doc[0] == "bar");
return true; return true;
} }
...@@ -1309,8 +1309,8 @@ namespace Test { ...@@ -1309,8 +1309,8 @@ namespace Test {
YAML_ASSERT(doc.size() == 2); YAML_ASSERT(doc.size() == 2);
for(YAML::Iterator it=doc.begin();it!=doc.end();++it) { for(YAML::Iterator it=doc.begin();it!=doc.end();++it) {
if(it.first() == "foo") { if(it.first() == "foo") {
YAML_ASSERT(it.first().GetTag() == "tag:yaml.org,2002:str"); YAML_ASSERT(it.first().Tag() == "tag:yaml.org,2002:str");
YAML_ASSERT(it.second().GetTag() == "tag:yaml.org,2002:str"); YAML_ASSERT(it.second().Tag() == "tag:yaml.org,2002:str");
YAML_ASSERT(it.second() == "bar"); YAML_ASSERT(it.second() == "bar");
} else if(it.first() == "baz") { } else if(it.first() == "baz") {
YAML_ASSERT(it.second() == "foo"); YAML_ASSERT(it.second() == "foo");
...@@ -1331,9 +1331,9 @@ namespace Test { ...@@ -1331,9 +1331,9 @@ namespace Test {
PARSE(doc, input); PARSE(doc, input);
YAML_ASSERT(doc.size() == 1); YAML_ASSERT(doc.size() == 1);
for(YAML::Iterator it=doc.begin();it!=doc.end();++it) { for(YAML::Iterator it=doc.begin();it!=doc.end();++it) {
YAML_ASSERT(it.first().GetTag() == "tag:yaml.org,2002:str"); YAML_ASSERT(it.first().Tag() == "tag:yaml.org,2002:str");
YAML_ASSERT(it.first() == "foo"); YAML_ASSERT(it.first() == "foo");
YAML_ASSERT(it.second().GetTag() == "!bar"); YAML_ASSERT(it.second().Tag() == "!bar");
YAML_ASSERT(it.second() == "baz"); YAML_ASSERT(it.second() == "baz");
} }
return true; return true;
...@@ -1362,11 +1362,11 @@ namespace Test { ...@@ -1362,11 +1362,11 @@ namespace Test {
PARSE(doc, input); PARSE(doc, input);
YAML_ASSERT(doc.size() == 3); YAML_ASSERT(doc.size() == 3);
YAML_ASSERT(doc[0].GetTag() == "!local"); YAML_ASSERT(doc[0].Tag() == "!local");
YAML_ASSERT(doc[0] == "foo"); YAML_ASSERT(doc[0] == "foo");
YAML_ASSERT(doc[1].GetTag() == "tag:yaml.org,2002:str"); YAML_ASSERT(doc[1].Tag() == "tag:yaml.org,2002:str");
YAML_ASSERT(doc[1] == "bar"); YAML_ASSERT(doc[1] == "bar");
YAML_ASSERT(doc[2].GetTag() == "tag:example.com,2000:app/tag%21"); YAML_ASSERT(doc[2].Tag() == "tag:example.com,2000:app/tag%21");
YAML_ASSERT(doc[2] == "baz"); YAML_ASSERT(doc[2] == "baz");
return true; return true;
} }
...@@ -1462,10 +1462,10 @@ namespace Test { ...@@ -1462,10 +1462,10 @@ namespace Test {
YAML_ASSERT(doc.size() == 2); YAML_ASSERT(doc.size() == 2);
for(YAML::Iterator it=doc.begin();it!=doc.end();++it) { for(YAML::Iterator it=doc.begin();it!=doc.end();++it) {
if(it.first() == "foo") { if(it.first() == "foo") {
YAML_ASSERT(it.second().GetTag() == "tag:yaml.org,2002:str"); YAML_ASSERT(it.second().Tag() == "tag:yaml.org,2002:str");
YAML_ASSERT(it.second() == ""); YAML_ASSERT(it.second() == "");
} else if(it.first() == "") { } else if(it.first() == "") {
YAML_ASSERT(it.first().GetTag() == "tag:yaml.org,2002:str"); YAML_ASSERT(it.first().Tag() == "tag:yaml.org,2002:str");
YAML_ASSERT(it.second() == "bar"); YAML_ASSERT(it.second() == "bar");
} else } else
return " unexpected key"; return " unexpected key";
...@@ -1862,12 +1862,12 @@ namespace Test { ...@@ -1862,12 +1862,12 @@ namespace Test {
PARSE(doc, input); PARSE(doc, input);
YAML_ASSERT(doc.size() == 5); YAML_ASSERT(doc.size() == 5);
YAML_ASSERT(doc[0].GetTag() == "tag:yaml.org,2002:str"); YAML_ASSERT(doc[0].Tag() == "tag:yaml.org,2002:str");
YAML_ASSERT(doc[0] == "a"); YAML_ASSERT(doc[0] == "a");
YAML_ASSERT(doc[1] == 'b'); YAML_ASSERT(doc[1] == 'b');
YAML_ASSERT(doc[2] == "c"); YAML_ASSERT(doc[2] == "c");
YAML_ASSERT(doc[3] == "c"); YAML_ASSERT(doc[3] == "c");
YAML_ASSERT(doc[4].GetTag() == "tag:yaml.org,2002:str"); YAML_ASSERT(doc[4].Tag() == "tag:yaml.org,2002:str");
YAML_ASSERT(doc[4] == ""); YAML_ASSERT(doc[4] == "");
return true; return true;
} }
......
...@@ -23,7 +23,7 @@ public: ...@@ -23,7 +23,7 @@ public:
virtual void OnDocumentStart(const YAML::Mark&) {} virtual void OnDocumentStart(const YAML::Mark&) {}
virtual void OnDocumentEnd() {} virtual void OnDocumentEnd() {}
virtual void OnNull(const std::string&, YAML::anchor_t) {} virtual void OnNull(const YAML::Mark&, YAML::anchor_t) {}
virtual void OnAlias(const YAML::Mark&, YAML::anchor_t) {} virtual void OnAlias(const YAML::Mark&, YAML::anchor_t) {}
virtual void OnScalar(const YAML::Mark&, const std::string&, YAML::anchor_t, const std::string&) {} virtual void OnScalar(const YAML::Mark&, const std::string&, YAML::anchor_t, const std::string&) {}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment