| 2420 | // global functions |
| 2421 | |
| 2422 | bool parseFromStream(CharReader::Factory const &fact, IStream &sin, Value *root, String *errs) |
| 2423 | { |
| 2424 | OStringStream ssin; |
| 2425 | ssin << sin.rdbuf(); |
| 2426 | String doc = ssin.str(); |
| 2427 | char const *begin = doc.data(); |
| 2428 | char const *end = begin + doc.size(); |
| 2429 | // Note that we do not actually need a null-terminator. |
| 2430 | CharReaderPtr const reader(fact.newCharReader()); |
| 2431 | return reader->parse(begin, end, root, errs); |
| 2432 | } |
| 2433 | |
| 2434 | IStream &operator>>(IStream &sin, Value &root) |
| 2435 | { |