mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Added LoadFile and LoadAllFromFile (new API)
This commit is contained in:
@@ -16,10 +16,12 @@ namespace YAML
|
||||
Node Load(const std::string& input);
|
||||
Node Load(const char *input);
|
||||
Node Load(std::istream& input);
|
||||
Node LoadFile(const std::string& filename);
|
||||
|
||||
std::vector<Node> LoadAll(const std::string& input);
|
||||
std::vector<Node> LoadAll(const char *input);
|
||||
std::vector<Node> LoadAll(std::istream& input);
|
||||
std::vector<Node> LoadAllFromFile(const std::string& filename);
|
||||
}
|
||||
|
||||
#endif // VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user