Added LoadFile and LoadAllFromFile (new API)

This commit is contained in:
beder
2012-01-11 21:31:01 -06:00
parent 2dbcc58912
commit f3446cbcea
2 changed files with 13 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
#include "yaml-cpp/parser.h"
#include "nodebuilder.h"
#include <fstream>
#include <sstream>
namespace YAML
@@ -27,6 +28,11 @@ namespace YAML
return builder.Root();
}
Node LoadFile(const std::string& filename) {
std::ifstream fin(filename.c_str());
return Load(fin);
}
std::vector<Node> LoadAll(const std::string& input) {
std::stringstream stream(input);
return LoadAll(stream);
@@ -50,4 +56,9 @@ namespace YAML
return docs;
}
std::vector<Node> LoadAllFromFile(const std::string& filename) {
std::ifstream fin(filename.c_str());
return LoadAll(fin);
}
}