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();
|
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
|
std::string Value::dump(const uint32_t indent, const char indentCharacter) const
|
||||||
{
|
{
|
||||||
Serializer serializer(indent, indentCharacter);
|
Serializer serializer(indent, indentCharacter);
|
||||||
@@ -313,8 +320,7 @@ std::istream& operator>>(std::istream& input, Value& value)
|
|||||||
}
|
}
|
||||||
inputString.append(buffer, input.gcount());
|
inputString.append(buffer, input.gcount());
|
||||||
|
|
||||||
Job job(inputString);
|
value = Job(inputString).fire();
|
||||||
value = job.fire();
|
|
||||||
|
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ public:
|
|||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
|
|
||||||
static Value parse(const std::string& input);
|
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;
|
std::string dump(const uint32_t indent = 0, const char indentCharacter = ' ') const;
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user