yaml-cpp/document.cpp

47 lines
688 B
C++
Raw Normal View History

2008-06-26 02:45:08 +04:00
#include "document.h"
#include "node.h"
#include "parser.h"
2008-06-26 13:05:28 +04:00
#include "scanner.h"
#include "exceptions.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());
2008-06-26 13:05:28 +04:00
Scanner scanner(fin);
try {
scanner.Scan();
} catch(const UnknownToken& e) {
}
2008-06-26 13:05:28 +04:00
// if(!scanner)
// return;
2008-06-26 13:05:28 +04:00
// m_pRoot = parser.ReadNextNode();
2008-06-26 02:45:08 +04:00
}
}