parser returns an object

This commit is contained in:
Niels 2015-01-02 17:19:40 +01:00
parent 16c30cff8b
commit 18364aac85
2 changed files with 19 additions and 39 deletions

View file

@ -194,13 +194,13 @@ class JSON
/// read from stream
friend std::istream& operator>>(std::istream& i, JSON& j)
{
Parser(i).parse(j);
j = Parser(i).parse();
return i;
}
/// read from stream
friend std::istream& operator<<(JSON& j, std::istream& i)
{
Parser(i).parse(j);
j = Parser(i).parse();
return i;
}
@ -406,8 +406,8 @@ class JSON
// no copy assignment
Parser& operator=(Parser) = delete;
/// parse into a given JSON object
void parse(JSON&);
/// parse and return a JSON object
JSON parse();
private:
/// read the next character, stripping whitespace