mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-10 04:51:17 +00:00
Switched YAML::Parse to YAML::Load, and added LoadAll
This commit is contained in:
@@ -8,17 +8,17 @@
|
||||
|
||||
namespace YAML
|
||||
{
|
||||
Node Parse(const std::string& input) {
|
||||
Node Load(const std::string& input) {
|
||||
std::stringstream stream(input);
|
||||
return Parse(stream);
|
||||
return Load(stream);
|
||||
}
|
||||
|
||||
Node Parse(const char *input) {
|
||||
Node Load(const char *input) {
|
||||
std::stringstream stream(input);
|
||||
return Parse(stream);
|
||||
return Load(stream);
|
||||
}
|
||||
|
||||
Node Parse(std::istream& input) {
|
||||
Node Load(std::istream& input) {
|
||||
Parser parser(input);
|
||||
NodeBuilder builder;
|
||||
if(!parser.HandleNextDocument(builder))
|
||||
@@ -26,4 +26,28 @@ namespace YAML
|
||||
|
||||
return builder.Root();
|
||||
}
|
||||
|
||||
std::vector<Node> LoadAll(const std::string& input) {
|
||||
std::stringstream stream(input);
|
||||
return LoadAll(stream);
|
||||
}
|
||||
|
||||
std::vector<Node> LoadAll(const char *input) {
|
||||
std::stringstream stream(input);
|
||||
return LoadAll(stream);
|
||||
}
|
||||
|
||||
std::vector<Node> LoadAll(std::istream& input) {
|
||||
std::vector<Node> docs;
|
||||
|
||||
Parser parser(input);
|
||||
while(1) {
|
||||
NodeBuilder builder;
|
||||
if(!parser.HandleNextDocument(builder))
|
||||
break;
|
||||
docs.push_back(builder.Root());
|
||||
}
|
||||
|
||||
return docs;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user