MCPcopy Create free account
hub / github.com/beefytech/Beef / ParseWithOpts

Method ParseWithOpts

BeefySysLib/util/Json.cpp:273–287  ·  view source on GitHub ↗

Parse an object - create a new root, and populate. */

Source from the content-addressed store, hash-verified

271
272/* Parse an object - create a new root, and populate. */
273Json* 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 */
289Json* Json::Parse(const char *value) {return Json::ParseWithOpts(value,0,0);}
290

Callers

nothing calls this directly

Calls 3

New_ItemFunction · 0.85
parse_valueFunction · 0.85
skipFunction · 0.85

Tested by

no test coverage detected