| 2248 | // global functions |
| 2249 | |
| 2250 | bool parseFromStream( |
| 2251 | CharReader::Factory const& fact, JSONCPP_ISTREAM& sin, |
| 2252 | Value* root, JSONCPP_STRING* errs) |
| 2253 | { |
| 2254 | JSONCPP_OSTRINGSTREAM ssin; |
| 2255 | ssin << sin.rdbuf(); |
| 2256 | JSONCPP_STRING doc = ssin.str(); |
| 2257 | char const* begin = doc.data(); |
| 2258 | char const* end = begin + doc.size(); |
| 2259 | // Note that we do not actually need a null-terminator. |
| 2260 | CharReaderPtr const reader(fact.newCharReader()); |
| 2261 | return reader->parse(begin, end, root, errs); |
| 2262 | } |
| 2263 | |
| 2264 | JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM& sin, Value& root) { |
| 2265 | CharReaderBuilder b; |