| 130 | //---------------------------------------------------------- |
| 131 | |
| 132 | static void set2() { |
| 133 | |
| 134 | //---------------------------------------------------------- |
| 135 | { |
| 136 | // tag::doc_parsing_8[] |
| 137 | stream_parser p; |
| 138 | boost::system::error_code ec; |
| 139 | string_view s = "[1,2,3] %HOME%"; |
| 140 | std::size_t n = p.write_some( s, ec ); |
| 141 | assert( ! ec && p.done() && n == 8 ); |
| 142 | s = s.substr( n ); |
| 143 | value jv = p.release(); |
| 144 | assert( s == "%HOME%" ); |
| 145 | // end::doc_parsing_8[] |
| 146 | } |
| 147 | //---------------------------------------------------------- |
| 148 | { |
| 149 | // tag::doc_parsing_9[] |
| 150 | parse_options opt; // All extensions default to off |
| 151 | opt.allow_comments = true; // Permit C and C++ style comments to appear in whitespace |
| 152 | opt.allow_trailing_commas = true; // Allow an additional trailing comma in |
| 153 | // object and array element lists |
| 154 | opt.allow_invalid_utf8 = true; // Skip utf-8 validation of keys and strings |
| 155 | stream_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[] |
nothing calls this directly
no test coverage detected