summaryrefslogtreecommitdiffstats
path: root/yaml-cpp/src/nodeownership.cpp
blob: 118edbc84b402444f25bcf7aad1a76302c2ea69d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#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;
	}
}