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

Function set2

test/doc_parsing.cpp:132–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130//----------------------------------------------------------
131
132static void set2() {
133
134//----------------------------------------------------------
135{
136// tag::doc_parsing_8[]
137stream_parser p;
138boost::system::error_code ec;
139string_view s = "[1,2,3] %HOME%";
140std::size_t n = p.write_some( s, ec );
141assert( ! ec && p.done() && n == 8 );
142s = s.substr( n );
143value jv = p.release();
144assert( s == "%HOME%" );
145// end::doc_parsing_8[]
146}
147//----------------------------------------------------------
148{
149// tag::doc_parsing_9[]
150parse_options opt; // All extensions default to off
151opt.allow_comments = true; // Permit C and C++ style comments to appear in whitespace
152opt.allow_trailing_commas = true; // Allow an additional trailing comma in
153 // object and array element lists
154opt.allow_invalid_utf8 = true; // Skip utf-8 validation of keys and strings
155stream_parser p( storage_ptr(), opt ); // The stream_parser will use the options
156// end::doc_parsing_9[]
157}
158//----------------------------------------------------------
159
160} // set2
161
162//----------------------------------------------------------
163// tag::doc_parsing_10[]

Callers

nothing calls this directly

Calls 4

storage_ptrClass · 0.50
write_someMethod · 0.45
doneMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected