Parse an object - create a new root, and populate. */
| 271 | |
| 272 | /* Parse an object - create a new root, and populate. */ |
| 273 | Json* Json::ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated) |
| 274 | { |
| 275 | const char *end=0; |
| 276 | Json* c=New_Item(); |
| 277 | ep=0; |
| 278 | if (!c) return 0; /* memory fail */ |
| 279 | |
| 280 | end=parse_value(c,skip(value)); |
| 281 | if (!end) {delete(c);return 0;} /* parse failure. ep is set. */ |
| 282 | |
| 283 | /* if we require null-terminated JSON without appended garbage, skip and then check for a null terminator */ |
| 284 | if (require_null_terminated) {end=skip(end);if (*end) {delete(c);ep=end;return 0;}} |
| 285 | if (return_parse_end) *return_parse_end=end; |
| 286 | return c; |
| 287 | } |
| 288 | /* Default options for Json::Parse */ |
| 289 | Json* Json::Parse(const char *value) {return Json::ParseWithOpts(value,0,0);} |
| 290 |
nothing calls this directly
no test coverage detected