document.cpp 497 Bytes
Newer Older
beder's avatar
beder committed
1
2
#include "document.h"
#include "node.h"
3
#include <fstream>
beder's avatar
beder committed
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

namespace YAML
{
	Document::Document(): m_pRoot(0)
	{
	}

	Document::Document(const std::string& fileName): m_pRoot(0)
	{
		Load(fileName);
	}

	Document::~Document()
	{
		Clear();
	}

	void Document::Clear()
	{
		delete m_pRoot;
		m_pRoot = 0;
	}

	void Document::Load(const std::string& fileName)
	{
29
30
31
32
33
		Clear();

		std::ifstream fin(fileName.c_str());
		m_pRoot = new Node;
		m_pRoot->Read(fin);
beder's avatar
beder committed
34
35
	}
}