| 2177 | // global functions |
| 2178 | |
| 2179 | bool parseFromStream(CharReader::Factory const &fact, IStream &sin, Value *root, |
| 2180 | String *errs) { |
| 2181 | OStringStream ssin; |
| 2182 | ssin << sin.rdbuf(); |
| 2183 | String doc = ssin.str(); |
| 2184 | char const *begin = doc.data(); |
| 2185 | char const *end = begin + doc.size(); |
| 2186 | // Note that we do not actually need a null-terminator. |
| 2187 | CharReaderPtr const reader(fact.newCharReader()); |
| 2188 | return reader->parse(begin, end, root, errs); |
| 2189 | } |
| 2190 | |
| 2191 | IStream &operator>>(IStream &sin, Value &root) { |
| 2192 | CharReaderBuilder b; |
no test coverage detected