mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Start of moving Value -> Node and Node -> old API Node (with a #define toggle)
This commit is contained in:
29
src/node/parse.cpp
Normal file
29
src/node/parse.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "yaml-cpp/value/parse.h"
|
||||
#include "yaml-cpp/value/value.h"
|
||||
#include "yaml-cpp/value/impl.h"
|
||||
#include "yaml-cpp/parser.h"
|
||||
#include "valuebuilder.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace YAML
|
||||
{
|
||||
Value Parse(const std::string& input) {
|
||||
std::stringstream stream(input);
|
||||
return Parse(stream);
|
||||
}
|
||||
|
||||
Value Parse(const char *input) {
|
||||
std::stringstream stream(input);
|
||||
return Parse(stream);
|
||||
}
|
||||
|
||||
Value Parse(std::istream& input) {
|
||||
Parser parser(input);
|
||||
ValueBuilder builder;
|
||||
if(!parser.HandleNextDocument(builder))
|
||||
return Value();
|
||||
|
||||
return builder.Root();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user