Util: Add parse(std::ifstream) function
This commit is contained in:
@@ -157,6 +157,13 @@ Value Value::parse(const std::string& input)
|
||||
return Job(input).fire();
|
||||
}
|
||||
|
||||
Value Value::parse(std::ifstream& file)
|
||||
{
|
||||
Value value;
|
||||
file >> value;
|
||||
return value;
|
||||
}
|
||||
|
||||
std::string Value::dump(const uint32_t indent, const char indentCharacter) const
|
||||
{
|
||||
Serializer serializer(indent, indentCharacter);
|
||||
@@ -313,8 +320,7 @@ std::istream& operator>>(std::istream& input, Value& value)
|
||||
}
|
||||
inputString.append(buffer, input.gcount());
|
||||
|
||||
Job job(inputString);
|
||||
value = job.fire();
|
||||
value = Job(inputString).fire();
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ public:
|
||||
// --------------------------------------
|
||||
|
||||
static Value parse(const std::string& input);
|
||||
static Value parse(std::ifstream& file);
|
||||
std::string dump(const uint32_t indent = 0, const char indentCharacter = ' ') const;
|
||||
|
||||
void clear();
|
||||
|
||||
Reference in New Issue
Block a user