parse.cpp 565 Bytes
Newer Older
1
2
3
#include "yaml-cpp/node/parse.h"
#include "yaml-cpp/node/node.h"
#include "yaml-cpp/node/impl.h"
4
#include "yaml-cpp/parser.h"
5
#include "nodebuilder.h"
6
7
8
9
10

#include <sstream>

namespace YAML
{
11
	Node Parse(const std::string& input) {
12
13
14
15
		std::stringstream stream(input);
		return Parse(stream);
	}
	
16
	Node Parse(const char *input) {
17
18
19
20
		std::stringstream stream(input);
		return Parse(stream);
	}
	
21
	Node Parse(std::istream& input) {
22
		Parser parser(input);
23
		NodeBuilder builder;
24
		if(!parser.HandleNextDocument(builder))
25
			return Node();
26
27
28
29
		
		return builder.Root();
	}
}