yaml-cpp/src/node/parse.cpp

30 lines
565 B
C++
Raw Normal View History

#include "yaml-cpp/node/parse.h"
#include "yaml-cpp/node/node.h"
#include "yaml-cpp/node/impl.h"
2011-09-10 08:40:19 +04:00
#include "yaml-cpp/parser.h"
#include "nodebuilder.h"
2011-09-10 08:40:19 +04:00
#include <sstream>
namespace YAML
{
Node Parse(const std::string& input) {
2011-09-10 08:40:19 +04:00
std::stringstream stream(input);
return Parse(stream);
}
Node Parse(const char *input) {
2011-09-10 08:40:19 +04:00
std::stringstream stream(input);
return Parse(stream);
}
Node Parse(std::istream& input) {
2011-09-10 08:40:19 +04:00
Parser parser(input);
NodeBuilder builder;
2011-09-10 08:40:19 +04:00
if(!parser.HandleNextDocument(builder))
return Node();
2011-09-10 08:40:19 +04:00
return builder.Root();
}
}