yaml-cpp/document.cpp

40 lines
560 B
C++
Raw Normal View History

2008-06-26 02:45:08 +04:00
#include "document.h"
#include "node.h"
#include "parser.h"
#include <fstream>
2008-06-26 02:45:08 +04:00
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)
{
Clear();
std::ifstream fin(fileName.c_str());
Parser parser(fin);
if(!parser)
return;
m_pRoot = parser.ReadNextNode();
2008-06-26 02:45:08 +04:00
}
}