MCPcopy Create free account
hub / github.com/boostorg/parser / main

Function main

example/callback_json.cpp:351–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349};
350
351int main(int argc, char * argv[])
352{
353 if (argc < 2) {
354 std::cerr << "A filename to parse is required.\n";
355 exit(1);
356 }
357
358 std::ifstream ifs(argv[1]);
359 if (!ifs) {
360 std::cerr << "Unable to read file '" << argv[1] << "'.\n";
361 exit(1);
362 }
363
364 std::string const file_contents = file_slurp(ifs);
365 bool success = json::parse(file_contents, argv[1], json_callbacks{});
366 if (success) {
367 std::cout << "Parse successful!\n";
368 } else {
369 std::cerr << "Parse failure.\n";
370 exit(1);
371 }
372
373 return 0;
374}
375//]

Callers

nothing calls this directly

Calls 2

file_slurpFunction · 0.70
parseFunction · 0.70

Tested by

no test coverage detected