MCPcopy Create free account
hub / github.com/boostorg/json / parse_file

Function parse_file

example/pretty.cpp:25–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23namespace json = boost::json;
24
25json::value
26parse_file( char const* filename )
27{
28 file f( filename, "r" );
29 json::stream_parser p;
30 boost::system::error_code ec;
31 do
32 {
33 char buf[4096];
34 auto const nread = f.read( buf, sizeof(buf) );
35 p.write( buf, nread, ec );
36 }
37 while( ! f.eof() );
38 if( ec )
39 return nullptr;
40 p.finish( ec );
41 if( ec )
42 return nullptr;
43 return p.release();
44}
45
46void
47pretty_print( std::ostream& os, json::value const& jv, std::string* indent = nullptr )

Callers 2

mainFunction · 0.85
benchMethod · 0.85

Calls 5

eofMethod · 0.80
finishMethod · 0.80
readMethod · 0.45
writeMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected