| 2230 | // global functions |
| 2231 | |
| 2232 | bool parseFromStream(CharReader::Factory const& fact, IStream& sin, Value* root, |
| 2233 | String* errs) { |
| 2234 | OStringStream ssin; |
| 2235 | ssin << sin.rdbuf(); |
| 2236 | String doc = std::move(ssin).str(); |
| 2237 | char const* begin = doc.data(); |
| 2238 | char const* end = begin + doc.size(); |
| 2239 | // Note that we do not actually need a null-terminator. |
| 2240 | CharReaderPtr const reader(fact.newCharReader()); |
| 2241 | return reader->parse(begin, end, root, errs); |
| 2242 | } |
| 2243 | |
| 2244 | IStream& operator>>(IStream& sin, Value& root) { |
| 2245 | CharReaderBuilder b; |
no test coverage detected