| 2240 | // global functions |
| 2241 | |
| 2242 | bool parseFromStream(CharReader::Factory const& fact, |
| 2243 | JSONCPP_ISTREAM& sin, |
| 2244 | Value* root, |
| 2245 | JSONCPP_STRING* errs) { |
| 2246 | JSONCPP_OSTRINGSTREAM ssin; |
| 2247 | ssin << sin.rdbuf(); |
| 2248 | JSONCPP_STRING doc = ssin.str(); |
| 2249 | char const* begin = doc.data(); |
| 2250 | char const* end = begin + doc.size(); |
| 2251 | // Note that we do not actually need a null-terminator. |
| 2252 | CharReaderPtr const reader(fact.newCharReader()); |
| 2253 | return reader->parse(begin, end, root, errs); |
| 2254 | } |
| 2255 | |
| 2256 | JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM& sin, Value& root) { |
| 2257 | CharReaderBuilder b; |
no test coverage detected