mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Added a new json constructor to read from a file.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <assert.h>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
const JsonNode JsonNode::nullNode;
|
||||
|
||||
@@ -19,6 +20,15 @@ JsonNode::JsonNode(std::string input):
|
||||
JsonParser parser(input, *this);
|
||||
}
|
||||
|
||||
JsonNode::JsonNode(const char *filename)
|
||||
{
|
||||
std::ifstream file(filename);
|
||||
std::string str((std::istreambuf_iterator<char>(file)),
|
||||
std::istreambuf_iterator<char>());
|
||||
|
||||
JsonParser parser(str, *this);
|
||||
}
|
||||
|
||||
JsonNode::JsonNode(const JsonNode ©):
|
||||
type(DATA_NULL)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user