30 #ifndef INCLUDE_NLOHMANN_JSON_HPP_
31 #define INCLUDE_NLOHMANN_JSON_HPP_
33 #define NLOHMANN_JSON_VERSION_MAJOR 3
34 #define NLOHMANN_JSON_VERSION_MINOR 9
35 #define NLOHMANN_JSON_VERSION_PATCH 1
40 #include <initializer_list>
59 #include <forward_list>
64 #include <type_traits>
65 #include <unordered_map>
146 static constexpr std::array<std::uint8_t, 9> order = {{
153 const auto l_index =
static_cast<std::size_t
>(lhs);
154 const auto r_index =
static_cast<std::size_t
>(rhs);
155 return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index];
183 #if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 15)
184 #if defined(JSON_HEDLEY_VERSION)
185 #undef JSON_HEDLEY_VERSION
187 #define JSON_HEDLEY_VERSION 15
189 #if defined(JSON_HEDLEY_STRINGIFY_EX)
190 #undef JSON_HEDLEY_STRINGIFY_EX
192 #define JSON_HEDLEY_STRINGIFY_EX(x) #x
194 #if defined(JSON_HEDLEY_STRINGIFY)
195 #undef JSON_HEDLEY_STRINGIFY
197 #define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x)
199 #if defined(JSON_HEDLEY_CONCAT_EX)
200 #undef JSON_HEDLEY_CONCAT_EX
202 #define JSON_HEDLEY_CONCAT_EX(a,b) a##b
204 #if defined(JSON_HEDLEY_CONCAT)
205 #undef JSON_HEDLEY_CONCAT
207 #define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b)
209 #if defined(JSON_HEDLEY_CONCAT3_EX)
210 #undef JSON_HEDLEY_CONCAT3_EX
212 #define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c
214 #if defined(JSON_HEDLEY_CONCAT3)
215 #undef JSON_HEDLEY_CONCAT3
217 #define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c)
219 #if defined(JSON_HEDLEY_VERSION_ENCODE)
220 #undef JSON_HEDLEY_VERSION_ENCODE
222 #define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision))
224 #if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR)
225 #undef JSON_HEDLEY_VERSION_DECODE_MAJOR
227 #define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000)
229 #if defined(JSON_HEDLEY_VERSION_DECODE_MINOR)
230 #undef JSON_HEDLEY_VERSION_DECODE_MINOR
232 #define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000)
234 #if defined(JSON_HEDLEY_VERSION_DECODE_REVISION)
235 #undef JSON_HEDLEY_VERSION_DECODE_REVISION
237 #define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000)
239 #if defined(JSON_HEDLEY_GNUC_VERSION)
240 #undef JSON_HEDLEY_GNUC_VERSION
242 #if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__)
243 #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
244 #elif defined(__GNUC__)
245 #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0)
248 #if defined(JSON_HEDLEY_GNUC_VERSION_CHECK)
249 #undef JSON_HEDLEY_GNUC_VERSION_CHECK
251 #if defined(JSON_HEDLEY_GNUC_VERSION)
252 #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
254 #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0)
257 #if defined(JSON_HEDLEY_MSVC_VERSION)
258 #undef JSON_HEDLEY_MSVC_VERSION
260 #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL)
261 #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100)
262 #elif defined(_MSC_FULL_VER) && !defined(__ICL)
263 #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10)
264 #elif defined(_MSC_VER) && !defined(__ICL)
265 #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0)
268 #if defined(JSON_HEDLEY_MSVC_VERSION_CHECK)
269 #undef JSON_HEDLEY_MSVC_VERSION_CHECK
271 #if !defined(JSON_HEDLEY_MSVC_VERSION)
272 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0)
273 #elif defined(_MSC_VER) && (_MSC_VER >= 1400)
274 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch)))
275 #elif defined(_MSC_VER) && (_MSC_VER >= 1200)
276 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch)))
278 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor)))
281 #if defined(JSON_HEDLEY_INTEL_VERSION)
282 #undef JSON_HEDLEY_INTEL_VERSION
284 #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL)
285 #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE)
286 #elif defined(__INTEL_COMPILER) && !defined(__ICL)
287 #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0)
290 #if defined(JSON_HEDLEY_INTEL_VERSION_CHECK)
291 #undef JSON_HEDLEY_INTEL_VERSION_CHECK
293 #if defined(JSON_HEDLEY_INTEL_VERSION)
294 #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
296 #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0)
299 #if defined(JSON_HEDLEY_INTEL_CL_VERSION)
300 #undef JSON_HEDLEY_INTEL_CL_VERSION
302 #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL)
303 #define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0)
306 #if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK)
307 #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK
309 #if defined(JSON_HEDLEY_INTEL_CL_VERSION)
310 #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
312 #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0)
315 #if defined(JSON_HEDLEY_PGI_VERSION)
316 #undef JSON_HEDLEY_PGI_VERSION
318 #if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__)
319 #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__)
322 #if defined(JSON_HEDLEY_PGI_VERSION_CHECK)
323 #undef JSON_HEDLEY_PGI_VERSION_CHECK
325 #if defined(JSON_HEDLEY_PGI_VERSION)
326 #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
328 #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0)
331 #if defined(JSON_HEDLEY_SUNPRO_VERSION)
332 #undef JSON_HEDLEY_SUNPRO_VERSION
334 #if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000)
335 #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10)
336 #elif defined(__SUNPRO_C)
337 #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf)
338 #elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000)
339 #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10)
340 #elif defined(__SUNPRO_CC)
341 #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf)
344 #if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK)
345 #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK
347 #if defined(JSON_HEDLEY_SUNPRO_VERSION)
348 #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
350 #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0)
353 #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION)
354 #undef JSON_HEDLEY_EMSCRIPTEN_VERSION
356 #if defined(__EMSCRIPTEN__)
357 #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__)
360 #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK)
361 #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK
363 #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION)
364 #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
366 #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0)
369 #if defined(JSON_HEDLEY_ARM_VERSION)
370 #undef JSON_HEDLEY_ARM_VERSION
372 #if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION)
373 #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100)
374 #elif defined(__CC_ARM) && defined(__ARMCC_VERSION)
375 #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100)
378 #if defined(JSON_HEDLEY_ARM_VERSION_CHECK)
379 #undef JSON_HEDLEY_ARM_VERSION_CHECK
381 #if defined(JSON_HEDLEY_ARM_VERSION)
382 #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
384 #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0)
387 #if defined(JSON_HEDLEY_IBM_VERSION)
388 #undef JSON_HEDLEY_IBM_VERSION
390 #if defined(__ibmxl__)
391 #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__)
392 #elif defined(__xlC__) && defined(__xlC_ver__)
393 #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff)
394 #elif defined(__xlC__)
395 #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0)
398 #if defined(JSON_HEDLEY_IBM_VERSION_CHECK)
399 #undef JSON_HEDLEY_IBM_VERSION_CHECK
401 #if defined(JSON_HEDLEY_IBM_VERSION)
402 #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
404 #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0)
407 #if defined(JSON_HEDLEY_TI_VERSION)
408 #undef JSON_HEDLEY_TI_VERSION
411 defined(__TI_COMPILER_VERSION__) && \
413 defined(__TMS470__) || defined(__TI_ARM__) || \
414 defined(__MSP430__) || \
415 defined(__TMS320C2000__) \
417 #if (__TI_COMPILER_VERSION__ >= 16000000)
418 #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
422 #if defined(JSON_HEDLEY_TI_VERSION_CHECK)
423 #undef JSON_HEDLEY_TI_VERSION_CHECK
425 #if defined(JSON_HEDLEY_TI_VERSION)
426 #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
428 #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0)
431 #if defined(JSON_HEDLEY_TI_CL2000_VERSION)
432 #undef JSON_HEDLEY_TI_CL2000_VERSION
434 #if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__)
435 #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
438 #if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK)
439 #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK
441 #if defined(JSON_HEDLEY_TI_CL2000_VERSION)
442 #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
444 #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0)
447 #if defined(JSON_HEDLEY_TI_CL430_VERSION)
448 #undef JSON_HEDLEY_TI_CL430_VERSION
450 #if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__)
451 #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
454 #if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK)
455 #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK
457 #if defined(JSON_HEDLEY_TI_CL430_VERSION)
458 #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
460 #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0)
463 #if defined(JSON_HEDLEY_TI_ARMCL_VERSION)
464 #undef JSON_HEDLEY_TI_ARMCL_VERSION
466 #if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__))
467 #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
470 #if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK)
471 #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK
473 #if defined(JSON_HEDLEY_TI_ARMCL_VERSION)
474 #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
476 #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0)
479 #if defined(JSON_HEDLEY_TI_CL6X_VERSION)
480 #undef JSON_HEDLEY_TI_CL6X_VERSION
482 #if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__)
483 #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
486 #if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK)
487 #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK
489 #if defined(JSON_HEDLEY_TI_CL6X_VERSION)
490 #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
492 #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0)
495 #if defined(JSON_HEDLEY_TI_CL7X_VERSION)
496 #undef JSON_HEDLEY_TI_CL7X_VERSION
498 #if defined(__TI_COMPILER_VERSION__) && defined(__C7000__)
499 #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
502 #if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK)
503 #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK
505 #if defined(JSON_HEDLEY_TI_CL7X_VERSION)
506 #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
508 #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0)
511 #if defined(JSON_HEDLEY_TI_CLPRU_VERSION)
512 #undef JSON_HEDLEY_TI_CLPRU_VERSION
514 #if defined(__TI_COMPILER_VERSION__) && defined(__PRU__)
515 #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
518 #if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK)
519 #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK
521 #if defined(JSON_HEDLEY_TI_CLPRU_VERSION)
522 #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
524 #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0)
527 #if defined(JSON_HEDLEY_CRAY_VERSION)
528 #undef JSON_HEDLEY_CRAY_VERSION
531 #if defined(_RELEASE_PATCHLEVEL)
532 #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL)
534 #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0)
538 #if defined(JSON_HEDLEY_CRAY_VERSION_CHECK)
539 #undef JSON_HEDLEY_CRAY_VERSION_CHECK
541 #if defined(JSON_HEDLEY_CRAY_VERSION)
542 #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
544 #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0)
547 #if defined(JSON_HEDLEY_IAR_VERSION)
548 #undef JSON_HEDLEY_IAR_VERSION
550 #if defined(__IAR_SYSTEMS_ICC__)
552 #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000))
554 #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(__VER__ / 100, __VER__ % 100, 0)
558 #if defined(JSON_HEDLEY_IAR_VERSION_CHECK)
559 #undef JSON_HEDLEY_IAR_VERSION_CHECK
561 #if defined(JSON_HEDLEY_IAR_VERSION)
562 #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
564 #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0)
567 #if defined(JSON_HEDLEY_TINYC_VERSION)
568 #undef JSON_HEDLEY_TINYC_VERSION
570 #if defined(__TINYC__)
571 #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100)
574 #if defined(JSON_HEDLEY_TINYC_VERSION_CHECK)
575 #undef JSON_HEDLEY_TINYC_VERSION_CHECK
577 #if defined(JSON_HEDLEY_TINYC_VERSION)
578 #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
580 #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0)
583 #if defined(JSON_HEDLEY_DMC_VERSION)
584 #undef JSON_HEDLEY_DMC_VERSION
587 #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf)
590 #if defined(JSON_HEDLEY_DMC_VERSION_CHECK)
591 #undef JSON_HEDLEY_DMC_VERSION_CHECK
593 #if defined(JSON_HEDLEY_DMC_VERSION)
594 #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
596 #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0)
599 #if defined(JSON_HEDLEY_COMPCERT_VERSION)
600 #undef JSON_HEDLEY_COMPCERT_VERSION
602 #if defined(__COMPCERT_VERSION__)
603 #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100)
606 #if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK)
607 #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK
609 #if defined(JSON_HEDLEY_COMPCERT_VERSION)
610 #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
612 #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0)
615 #if defined(JSON_HEDLEY_PELLES_VERSION)
616 #undef JSON_HEDLEY_PELLES_VERSION
618 #if defined(__POCC__)
619 #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0)
622 #if defined(JSON_HEDLEY_PELLES_VERSION_CHECK)
623 #undef JSON_HEDLEY_PELLES_VERSION_CHECK
625 #if defined(JSON_HEDLEY_PELLES_VERSION)
626 #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
628 #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0)
631 #if defined(JSON_HEDLEY_MCST_LCC_VERSION)
632 #undef JSON_HEDLEY_MCST_LCC_VERSION
634 #if defined(__LCC__) && defined(__LCC_MINOR__)
635 #define JSON_HEDLEY_MCST_LCC_VERSION JSON_HEDLEY_VERSION_ENCODE(__LCC__ / 100, __LCC__ % 100, __LCC_MINOR__)
638 #if defined(JSON_HEDLEY_MCST_LCC_VERSION_CHECK)
639 #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK
641 #if defined(JSON_HEDLEY_MCST_LCC_VERSION)
642 #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_MCST_LCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
644 #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (0)
647 #if defined(JSON_HEDLEY_GCC_VERSION)
648 #undef JSON_HEDLEY_GCC_VERSION
651 defined(JSON_HEDLEY_GNUC_VERSION) && \
652 !defined(__clang__) && \
653 !defined(JSON_HEDLEY_INTEL_VERSION) && \
654 !defined(JSON_HEDLEY_PGI_VERSION) && \
655 !defined(JSON_HEDLEY_ARM_VERSION) && \
656 !defined(JSON_HEDLEY_CRAY_VERSION) && \
657 !defined(JSON_HEDLEY_TI_VERSION) && \
658 !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \
659 !defined(JSON_HEDLEY_TI_CL430_VERSION) && \
660 !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \
661 !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \
662 !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \
663 !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \
664 !defined(__COMPCERT__) && \
665 !defined(JSON_HEDLEY_MCST_LCC_VERSION)
666 #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION
669 #if defined(JSON_HEDLEY_GCC_VERSION_CHECK)
670 #undef JSON_HEDLEY_GCC_VERSION_CHECK
672 #if defined(JSON_HEDLEY_GCC_VERSION)
673 #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
675 #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0)
678 #if defined(JSON_HEDLEY_HAS_ATTRIBUTE)
679 #undef JSON_HEDLEY_HAS_ATTRIBUTE
682 defined(__has_attribute) && \
684 (!defined(JSON_HEDLEY_IAR_VERSION) || JSON_HEDLEY_IAR_VERSION_CHECK(8,5,9)) \
686 # define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute)
688 # define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0)
691 #if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE)
692 #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE
694 #if defined(__has_attribute)
695 #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute)
697 #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
700 #if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE)
701 #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE
703 #if defined(__has_attribute)
704 #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute)
706 #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
709 #if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE)
710 #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE
713 defined(__has_cpp_attribute) && \
714 defined(__cplusplus) && \
715 (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0))
716 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute)
718 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0)
721 #if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS)
722 #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS
724 #if !defined(__cplusplus) || !defined(__has_cpp_attribute)
725 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0)
727 !defined(JSON_HEDLEY_PGI_VERSION) && \
728 !defined(JSON_HEDLEY_IAR_VERSION) && \
729 (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \
730 (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0))
731 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute)
733 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0)
736 #if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE)
737 #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE
739 #if defined(__has_cpp_attribute) && defined(__cplusplus)
740 #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute)
742 #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
745 #if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE)
746 #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE
748 #if defined(__has_cpp_attribute) && defined(__cplusplus)
749 #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute)
751 #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
754 #if defined(JSON_HEDLEY_HAS_BUILTIN)
755 #undef JSON_HEDLEY_HAS_BUILTIN
757 #if defined(__has_builtin)
758 #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin)
760 #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0)
763 #if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN)
764 #undef JSON_HEDLEY_GNUC_HAS_BUILTIN
766 #if defined(__has_builtin)
767 #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin)
769 #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
772 #if defined(JSON_HEDLEY_GCC_HAS_BUILTIN)
773 #undef JSON_HEDLEY_GCC_HAS_BUILTIN
775 #if defined(__has_builtin)
776 #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin)
778 #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
781 #if defined(JSON_HEDLEY_HAS_FEATURE)
782 #undef JSON_HEDLEY_HAS_FEATURE
784 #if defined(__has_feature)
785 #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature)
787 #define JSON_HEDLEY_HAS_FEATURE(feature) (0)
790 #if defined(JSON_HEDLEY_GNUC_HAS_FEATURE)
791 #undef JSON_HEDLEY_GNUC_HAS_FEATURE
793 #if defined(__has_feature)
794 #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature)
796 #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
799 #if defined(JSON_HEDLEY_GCC_HAS_FEATURE)
800 #undef JSON_HEDLEY_GCC_HAS_FEATURE
802 #if defined(__has_feature)
803 #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature)
805 #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
808 #if defined(JSON_HEDLEY_HAS_EXTENSION)
809 #undef JSON_HEDLEY_HAS_EXTENSION
811 #if defined(__has_extension)
812 #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension)
814 #define JSON_HEDLEY_HAS_EXTENSION(extension) (0)
817 #if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION)
818 #undef JSON_HEDLEY_GNUC_HAS_EXTENSION
820 #if defined(__has_extension)
821 #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension)
823 #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
826 #if defined(JSON_HEDLEY_GCC_HAS_EXTENSION)
827 #undef JSON_HEDLEY_GCC_HAS_EXTENSION
829 #if defined(__has_extension)
830 #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension)
832 #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
835 #if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE)
836 #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE
838 #if defined(__has_declspec_attribute)
839 #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute)
841 #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0)
844 #if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE)
845 #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE
847 #if defined(__has_declspec_attribute)
848 #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute)
850 #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
853 #if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE)
854 #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE
856 #if defined(__has_declspec_attribute)
857 #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute)
859 #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
862 #if defined(JSON_HEDLEY_HAS_WARNING)
863 #undef JSON_HEDLEY_HAS_WARNING
865 #if defined(__has_warning)
866 #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning)
868 #define JSON_HEDLEY_HAS_WARNING(warning) (0)
871 #if defined(JSON_HEDLEY_GNUC_HAS_WARNING)
872 #undef JSON_HEDLEY_GNUC_HAS_WARNING
874 #if defined(__has_warning)
875 #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning)
877 #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
880 #if defined(JSON_HEDLEY_GCC_HAS_WARNING)
881 #undef JSON_HEDLEY_GCC_HAS_WARNING
883 #if defined(__has_warning)
884 #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning)
886 #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
890 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \
891 defined(__clang__) || \
892 JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \
893 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
894 JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \
895 JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \
896 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
897 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
898 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \
899 JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \
900 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \
901 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \
902 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
903 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
904 JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \
905 JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \
906 JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \
907 (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR))
908 #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value)
909 #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
910 #define JSON_HEDLEY_PRAGMA(value) __pragma(value)
912 #define JSON_HEDLEY_PRAGMA(value)
915 #if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH)
916 #undef JSON_HEDLEY_DIAGNOSTIC_PUSH
918 #if defined(JSON_HEDLEY_DIAGNOSTIC_POP)
919 #undef JSON_HEDLEY_DIAGNOSTIC_POP
921 #if defined(__clang__)
922 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
923 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
924 #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
925 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
926 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
927 #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0)
928 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
929 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
931 JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \
932 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
933 #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push))
934 #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop))
935 #elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0)
936 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push")
937 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop")
939 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
940 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
941 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \
942 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \
943 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
944 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
945 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push")
946 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop")
947 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0)
948 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
949 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
951 #define JSON_HEDLEY_DIAGNOSTIC_PUSH
952 #define JSON_HEDLEY_DIAGNOSTIC_POP
957 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_)
958 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_
960 #if defined(__cplusplus)
961 # if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat")
962 # if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions")
963 # if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions")
964 # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
965 JSON_HEDLEY_DIAGNOSTIC_PUSH \
966 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
967 _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \
968 _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \
970 JSON_HEDLEY_DIAGNOSTIC_POP
972 # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
973 JSON_HEDLEY_DIAGNOSTIC_PUSH \
974 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
975 _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \
977 JSON_HEDLEY_DIAGNOSTIC_POP
980 # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
981 JSON_HEDLEY_DIAGNOSTIC_PUSH \
982 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
984 JSON_HEDLEY_DIAGNOSTIC_POP
988 #if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_)
989 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x
992 #if defined(JSON_HEDLEY_CONST_CAST)
993 #undef JSON_HEDLEY_CONST_CAST
995 #if defined(__cplusplus)
996 # define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast<T>(expr))
998 JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \
999 JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \
1000 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
1001 # define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \
1002 JSON_HEDLEY_DIAGNOSTIC_PUSH \
1003 JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \
1005 JSON_HEDLEY_DIAGNOSTIC_POP \
1008 # define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr))
1011 #if defined(JSON_HEDLEY_REINTERPRET_CAST)
1012 #undef JSON_HEDLEY_REINTERPRET_CAST
1014 #if defined(__cplusplus)
1015 #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast<T>(expr))
1017 #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr))
1020 #if defined(JSON_HEDLEY_STATIC_CAST)
1021 #undef JSON_HEDLEY_STATIC_CAST
1023 #if defined(__cplusplus)
1024 #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast<T>(expr))
1026 #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr))
1029 #if defined(JSON_HEDLEY_CPP_CAST)
1030 #undef JSON_HEDLEY_CPP_CAST
1032 #if defined(__cplusplus)
1033 # if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast")
1034 # define JSON_HEDLEY_CPP_CAST(T, expr) \
1035 JSON_HEDLEY_DIAGNOSTIC_PUSH \
1036 _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \
1038 JSON_HEDLEY_DIAGNOSTIC_POP
1039 # elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0)
1040 # define JSON_HEDLEY_CPP_CAST(T, expr) \
1041 JSON_HEDLEY_DIAGNOSTIC_PUSH \
1042 _Pragma("diag_suppress=Pe137") \
1043 JSON_HEDLEY_DIAGNOSTIC_POP
1045 # define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr))
1048 # define JSON_HEDLEY_CPP_CAST(T, expr) (expr)
1051 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED)
1052 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
1054 #if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations")
1055 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
1056 #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
1057 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)")
1058 #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1059 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786))
1060 #elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0)
1061 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445")
1062 #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
1063 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444")
1064 #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0)
1065 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
1066 #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
1067 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996))
1068 #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1069 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444")
1071 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1072 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1073 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1074 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1075 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1076 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1077 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1078 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1079 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1080 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1081 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
1082 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718")
1083 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus)
1084 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)")
1085 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus)
1086 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)")
1087 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1088 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215")
1089 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0)
1090 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)")
1092 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
1095 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS)
1096 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
1098 #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas")
1099 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"")
1100 #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
1101 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)")
1102 #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1103 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161))
1104 #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
1105 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675")
1106 #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0)
1107 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"")
1108 #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
1109 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068))
1111 JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \
1112 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \
1113 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1114 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0)
1115 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163")
1116 #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0)
1117 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163")
1118 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1119 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161")
1120 #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1121 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 161")
1123 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
1126 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES)
1127 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES
1129 #if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes")
1130 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"")
1131 #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0)
1132 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
1133 #elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0)
1134 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)")
1135 #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1136 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292))
1137 #elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0)
1138 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030))
1139 #elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0)
1140 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098")
1141 #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
1142 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097")
1143 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)
1144 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)")
1146 JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \
1147 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \
1148 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0)
1149 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173")
1150 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1151 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097")
1152 #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1153 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097")
1155 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES
1158 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL)
1159 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
1161 #if JSON_HEDLEY_HAS_WARNING("-Wcast-qual")
1162 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"")
1163 #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
1164 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)")
1165 #elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0)
1166 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"")
1168 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
1171 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION)
1172 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION
1174 #if JSON_HEDLEY_HAS_WARNING("-Wunused-function")
1175 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("clang diagnostic ignored \"-Wunused-function\"")
1176 #elif JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0)
1177 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("GCC diagnostic ignored \"-Wunused-function\"")
1178 #elif JSON_HEDLEY_MSVC_VERSION_CHECK(1,0,0)
1179 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION __pragma(warning(disable:4505))
1180 #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1181 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("diag_suppress 3142")
1183 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION
1186 #if defined(JSON_HEDLEY_DEPRECATED)
1187 #undef JSON_HEDLEY_DEPRECATED
1189 #if defined(JSON_HEDLEY_DEPRECATED_FOR)
1190 #undef JSON_HEDLEY_DEPRECATED_FOR
1193 JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \
1194 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1195 #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since))
1196 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement))
1198 (JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) && !defined(JSON_HEDLEY_IAR_VERSION)) || \
1199 JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \
1200 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1201 JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \
1202 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \
1203 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
1204 JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \
1205 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \
1206 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \
1207 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1208 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) || \
1209 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1210 #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since)))
1211 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement)))
1212 #elif defined(__cplusplus) && (__cplusplus >= 201402L)
1213 #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]])
1214 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]])
1216 JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \
1217 JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
1218 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1219 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1220 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1221 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1222 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1223 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1224 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1225 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1226 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1227 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1228 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1229 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1230 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \
1231 JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0)
1232 #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__))
1233 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__))
1235 JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
1236 JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \
1237 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1238 #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated)
1239 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated)
1240 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1241 #define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated")
1242 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated")
1244 #define JSON_HEDLEY_DEPRECATED(since)
1245 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement)
1248 #if defined(JSON_HEDLEY_UNAVAILABLE)
1249 #undef JSON_HEDLEY_UNAVAILABLE
1252 JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \
1253 JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \
1254 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1255 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1256 #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since)))
1258 #define JSON_HEDLEY_UNAVAILABLE(available_since)
1261 #if defined(JSON_HEDLEY_WARN_UNUSED_RESULT)
1262 #undef JSON_HEDLEY_WARN_UNUSED_RESULT
1264 #if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG)
1265 #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG
1268 JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \
1269 JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \
1270 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1271 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1272 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1273 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1274 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1275 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1276 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1277 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1278 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1279 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1280 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1281 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1282 (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \
1283 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
1284 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1285 #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
1286 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__))
1287 #elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L)
1288 #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
1289 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]])
1290 #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard)
1291 #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
1292 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
1293 #elif defined(_Check_return_)
1294 #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_
1295 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_
1297 #define JSON_HEDLEY_WARN_UNUSED_RESULT
1298 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg)
1301 #if defined(JSON_HEDLEY_SENTINEL)
1302 #undef JSON_HEDLEY_SENTINEL
1305 JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \
1306 JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \
1307 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1308 JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \
1309 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1310 #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position)))
1312 #define JSON_HEDLEY_SENTINEL(position)
1315 #if defined(JSON_HEDLEY_NO_RETURN)
1316 #undef JSON_HEDLEY_NO_RETURN
1318 #if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1319 #define JSON_HEDLEY_NO_RETURN __noreturn
1321 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1322 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1323 #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__))
1324 #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
1325 #define JSON_HEDLEY_NO_RETURN _Noreturn
1326 #elif defined(__cplusplus) && (__cplusplus >= 201103L)
1327 #define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]])
1329 JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \
1330 JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \
1331 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1332 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1333 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1334 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1335 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1336 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1337 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1338 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1339 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1340 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1341 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1342 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1343 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1344 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1345 JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0)
1346 #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__))
1347 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
1348 #define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return")
1350 JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
1351 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1352 #define JSON_HEDLEY_NO_RETURN __declspec(noreturn)
1353 #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus)
1354 #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;")
1355 #elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0)
1356 #define JSON_HEDLEY_NO_RETURN __attribute((noreturn))
1357 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0)
1358 #define JSON_HEDLEY_NO_RETURN __declspec(noreturn)
1360 #define JSON_HEDLEY_NO_RETURN
1363 #if defined(JSON_HEDLEY_NO_ESCAPE)
1364 #undef JSON_HEDLEY_NO_ESCAPE
1366 #if JSON_HEDLEY_HAS_ATTRIBUTE(noescape)
1367 #define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__))
1369 #define JSON_HEDLEY_NO_ESCAPE
1372 #if defined(JSON_HEDLEY_UNREACHABLE)
1373 #undef JSON_HEDLEY_UNREACHABLE
1375 #if defined(JSON_HEDLEY_UNREACHABLE_RETURN)
1376 #undef JSON_HEDLEY_UNREACHABLE_RETURN
1378 #if defined(JSON_HEDLEY_ASSUME)
1379 #undef JSON_HEDLEY_ASSUME
1382 JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
1383 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1384 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1385 #define JSON_HEDLEY_ASSUME(expr) __assume(expr)
1386 #elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume)
1387 #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr)
1389 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \
1390 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0)
1391 #if defined(__cplusplus)
1392 #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr)
1394 #define JSON_HEDLEY_ASSUME(expr) _nassert(expr)
1398 (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \
1399 JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \
1400 JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \
1401 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1402 JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) || \
1403 JSON_HEDLEY_CRAY_VERSION_CHECK(10,0,0) || \
1404 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1405 #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable()
1406 #elif defined(JSON_HEDLEY_ASSUME)
1407 #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0)
1409 #if !defined(JSON_HEDLEY_ASSUME)
1410 #if defined(JSON_HEDLEY_UNREACHABLE)
1411 #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1)))
1413 #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr)
1416 #if defined(JSON_HEDLEY_UNREACHABLE)
1418 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \
1419 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0)
1420 #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value))
1422 #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE()
1425 #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value)
1427 #if !defined(JSON_HEDLEY_UNREACHABLE)
1428 #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0)
1432 #if JSON_HEDLEY_HAS_WARNING("-Wpedantic")
1433 #pragma clang diagnostic ignored "-Wpedantic"
1435 #if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus)
1436 #pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
1438 #if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0)
1439 #if defined(__clang__)
1440 #pragma clang diagnostic ignored "-Wvariadic-macros"
1441 #elif defined(JSON_HEDLEY_GCC_VERSION)
1442 #pragma GCC diagnostic ignored "-Wvariadic-macros"
1445 #if defined(JSON_HEDLEY_NON_NULL)
1446 #undef JSON_HEDLEY_NON_NULL
1449 JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \
1450 JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
1451 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1452 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0)
1453 #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__)))
1455 #define JSON_HEDLEY_NON_NULL(...)
1459 #if defined(JSON_HEDLEY_PRINTF_FORMAT)
1460 #undef JSON_HEDLEY_PRINTF_FORMAT
1462 #if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO)
1463 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check)))
1464 #elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO)
1465 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check)))
1467 JSON_HEDLEY_HAS_ATTRIBUTE(format) || \
1468 JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
1469 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1470 JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \
1471 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1472 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1473 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1474 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1475 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1476 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1477 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1478 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1479 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1480 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1481 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1482 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1483 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1484 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check)))
1485 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0)
1486 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check))
1488 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check)
1491 #if defined(JSON_HEDLEY_CONSTEXPR)
1492 #undef JSON_HEDLEY_CONSTEXPR
1494 #if defined(__cplusplus)
1495 #if __cplusplus >= 201103L
1496 #define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr)
1499 #if !defined(JSON_HEDLEY_CONSTEXPR)
1500 #define JSON_HEDLEY_CONSTEXPR
1503 #if defined(JSON_HEDLEY_PREDICT)
1504 #undef JSON_HEDLEY_PREDICT
1506 #if defined(JSON_HEDLEY_LIKELY)
1507 #undef JSON_HEDLEY_LIKELY
1509 #if defined(JSON_HEDLEY_UNLIKELY)
1510 #undef JSON_HEDLEY_UNLIKELY
1512 #if defined(JSON_HEDLEY_UNPREDICTABLE)
1513 #undef JSON_HEDLEY_UNPREDICTABLE
1515 #if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable)
1516 #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr))
1519 (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \
1520 JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) || \
1521 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1522 # define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability))
1523 # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability))
1524 # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability))
1525 # define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 )
1526 # define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 )
1528 (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \
1529 JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \
1530 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1531 (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \
1532 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1533 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1534 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1535 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \
1536 JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \
1537 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \
1538 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \
1539 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1540 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1541 JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \
1542 JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \
1543 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1544 # define JSON_HEDLEY_PREDICT(expr, expected, probability) \
1545 (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)))
1546 # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \
1548 double hedley_probability_ = (probability); \
1549 ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \
1551 # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \
1553 double hedley_probability_ = (probability); \
1554 ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \
1556 # define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1)
1557 # define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0)
1559 # define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))
1560 # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr))
1561 # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr))
1562 # define JSON_HEDLEY_LIKELY(expr) (!!(expr))
1563 # define JSON_HEDLEY_UNLIKELY(expr) (!!(expr))
1565 #if !defined(JSON_HEDLEY_UNPREDICTABLE)
1566 #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5)
1569 #if defined(JSON_HEDLEY_MALLOC)
1570 #undef JSON_HEDLEY_MALLOC
1573 JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \
1574 JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
1575 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1576 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1577 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1578 JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \
1579 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1580 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1581 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1582 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1583 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1584 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1585 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1586 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1587 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1588 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1589 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1590 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1591 #define JSON_HEDLEY_MALLOC __attribute__((__malloc__))
1592 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
1593 #define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory")
1595 JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \
1596 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1597 #define JSON_HEDLEY_MALLOC __declspec(restrict)
1599 #define JSON_HEDLEY_MALLOC
1602 #if defined(JSON_HEDLEY_PURE)
1603 #undef JSON_HEDLEY_PURE
1606 JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \
1607 JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \
1608 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1609 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1610 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1611 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1612 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1613 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1614 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1615 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1616 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1617 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1618 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1619 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1620 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1621 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1622 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1623 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
1624 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1625 # define JSON_HEDLEY_PURE __attribute__((__pure__))
1626 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
1627 # define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data")
1628 #elif defined(__cplusplus) && \
1630 JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \
1631 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \
1632 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \
1634 # define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;")
1636 # define JSON_HEDLEY_PURE
1639 #if defined(JSON_HEDLEY_CONST)
1640 #undef JSON_HEDLEY_CONST
1643 JSON_HEDLEY_HAS_ATTRIBUTE(const) || \
1644 JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \
1645 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1646 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1647 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1648 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1649 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1650 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1651 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1652 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1653 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1654 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1655 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1656 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1657 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1658 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1659 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1660 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
1661 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1662 #define JSON_HEDLEY_CONST __attribute__((__const__))
1664 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
1665 #define JSON_HEDLEY_CONST _Pragma("no_side_effect")
1667 #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE
1670 #if defined(JSON_HEDLEY_RESTRICT)
1671 #undef JSON_HEDLEY_RESTRICT
1673 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus)
1674 #define JSON_HEDLEY_RESTRICT restrict
1676 JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
1677 JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \
1678 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1679 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \
1680 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1681 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1682 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
1683 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1684 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \
1685 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \
1686 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1687 (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \
1688 JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \
1689 defined(__clang__) || \
1690 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1691 #define JSON_HEDLEY_RESTRICT __restrict
1692 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus)
1693 #define JSON_HEDLEY_RESTRICT _Restrict
1695 #define JSON_HEDLEY_RESTRICT
1698 #if defined(JSON_HEDLEY_INLINE)
1699 #undef JSON_HEDLEY_INLINE
1702 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \
1703 (defined(__cplusplus) && (__cplusplus >= 199711L))
1704 #define JSON_HEDLEY_INLINE inline
1706 defined(JSON_HEDLEY_GCC_VERSION) || \
1707 JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0)
1708 #define JSON_HEDLEY_INLINE __inline__
1710 JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \
1711 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \
1712 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1713 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \
1714 JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \
1715 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \
1716 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \
1717 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1718 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1719 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1720 #define JSON_HEDLEY_INLINE __inline
1722 #define JSON_HEDLEY_INLINE
1725 #if defined(JSON_HEDLEY_ALWAYS_INLINE)
1726 #undef JSON_HEDLEY_ALWAYS_INLINE
1729 JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \
1730 JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \
1731 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1732 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1733 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1734 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1735 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1736 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1737 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1738 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1739 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1740 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1741 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1742 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1743 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1744 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1745 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1746 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \
1747 JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0)
1748 # define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE
1750 JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \
1751 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1752 # define JSON_HEDLEY_ALWAYS_INLINE __forceinline
1753 #elif defined(__cplusplus) && \
1755 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1756 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1757 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1758 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \
1759 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1760 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \
1762 # define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;")
1763 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1764 # define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced")
1766 # define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE
1769 #if defined(JSON_HEDLEY_NEVER_INLINE)
1770 #undef JSON_HEDLEY_NEVER_INLINE
1773 JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \
1774 JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \
1775 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1776 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1777 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1778 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1779 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1780 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1781 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1782 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1783 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1784 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1785 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1786 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1787 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1788 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1789 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1790 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \
1791 JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0)
1792 #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__))
1794 JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
1795 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1796 #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline)
1797 #elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0)
1798 #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline")
1799 #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus)
1800 #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;")
1801 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1802 #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never")
1803 #elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0)
1804 #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline))
1805 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0)
1806 #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline)
1808 #define JSON_HEDLEY_NEVER_INLINE
1811 #if defined(JSON_HEDLEY_PRIVATE)
1812 #undef JSON_HEDLEY_PRIVATE
1814 #if defined(JSON_HEDLEY_PUBLIC)
1815 #undef JSON_HEDLEY_PUBLIC
1817 #if defined(JSON_HEDLEY_IMPORT)
1818 #undef JSON_HEDLEY_IMPORT
1820 #if defined(_WIN32) || defined(__CYGWIN__)
1821 # define JSON_HEDLEY_PRIVATE
1822 # define JSON_HEDLEY_PUBLIC __declspec(dllexport)
1823 # define JSON_HEDLEY_IMPORT __declspec(dllimport)
1826 JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \
1827 JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
1828 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1829 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1830 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1831 JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \
1833 defined(__TI_EABI__) && \
1835 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1836 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \
1839 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1840 # define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden")))
1841 # define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default")))
1843 # define JSON_HEDLEY_PRIVATE
1844 # define JSON_HEDLEY_PUBLIC
1846 # define JSON_HEDLEY_IMPORT extern
1849 #if defined(JSON_HEDLEY_NO_THROW)
1850 #undef JSON_HEDLEY_NO_THROW
1853 JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \
1854 JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
1855 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1856 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1857 #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__))
1859 JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \
1860 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \
1861 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0)
1862 #define JSON_HEDLEY_NO_THROW __declspec(nothrow)
1864 #define JSON_HEDLEY_NO_THROW
1867 #if defined(JSON_HEDLEY_FALL_THROUGH)
1868 #undef JSON_HEDLEY_FALL_THROUGH
1871 JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \
1872 JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) || \
1873 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1874 #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__))
1875 #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough)
1876 #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]])
1877 #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough)
1878 #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]])
1879 #elif defined(__fallthrough)
1880 #define JSON_HEDLEY_FALL_THROUGH __fallthrough
1882 #define JSON_HEDLEY_FALL_THROUGH
1885 #if defined(JSON_HEDLEY_RETURNS_NON_NULL)
1886 #undef JSON_HEDLEY_RETURNS_NON_NULL
1889 JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \
1890 JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \
1891 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1892 #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__))
1893 #elif defined(_Ret_notnull_)
1894 #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_
1896 #define JSON_HEDLEY_RETURNS_NON_NULL
1899 #if defined(JSON_HEDLEY_ARRAY_PARAM)
1900 #undef JSON_HEDLEY_ARRAY_PARAM
1903 defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
1904 !defined(__STDC_NO_VLA__) && \
1905 !defined(__cplusplus) && \
1906 !defined(JSON_HEDLEY_PGI_VERSION) && \
1907 !defined(JSON_HEDLEY_TINYC_VERSION)
1908 #define JSON_HEDLEY_ARRAY_PARAM(name) (name)
1910 #define JSON_HEDLEY_ARRAY_PARAM(name)
1913 #if defined(JSON_HEDLEY_IS_CONSTANT)
1914 #undef JSON_HEDLEY_IS_CONSTANT
1916 #if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR)
1917 #undef JSON_HEDLEY_REQUIRE_CONSTEXPR
1921 #if defined(JSON_HEDLEY_IS_CONSTEXPR_)
1922 #undef JSON_HEDLEY_IS_CONSTEXPR_
1925 JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \
1926 JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \
1927 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1928 JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \
1929 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1930 JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \
1931 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \
1932 (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \
1933 JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \
1934 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1935 #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr)
1937 #if !defined(__cplusplus)
1939 JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \
1940 JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \
1941 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1942 JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \
1943 JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \
1944 JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \
1945 JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24)
1946 #if defined(__INTPTR_TYPE__)
1947 #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*)
1950 #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*)
1954 defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \
1955 !defined(JSON_HEDLEY_SUNPRO_VERSION) && \
1956 !defined(JSON_HEDLEY_PGI_VERSION) && \
1957 !defined(JSON_HEDLEY_IAR_VERSION)) || \
1958 (JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) && !defined(JSON_HEDLEY_IAR_VERSION)) || \
1959 JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \
1960 JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \
1961 JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \
1962 JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0)
1963 #if defined(__INTPTR_TYPE__)
1964 #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0)
1967 #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0)
1970 defined(JSON_HEDLEY_GCC_VERSION) || \
1971 defined(JSON_HEDLEY_INTEL_VERSION) || \
1972 defined(JSON_HEDLEY_TINYC_VERSION) || \
1973 defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \
1974 JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \
1975 defined(JSON_HEDLEY_TI_CL2000_VERSION) || \
1976 defined(JSON_HEDLEY_TI_CL6X_VERSION) || \
1977 defined(JSON_HEDLEY_TI_CL7X_VERSION) || \
1978 defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \
1980 # define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \
1984 ((void*) ((expr) * 0L) ) : \
1985 ((struct { char v[sizeof(void) * 2]; } *) 1) \
1991 #if defined(JSON_HEDLEY_IS_CONSTEXPR_)
1992 #if !defined(JSON_HEDLEY_IS_CONSTANT)
1993 #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr)
1995 #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1))
1997 #if !defined(JSON_HEDLEY_IS_CONSTANT)
1998 #define JSON_HEDLEY_IS_CONSTANT(expr) (0)
2000 #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr)
2003 #if defined(JSON_HEDLEY_BEGIN_C_DECLS)
2004 #undef JSON_HEDLEY_BEGIN_C_DECLS
2006 #if defined(JSON_HEDLEY_END_C_DECLS)
2007 #undef JSON_HEDLEY_END_C_DECLS
2009 #if defined(JSON_HEDLEY_C_DECL)
2010 #undef JSON_HEDLEY_C_DECL
2012 #if defined(__cplusplus)
2013 #define JSON_HEDLEY_BEGIN_C_DECLS extern "C" {
2014 #define JSON_HEDLEY_END_C_DECLS }
2015 #define JSON_HEDLEY_C_DECL extern "C"
2017 #define JSON_HEDLEY_BEGIN_C_DECLS
2018 #define JSON_HEDLEY_END_C_DECLS
2019 #define JSON_HEDLEY_C_DECL
2022 #if defined(JSON_HEDLEY_STATIC_ASSERT)
2023 #undef JSON_HEDLEY_STATIC_ASSERT
2026 !defined(__cplusplus) && ( \
2027 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \
2028 (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \
2029 JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \
2030 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
2031 defined(_Static_assert) \
2033 # define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message)
2035 (defined(__cplusplus) && (__cplusplus >= 201103L)) || \
2036 JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \
2037 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
2038 # define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message))
2040 # define JSON_HEDLEY_STATIC_ASSERT(expr, message)
2043 #if defined(JSON_HEDLEY_NULL)
2044 #undef JSON_HEDLEY_NULL
2046 #if defined(__cplusplus)
2047 #if __cplusplus >= 201103L
2048 #define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr)
2050 #define JSON_HEDLEY_NULL NULL
2052 #define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0)
2055 #define JSON_HEDLEY_NULL NULL
2057 #define JSON_HEDLEY_NULL ((void*) 0)
2060 #if defined(JSON_HEDLEY_MESSAGE)
2061 #undef JSON_HEDLEY_MESSAGE
2063 #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas")
2064 # define JSON_HEDLEY_MESSAGE(msg) \
2065 JSON_HEDLEY_DIAGNOSTIC_PUSH \
2066 JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
2067 JSON_HEDLEY_PRAGMA(message msg) \
2068 JSON_HEDLEY_DIAGNOSTIC_POP
2070 JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \
2071 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
2072 # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg)
2073 #elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0)
2074 # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg)
2075 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
2076 # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg))
2077 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0)
2078 # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg))
2080 # define JSON_HEDLEY_MESSAGE(msg)
2083 #if defined(JSON_HEDLEY_WARNING)
2084 #undef JSON_HEDLEY_WARNING
2086 #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas")
2087 # define JSON_HEDLEY_WARNING(msg) \
2088 JSON_HEDLEY_DIAGNOSTIC_PUSH \
2089 JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
2090 JSON_HEDLEY_PRAGMA(clang warning msg) \
2091 JSON_HEDLEY_DIAGNOSTIC_POP
2093 JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \
2094 JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \
2095 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
2096 # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg)
2098 JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \
2099 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
2100 # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg))
2102 # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg)
2105 #if defined(JSON_HEDLEY_REQUIRE)
2106 #undef JSON_HEDLEY_REQUIRE
2108 #if defined(JSON_HEDLEY_REQUIRE_MSG)
2109 #undef JSON_HEDLEY_REQUIRE_MSG
2111 #if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if)
2112 # if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat")
2113 # define JSON_HEDLEY_REQUIRE(expr) \
2114 JSON_HEDLEY_DIAGNOSTIC_PUSH \
2115 _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \
2116 __attribute__((diagnose_if(!(expr), #expr, "error"))) \
2117 JSON_HEDLEY_DIAGNOSTIC_POP
2118 # define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \
2119 JSON_HEDLEY_DIAGNOSTIC_PUSH \
2120 _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \
2121 __attribute__((diagnose_if(!(expr), msg, "error"))) \
2122 JSON_HEDLEY_DIAGNOSTIC_POP
2124 # define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error")))
2125 # define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error")))
2128 # define JSON_HEDLEY_REQUIRE(expr)
2129 # define JSON_HEDLEY_REQUIRE_MSG(expr,msg)
2132 #if defined(JSON_HEDLEY_FLAGS)
2133 #undef JSON_HEDLEY_FLAGS
2135 #if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) && (!defined(__cplusplus) || JSON_HEDLEY_HAS_WARNING("-Wbitfield-enum-conversion"))
2136 #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__))
2138 #define JSON_HEDLEY_FLAGS
2141 #if defined(JSON_HEDLEY_FLAGS_CAST)
2142 #undef JSON_HEDLEY_FLAGS_CAST
2144 #if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0)
2145 # define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \
2146 JSON_HEDLEY_DIAGNOSTIC_PUSH \
2147 _Pragma("warning(disable:188)") \
2149 JSON_HEDLEY_DIAGNOSTIC_POP \
2152 # define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr)
2155 #if defined(JSON_HEDLEY_EMPTY_BASES)
2156 #undef JSON_HEDLEY_EMPTY_BASES
2159 (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \
2160 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
2161 #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases)
2163 #define JSON_HEDLEY_EMPTY_BASES
2168 #if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK)
2169 #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK
2171 #if defined(__clang__)
2172 #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0)
2174 #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
2177 #if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE)
2178 #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE
2180 #define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute)
2182 #if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE)
2183 #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE
2185 #define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute)
2187 #if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN)
2188 #undef JSON_HEDLEY_CLANG_HAS_BUILTIN
2190 #define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin)
2192 #if defined(JSON_HEDLEY_CLANG_HAS_FEATURE)
2193 #undef JSON_HEDLEY_CLANG_HAS_FEATURE
2195 #define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature)
2197 #if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION)
2198 #undef JSON_HEDLEY_CLANG_HAS_EXTENSION
2200 #define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension)
2202 #if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE)
2203 #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE
2205 #define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute)
2207 #if defined(JSON_HEDLEY_CLANG_HAS_WARNING)
2208 #undef JSON_HEDLEY_CLANG_HAS_WARNING
2210 #define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning)
2219 #if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK)
2220 #if defined(__clang__)
2221 #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400
2222 #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers"
2224 #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER))
2225 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800
2226 #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
2232 #if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)
2233 #define JSON_HAS_CPP_20
2234 #define JSON_HAS_CPP_17
2235 #define JSON_HAS_CPP_14
2236 #elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1)
2237 #define JSON_HAS_CPP_17
2238 #define JSON_HAS_CPP_14
2239 #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)
2240 #define JSON_HAS_CPP_14
2244 #if defined(__clang__)
2245 #pragma GCC diagnostic push
2246 #pragma GCC diagnostic ignored "-Wdocumentation"
2250 #if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION)
2251 #define JSON_THROW(exception) throw exception
2252 #define JSON_TRY try
2253 #define JSON_CATCH(exception) catch(exception)
2254 #define JSON_INTERNAL_CATCH(exception) catch(exception)
2257 #define JSON_THROW(exception) std::abort()
2258 #define JSON_TRY if(true)
2259 #define JSON_CATCH(exception) if(false)
2260 #define JSON_INTERNAL_CATCH(exception) if(false)
2264 #if defined(JSON_THROW_USER)
2266 #define JSON_THROW JSON_THROW_USER
2268 #if defined(JSON_TRY_USER)
2270 #define JSON_TRY JSON_TRY_USER
2272 #if defined(JSON_CATCH_USER)
2274 #define JSON_CATCH JSON_CATCH_USER
2275 #undef JSON_INTERNAL_CATCH
2276 #define JSON_INTERNAL_CATCH JSON_CATCH_USER
2278 #if defined(JSON_INTERNAL_CATCH_USER)
2279 #undef JSON_INTERNAL_CATCH
2280 #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER
2284 #if !defined(JSON_ASSERT)
2286 #define JSON_ASSERT(x) assert(x)
2290 #if defined(JSON_TESTS_PRIVATE)
2291 #define JSON_PRIVATE_UNLESS_TESTED public
2293 #define JSON_PRIVATE_UNLESS_TESTED private
2301 #define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \
2302 template<typename BasicJsonType> \
2303 inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \
2305 static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \
2306 static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \
2307 auto it = std::find_if(std::begin(m), std::end(m), \
2308 [e](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \
2310 return ej_pair.first == e; \
2312 j = ((it != std::end(m)) ? it : std::begin(m))->second; \
2314 template<typename BasicJsonType> \
2315 inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \
2317 static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \
2318 static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \
2319 auto it = std::find_if(std::begin(m), std::end(m), \
2320 [&j](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \
2322 return ej_pair.second == j; \
2324 e = ((it != std::end(m)) ? it : std::begin(m))->first; \
2330 #define NLOHMANN_BASIC_JSON_TPL_DECLARATION \
2331 template<template<typename, typename, typename...> class ObjectType, \
2332 template<typename, typename...> class ArrayType, \
2333 class StringType, class BooleanType, class NumberIntegerType, \
2334 class NumberUnsignedType, class NumberFloatType, \
2335 template<typename> class AllocatorType, \
2336 template<typename, typename = void> class JSONSerializer, \
2339 #define NLOHMANN_BASIC_JSON_TPL \
2340 basic_json<ObjectType, ArrayType, StringType, BooleanType, \
2341 NumberIntegerType, NumberUnsignedType, NumberFloatType, \
2342 AllocatorType, JSONSerializer, BinaryType>
2346 #define NLOHMANN_JSON_EXPAND( x ) x
2347 #define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME,...) NAME
2348 #define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \
2349 NLOHMANN_JSON_PASTE64, \
2350 NLOHMANN_JSON_PASTE63, \
2351 NLOHMANN_JSON_PASTE62, \
2352 NLOHMANN_JSON_PASTE61, \
2353 NLOHMANN_JSON_PASTE60, \
2354 NLOHMANN_JSON_PASTE59, \
2355 NLOHMANN_JSON_PASTE58, \
2356 NLOHMANN_JSON_PASTE57, \
2357 NLOHMANN_JSON_PASTE56, \
2358 NLOHMANN_JSON_PASTE55, \
2359 NLOHMANN_JSON_PASTE54, \
2360 NLOHMANN_JSON_PASTE53, \
2361 NLOHMANN_JSON_PASTE52, \
2362 NLOHMANN_JSON_PASTE51, \
2363 NLOHMANN_JSON_PASTE50, \
2364 NLOHMANN_JSON_PASTE49, \
2365 NLOHMANN_JSON_PASTE48, \
2366 NLOHMANN_JSON_PASTE47, \
2367 NLOHMANN_JSON_PASTE46, \
2368 NLOHMANN_JSON_PASTE45, \
2369 NLOHMANN_JSON_PASTE44, \
2370 NLOHMANN_JSON_PASTE43, \
2371 NLOHMANN_JSON_PASTE42, \
2372 NLOHMANN_JSON_PASTE41, \
2373 NLOHMANN_JSON_PASTE40, \
2374 NLOHMANN_JSON_PASTE39, \
2375 NLOHMANN_JSON_PASTE38, \
2376 NLOHMANN_JSON_PASTE37, \
2377 NLOHMANN_JSON_PASTE36, \
2378 NLOHMANN_JSON_PASTE35, \
2379 NLOHMANN_JSON_PASTE34, \
2380 NLOHMANN_JSON_PASTE33, \
2381 NLOHMANN_JSON_PASTE32, \
2382 NLOHMANN_JSON_PASTE31, \
2383 NLOHMANN_JSON_PASTE30, \
2384 NLOHMANN_JSON_PASTE29, \
2385 NLOHMANN_JSON_PASTE28, \
2386 NLOHMANN_JSON_PASTE27, \
2387 NLOHMANN_JSON_PASTE26, \
2388 NLOHMANN_JSON_PASTE25, \
2389 NLOHMANN_JSON_PASTE24, \
2390 NLOHMANN_JSON_PASTE23, \
2391 NLOHMANN_JSON_PASTE22, \
2392 NLOHMANN_JSON_PASTE21, \
2393 NLOHMANN_JSON_PASTE20, \
2394 NLOHMANN_JSON_PASTE19, \
2395 NLOHMANN_JSON_PASTE18, \
2396 NLOHMANN_JSON_PASTE17, \
2397 NLOHMANN_JSON_PASTE16, \
2398 NLOHMANN_JSON_PASTE15, \
2399 NLOHMANN_JSON_PASTE14, \
2400 NLOHMANN_JSON_PASTE13, \
2401 NLOHMANN_JSON_PASTE12, \
2402 NLOHMANN_JSON_PASTE11, \
2403 NLOHMANN_JSON_PASTE10, \
2404 NLOHMANN_JSON_PASTE9, \
2405 NLOHMANN_JSON_PASTE8, \
2406 NLOHMANN_JSON_PASTE7, \
2407 NLOHMANN_JSON_PASTE6, \
2408 NLOHMANN_JSON_PASTE5, \
2409 NLOHMANN_JSON_PASTE4, \
2410 NLOHMANN_JSON_PASTE3, \
2411 NLOHMANN_JSON_PASTE2, \
2412 NLOHMANN_JSON_PASTE1)(__VA_ARGS__))
2413 #define NLOHMANN_JSON_PASTE2(func, v1) func(v1)
2414 #define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2)
2415 #define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3)
2416 #define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4)
2417 #define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5)
2418 #define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6)
2419 #define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7)
2420 #define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8)
2421 #define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9)
2422 #define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10)
2423 #define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11)
2424 #define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12)
2425 #define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13)
2426 #define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14)
2427 #define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15)
2428 #define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16)
2429 #define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17)
2430 #define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18)
2431 #define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19)
2432 #define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20)
2433 #define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21)
2434 #define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22)
2435 #define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23)
2436 #define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24)
2437 #define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25)
2438 #define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26)
2439 #define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27)
2440 #define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28)
2441 #define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29)
2442 #define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30)
2443 #define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31)
2444 #define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32)
2445 #define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33)
2446 #define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34)
2447 #define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35)
2448 #define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36)
2449 #define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37)
2450 #define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38)
2451 #define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39)
2452 #define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40)
2453 #define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41)
2454 #define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42)
2455 #define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43)
2456 #define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44)
2457 #define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45)
2458 #define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46)
2459 #define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47)
2460 #define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48)
2461 #define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49)
2462 #define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50)
2463 #define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51)
2464 #define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52)
2465 #define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53)
2466 #define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54)
2467 #define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55)
2468 #define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56)
2469 #define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57)
2470 #define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58)
2471 #define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59)
2472 #define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60)
2473 #define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61)
2474 #define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62)
2475 #define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63)
2477 #define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1;
2478 #define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1);
2485 #define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \
2486 friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
2487 friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
2494 #define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \
2495 inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
2496 inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
2498 #ifndef JSON_USE_IMPLICIT_CONVERSIONS
2499 #define JSON_USE_IMPLICIT_CONVERSIONS 1
2502 #if JSON_USE_IMPLICIT_CONVERSIONS
2503 #define JSON_EXPLICIT
2505 #define JSON_EXPLICIT explicit
2528 const std::string& t)
2531 for (
auto pos = s.find(f);
2532 pos != std::string::npos;
2533 s.replace(
pos, f.size(), t),
2534 pos = s.find(f,
pos + t.size()))
2588 constexpr
operator size_t()
const
2652 static std::string
name(
const std::string& ename,
int id_)
2654 return "[json.exception." + ename +
"." +
std::to_string(id_) +
"] ";
2657 template<
typename BasicJsonType>
2660 #if JSON_DIAGNOSTICS
2661 std::vector<std::string> tokens;
2662 for (
const auto* current = &leaf_element; current->m_parent !=
nullptr; current = current->m_parent)
2664 switch (current->m_parent->type())
2668 for (std::size_t i = 0; i < current->m_parent->m_value.array->size(); ++i)
2670 if (¤t->m_parent->m_value.array->operator[](i) == current)
2681 for (
const auto& element : *current->m_parent->m_value.object)
2683 if (&element.second == current)
2685 tokens.emplace_back(element.first.c_str());
2702 return "(" + std::accumulate(tokens.rbegin(), tokens.rend(), std::string{},
2703 [](
const std::string &
a,
const std::string & b)
2705 return a +
"/" + detail::escape(b);
2708 static_cast<void>(leaf_element);
2715 std::runtime_error
m;
2775 template<
typename BasicJsonType>
2783 template<
typename BasicJsonType>
2784 static parse_error create(
int id_, std::size_t byte_,
const std::string& what_arg,
const BasicJsonType& context)
2854 template<
typename BasicJsonType>
2909 template<
typename BasicJsonType>
2957 template<
typename BasicJsonType>
2996 template<
typename BasicJsonType>
3016 #include <type_traits>
3027 template<
typename T>
3030 #ifdef JSON_HAS_CPP_14
3041 template<
bool B,
typename T =
void>
3068 template <
typename T, T... Ints>
3072 static constexpr std::size_t
size() noexcept
3074 return sizeof...(Ints);
3083 template <
size_t... Ints>
3086 namespace utility_internal
3089 template <
typename Seq,
size_t SeqSize,
size_t Rem>
3093 template <
typename T, T... Ints,
size_t SeqSize>
3099 template <
typename T, T... Ints,
size_t SeqSize>
3107 template <
typename T,
size_t N>
3114 template <
typename T>
3129 template <
typename T, T N>
3145 template <
typename... Ts>
3157 template<
typename T>
3163 template<
typename T>
3173 #include <type_traits>
3204 template<
typename It,
typename =
void>
3207 template<
typename It>
3211 typename It::reference, typename It::iterator_category >>
3222 template<
typename T,
typename =
void>
3227 template<
typename T>
3233 template<
typename T>
3252 #include <type_traits>
3272 template<
class Default,
3274 template<
class...>
class Op,
3282 template<
class Default,
template<
class...>
class Op,
class... Args>
3289 template<
template<
class...>
class Op,
class... Args>
3292 template<
template<
class...>
class Op,
class... Args>
3295 template<
class Default,
template<
class...>
class Op,
class... Args>
3298 template<
class Default,
template<
class...>
class Op,
class... Args>
3301 template<
class Expected,
template<
class...>
class Op,
class... Args>
3304 template<
class To,
template<
class...>
class Op,
class... Args>
3306 std::is_convertible<
detected_t<Op, Args...>, To>;
3311 #ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_
3312 #define INCLUDE_NLOHMANN_JSON_FWD_HPP_
3334 template<
typename T =
void,
typename SFINAE =
void>
3337 template<
template<
typename U,
typename V,
typename... Args>
class ObjectType =
3339 template<
typename U,
typename... Args>
class ArrayType = std::vector,
3340 class StringType = std::string,
class BooleanType = bool,
3343 class NumberFloatType = double,
3344 template<
typename U>
class AllocatorType = std::allocator,
3345 template<
typename T,
typename SFINAE =
void>
class JSONSerializer =
3347 class BinaryType = std::vector<std::uint8_t>>
3361 template<
typename BasicJsonType>
3374 template<
class Key,
class T,
class IgnoredLess,
class Allocator>
3431 template<
typename T>
3438 template<
typename T>
3441 template<
typename T>
3444 template<
typename T>
3447 template<
typename T>
3450 template<
typename T>
3453 template<
typename T>
3456 template<
typename T>
3459 template<
typename T>
3462 template<
typename T,
typename... Args>
3465 template<
typename T,
typename... Args>
3468 template<
typename T,
typename U>
3472 template<
typename BasicJsonType,
typename T,
typename =
void>
3479 template <
typename BasicJsonType,
typename T>
3485 template<
typename BasicJsonType,
typename T>
3489 using serializer =
typename BasicJsonType::template json_serializer<T, void>;
3493 const BasicJsonType&, T&>::value;
3498 template<
typename BasicJsonType,
typename T,
typename =
void>
3501 template<
typename BasicJsonType,
typename T>
3504 using serializer =
typename BasicJsonType::template json_serializer<T, void>;
3508 const BasicJsonType&>::value;
3513 template<
typename BasicJsonType,
typename T,
typename =
void>
3516 template<
typename BasicJsonType,
typename T>
3519 using serializer =
typename BasicJsonType::template json_serializer<T, void>;
3531 template<
typename T,
typename =
void>
3534 template<
typename T>
3553 template<
typename T,
typename =
void>
3556 template<
typename T>
3559 template<
typename BasicJsonType,
typename CompatibleObjectType,
3563 template<
typename BasicJsonType,
typename CompatibleObjectType>
3565 BasicJsonType, CompatibleObjectType,
3573 std::is_constructible<
typename object_t::key_type,
3574 typename CompatibleObjectType::key_type>::value &&
3575 std::is_constructible<
typename object_t::mapped_type,
3576 typename CompatibleObjectType::mapped_type>::value;
3579 template<
typename BasicJsonType,
typename CompatibleObjectType>
3583 template<
typename BasicJsonType,
typename ConstructibleObjectType,
3587 template<
typename BasicJsonType,
typename ConstructibleObjectType>
3589 BasicJsonType, ConstructibleObjectType,
3599 (std::is_constructible<
typename ConstructibleObjectType::key_type,
3600 typename object_t::key_type>::value &&
3602 typename object_t::mapped_type,
3603 typename ConstructibleObjectType::mapped_type >::value)) ||
3605 typename ConstructibleObjectType::mapped_type>::value ||
3608 typename ConstructibleObjectType::mapped_type >::value);
3611 template<
typename BasicJsonType,
typename ConstructibleObjectType>
3614 ConstructibleObjectType> {};
3616 template<
typename BasicJsonType,
typename CompatibleStringType,
3620 template<
typename BasicJsonType,
typename CompatibleStringType>
3622 BasicJsonType, CompatibleStringType,
3630 template<
typename BasicJsonType,
typename ConstructibleStringType>
3634 template<
typename BasicJsonType,
typename ConstructibleStringType,
3638 template<
typename BasicJsonType,
typename ConstructibleStringType>
3640 BasicJsonType, ConstructibleStringType,
3645 std::is_constructible<ConstructibleStringType,
3649 template<
typename BasicJsonType,
typename ConstructibleStringType>
3653 template<
typename BasicJsonType,
typename CompatibleArrayType,
typename =
void>
3656 template<
typename BasicJsonType,
typename CompatibleArrayType>
3658 BasicJsonType, CompatibleArrayType,
3665 iterator_traits<CompatibleArrayType >>
::value >>
3668 std::is_constructible<BasicJsonType,
3669 typename CompatibleArrayType::value_type>::value;
3672 template<
typename BasicJsonType,
typename CompatibleArrayType>
3676 template<
typename BasicJsonType,
typename ConstructibleArrayType,
typename =
void>
3679 template<
typename BasicJsonType,
typename ConstructibleArrayType>
3681 BasicJsonType, ConstructibleArrayType,
3683 typename BasicJsonType::value_type>
::value >>
3684 : std::true_type {};
3686 template<
typename BasicJsonType,
typename ConstructibleArrayType>
3688 BasicJsonType, ConstructibleArrayType,
3690 typename BasicJsonType::value_type>
::value&&
3691 std::is_default_constructible<ConstructibleArrayType>
::value&&
3692 (std::is_move_assignable<ConstructibleArrayType>::value ||
3693 std::is_copy_assignable<ConstructibleArrayType>::value)&&
3697 detected_t<value_type_t, ConstructibleArrayType >>
::value >>
3707 (std::is_same<
typename ConstructibleArrayType::value_type,
3708 typename BasicJsonType::array_t::value_type>::value ||
3710 typename ConstructibleArrayType::value_type>::value ||
3712 BasicJsonType,
typename ConstructibleArrayType::value_type >::value);
3715 template<
typename BasicJsonType,
typename ConstructibleArrayType>
3719 template<
typename RealIntegerType,
typename CompatibleNumberIntegerType,
3723 template<
typename RealIntegerType,
typename CompatibleNumberIntegerType>
3725 RealIntegerType, CompatibleNumberIntegerType,
3727 std::is_integral<CompatibleNumberIntegerType>
::value&&
3728 !std::is_same<bool, CompatibleNumberIntegerType>
::value >>
3735 std::is_constructible<RealIntegerType,
3736 CompatibleNumberIntegerType>::value &&
3737 CompatibleLimits::is_integer &&
3738 RealLimits::is_signed == CompatibleLimits::is_signed;
3741 template<
typename RealIntegerType,
typename CompatibleNumberIntegerType>
3744 CompatibleNumberIntegerType> {};
3746 template<
typename BasicJsonType,
typename CompatibleType,
typename =
void>
3749 template<
typename BasicJsonType,
typename CompatibleType>
3751 BasicJsonType, CompatibleType,
3758 template<
typename BasicJsonType,
typename CompatibleType>
3765 template<
class B1,
class... Bn>
3767 : std::conditional<bool(B1::value), conjunction<Bn...>, B1>
::type {};
3769 template<
typename T1,
typename T2>
3772 template<
typename T1,
typename... Args>
3784 template<
typename BasicJsonType>
3785 void from_json(
const BasicJsonType& j,
typename std::nullptr_t& n)
3795 template <
typename BasicJsonType,
typename ArithmeticType,
3801 switch (
static_cast<value_t>(j))
3805 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>());
3810 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>());
3815 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>());
3824 template<
typename BasicJsonType>
3825 void from_json(
const BasicJsonType& j,
typename BasicJsonType::boolean_t& b)
3831 b = *j.template get_ptr<const typename BasicJsonType::boolean_t*>();
3834 template<
typename BasicJsonType>
3841 s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
3845 typename BasicJsonType,
typename ConstructibleStringType,
3849 ConstructibleStringType>::value,
3851 void from_json(
const BasicJsonType& j, ConstructibleStringType& s)
3858 s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
3861 template<
typename BasicJsonType>
3862 void from_json(
const BasicJsonType& j,
typename BasicJsonType::number_float_t& val)
3867 template<
typename BasicJsonType>
3868 void from_json(
const BasicJsonType& j,
typename BasicJsonType::number_unsigned_t& val)
3873 template<
typename BasicJsonType>
3874 void from_json(
const BasicJsonType& j,
typename BasicJsonType::number_integer_t& val)
3879 template<
typename BasicJsonType,
typename EnumType,
3885 e =
static_cast<EnumType
>(val);
3889 template<
typename BasicJsonType,
typename T,
typename Allocator,
3891 void from_json(
const BasicJsonType& j, std::forward_list<T, Allocator>& l)
3898 std::transform(j.rbegin(), j.rend(),
3899 std::front_inserter(l), [](
const BasicJsonType & i)
3901 return i.template get<T>();
3906 template<
typename BasicJsonType,
typename T,
3915 std::transform(j.begin(), j.end(), std::begin(l),
3916 [](
const BasicJsonType & elem)
3918 return elem.template get<T>();
3922 template<
typename BasicJsonType,
typename T, std::
size_t N>
3924 -> decltype(j.template get<T>(),
void())
3926 for (std::size_t i = 0; i <
N; ++i)
3928 arr[i] = j.at(i).template get<T>();
3932 template<
typename BasicJsonType>
3935 arr = *j.template get_ptr<const typename BasicJsonType::array_t*>();
3938 template<
typename BasicJsonType,
typename T, std::
size_t N>
3941 -> decltype(j.template get<T>(),
void())
3943 for (std::size_t i = 0; i <
N; ++i)
3945 arr[i] = j.at(i).template get<T>();
3949 template<
typename BasicJsonType,
typename ConstructibleArrayType>
3952 arr.reserve(std::declval<typename ConstructibleArrayType::size_type>()),
3953 j.template get<typename ConstructibleArrayType::value_type>(),
3958 ConstructibleArrayType ret;
3959 ret.reserve(j.size());
3960 std::transform(j.begin(), j.end(),
3961 std::inserter(ret, end(ret)), [](
const BasicJsonType & i)
3965 return i.template get<typename ConstructibleArrayType::value_type>();
3967 arr = std::move(ret);
3970 template<
typename BasicJsonType,
typename ConstructibleArrayType>
3976 ConstructibleArrayType ret;
3978 j.begin(), j.end(), std::inserter(ret, end(ret)),
3979 [](
const BasicJsonType & i)
3983 return i.template get<typename ConstructibleArrayType::value_type>();
3985 arr = std::move(ret);
3988 template <
typename BasicJsonType,
typename ConstructibleArrayType,
3996 auto from_json(
const BasicJsonType& j, ConstructibleArrayType& arr)
3998 j.template get<typename ConstructibleArrayType::value_type>(),
4009 template<
typename BasicJsonType>
4010 void from_json(
const BasicJsonType& j,
typename BasicJsonType::binary_t& bin)
4017 bin = *j.template get_ptr<const typename BasicJsonType::binary_t*>();
4020 template<
typename BasicJsonType,
typename ConstructibleObjectType,
4022 void from_json(
const BasicJsonType& j, ConstructibleObjectType& obj)
4029 ConstructibleObjectType ret;
4030 const auto* inner_object = j.template get_ptr<const typename BasicJsonType::object_t*>();
4031 using value_type =
typename ConstructibleObjectType::value_type;
4033 inner_object->begin(), inner_object->end(),
4034 std::inserter(ret, ret.begin()),
4035 [](
typename BasicJsonType::object_t::value_type
const & p)
4037 return value_type(p.first, p.second.template get<typename ConstructibleObjectType::mapped_type>());
4039 obj = std::move(ret);
4046 template <
typename BasicJsonType,
typename ArithmeticType,
4056 switch (
static_cast<value_t>(j))
4060 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>());
4065 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>());
4070 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>());
4075 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::boolean_t*>());
4084 template<
typename BasicJsonType,
typename A1,
typename A2>
4085 void from_json(
const BasicJsonType& j, std::pair<A1, A2>& p)
4087 p = {j.at(0).template get<A1>(), j.at(1).template get<A2>()};
4090 template<
typename BasicJsonType,
typename Tuple, std::size_t... Idx>
4096 template<
typename BasicJsonType,
typename... Args>
4097 void from_json(
const BasicJsonType& j, std::tuple<Args...>& t)
4102 template <
typename BasicJsonType,
typename Key,
typename Value,
typename Compare,
typename Allocator,
4105 void from_json(
const BasicJsonType& j, std::map<Key, Value, Compare, Allocator>& m)
4112 for (
const auto& p : j)
4118 m.emplace(p.at(0).template get<Key>(), p.at(1).template get<Value>());
4122 template <
typename BasicJsonType,
typename Key,
typename Value,
typename Hash,
typename KeyEqual,
typename Allocator,
4125 void from_json(
const BasicJsonType& j, std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>& m)
4132 for (
const auto& p : j)
4138 m.emplace(p.at(0).template get<Key>(), p.at(1).template get<Value>());
4144 template<
typename BasicJsonType,
typename T>
4166 #include <algorithm>
4170 #include <type_traits>
4193 template<
typename string_type>
4208 using string_type =
typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().
key() ) >::
type >::
type;
4259 switch (
anchor.m_object->type())
4283 typename IteratorType::reference
value()
const
4316 template<std::
size_t N,
typename IteratorType, enable_if_t<N == 0,
int> = 0>
4324 template<std::
size_t N,
typename IteratorType, enable_if_t<N == 1,
int> = 0>
4338 #if defined(__clang__)
4340 #pragma clang diagnostic push
4341 #pragma clang diagnostic ignored "-Wmismatched-tags"
4343 template<
typename IteratorType>
4345 :
public std::integral_constant<std::size_t, 2> {};
4347 template<std::
size_t N,
typename IteratorType>
4352 get<N>(std::declval <
4355 #if defined(__clang__)
4356 #pragma clang diagnostic pop
4380 template<
typename BasicJsonType>
4381 static void construct(BasicJsonType& j,
typename BasicJsonType::boolean_t b) noexcept
4385 j.assert_invariant();
4392 template<
typename BasicJsonType>
4397 j.assert_invariant();
4400 template<
typename BasicJsonType>
4404 j.m_value = std::move(s);
4405 j.assert_invariant();
4408 template <
typename BasicJsonType,
typename CompatibleStringType,
4411 static void construct(BasicJsonType& j,
const CompatibleStringType& str)
4414 j.m_value.string = j.template create<typename BasicJsonType::string_t>(str);
4415 j.assert_invariant();
4422 template<
typename BasicJsonType>
4423 static void construct(BasicJsonType& j,
const typename BasicJsonType::binary_t& b)
4426 j.m_value =
typename BasicJsonType::binary_t(b);
4427 j.assert_invariant();
4430 template<
typename BasicJsonType>
4431 static void construct(BasicJsonType& j,
typename BasicJsonType::binary_t&& b)
4434 j.m_value =
typename BasicJsonType::binary_t(std::move(b));;
4435 j.assert_invariant();
4442 template<
typename BasicJsonType>
4443 static void construct(BasicJsonType& j,
typename BasicJsonType::number_float_t val) noexcept
4447 j.assert_invariant();
4454 template<
typename BasicJsonType>
4455 static void construct(BasicJsonType& j,
typename BasicJsonType::number_unsigned_t val) noexcept
4459 j.assert_invariant();
4466 template<
typename BasicJsonType>
4467 static void construct(BasicJsonType& j,
typename BasicJsonType::number_integer_t val) noexcept
4471 j.assert_invariant();
4478 template<
typename BasicJsonType>
4479 static void construct(BasicJsonType& j,
const typename BasicJsonType::array_t& arr)
4484 j.assert_invariant();
4487 template<
typename BasicJsonType>
4488 static void construct(BasicJsonType& j,
typename BasicJsonType::array_t&& arr)
4491 j.m_value = std::move(arr);
4493 j.assert_invariant();
4496 template <
typename BasicJsonType,
typename CompatibleArrayType,
4499 static void construct(BasicJsonType& j,
const CompatibleArrayType& arr)
4504 j.m_value.array = j.template create<typename BasicJsonType::array_t>(begin(arr), end(arr));
4506 j.assert_invariant();
4509 template<
typename BasicJsonType>
4510 static void construct(BasicJsonType& j,
const std::vector<bool>& arr)
4514 j.m_value.array->reserve(arr.size());
4515 for (
const bool x : arr)
4517 j.m_value.array->push_back(x);
4518 j.set_parent(j.m_value.array->back());
4520 j.assert_invariant();
4523 template<
typename BasicJsonType,
typename T,
4525 static void construct(BasicJsonType& j,
const std::valarray<T>& arr)
4529 j.m_value.array->resize(arr.size());
4532 std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin());
4535 j.assert_invariant();
4542 template<
typename BasicJsonType>
4543 static void construct(BasicJsonType& j,
const typename BasicJsonType::object_t& obj)
4548 j.assert_invariant();
4551 template<
typename BasicJsonType>
4552 static void construct(BasicJsonType& j,
typename BasicJsonType::object_t&& obj)
4555 j.m_value = std::move(obj);
4557 j.assert_invariant();
4560 template <
typename BasicJsonType,
typename CompatibleObjectType,
4562 static void construct(BasicJsonType& j,
const CompatibleObjectType& obj)
4568 j.m_value.object = j.template create<typename BasicJsonType::object_t>(begin(obj), end(obj));
4570 j.assert_invariant();
4578 template<
typename BasicJsonType,
typename T,
4585 template<
typename BasicJsonType,
typename CompatibleString,
4587 void to_json(BasicJsonType& j,
const CompatibleString& s)
4592 template<
typename BasicJsonType>
4598 template<
typename BasicJsonType,
typename FloatType,
4600 void to_json(BasicJsonType& j, FloatType val) noexcept
4605 template<
typename BasicJsonType,
typename CompatibleNumberUnsignedType,
4607 void to_json(BasicJsonType& j, CompatibleNumberUnsignedType val) noexcept
4612 template<
typename BasicJsonType,
typename CompatibleNumberIntegerType,
4614 void to_json(BasicJsonType& j, CompatibleNumberIntegerType val) noexcept
4619 template<
typename BasicJsonType,
typename EnumType,
4621 void to_json(BasicJsonType& j, EnumType e) noexcept
4627 template<
typename BasicJsonType>
4628 void to_json(BasicJsonType& j,
const std::vector<bool>& e)
4633 template <
typename BasicJsonType,
typename CompatibleArrayType,
4634 enable_if_t < is_compatible_array_type<BasicJsonType,
4635 CompatibleArrayType>::value&&
4641 void to_json(BasicJsonType& j,
const CompatibleArrayType& arr)
4646 template<
typename BasicJsonType>
4647 void to_json(BasicJsonType& j,
const typename BasicJsonType::binary_t& bin)
4652 template<
typename BasicJsonType,
typename T,
4654 void to_json(BasicJsonType& j,
const std::valarray<T>& arr)
4659 template<
typename BasicJsonType>
4660 void to_json(BasicJsonType& j,
typename BasicJsonType::array_t&& arr)
4665 template <
typename BasicJsonType,
typename CompatibleObjectType,
4667 void to_json(BasicJsonType& j,
const CompatibleObjectType& obj)
4672 template<
typename BasicJsonType>
4673 void to_json(BasicJsonType& j,
typename BasicJsonType::object_t&& obj)
4679 typename BasicJsonType,
typename T, std::size_t
N,
4681 const T(&)[
N]>::value,
4689 void to_json(BasicJsonType& j,
const std::pair<T1, T2>& p)
4691 j = { p.first, p.second };
4695 template<
typename BasicJsonType,
typename T,
4696 enable_if_t<std::is_same<T, iteration_proxy_value<typename BasicJsonType::iterator>>::value,
int> = 0>
4699 j = { {b.key(), b.value()} };
4702 template<
typename BasicJsonType,
typename Tuple, std::size_t... Idx>
4705 j = { std::get<Idx>(t)... };
4709 void to_json(BasicJsonType& j,
const T& t)
4716 template<
typename BasicJsonType,
typename T>
4717 auto operator()(BasicJsonType& j, T&& val)
const noexcept(noexcept(
to_json(j, std::forward<T>(val))))
4718 -> decltype(
to_json(j, std::forward<T>(val)),
void())
4720 return to_json(j, std::forward<T>(val));
4738 template<
typename,
typename>
4750 template<
typename BasicJsonType,
typename ValueType>
4751 static auto from_json(BasicJsonType&& j, ValueType& val) noexcept(
4767 template<
typename BasicJsonType,
typename ValueType>
4768 static auto to_json(BasicJsonType& j, ValueType&& val) noexcept(
4801 template<
typename BinaryType>
4840 return !(rhs == *
this);
4957 #include <functional>
4968 inline std::size_t
combine(std::size_t seed, std::size_t h) noexcept
4970 seed ^= h + 0x9e3779b9 + (seed << 6U) + (seed >> 2U);
4985 template<
typename BasicJsonType>
4986 std::size_t
hash(
const BasicJsonType& j)
4989 using number_integer_t =
typename BasicJsonType::number_integer_t;
4990 using number_unsigned_t =
typename BasicJsonType::number_unsigned_t;
4991 using number_float_t =
typename BasicJsonType::number_float_t;
4993 const auto type =
static_cast<std::size_t
>(j.type());
4996 case BasicJsonType::value_t::null:
4997 case BasicJsonType::value_t::discarded:
5002 case BasicJsonType::value_t::object:
5005 for (
const auto& element : j.items())
5007 const auto h = std::hash<string_t> {}(element.key());
5014 case BasicJsonType::value_t::array:
5017 for (
const auto& element : j)
5024 case BasicJsonType::value_t::string:
5026 const auto h = std::hash<string_t> {}(j.template get_ref<const string_t&>());
5030 case BasicJsonType::value_t::boolean:
5032 const auto h = std::hash<bool> {}(j.template get<bool>());
5036 case BasicJsonType::value_t::number_integer:
5038 const auto h = std::hash<number_integer_t> {}(j.template get<number_integer_t>());
5042 case BasicJsonType::value_t::number_unsigned:
5044 const auto h = std::hash<number_unsigned_t> {}(j.template get<number_unsigned_t>());
5048 case BasicJsonType::value_t::number_float:
5050 const auto h = std::hash<number_float_t> {}(j.template get<number_float_t>());
5054 case BasicJsonType::value_t::binary:
5057 const auto h = std::hash<bool> {}(j.get_binary().has_subtype());
5059 seed =
combine(seed, j.get_binary().subtype());
5060 for (
const auto byte : j.get_binary())
5062 seed =
combine(seed, std::hash<std::uint8_t> {}(byte));
5079 #include <algorithm>
5106 #include <type_traits>
5148 return std::fgetc(
m_file);
5177 is->clear(
is->rdstate() & std::ios::eofbit);
5182 :
is(&i),
sb(i.rdbuf())
5191 :
is(rhs.is),
sb(rhs.sb)
5202 auto res =
sb->sbumpc();
5206 is->clear(
is->rdstate() | std::ios::eofbit);
5213 std::istream*
is =
nullptr;
5214 std::streambuf*
sb =
nullptr;
5219 template<
typename IteratorType>
5223 using char_type =
typename std::iterator_traits<IteratorType>::value_type;
5233 auto result = std::char_traits<char_type>::to_int_type(*
current);
5238 return std::char_traits<char_type>::eof();
5245 template<
typename BaseInputAdapter,
size_t T>
5255 template<
typename BaseInputAdapter,
size_t T>
5258 template<
typename BaseInputAdapter>
5263 std::array<std::char_traits<char>::int_type, 4>& utf8_bytes,
5264 size_t& utf8_bytes_index,
5265 size_t& utf8_bytes_filled)
5267 utf8_bytes_index = 0;
5271 utf8_bytes[0] = std::char_traits<char>::eof();
5272 utf8_bytes_filled = 1;
5277 const auto wc = input.get_character();
5282 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(wc);
5283 utf8_bytes_filled = 1;
5285 else if (wc <= 0x7FF)
5287 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xC0u | ((
static_cast<unsigned int>(wc) >> 6u) & 0x1Fu));
5288 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
5289 utf8_bytes_filled = 2;
5291 else if (wc <= 0xFFFF)
5293 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xE0u | ((
static_cast<unsigned int>(wc) >> 12u) & 0x0Fu));
5294 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((
static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));
5295 utf8_bytes[2] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
5296 utf8_bytes_filled = 3;
5298 else if (wc <= 0x10FFFF)
5300 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xF0u | ((
static_cast<unsigned int>(wc) >> 18u) & 0x07u));
5301 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((
static_cast<unsigned int>(wc) >> 12u) & 0x3Fu));
5302 utf8_bytes[2] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((
static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));
5303 utf8_bytes[3] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
5304 utf8_bytes_filled = 4;
5309 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(wc);
5310 utf8_bytes_filled = 1;
5316 template<
typename BaseInputAdapter>
5321 std::array<std::char_traits<char>::int_type, 4>& utf8_bytes,
5322 size_t& utf8_bytes_index,
5323 size_t& utf8_bytes_filled)
5325 utf8_bytes_index = 0;
5329 utf8_bytes[0] = std::char_traits<char>::eof();
5330 utf8_bytes_filled = 1;
5335 const auto wc = input.get_character();
5340 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(wc);
5341 utf8_bytes_filled = 1;
5343 else if (wc <= 0x7FF)
5345 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xC0u | ((
static_cast<unsigned int>(wc) >> 6u)));
5346 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
5347 utf8_bytes_filled = 2;
5349 else if (0xD800 > wc || wc >= 0xE000)
5351 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xE0u | ((
static_cast<unsigned int>(wc) >> 12u)));
5352 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((
static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));
5353 utf8_bytes[2] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
5354 utf8_bytes_filled = 3;
5360 const auto wc2 =
static_cast<unsigned int>(input.get_character());
5361 const auto charcode = 0x10000u + (((
static_cast<unsigned int>(wc) & 0x3FFu) << 10u) | (wc2 & 0x3FFu));
5362 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xF0u | (charcode >> 18u));
5363 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((charcode >> 12u) & 0x3Fu));
5364 utf8_bytes[2] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((charcode >> 6u) & 0x3Fu));
5365 utf8_bytes[3] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (charcode & 0x3Fu));
5366 utf8_bytes_filled = 4;
5370 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(wc);
5371 utf8_bytes_filled = 1;
5379 template<
typename BaseInputAdapter,
typename W
ideCharType>
5393 fill_buffer<sizeof(WideCharType)>();
5415 std::array<std::char_traits<char>::int_type, 4>
utf8_bytes = {{0, 0, 0, 0}};
5424 template<
typename IteratorType,
typename Enable =
void>
5428 using char_type =
typename std::iterator_traits<iterator_type>::value_type;
5433 return adapter_type(std::move(first), std::move(last));
5437 template<
typename T>
5447 template<
typename IteratorType>
5451 using char_type =
typename std::iterator_traits<iterator_type>::value_type;
5462 template<
typename IteratorType>
5466 return factory_type::create(first, last);
5473 namespace container_input_adapter_factory_impl
5479 template<
typename ContainerType,
typename Enable =
void>
5482 template<
typename ContainerType>
5484 void_t<decltype(begin(
std::declval<ContainerType>()), end(std::declval<ContainerType>()))>>
5496 template<
typename ContainerType>
5521 template <
typename CharT,
5522 typename std::enable_if <
5530 auto length = std::strlen(
reinterpret_cast<const char*
>(b));
5531 const auto* ptr =
reinterpret_cast<const char*
>(b);
5535 template<
typename T, std::
size_t N>
5547 template <
typename CharT,
5548 typename std::enable_if <
5554 : ia(
reinterpret_cast<const char*
>(b),
reinterpret_cast<const char*
>(b) + l) {}
5556 template<
class IteratorType,
5557 typename std::enable_if<
5558 std::is_same<typename iterator_traits<IteratorType>::iterator_category, std::random_access_iterator_tag>::value,
5565 return std::move(ia);
5598 template<
typename BasicJsonType>
5611 virtual bool null() = 0;
5702 const std::string& last_token,
5729 template<
typename BasicJsonType>
5745 : root(r), allow_exceptions(allow_exceptions_)
5757 handle_value(
nullptr);
5793 handle_value(std::move(val));
5799 ref_stack.push_back(handle_value(BasicJsonType::value_t::object));
5812 object_element = &(ref_stack.back()->m_value.object->operator[](val));
5818 ref_stack.back()->set_parents();
5819 ref_stack.pop_back();
5825 ref_stack.push_back(handle_value(BasicJsonType::value_t::array));
5837 ref_stack.back()->set_parents();
5838 ref_stack.pop_back();
5842 template<
class Exception>
5844 const Exception& ex)
5847 static_cast<void>(ex);
5848 if (allow_exceptions)
5867 template<
typename Value>
5871 if (ref_stack.empty())
5873 root = BasicJsonType(std::forward<Value>(v));
5877 JSON_ASSERT(ref_stack.back()->is_array() || ref_stack.back()->is_object());
5879 if (ref_stack.back()->is_array())
5881 ref_stack.back()->m_value.array->emplace_back(std::forward<Value>(v));
5882 return &(ref_stack.back()->m_value.array->back());
5887 *object_element = BasicJsonType(std::forward<Value>(v));
5888 return object_element;
5894 std::vector<BasicJsonType*> ref_stack {};
5896 BasicJsonType* object_element =
nullptr;
5898 bool errored =
false;
5900 const bool allow_exceptions =
true;
5903 template<
typename BasicJsonType>
5917 const bool allow_exceptions_ =
true)
5918 : root(r), callback(cb), allow_exceptions(allow_exceptions_)
5920 keep_stack.push_back(
true);
5932 handle_value(
nullptr);
5968 handle_value(std::move(val));
5975 const bool keep = callback(
static_cast<int>(ref_stack.size()), parse_event_t::object_start, discarded);
5976 keep_stack.push_back(keep);
5978 auto val = handle_value(BasicJsonType::value_t::object,
true);
5979 ref_stack.push_back(val.second);
5982 if (ref_stack.back() &&
JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) && len > ref_stack.back()->max_size()))
5992 BasicJsonType k = BasicJsonType(val);
5995 const bool keep = callback(
static_cast<int>(ref_stack.size()), parse_event_t::key, k);
5996 key_keep_stack.push_back(keep);
5999 if (keep && ref_stack.back())
6001 object_element = &(ref_stack.back()->m_value.object->operator[](val) = discarded);
6009 if (ref_stack.back())
6011 if (!callback(
static_cast<int>(ref_stack.size()) - 1, parse_event_t::object_end, *ref_stack.back()))
6014 *ref_stack.back() = discarded;
6018 ref_stack.back()->set_parents();
6024 ref_stack.pop_back();
6025 keep_stack.pop_back();
6027 if (!ref_stack.empty() && ref_stack.back() && ref_stack.back()->is_structured())
6030 for (
auto it = ref_stack.back()->begin(); it != ref_stack.back()->end(); ++it)
6032 if (it->is_discarded())
6034 ref_stack.back()->erase(it);
6045 const bool keep = callback(
static_cast<int>(ref_stack.size()), parse_event_t::array_start, discarded);
6046 keep_stack.push_back(keep);
6048 auto val = handle_value(BasicJsonType::value_t::array,
true);
6049 ref_stack.push_back(val.second);
6052 if (ref_stack.back() &&
JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) && len > ref_stack.back()->max_size()))
6064 if (ref_stack.back())
6066 keep = callback(
static_cast<int>(ref_stack.size()) - 1, parse_event_t::array_end, *ref_stack.back());
6069 ref_stack.back()->set_parents();
6074 *ref_stack.back() = discarded;
6080 ref_stack.pop_back();
6081 keep_stack.pop_back();
6084 if (!keep && !ref_stack.empty() && ref_stack.back()->is_array())
6086 ref_stack.back()->m_value.array->pop_back();
6092 template<
class Exception>
6094 const Exception& ex)
6097 static_cast<void>(ex);
6098 if (allow_exceptions)
6126 template<
typename Value>
6133 if (!keep_stack.back())
6135 return {
false,
nullptr};
6139 auto value = BasicJsonType(std::forward<Value>(v));
6147 return {
false,
nullptr};
6150 if (ref_stack.empty())
6152 root = std::move(
value);
6153 return {
true, &root};
6158 if (!ref_stack.back())
6160 return {
false,
nullptr};
6164 JSON_ASSERT(ref_stack.back()->is_array() || ref_stack.back()->is_object());
6167 if (ref_stack.back()->is_array())
6169 ref_stack.back()->m_value.array->emplace_back(std::move(
value));
6170 return {
true, &(ref_stack.back()->m_value.array->back())};
6177 const bool store_element = key_keep_stack.back();
6178 key_keep_stack.pop_back();
6182 return {
false,
nullptr};
6186 *object_element = std::move(
value);
6187 return {
true, object_element};
6193 std::vector<BasicJsonType*> ref_stack {};
6195 std::vector<bool> keep_stack {};
6197 std::vector<bool> key_keep_stack {};
6199 BasicJsonType* object_element =
nullptr;
6201 bool errored =
false;
6205 const bool allow_exceptions =
true;
6207 BasicJsonType discarded = BasicJsonType::value_t::discarded;
6210 template<
typename BasicJsonType>
6297 #include <initializer_list>
6317 template<
typename BasicJsonType>
6351 return "<uninitialized>";
6353 return "true literal";
6355 return "false literal";
6357 return "null literal";
6359 return "string literal";
6363 return "number literal";
6377 return "<parse error>";
6379 return "end of input";
6381 return "'[', '{', or a literal";
6384 return "unknown token";
6394 template<
typename BasicJsonType,
typename InputAdapterType>
6407 explicit lexer(InputAdapterType&& adapter,
bool ignore_comments_ =
false) noexcept
6408 :
ia(
std::move(adapter))
6429 const auto* loc = localeconv();
6431 return (loc->decimal_point ==
nullptr) ?
'.' : *(loc->decimal_point);
6459 const auto factors = { 12u, 8u, 4u, 0u };
6460 for (
const auto factor : factors)
6466 codepoint +=
static_cast<int>((
static_cast<unsigned int>(
current) - 0x30u) << factor);
6470 codepoint +=
static_cast<int>((
static_cast<unsigned int>(
current) - 0x37u) << factor);
6474 codepoint +=
static_cast<int>((
static_cast<unsigned int>(
current) - 0x57u) << factor);
6482 JSON_ASSERT(0x0000 <= codepoint && codepoint <= 0xFFFF);
6503 JSON_ASSERT(ranges.size() == 2 || ranges.size() == 4 || ranges.size() == 6);
6506 for (
auto range = ranges.begin(); range != ranges.end(); ++range)
6552 case std::char_traits<char_type>::eof():
6555 return token_type::parse_error;
6561 return token_type::value_string;
6606 int codepoint = codepoint1;
6610 error_message =
"invalid string: '\\u' must be followed by 4 hex digits";
6611 return token_type::parse_error;
6615 if (0xD800 <= codepoint1 && codepoint1 <= 0xDBFF)
6624 error_message =
"invalid string: '\\u' must be followed by 4 hex digits";
6625 return token_type::parse_error;
6632 codepoint =
static_cast<int>(
6634 (
static_cast<unsigned int>(codepoint1) << 10u)
6636 +
static_cast<unsigned int>(codepoint2)
6644 error_message =
"invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF";
6645 return token_type::parse_error;
6650 error_message =
"invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF";
6651 return token_type::parse_error;
6658 error_message =
"invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF";
6659 return token_type::parse_error;
6664 JSON_ASSERT(0x00 <= codepoint && codepoint <= 0x10FFFF);
6667 if (codepoint < 0x80)
6672 else if (codepoint <= 0x7FF)
6675 add(
static_cast<char_int_type>(0xC0u | (
static_cast<unsigned int>(codepoint) >> 6u)));
6676 add(
static_cast<char_int_type>(0x80u | (
static_cast<unsigned int>(codepoint) & 0x3Fu)));
6678 else if (codepoint <= 0xFFFF)
6681 add(
static_cast<char_int_type>(0xE0u | (
static_cast<unsigned int>(codepoint) >> 12u)));
6682 add(
static_cast<char_int_type>(0x80u | ((
static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu)));
6683 add(
static_cast<char_int_type>(0x80u | (
static_cast<unsigned int>(codepoint) & 0x3Fu)));
6688 add(
static_cast<char_int_type>(0xF0u | (
static_cast<unsigned int>(codepoint) >> 18u)));
6689 add(
static_cast<char_int_type>(0x80u | ((
static_cast<unsigned int>(codepoint) >> 12u) & 0x3Fu)));
6690 add(
static_cast<char_int_type>(0x80u | ((
static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu)));
6691 add(
static_cast<char_int_type>(0x80u | (
static_cast<unsigned int>(codepoint) & 0x3Fu)));
6699 error_message =
"invalid string: forbidden character after backslash";
6700 return token_type::parse_error;
6709 error_message =
"invalid string: control character U+0000 (NUL) must be escaped to \\u0000";
6710 return token_type::parse_error;
6715 error_message =
"invalid string: control character U+0001 (SOH) must be escaped to \\u0001";
6716 return token_type::parse_error;
6721 error_message =
"invalid string: control character U+0002 (STX) must be escaped to \\u0002";
6722 return token_type::parse_error;
6727 error_message =
"invalid string: control character U+0003 (ETX) must be escaped to \\u0003";
6728 return token_type::parse_error;
6733 error_message =
"invalid string: control character U+0004 (EOT) must be escaped to \\u0004";
6734 return token_type::parse_error;
6739 error_message =
"invalid string: control character U+0005 (ENQ) must be escaped to \\u0005";
6740 return token_type::parse_error;
6745 error_message =
"invalid string: control character U+0006 (ACK) must be escaped to \\u0006";
6746 return token_type::parse_error;
6751 error_message =
"invalid string: control character U+0007 (BEL) must be escaped to \\u0007";
6752 return token_type::parse_error;
6757 error_message =
"invalid string: control character U+0008 (BS) must be escaped to \\u0008 or \\b";
6758 return token_type::parse_error;
6763 error_message =
"invalid string: control character U+0009 (HT) must be escaped to \\u0009 or \\t";
6764 return token_type::parse_error;
6769 error_message =
"invalid string: control character U+000A (LF) must be escaped to \\u000A or \\n";
6770 return token_type::parse_error;
6775 error_message =
"invalid string: control character U+000B (VT) must be escaped to \\u000B";
6776 return token_type::parse_error;
6781 error_message =
"invalid string: control character U+000C (FF) must be escaped to \\u000C or \\f";
6782 return token_type::parse_error;
6787 error_message =
"invalid string: control character U+000D (CR) must be escaped to \\u000D or \\r";
6788 return token_type::parse_error;
6793 error_message =
"invalid string: control character U+000E (SO) must be escaped to \\u000E";
6794 return token_type::parse_error;
6799 error_message =
"invalid string: control character U+000F (SI) must be escaped to \\u000F";
6800 return token_type::parse_error;
6805 error_message =
"invalid string: control character U+0010 (DLE) must be escaped to \\u0010";
6806 return token_type::parse_error;
6811 error_message =
"invalid string: control character U+0011 (DC1) must be escaped to \\u0011";
6812 return token_type::parse_error;
6817 error_message =
"invalid string: control character U+0012 (DC2) must be escaped to \\u0012";
6818 return token_type::parse_error;
6823 error_message =
"invalid string: control character U+0013 (DC3) must be escaped to \\u0013";
6824 return token_type::parse_error;
6829 error_message =
"invalid string: control character U+0014 (DC4) must be escaped to \\u0014";
6830 return token_type::parse_error;
6835 error_message =
"invalid string: control character U+0015 (NAK) must be escaped to \\u0015";
6836 return token_type::parse_error;
6841 error_message =
"invalid string: control character U+0016 (SYN) must be escaped to \\u0016";
6842 return token_type::parse_error;
6847 error_message =
"invalid string: control character U+0017 (ETB) must be escaped to \\u0017";
6848 return token_type::parse_error;
6853 error_message =
"invalid string: control character U+0018 (CAN) must be escaped to \\u0018";
6854 return token_type::parse_error;
6859 error_message =
"invalid string: control character U+0019 (EM) must be escaped to \\u0019";
6860 return token_type::parse_error;
6865 error_message =
"invalid string: control character U+001A (SUB) must be escaped to \\u001A";
6866 return token_type::parse_error;
6871 error_message =
"invalid string: control character U+001B (ESC) must be escaped to \\u001B";
6872 return token_type::parse_error;
6877 error_message =
"invalid string: control character U+001C (FS) must be escaped to \\u001C";
6878 return token_type::parse_error;
6883 error_message =
"invalid string: control character U+001D (GS) must be escaped to \\u001D";
6884 return token_type::parse_error;
6889 error_message =
"invalid string: control character U+001E (RS) must be escaped to \\u001E";
6890 return token_type::parse_error;
6895 error_message =
"invalid string: control character U+001F (US) must be escaped to \\u001F";
6896 return token_type::parse_error;
7033 return token_type::parse_error;
7043 return token_type::parse_error;
7067 return token_type::parse_error;
7077 return token_type::parse_error;
7087 return token_type::parse_error;
7099 return token_type::parse_error;
7109 return token_type::parse_error;
7118 return token_type::parse_error;
7141 case std::char_traits<char_type>::eof():
7158 case std::char_traits<char_type>::eof():
7189 error_message =
"invalid comment; expecting '/' or '*' after '/'";
7198 f = std::strtof(str, endptr);
7202 static
void strtof(
double& f,
const char* str,
char** endptr) noexcept
7204 f = std::strtod(str, endptr);
7208 static
void strtof(
long double& f,
const char* str,
char** endptr) noexcept
7210 f = std::strtold(str, endptr);
7260 token_type number_type = token_type::value_unsigned;
7268 goto scan_number_minus;
7274 goto scan_number_zero;
7288 goto scan_number_any1;
7298 number_type = token_type::value_integer;
7304 goto scan_number_zero;
7318 goto scan_number_any1;
7324 return token_type::parse_error;
7335 goto scan_number_decimal1;
7342 goto scan_number_exponent;
7346 goto scan_number_done;
7365 goto scan_number_any1;
7371 goto scan_number_decimal1;
7378 goto scan_number_exponent;
7382 goto scan_number_done;
7385 scan_number_decimal1:
7387 number_type = token_type::value_float;
7402 goto scan_number_decimal2;
7408 return token_type::parse_error;
7412 scan_number_decimal2:
7428 goto scan_number_decimal2;
7435 goto scan_number_exponent;
7439 goto scan_number_done;
7442 scan_number_exponent:
7444 number_type = token_type::value_float;
7451 goto scan_number_sign;
7466 goto scan_number_any2;
7472 "invalid number; expected '+', '-', or digit after exponent";
7473 return token_type::parse_error;
7493 goto scan_number_any2;
7498 error_message =
"invalid number; expected digit after exponent sign";
7499 return token_type::parse_error;
7519 goto scan_number_any2;
7523 goto scan_number_done;
7531 char* endptr =
nullptr;
7535 if (number_type == token_type::value_unsigned)
7537 const auto x = std::strtoull(
token_buffer.data(), &endptr, 10);
7547 return token_type::value_unsigned;
7551 else if (number_type == token_type::value_integer)
7553 const auto x = std::strtoll(
token_buffer.data(), &endptr, 10);
7563 return token_type::value_integer;
7575 return token_type::value_float;
7588 for (std::size_t i = 1; i < length; ++i)
7593 return token_type::parse_error;
7687 token_buffer.push_back(
static_cast<typename string_t::value_type
>(c));
7738 if (
static_cast<unsigned char>(c) <=
'\x1F')
7741 std::array<char, 9> cs{{}};
7742 (std::snprintf)(cs.data(), cs.size(),
"<U+%.4X>",
static_cast<unsigned char>(c));
7743 result += cs.data();
7748 result.push_back(
static_cast<std::string::value_type
>(c));
7775 return get() == 0xBB &&
get() == 0xBF;
7798 error_message =
"invalid BOM; must be 0xEF 0xBB 0xBF if given";
7799 return token_type::parse_error;
7810 return token_type::parse_error;
7821 return token_type::begin_array;
7823 return token_type::end_array;
7825 return token_type::begin_object;
7827 return token_type::end_object;
7829 return token_type::name_separator;
7831 return token_type::value_separator;
7837 return scan_literal(true_literal.data(), true_literal.size(), token_type::literal_true);
7842 return scan_literal(false_literal.data(), false_literal.size(), token_type::literal_false);
7847 return scan_literal(null_literal.data(), null_literal.size(), token_type::literal_null);
7871 case std::char_traits<char_type>::eof():
7872 return token_type::end_of_input;
7877 return token_type::parse_error;
7935 template<
typename T>
7938 template<
typename T>
7940 decltype(std::declval<T&>().
boolean(std::declval<bool>()));
7942 template<
typename T,
typename Integer>
7944 decltype(std::declval<T&>().number_integer(std::declval<Integer>()));
7946 template<
typename T,
typename Un
signed>
7948 decltype(std::declval<T&>().number_unsigned(std::declval<Unsigned>()));
7950 template<
typename T,
typename Float,
typename String>
7952 std::declval<Float>(), std::declval<const String&>()));
7954 template<
typename T,
typename String>
7956 decltype(std::declval<T&>().
string(std::declval<String&>()));
7958 template<
typename T,
typename Binary>
7960 decltype(std::declval<T&>().binary(std::declval<Binary&>()));
7962 template<
typename T>
7964 decltype(std::declval<T&>().start_object(std::declval<std::size_t>()));
7966 template<
typename T,
typename String>
7968 decltype(std::declval<T&>().key(std::declval<String&>()));
7970 template<
typename T>
7973 template<
typename T>
7975 decltype(std::declval<T&>().start_array(std::declval<std::size_t>()));
7977 template<
typename T>
7980 template<
typename T,
typename Exception>
7982 std::declval<std::size_t>(), std::declval<const std::string&>(),
7983 std::declval<const Exception&>()));
7985 template<
typename SAX,
typename BasicJsonType>
7990 "BasicJsonType must be of type basic_json<...>");
8016 template<
typename SAX,
typename BasicJsonType>
8021 "BasicJsonType must be of type basic_json<...>");
8032 "Missing/invalid function: bool null()");
8034 "Missing/invalid function: bool boolean(bool)");
8036 "Missing/invalid function: bool boolean(bool)");
8040 "Missing/invalid function: bool number_integer(number_integer_t)");
8044 "Missing/invalid function: bool number_unsigned(number_unsigned_t)");
8047 "Missing/invalid function: bool number_float(number_float_t, const string_t&)");
8050 "Missing/invalid function: bool string(string_t&)");
8053 "Missing/invalid function: bool binary(binary_t&)");
8055 "Missing/invalid function: bool start_object(std::size_t)");
8057 "Missing/invalid function: bool key(string_t&)");
8059 "Missing/invalid function: bool end_object()");
8061 "Missing/invalid function: bool start_array(std::size_t)");
8063 "Missing/invalid function: bool end_array()");
8066 "Missing/invalid function: bool parse_error(std::size_t, const "
8067 "std::string&, const exception&)");
8096 return *
reinterpret_cast<char*
>(&num) == 1;
8107 template<
typename BasicJsonType,
typename InputAdapterType,
typename SAX = json_sax_dom_parser<BasicJsonType>>
8148 const bool strict = true,
8152 bool result =
false;
8177 if (result && strict)
8222 return sax->end_object();
8234 auto out = std::back_inserter(result);
8246 *out++ =
static_cast<typename string_t::value_type
>(
current);
8261 template<
typename NumberType>
8282 template<
typename NumberType>
8294 result.set_subtype(subtype);
8310 const std::size_t element_type_parse_position)
8312 switch (element_type)
8346 return sax->boolean(
get() != 0);
8368 std::array<char, 3> cr{{}};
8369 (std::snprintf)(cr.data(), cr.size(),
"%.2hhX",
static_cast<unsigned char>(element_type));
8370 return sax->parse_error(element_type_parse_position, std::string(cr.data()),
parse_error::create(114, element_type_parse_position,
"Unsupported BSON record type 0x" + std::string(cr.data()), BasicJsonType()));
8391 while (
auto element_type =
get())
8398 const std::size_t element_type_parse_position =
chars_read;
8404 if (!is_array && !
sax->key(key))
8440 return sax->end_array();
8461 case std::char_traits<char_type>::eof():
8662 return get_cbor_array(
static_cast<std::size_t
>(
static_cast<unsigned int>(
current) & 0x1Fu), tag_handler);
8716 return get_cbor_object(
static_cast<std::size_t
>(
static_cast<unsigned int>(
current) & 0x1Fu), tag_handler);
8765 switch (tag_handler)
8814 return sax->boolean(
false);
8817 return sax->boolean(
true);
8824 const auto byte1_raw =
get();
8829 const auto byte2_raw =
get();
8835 const auto byte1 =
static_cast<unsigned char>(byte1_raw);
8836 const auto byte2 =
static_cast<unsigned char>(byte2_raw);
8846 const auto half =
static_cast<unsigned int>((byte1 << 8u) + byte2);
8847 const double val = [&half]
8849 const int exp = (half >> 10u) & 0x1Fu;
8850 const unsigned int mant = half & 0x3FFu;
8856 return std::ldexp(mant, -24);
8859 ? std::numeric_limits<double>::infinity()
8860 : std::numeric_limits<double>::quiet_NaN();
8862 return std::ldexp(mant + 1024, exp - 25);
8865 return sax->number_float((half & 0x8000u) != 0
8965 while (
get() != 0xFF)
8972 result.append(chunk);
9064 while (
get() != 0xFF)
9071 result.insert(result.end(), chunk.begin(), chunk.end());
9098 if (len != std::size_t(-1))
9100 for (std::size_t i = 0; i < len; ++i)
9110 while (
get() != 0xFF)
9119 return sax->end_array();
9137 if (len != std::size_t(-1))
9139 for (std::size_t i = 0; i < len; ++i)
9156 while (
get() != 0xFF)
9171 return sax->end_object();
9186 case std::char_traits<char_type>::eof():
9403 return sax->boolean(
false);
9406 return sax->boolean(
true);
9646 auto assign_and_return_true = [&result](
std::int8_t subtype)
9648 result.set_subtype(
static_cast<std::uint8_t>(subtype));
9682 assign_and_return_true(subtype);
9692 assign_and_return_true(subtype);
9702 assign_and_return_true(subtype);
9710 assign_and_return_true(subtype);
9718 assign_and_return_true(subtype);
9726 assign_and_return_true(subtype);
9734 assign_and_return_true(subtype);
9742 assign_and_return_true(subtype);
9761 for (std::size_t i = 0; i < len; ++i)
9769 return sax->end_array();
9784 for (std::size_t i = 0; i < len; ++i)
9799 return sax->end_object();
9878 return sax->parse_error(
chars_read, last_token,
parse_error::create(113,
chars_read,
exception_message(
input_format_t::ubjson,
"expected length type specification (U, i, I, l, L); last byte: 0x" + last_token,
"string"), BasicJsonType()));
9897 result =
static_cast<std::size_t
>(number);
9908 result =
static_cast<std::size_t
>(number);
9919 result =
static_cast<std::size_t
>(number);
9930 result =
static_cast<std::size_t
>(number);
9941 result =
static_cast<std::size_t
>(number);
9948 return sax->parse_error(
chars_read, last_token,
parse_error::create(113,
chars_read,
exception_message(
input_format_t::ubjson,
"expected length type specification (U, i, I, l, L) after '#'; last byte: 0x" + last_token,
"size"), BasicJsonType()));
9965 result.first = string_t::npos;
9972 result.second =
get();
10008 case std::char_traits<char_type>::eof():
10012 return sax->boolean(
true);
10014 return sax->boolean(
false);
10017 return sax->null();
10079 return sax->string(s);
10107 std::pair<std::size_t, char_int_type> size_and_type;
10113 if (size_and_type.first != string_t::npos)
10120 if (size_and_type.second != 0)
10122 if (size_and_type.second !=
'N')
10124 for (std::size_t i = 0; i < size_and_type.first; ++i)
10135 for (std::size_t i = 0; i < size_and_type.first; ++i)
10161 return sax->end_array();
10169 std::pair<std::size_t, char_int_type> size_and_type;
10176 if (size_and_type.first != string_t::npos)
10183 if (size_and_type.second != 0)
10185 for (std::size_t i = 0; i < size_and_type.first; ++i)
10200 for (std::size_t i = 0; i < size_and_type.first; ++i)
10236 return sax->end_object();
10245 std::size_t size{};
10253 std::vector<char> number_vector;
10254 for (std::size_t i = 0; i < size; ++i)
10261 number_vector.push_back(
static_cast<char>(
current));
10267 const auto result_number = number_lexer.scan();
10268 const auto number_string = number_lexer.get_token_string();
10269 const auto result_remainder = number_lexer.scan();
10278 switch (result_number)
10280 case token_type::value_integer:
10281 return sax->number_integer(number_lexer.get_number_integer());
10282 case token_type::value_unsigned:
10283 return sax->number_unsigned(number_lexer.get_number_unsigned());
10284 case token_type::value_float:
10285 return sax->number_float(number_lexer.get_number_float(), std::move(number_string));
10337 template<
typename NumberType,
bool InputIsLittleEndian = false>
10342 for (std::size_t i = 0; i <
sizeof(NumberType); ++i)
10362 std::memcpy(&result, vec.data(),
sizeof(NumberType));
10380 template<
typename NumberType>
10382 const NumberType len,
10385 bool success =
true;
10386 for (NumberType i = 0; i < len; i++)
10394 result.push_back(
static_cast<typename string_t::value_type
>(
current));
10413 template<
typename NumberType>
10415 const NumberType len,
10418 bool success =
true;
10419 for (NumberType i = 0; i < len; i++)
10453 std::array<char, 3> cr{{}};
10454 (std::snprintf)(cr.data(), cr.size(),
"%.2hhX",
static_cast<unsigned char>(
current));
10455 return std::string{cr.data()};
10465 const std::string&
detail,
10466 const std::string& context)
const
10468 std::string error_msg =
"syntax error while parsing ";
10473 error_msg +=
"CBOR";
10477 error_msg +=
"MessagePack";
10481 error_msg +=
"UBJSON";
10485 error_msg +=
"BSON";
10492 return error_msg +
" " + context +
": " +
detail;
10523 #include <functional>
10567 template<
typename BasicJsonType>
10569 std::function<bool(
int ,
parse_event_t , BasicJsonType& )>;
10576 template<
typename BasicJsonType,
typename InputAdapterType>
10590 const bool allow_exceptions_ =
true,
10591 const bool skip_comments =
false)
10593 ,
m_lexer(
std::move(adapter), skip_comments)
10610 void parse(
const bool strict, BasicJsonType& result)
10618 if (strict && (
get_token() != token_type::end_of_input))
10635 if (result.is_discarded())
10646 if (strict && (
get_token() != token_type::end_of_input))
10661 result.assert_invariant();
10673 return sax_parse(&sax_acceptor, strict);
10676 template<
typename SAX>
10684 if (result && strict && (
get_token() != token_type::end_of_input))
10695 template<
typename SAX>
10701 std::vector<bool> states;
10703 bool skip_to_state_evaluation =
false;
10707 if (!skip_to_state_evaluation)
10712 case token_type::begin_object:
10720 if (
get_token() == token_type::end_object)
10750 states.push_back(
false);
10757 case token_type::begin_array:
10765 if (
get_token() == token_type::end_array)
10775 states.push_back(
true);
10781 case token_type::value_float:
10800 case token_type::literal_false:
10809 case token_type::literal_null:
10818 case token_type::literal_true:
10827 case token_type::value_integer:
10836 case token_type::value_string:
10845 case token_type::value_unsigned:
10854 case token_type::parse_error:
10872 skip_to_state_evaluation =
false;
10876 if (states.empty())
10885 if (
get_token() == token_type::value_separator)
10906 skip_to_state_evaluation =
true;
10918 if (
get_token() == token_type::value_separator)
10960 skip_to_state_evaluation =
true;
10978 std::string error_msg =
"syntax error ";
10980 if (!context.empty())
10982 error_msg +=
"while parsing " + context +
" ";
10997 if (expected != token_type::uninitialized)
11087 return lhs.m_it == rhs.m_it;
11092 return lhs.m_it < rhs.m_it;
11097 auto result = *
this;
11104 return lhs.m_it - rhs.m_it;
11115 auto result = *
this;
11128 auto result = *
this;
11174 #include <iterator>
11175 #include <type_traits>
11197 template<
typename IteratorType>
class iteration_proxy;
11198 template<
typename IteratorType>
class iteration_proxy_value;
11216 template<
typename BasicJsonType>
11231 "iter_impl only accepts (const) basic_json");
11248 typename BasicJsonType::const_pointer,
11253 typename BasicJsonType::const_reference,
11254 typename BasicJsonType::reference>
::type;
11271 switch (m_object->m_type)
11310 : m_object(other.m_object),
m_it(other.m_it)
11321 if (&other !=
this)
11323 m_object = other.m_object;
11335 : m_object(other.m_object),
m_it(other.m_it)
11346 m_object = other.m_object;
11356 void set_begin() noexcept
11360 switch (m_object->m_type)
11397 switch (m_object->m_type)
11428 switch (m_object->m_type)
11465 switch (m_object->m_type)
11497 auto result = *
this;
11510 switch (m_object->m_type)
11540 auto result = *
this;
11553 switch (m_object->m_type)
11581 template <
typename IterImpl, detail::enable_if_t < (std::is_same<IterImpl, iter_impl>::value || std::is_same<IterImpl, other_iter_impl>::value), std::
nullptr_t > =
nullptr >
11592 switch (m_object->m_type)
11609 template <
typename IterImpl, detail::enable_if_t < (std::is_same<IterImpl, iter_impl>::value || std::is_same<IterImpl, other_iter_impl>::value), std::
nullptr_t > =
nullptr >
11629 switch (m_object->m_type)
11648 return !other.operator < (*this);
11677 switch (m_object->m_type)
11713 auto result = *
this;
11735 auto result = *
this;
11748 switch (m_object->m_type)
11769 switch (m_object->m_type)
11796 const typename object_t::key_type&
key()
const
11832 #include <iterator>
11861 template<
typename Base>
11935 auto it = --this->base();
11942 auto it = --this->base();
11943 return it.operator * ();
11954 #include <algorithm>
11973 template<
typename BasicJsonType>
12024 [](
const std::string &
a,
const std::string & b)
12026 return a +
"/" + detail::escape(b);
12031 operator std::string()
const
12305 std::size_t processed_chars = 0;
12306 unsigned long long res = 0;
12309 res = std::stoull(s, &processed_chars);
12324 if (res >=
static_cast<unsigned long long>((std::numeric_limits<size_type>::max)()))
12366 if (reference_token ==
"0")
12431 if (ptr->is_null())
12435 std::all_of(reference_token.begin(), reference_token.end(),
12436 [](
const unsigned char x)
12438 return std::isdigit(x);
12442 *ptr = (nums || reference_token ==
"-")
12447 switch (ptr->type())
12452 ptr = &ptr->operator[](reference_token);
12458 if (reference_token ==
"-")
12461 ptr = &ptr->operator[](ptr->m_value.array->size());
12466 ptr = &ptr->operator[](
array_index(reference_token));
12489 switch (ptr->type())
12494 ptr = &ptr->at(reference_token);
12504 "array index '-' (" +
std::to_string(ptr->m_value.array->size()) +
12505 ") is out of range", *ptr));
12538 switch (ptr->type())
12543 ptr = &ptr->operator[](reference_token);
12556 ptr = &ptr->operator[](
array_index(reference_token));
12578 switch (ptr->type())
12583 ptr = &ptr->at(reference_token);
12593 "array index '-' (" +
std::to_string(ptr->m_value.array->size()) +
12594 ") is out of range", *ptr));
12618 switch (ptr->type())
12622 if (!ptr->contains(reference_token))
12628 ptr = &ptr->operator[](reference_token);
12639 if (
JSON_HEDLEY_UNLIKELY(reference_token.size() == 1 && !(
"0" <= reference_token && reference_token <=
"9")))
12651 for (std::size_t i = 1; i < reference_token.size(); i++)
12662 if (idx >= ptr->size())
12668 ptr = &ptr->operator[](idx);
12694 static std::vector<std::string>
split(
const std::string& reference_string)
12696 std::vector<std::string>
result;
12699 if (reference_string.empty())
12715 std::size_t slash = reference_string.find_first_of(
'/', 1),
12722 start = (slash == std::string::npos) ? 0 : slash + 1,
12724 slash = reference_string.find_first_of(
'/', start))
12728 auto reference_token = reference_string.substr(start, slash - start);
12731 for (std::size_t
pos = reference_token.find_first_of(
'~');
12732 pos != std::string::npos;
12733 pos = reference_token.find_first_of(
'~',
pos + 1))
12739 (reference_token[
pos + 1] !=
'0' &&
12740 reference_token[
pos + 1] !=
'1')))
12762 static void flatten(
const std::string& reference_string,
12766 switch (
value.type())
12770 if (
value.m_value.array->empty())
12773 result[reference_string] =
nullptr;
12778 for (std::size_t i = 0; i <
value.m_value.array->size(); ++i)
12789 if (
value.m_value.object->empty())
12792 result[reference_string] =
nullptr;
12797 for (
const auto& element : *
value.m_value.object)
12835 for (
const auto& element : *
value.m_value.object)
12866 return lhs.reference_tokens ==
rhs.reference_tokens;
12883 return !(lhs ==
rhs);
12894 #include <initializer_list>
12904 template<
typename BasicJsonType>
12973 #include <algorithm>
12989 #include <algorithm>
12992 #include <iterator>
13019 template<typename CharType>
13023 template<typename CharType>
13037 void write_characters(
const CharType* s,
std::
size_t length)
override
13039 std::copy(s, s + length, std::back_inserter(v));
13043 std::vector<CharType>&
v;
13047 template<
typename CharType>
13061 void write_characters(
const CharType* s,
std::
size_t length)
override
13063 stream.write(s,
static_cast<std::streamsize
>(length));
13071 template<
typename CharType,
typename StringType = std::basic_
string<CharType>>
13085 void write_characters(
const CharType* s,
std::
size_t length)
override
13087 str.append(s, length);
13094 template<
typename CharType,
typename StringType = std::basic_
string<CharType>>
13130 template<
typename BasicJsonType,
typename CharType>
13156 case value_t::object:
13158 write_bson_object(*j.m_value.object);
13164 JSON_THROW(type_error::create(317,
"to serialize to BSON, top-level type must be object, but is " + std::string(j.type_name()), j));;
13176 case value_t::null:
13178 oa->write_character(to_char_type(0xF6));
13182 case value_t::boolean:
13184 oa->write_character(j.m_value.boolean
13185 ? to_char_type(0xF5)
13186 : to_char_type(0xF4));
13190 case value_t::number_integer:
13192 if (j.m_value.number_integer >= 0)
13197 if (j.m_value.number_integer <= 0x17)
13199 write_number(
static_cast<std::uint8_t>(j.m_value.number_integer));
13201 else if (j.m_value.number_integer <= (std::numeric_limits<std::uint8_t>::max)())
13203 oa->write_character(to_char_type(0x18));
13204 write_number(
static_cast<std::uint8_t>(j.m_value.number_integer));
13206 else if (j.m_value.number_integer <= (std::numeric_limits<std::uint16_t>::max)())
13208 oa->write_character(to_char_type(0x19));
13209 write_number(
static_cast<std::uint16_t>(j.m_value.number_integer));
13211 else if (j.m_value.number_integer <= (std::numeric_limits<std::uint32_t>::max)())
13213 oa->write_character(to_char_type(0x1A));
13214 write_number(
static_cast<std::uint32_t>(j.m_value.number_integer));
13218 oa->write_character(to_char_type(0x1B));
13219 write_number(
static_cast<std::uint64_t>(j.m_value.number_integer));
13226 const auto positive_number = -1 - j.m_value.number_integer;
13227 if (j.m_value.number_integer >= -24)
13229 write_number(
static_cast<std::uint8_t>(0x20 + positive_number));
13231 else if (positive_number <= (std::numeric_limits<std::uint8_t>::max)())
13233 oa->write_character(to_char_type(0x38));
13234 write_number(
static_cast<std::uint8_t>(positive_number));
13236 else if (positive_number <= (std::numeric_limits<std::uint16_t>::max)())
13238 oa->write_character(to_char_type(0x39));
13241 else if (positive_number <= (std::numeric_limits<std::uint32_t>::max)())
13243 oa->write_character(to_char_type(0x3A));
13248 oa->write_character(to_char_type(0x3B));
13255 case value_t::number_unsigned:
13257 if (j.m_value.number_unsigned <= 0x17)
13259 write_number(
static_cast<std::uint8_t>(j.m_value.number_unsigned));
13261 else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint8_t>::max)())
13263 oa->write_character(to_char_type(0x18));
13264 write_number(
static_cast<std::uint8_t>(j.m_value.number_unsigned));
13266 else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint16_t>::max)())
13268 oa->write_character(to_char_type(0x19));
13269 write_number(
static_cast<std::uint16_t>(j.m_value.number_unsigned));
13271 else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint32_t>::max)())
13273 oa->write_character(to_char_type(0x1A));
13274 write_number(
static_cast<std::uint32_t>(j.m_value.number_unsigned));
13278 oa->write_character(to_char_type(0x1B));
13279 write_number(
static_cast<std::uint64_t>(j.m_value.number_unsigned));
13284 case value_t::number_float:
13286 if (std::isnan(j.m_value.number_float))
13289 oa->write_character(to_char_type(0xF9));
13290 oa->write_character(to_char_type(0x7E));
13291 oa->write_character(to_char_type(0x00));
13293 else if (std::isinf(j.m_value.number_float))
13296 oa->write_character(to_char_type(0xf9));
13297 oa->write_character(j.m_value.number_float > 0 ? to_char_type(0x7C) : to_char_type(0xFC));
13298 oa->write_character(to_char_type(0x00));
13307 case value_t::string:
13310 const auto N = j.m_value.string->size();
13315 else if (
N <= (std::numeric_limits<std::uint8_t>::max)())
13317 oa->write_character(to_char_type(0x78));
13320 else if (
N <= (std::numeric_limits<std::uint16_t>::max)())
13322 oa->write_character(to_char_type(0x79));
13325 else if (
N <= (std::numeric_limits<std::uint32_t>::max)())
13327 oa->write_character(to_char_type(0x7A));
13331 else if (
N <= (std::numeric_limits<std::uint64_t>::max)())
13333 oa->write_character(to_char_type(0x7B));
13339 oa->write_characters(
13340 reinterpret_cast<const CharType*
>(j.m_value.string->c_str()),
13341 j.m_value.string->size());
13345 case value_t::array:
13348 const auto N = j.m_value.array->size();
13353 else if (
N <= (std::numeric_limits<std::uint8_t>::max)())
13355 oa->write_character(to_char_type(0x98));
13358 else if (
N <= (std::numeric_limits<std::uint16_t>::max)())
13360 oa->write_character(to_char_type(0x99));
13363 else if (
N <= (std::numeric_limits<std::uint32_t>::max)())
13365 oa->write_character(to_char_type(0x9A));
13369 else if (
N <= (std::numeric_limits<std::uint64_t>::max)())
13371 oa->write_character(to_char_type(0x9B));
13377 for (
const auto& el : *j.m_value.array)
13384 case value_t::binary:
13386 if (j.m_value.binary->has_subtype())
13389 write_number(j.m_value.binary->subtype());
13393 const auto N = j.m_value.binary->size();
13398 else if (
N <= (std::numeric_limits<std::uint8_t>::max)())
13400 oa->write_character(to_char_type(0x58));
13403 else if (
N <= (std::numeric_limits<std::uint16_t>::max)())
13405 oa->write_character(to_char_type(0x59));
13408 else if (
N <= (std::numeric_limits<std::uint32_t>::max)())
13410 oa->write_character(to_char_type(0x5A));
13414 else if (
N <= (std::numeric_limits<std::uint64_t>::max)())
13416 oa->write_character(to_char_type(0x5B));
13422 oa->write_characters(
13423 reinterpret_cast<const CharType*
>(j.m_value.binary->data()),
13429 case value_t::object:
13432 const auto N = j.m_value.object->size();
13437 else if (
N <= (std::numeric_limits<std::uint8_t>::max)())
13439 oa->write_character(to_char_type(0xB8));
13442 else if (
N <= (std::numeric_limits<std::uint16_t>::max)())
13444 oa->write_character(to_char_type(0xB9));
13447 else if (
N <= (std::numeric_limits<std::uint32_t>::max)())
13449 oa->write_character(to_char_type(0xBA));
13453 else if (
N <= (std::numeric_limits<std::uint64_t>::max)())
13455 oa->write_character(to_char_type(0xBB));
13461 for (
const auto& el : *j.m_value.object)
13463 write_cbor(el.first);
13464 write_cbor(el.second);
13481 case value_t::null:
13483 oa->write_character(to_char_type(0xC0));
13487 case value_t::boolean:
13489 oa->write_character(j.m_value.boolean
13490 ? to_char_type(0xC3)
13491 : to_char_type(0xC2));
13495 case value_t::number_integer:
13497 if (j.m_value.number_integer >= 0)
13502 if (j.m_value.number_unsigned < 128)
13505 write_number(
static_cast<std::uint8_t>(j.m_value.number_integer));
13507 else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint8_t>::max)())
13510 oa->write_character(to_char_type(0xCC));
13511 write_number(
static_cast<std::uint8_t>(j.m_value.number_integer));
13513 else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint16_t>::max)())
13516 oa->write_character(to_char_type(0xCD));
13517 write_number(
static_cast<std::uint16_t>(j.m_value.number_integer));
13519 else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint32_t>::max)())
13522 oa->write_character(to_char_type(0xCE));
13523 write_number(
static_cast<std::uint32_t>(j.m_value.number_integer));
13525 else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint64_t>::max)())
13528 oa->write_character(to_char_type(0xCF));
13529 write_number(
static_cast<std::uint64_t>(j.m_value.number_integer));
13534 if (j.m_value.number_integer >= -32)
13537 write_number(
static_cast<std::int8_t>(j.m_value.number_integer));
13539 else if (j.m_value.number_integer >= (std::numeric_limits<std::int8_t>::min)() &&
13540 j.m_value.number_integer <= (std::numeric_limits<std::int8_t>::max)())
13543 oa->write_character(to_char_type(0xD0));
13544 write_number(
static_cast<std::int8_t>(j.m_value.number_integer));
13546 else if (j.m_value.number_integer >= (std::numeric_limits<std::int16_t>::min)() &&
13547 j.m_value.number_integer <= (std::numeric_limits<std::int16_t>::max)())
13550 oa->write_character(to_char_type(0xD1));
13551 write_number(
static_cast<std::int16_t>(j.m_value.number_integer));
13553 else if (j.m_value.number_integer >= (std::numeric_limits<std::int32_t>::min)() &&
13554 j.m_value.number_integer <= (std::numeric_limits<std::int32_t>::max)())
13557 oa->write_character(to_char_type(0xD2));
13558 write_number(
static_cast<std::int32_t>(j.m_value.number_integer));
13560 else if (j.m_value.number_integer >= (std::numeric_limits<std::int64_t>::min)() &&
13561 j.m_value.number_integer <= (std::numeric_limits<std::int64_t>::max)())
13564 oa->write_character(to_char_type(0xD3));
13565 write_number(
static_cast<std::int64_t>(j.m_value.number_integer));
13571 case value_t::number_unsigned:
13573 if (j.m_value.number_unsigned < 128)
13576 write_number(
static_cast<std::uint8_t>(j.m_value.number_integer));
13578 else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint8_t>::max)())
13581 oa->write_character(to_char_type(0xCC));
13582 write_number(
static_cast<std::uint8_t>(j.m_value.number_integer));
13584 else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint16_t>::max)())
13587 oa->write_character(to_char_type(0xCD));
13588 write_number(
static_cast<std::uint16_t>(j.m_value.number_integer));
13590 else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint32_t>::max)())
13593 oa->write_character(to_char_type(0xCE));
13594 write_number(
static_cast<std::uint32_t>(j.m_value.number_integer));
13596 else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint64_t>::max)())
13599 oa->write_character(to_char_type(0xCF));
13600 write_number(
static_cast<std::uint64_t>(j.m_value.number_integer));
13605 case value_t::number_float:
13611 case value_t::string:
13614 const auto N = j.m_value.string->size();
13620 else if (
N <= (std::numeric_limits<std::uint8_t>::max)())
13623 oa->write_character(to_char_type(0xD9));
13626 else if (
N <= (std::numeric_limits<std::uint16_t>::max)())
13629 oa->write_character(to_char_type(0xDA));
13632 else if (
N <= (std::numeric_limits<std::uint32_t>::max)())
13635 oa->write_character(to_char_type(0xDB));
13640 oa->write_characters(
13641 reinterpret_cast<const CharType*
>(j.m_value.string->c_str()),
13642 j.m_value.string->size());
13646 case value_t::array:
13649 const auto N = j.m_value.array->size();
13655 else if (
N <= (std::numeric_limits<std::uint16_t>::max)())
13658 oa->write_character(to_char_type(0xDC));
13661 else if (
N <= (std::numeric_limits<std::uint32_t>::max)())
13664 oa->write_character(to_char_type(0xDD));
13669 for (
const auto& el : *j.m_value.array)
13676 case value_t::binary:
13680 const bool use_ext = j.m_value.binary->has_subtype();
13683 const auto N = j.m_value.binary->size();
13684 if (
N <= (std::numeric_limits<std::uint8_t>::max)())
13693 output_type = 0xD4;
13696 output_type = 0xD5;
13699 output_type = 0xD6;
13702 output_type = 0xD7;
13705 output_type = 0xD8;
13708 output_type = 0xC7;
13716 output_type = 0xC4;
13720 oa->write_character(to_char_type(output_type));
13726 else if (
N <= (std::numeric_limits<std::uint16_t>::max)())
13732 oa->write_character(to_char_type(output_type));
13735 else if (
N <= (std::numeric_limits<std::uint32_t>::max)())
13741 oa->write_character(to_char_type(output_type));
13748 write_number(
static_cast<std::int8_t>(j.m_value.binary->subtype()));
13752 oa->write_characters(
13753 reinterpret_cast<const CharType*
>(j.m_value.binary->data()),
13759 case value_t::object:
13762 const auto N = j.m_value.object->size();
13768 else if (
N <= (std::numeric_limits<std::uint16_t>::max)())
13771 oa->write_character(to_char_type(0xDE));
13774 else if (
N <= (std::numeric_limits<std::uint32_t>::max)())
13777 oa->write_character(to_char_type(0xDF));
13782 for (
const auto& el : *j.m_value.object)
13784 write_msgpack(el.first);
13785 write_msgpack(el.second);
13802 const bool use_type,
const bool add_prefix =
true)
13806 case value_t::null:
13810 oa->write_character(to_char_type(
'Z'));
13815 case value_t::boolean:
13819 oa->write_character(j.m_value.boolean
13820 ? to_char_type(
'T')
13821 : to_char_type(
'F'));
13826 case value_t::number_integer:
13828 write_number_with_ubjson_prefix(j.m_value.number_integer, add_prefix);
13832 case value_t::number_unsigned:
13834 write_number_with_ubjson_prefix(j.m_value.number_unsigned, add_prefix);
13838 case value_t::number_float:
13840 write_number_with_ubjson_prefix(j.m_value.number_float, add_prefix);
13844 case value_t::string:
13848 oa->write_character(to_char_type(
'S'));
13850 write_number_with_ubjson_prefix(j.m_value.string->size(),
true);
13851 oa->write_characters(
13852 reinterpret_cast<const CharType*
>(j.m_value.string->c_str()),
13853 j.m_value.string->size());
13857 case value_t::array:
13861 oa->write_character(to_char_type(
'['));
13864 bool prefix_required =
true;
13865 if (use_type && !j.m_value.array->empty())
13868 const CharType first_prefix = ubjson_prefix(j.front());
13869 const bool same_prefix = std::all_of(j.begin() + 1, j.end(),
13870 [
this, first_prefix](
const BasicJsonType & v)
13872 return ubjson_prefix(v) == first_prefix;
13877 prefix_required =
false;
13878 oa->write_character(to_char_type(
'$'));
13879 oa->write_character(first_prefix);
13885 oa->write_character(to_char_type(
'#'));
13886 write_number_with_ubjson_prefix(j.m_value.array->size(),
true);
13889 for (
const auto& el : *j.m_value.array)
13891 write_ubjson(el, use_count, use_type, prefix_required);
13896 oa->write_character(to_char_type(
']'));
13902 case value_t::binary:
13906 oa->write_character(to_char_type(
'['));
13909 if (use_type && !j.m_value.binary->empty())
13912 oa->write_character(to_char_type(
'$'));
13913 oa->write_character(
'U');
13918 oa->write_character(to_char_type(
'#'));
13919 write_number_with_ubjson_prefix(j.m_value.binary->size(),
true);
13924 oa->write_characters(
13925 reinterpret_cast<const CharType*
>(j.m_value.binary->data()),
13926 j.m_value.binary->size());
13930 for (
size_t i = 0; i < j.m_value.binary->size(); ++i)
13932 oa->write_character(to_char_type(
'U'));
13933 oa->write_character(j.m_value.binary->data()[i]);
13939 oa->write_character(to_char_type(
']'));
13945 case value_t::object:
13949 oa->write_character(to_char_type(
'{'));
13952 bool prefix_required =
true;
13953 if (use_type && !j.m_value.object->empty())
13956 const CharType first_prefix = ubjson_prefix(j.front());
13957 const bool same_prefix = std::all_of(j.begin(), j.end(),
13958 [
this, first_prefix](
const BasicJsonType & v)
13960 return ubjson_prefix(v) == first_prefix;
13965 prefix_required =
false;
13966 oa->write_character(to_char_type(
'$'));
13967 oa->write_character(first_prefix);
13973 oa->write_character(to_char_type(
'#'));
13974 write_number_with_ubjson_prefix(j.m_value.object->size(),
true);
13977 for (
const auto& el : *j.m_value.object)
13979 write_number_with_ubjson_prefix(el.first.size(),
true);
13980 oa->write_characters(
13981 reinterpret_cast<const CharType*
>(el.first.c_str()),
13983 write_ubjson(el.second, use_count, use_type, prefix_required);
13988 oa->write_character(to_char_type(
'}'));
14010 const auto it = name.find(
static_cast<typename string_t::value_type
>(0));
14013 JSON_THROW(out_of_range::create(409,
"BSON key cannot contain code point U+0000 (at byte " +
std::to_string(it) +
")", j));
14016 return 1ul + name.size() + 1u;
14025 oa->write_character(to_char_type(element_type));
14026 oa->write_characters(
14027 reinterpret_cast<const CharType*
>(name.c_str()),
14037 write_bson_entry_header(name, 0x08);
14038 oa->write_character(
value ? to_char_type(0x01) : to_char_type(0x00));
14045 const double value)
14047 write_bson_entry_header(name, 0x01);
14048 write_number<double, true>(
value);
14065 write_bson_entry_header(name, 0x02);
14067 write_number<std::int32_t, true>(
static_cast<std::int32_t>(
value.size() + 1ul));
14068 oa->write_characters(
14069 reinterpret_cast<const CharType*
>(
value.c_str()),
14078 write_bson_entry_header(name, 0x0A);
14086 return (std::numeric_limits<std::int32_t>::min)() <=
value &&
value <= (std::numeric_limits<std::int32_t>::max)()
14097 if ((std::numeric_limits<std::int32_t>::min)() <=
value &&
value <= (std::numeric_limits<std::int32_t>::max)())
14099 write_bson_entry_header(name, 0x10);
14104 write_bson_entry_header(name, 0x12);
14114 return (
value <=
static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))
14123 const BasicJsonType& j)
14125 if (j.m_value.number_unsigned <=
static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))
14127 write_bson_entry_header(name, 0x10 );
14128 write_number<std::int32_t, true>(
static_cast<std::int32_t>(j.m_value.number_unsigned));
14130 else if (j.m_value.number_unsigned <=
static_cast<std::uint64_t>((std::numeric_limits<std::int64_t>::max)()))
14132 write_bson_entry_header(name, 0x12 );
14133 write_number<std::int64_t, true>(
static_cast<std::int64_t>(j.m_value.number_unsigned));
14137 JSON_THROW(out_of_range::create(407,
"integer number " +
std::to_string(j.m_value.number_unsigned) +
" cannot be represented by BSON as it does not fit int64", j));
14145 const typename BasicJsonType::object_t& value)
14147 write_bson_entry_header(name, 0x03);
14148 write_bson_object(
value);
14156 std::size_t array_index = 0ul;
14158 const std::size_t embedded_document_size = std::accumulate(std::begin(
value), std::end(
value), std::size_t(0), [&array_index](std::size_t result,
const typename BasicJsonType::array_t::value_type & el)
14160 return result + calc_bson_element_size(
std::to_string(array_index++), el);
14163 return sizeof(
std::int32_t) + embedded_document_size + 1ul;
14178 const typename BasicJsonType::array_t& value)
14180 write_bson_entry_header(name, 0x04);
14181 write_number<std::int32_t, true>(
static_cast<std::int32_t>(calc_bson_array_size(
value)));
14183 std::size_t array_index = 0ul;
14185 for (
const auto& el :
value)
14190 oa->write_character(to_char_type(0x00));
14199 write_bson_entry_header(name, 0x05);
14204 oa->write_characters(
reinterpret_cast<const CharType*
>(
value.data()),
value.size());
14212 const BasicJsonType& j)
14214 const auto header_size = calc_bson_entry_header_size(name, j);
14217 case value_t::object:
14218 return header_size + calc_bson_object_size(*j.m_value.object);
14220 case value_t::array:
14221 return header_size + calc_bson_array_size(*j.m_value.array);
14223 case value_t::binary:
14224 return header_size + calc_bson_binary_size(*j.m_value.binary);
14226 case value_t::boolean:
14227 return header_size + 1ul;
14229 case value_t::number_float:
14230 return header_size + 8ul;
14232 case value_t::number_integer:
14233 return header_size + calc_bson_integer_size(j.m_value.number_integer);
14235 case value_t::number_unsigned:
14236 return header_size + calc_bson_unsigned_size(j.m_value.number_unsigned);
14238 case value_t::string:
14239 return header_size + calc_bson_string_size(*j.m_value.string);
14241 case value_t::null:
14242 return header_size + 0ul;
14259 const BasicJsonType& j)
14263 case value_t::object:
14264 return write_bson_object_entry(name, *j.m_value.object);
14266 case value_t::array:
14267 return write_bson_array(name, *j.m_value.array);
14269 case value_t::binary:
14270 return write_bson_binary(name, *j.m_value.binary);
14272 case value_t::boolean:
14273 return write_bson_boolean(name, j.m_value.boolean);
14275 case value_t::number_float:
14276 return write_bson_double(name, j.m_value.number_float);
14278 case value_t::number_integer:
14279 return write_bson_integer(name, j.m_value.number_integer);
14281 case value_t::number_unsigned:
14282 return write_bson_unsigned(name, j);
14284 case value_t::string:
14285 return write_bson_string(name, *j.m_value.string);
14287 case value_t::null:
14288 return write_bson_null(name);
14306 std::size_t document_size = std::accumulate(
value.begin(),
value.end(), std::size_t(0),
14307 [](
size_t result,
const typename BasicJsonType::object_t::value_type & el)
14309 return result += calc_bson_element_size(el.first, el.second);
14321 write_number<std::int32_t, true>(
static_cast<std::int32_t>(calc_bson_object_size(
value)));
14323 for (
const auto& el :
value)
14325 write_bson_element(el.first, el.second);
14328 oa->write_character(to_char_type(0x00));
14337 return to_char_type(0xFA);
14342 return to_char_type(0xFB);
14351 return to_char_type(0xCA);
14356 return to_char_type(0xCB);
14364 template<
typename NumberType,
typename std::enable_if<
14367 const bool add_prefix)
14371 oa->write_character(get_ubjson_float_prefix(n));
14377 template<
typename NumberType,
typename std::enable_if<
14380 const bool add_prefix)
14382 if (n <=
static_cast<std::uint64_t>((std::numeric_limits<std::int8_t>::max)()))
14386 oa->write_character(to_char_type(
'i'));
14390 else if (n <= (std::numeric_limits<std::uint8_t>::max)())
14394 oa->write_character(to_char_type(
'U'));
14398 else if (n <=
static_cast<std::uint64_t>((std::numeric_limits<std::int16_t>::max)()))
14402 oa->write_character(to_char_type(
'I'));
14406 else if (n <=
static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))
14410 oa->write_character(to_char_type(
'l'));
14414 else if (n <=
static_cast<std::uint64_t>((std::numeric_limits<std::int64_t>::max)()))
14418 oa->write_character(to_char_type(
'L'));
14426 oa->write_character(to_char_type(
'H'));
14429 const auto number = BasicJsonType(n).dump();
14430 write_number_with_ubjson_prefix(number.size(),
true);
14431 for (std::size_t i = 0; i < number.size(); ++i)
14433 oa->write_character(to_char_type(
static_cast<std::uint8_t>(number[i])));
14439 template <
typename NumberType,
typename std::enable_if <
14443 const bool add_prefix)
14445 if ((std::numeric_limits<std::int8_t>::min)() <= n && n <= (std::numeric_limits<std::int8_t>::max)())
14449 oa->write_character(to_char_type(
'i'));
14453 else if (
static_cast<std::int64_t>((std::numeric_limits<std::uint8_t>::min)()) <= n && n <=
static_cast<std::int64_t>((std::numeric_limits<std::uint8_t>::max)()))
14457 oa->write_character(to_char_type(
'U'));
14461 else if ((std::numeric_limits<std::int16_t>::min)() <= n && n <= (std::numeric_limits<std::int16_t>::max)())
14465 oa->write_character(to_char_type(
'I'));
14469 else if ((std::numeric_limits<std::int32_t>::min)() <= n && n <= (std::numeric_limits<std::int32_t>::max)())
14473 oa->write_character(to_char_type(
'l'));
14477 else if ((std::numeric_limits<std::int64_t>::min)() <= n && n <= (std::numeric_limits<std::int64_t>::max)())
14481 oa->write_character(to_char_type(
'L'));
14490 oa->write_character(to_char_type(
'H'));
14493 const auto number = BasicJsonType(n).dump();
14494 write_number_with_ubjson_prefix(number.size(),
true);
14495 for (std::size_t i = 0; i < number.size(); ++i)
14497 oa->write_character(to_char_type(
static_cast<std::uint8_t>(number[i])));
14510 case value_t::null:
14513 case value_t::boolean:
14514 return j.m_value.boolean ?
'T' :
'F';
14516 case value_t::number_integer:
14518 if ((std::numeric_limits<std::int8_t>::min)() <= j.m_value.number_integer && j.m_value.number_integer <= (std::numeric_limits<std::int8_t>::max)())
14522 if ((std::numeric_limits<std::uint8_t>::min)() <= j.m_value.number_integer && j.m_value.number_integer <= (std::numeric_limits<std::uint8_t>::max)())
14526 if ((std::numeric_limits<std::int16_t>::min)() <= j.m_value.number_integer && j.m_value.number_integer <= (std::numeric_limits<std::int16_t>::max)())
14530 if ((std::numeric_limits<std::int32_t>::min)() <= j.m_value.number_integer && j.m_value.number_integer <= (std::numeric_limits<std::int32_t>::max)())
14534 if ((std::numeric_limits<std::int64_t>::min)() <= j.m_value.number_integer && j.m_value.number_integer <= (std::numeric_limits<std::int64_t>::max)())
14542 case value_t::number_unsigned:
14544 if (j.m_value.number_unsigned <=
static_cast<std::uint64_t>((std::numeric_limits<std::int8_t>::max)()))
14548 if (j.m_value.number_unsigned <=
static_cast<std::uint64_t>((std::numeric_limits<std::uint8_t>::max)()))
14552 if (j.m_value.number_unsigned <=
static_cast<std::uint64_t>((std::numeric_limits<std::int16_t>::max)()))
14556 if (j.m_value.number_unsigned <=
static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))
14560 if (j.m_value.number_unsigned <=
static_cast<std::uint64_t>((std::numeric_limits<std::int64_t>::max)()))
14568 case value_t::number_float:
14569 return get_ubjson_float_prefix(j.m_value.number_float);
14571 case value_t::string:
14574 case value_t::array:
14575 case value_t::binary:
14578 case value_t::object:
14611 template<
typename NumberType,
bool OutputIsLittleEndian = false>
14615 std::array<CharType,
sizeof(NumberType)> vec{};
14616 std::memcpy(vec.data(), &n,
sizeof(NumberType));
14625 oa->write_characters(vec.data(),
sizeof(NumberType));
14630 if (
static_cast<double>(n) >=
static_cast<double>(std::numeric_limits<float>::lowest()) &&
14631 static_cast<double>(n) <=
static_cast<double>((std::numeric_limits<float>::max)()) &&
14632 static_cast<double>(
static_cast<float>(n)) ==
static_cast<double>(n))
14635 ? get_cbor_float_prefix(
static_cast<float>(n))
14636 : get_msgpack_float_prefix(
static_cast<float>(n)));
14637 write_number(
static_cast<float>(n));
14642 ? get_cbor_float_prefix(n)
14643 : get_msgpack_float_prefix(n));
14653 template <
typename C = CharType,
14657 return *
reinterpret_cast<char*
>(&x);
14660 template <
typename C = CharType,
14664 static_assert(
sizeof(
std::uint8_t) ==
sizeof(CharType),
"size of CharType must be equal to std::uint8_t");
14667 std::memcpy(&result, &x,
sizeof(x));
14671 template<
typename C = CharType,
14678 template <
typename InputCharType,
typename C = CharType,
14704 #include <algorithm>
14713 #include <type_traits>
14724 #include <type_traits>
14753 namespace dtoa_impl
14756 template<
typename Target,
typename Source>
14759 static_assert(
sizeof(Target) ==
sizeof(Source),
"size mismatch");
14762 std::memcpy(&target, &
source,
sizeof(Source));
14784 return {x.f - y.f, x.e};
14793 static_assert(
kPrecision == 64,
"internal error");
14849 return {h, x.e + y.e + 64};
14860 while ((x.f >> 63u) == 0)
14875 const int delta = x.
e - target_exponent;
14880 return {x.f << delta, target_exponent};
14897 template<
typename FloatType>
14910 static_assert(std::numeric_limits<FloatType>::is_iec559,
14911 "internal error: dtoa_short requires an IEEE-754 floating-point implementation");
14913 constexpr
int kPrecision = std::numeric_limits<FloatType>::digits;
14914 constexpr
int kBias = std::numeric_limits<FloatType>::max_exponent - 1 + (kPrecision - 1);
14915 constexpr
int kMinExp = 1 - kBias;
14924 const bool is_denormal = E == 0;
14925 const diyfp v = is_denormal
14926 ?
diyfp(F, kMinExp)
14927 :
diyfp(F + kHiddenBit,
static_cast<int>(E) - kBias);
14950 const bool lower_boundary_is_closer = F == 0 && E > 1;
14952 const diyfp m_minus = lower_boundary_is_closer
14953 ?
diyfp(4 * v.
f - 1, v.
e - 2)
14954 :
diyfp(2 * v.
f - 1, v.
e - 1);
15089 constexpr
int kCachedPowersMinDecExp = -300;
15090 constexpr
int kCachedPowersDecStep = 8;
15092 static constexpr std::array<cached_power, 79> kCachedPowers =
15095 { 0xAB70FE17C79AC6CA, -1060, -300 },
15096 { 0xFF77B1FCBEBCDC4F, -1034, -292 },
15097 { 0xBE5691EF416BD60C, -1007, -284 },
15098 { 0x8DD01FAD907FFC3C, -980, -276 },
15099 { 0xD3515C2831559A83, -954, -268 },
15100 { 0x9D71AC8FADA6C9B5, -927, -260 },
15101 { 0xEA9C227723EE8BCB, -901, -252 },
15102 { 0xAECC49914078536D, -874, -244 },
15103 { 0x823C12795DB6CE57, -847, -236 },
15104 { 0xC21094364DFB5637, -821, -228 },
15105 { 0x9096EA6F3848984F, -794, -220 },
15106 { 0xD77485CB25823AC7, -768, -212 },
15107 { 0xA086CFCD97BF97F4, -741, -204 },
15108 { 0xEF340A98172AACE5, -715, -196 },
15109 { 0xB23867FB2A35B28E, -688, -188 },
15110 { 0x84C8D4DFD2C63F3B, -661, -180 },
15111 { 0xC5DD44271AD3CDBA, -635, -172 },
15112 { 0x936B9FCEBB25C996, -608, -164 },
15113 { 0xDBAC6C247D62A584, -582, -156 },
15114 { 0xA3AB66580D5FDAF6, -555, -148 },
15115 { 0xF3E2F893DEC3F126, -529, -140 },
15116 { 0xB5B5ADA8AAFF80B8, -502, -132 },
15117 { 0x87625F056C7C4A8B, -475, -124 },
15118 { 0xC9BCFF6034C13053, -449, -116 },
15119 { 0x964E858C91BA2655, -422, -108 },
15120 { 0xDFF9772470297EBD, -396, -100 },
15121 { 0xA6DFBD9FB8E5B88F, -369, -92 },
15122 { 0xF8A95FCF88747D94, -343, -84 },
15123 { 0xB94470938FA89BCF, -316, -76 },
15124 { 0x8A08F0F8BF0F156B, -289, -68 },
15125 { 0xCDB02555653131B6, -263, -60 },
15126 { 0x993FE2C6D07B7FAC, -236, -52 },
15127 { 0xE45C10C42A2B3B06, -210, -44 },
15128 { 0xAA242499697392D3, -183, -36 },
15129 { 0xFD87B5F28300CA0E, -157, -28 },
15130 { 0xBCE5086492111AEB, -130, -20 },
15131 { 0x8CBCCC096F5088CC, -103, -12 },
15132 { 0xD1B71758E219652C, -77, -4 },
15133 { 0x9C40000000000000, -50, 4 },
15134 { 0xE8D4A51000000000, -24, 12 },
15135 { 0xAD78EBC5AC620000, 3, 20 },
15136 { 0x813F3978F8940984, 30, 28 },
15137 { 0xC097CE7BC90715B3, 56, 36 },
15138 { 0x8F7E32CE7BEA5C70, 83, 44 },
15139 { 0xD5D238A4ABE98068, 109, 52 },
15140 { 0x9F4F2726179A2245, 136, 60 },
15141 { 0xED63A231D4C4FB27, 162, 68 },
15142 { 0xB0DE65388CC8ADA8, 189, 76 },
15143 { 0x83C7088E1AAB65DB, 216, 84 },
15144 { 0xC45D1DF942711D9A, 242, 92 },
15145 { 0x924D692CA61BE758, 269, 100 },
15146 { 0xDA01EE641A708DEA, 295, 108 },
15147 { 0xA26DA3999AEF774A, 322, 116 },
15148 { 0xF209787BB47D6B85, 348, 124 },
15149 { 0xB454E4A179DD1877, 375, 132 },
15150 { 0x865B86925B9BC5C2, 402, 140 },
15151 { 0xC83553C5C8965D3D, 428, 148 },
15152 { 0x952AB45CFA97A0B3, 455, 156 },
15153 { 0xDE469FBD99A05FE3, 481, 164 },
15154 { 0xA59BC234DB398C25, 508, 172 },
15155 { 0xF6C69A72A3989F5C, 534, 180 },
15156 { 0xB7DCBF5354E9BECE, 561, 188 },
15157 { 0x88FCF317F22241E2, 588, 196 },
15158 { 0xCC20CE9BD35C78A5, 614, 204 },
15159 { 0x98165AF37B2153DF, 641, 212 },
15160 { 0xE2A0B5DC971F303A, 667, 220 },
15161 { 0xA8D9D1535CE3B396, 694, 228 },
15162 { 0xFB9B7CD9A4A7443C, 720, 236 },
15163 { 0xBB764C4CA7A44410, 747, 244 },
15164 { 0x8BAB8EEFB6409C1A, 774, 252 },
15165 { 0xD01FEF10A657842C, 800, 260 },
15166 { 0x9B10A4E5E9913129, 827, 268 },
15167 { 0xE7109BFBA19C0C9D, 853, 276 },
15168 { 0xAC2820D9623BF429, 880, 284 },
15169 { 0x80444B5E7AA7CF85, 907, 292 },
15170 { 0xBF21E44003ACDD2D, 933, 300 },
15171 { 0x8E679C2F5E44FF8F, 960, 308 },
15172 { 0xD433179D9C8CB841, 986, 316 },
15173 { 0x9E19DB92B4E31BA9, 1013, 324 },
15183 const int f =
kAlpha - e - 1;
15184 const int k = (f * 78913) / (1 << 18) +
static_cast<int>(f > 0);
15186 const int index = (-kCachedPowersMinDecExp + k + (kCachedPowersDecStep - 1)) / kCachedPowersDecStep;
15188 JSON_ASSERT(
static_cast<std::size_t
>(index) < kCachedPowers.size());
15190 const cached_power cached = kCachedPowers[
static_cast<std::size_t
>(index)];
15204 if (n >= 1000000000)
15206 pow10 = 1000000000;
15210 if (n >= 100000000)
15283 && delta - rest >= ten_k
15284 && (rest + ten_k < dist || dist - rest > rest + ten_k - dist))
15299 static_assert(
kAlpha >= -60,
"internal error");
15300 static_assert(
kGamma <= -32,
"internal error");
15373 buffer[length++] =
static_cast<char>(
'0' +
d);
15397 decimal_exponent += n;
15409 grisu2_round(buffer, length, dist, delta, rest, ten_n);
15470 JSON_ASSERT(p2 <= (std::numeric_limits<std::uint64_t>::max)() / 10);
15480 buffer[length++] =
static_cast<char>(
'0' +
d);
15505 decimal_exponent -= m;
15537 inline
void grisu2(
char* buf,
int& len,
int& decimal_exponent,
15554 const diyfp c_minus_k(cached.
f, cached.
e);
15582 const diyfp M_minus(w_minus.
f + 1, w_minus.
e);
15583 const diyfp M_plus (w_plus.
f - 1, w_plus.
e );
15585 decimal_exponent = -cached.
k;
15595 template<
typename FloatType>
15597 void
grisu2(
char* buf,
int& len,
int& decimal_exponent, FloatType value)
15600 "internal error: not enough precision");
15658 *buf++ =
static_cast<char>(
'0' + k);
15662 *buf++ =
static_cast<char>(
'0' + k / 10);
15664 *buf++ =
static_cast<char>(
'0' + k);
15668 *buf++ =
static_cast<char>(
'0' + k / 100);
15670 *buf++ =
static_cast<char>(
'0' + k / 10);
15672 *buf++ =
static_cast<char>(
'0' + k);
15690 int min_exp,
int max_exp)
15696 const int n = len + decimal_exponent;
15702 if (k <= n && n <= max_exp)
15707 std::memset(buf + k,
'0',
static_cast<size_t>(n) -
static_cast<size_t>(k));
15711 return buf + (
static_cast<size_t>(n) + 2);
15714 if (0 < n && n <= max_exp)
15721 std::memmove(buf + (
static_cast<size_t>(n) + 1), buf + n,
static_cast<size_t>(k) -
static_cast<size_t>(n));
15723 return buf + (
static_cast<size_t>(k) + 1U);
15726 if (min_exp < n && n <= 0)
15731 std::memmove(buf + (2 +
static_cast<size_t>(-n)), buf,
static_cast<size_t>(k));
15734 std::memset(buf + 2,
'0',
static_cast<size_t>(-n));
15735 return buf + (2U +
static_cast<size_t>(-n) +
static_cast<size_t>(k));
15750 std::memmove(buf + 2, buf + 1,
static_cast<size_t>(k) - 1);
15752 buf += 1 +
static_cast<size_t>(k);
15771 template<
typename FloatType>
15776 static_cast<void>(last);
15780 if (std::signbit(
value))
15795 JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10);
15802 int decimal_exponent = 0;
15805 JSON_ASSERT(len <= std::numeric_limits<FloatType>::max_digits10);
15808 constexpr
int kMinExp = -4;
15810 constexpr
int kMaxExp = std::numeric_limits<FloatType>::digits10;
15813 JSON_ASSERT(last - first >= 2 + (-kMinExp - 1) + std::numeric_limits<FloatType>::max_digits10);
15814 JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10 + 6);
15851 template<
typename BasicJsonType>
15871 ,
loc(
std::localeconv())
15909 const bool pretty_print,
15911 const unsigned int indent_step,
15912 const unsigned int current_indent = 0)
15914 switch (val.m_type)
15918 if (val.m_value.object->empty())
15920 o->write_characters(
"{}", 2);
15926 o->write_characters(
"{\n", 2);
15929 const auto new_indent = current_indent + indent_step;
15936 auto i = val.m_value.object->cbegin();
15937 for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i)
15940 o->write_character(
'\"');
15942 o->write_characters(
"\": ", 3);
15944 o->write_characters(
",\n", 2);
15949 JSON_ASSERT(std::next(i) == val.m_value.object->cend());
15951 o->write_character(
'\"');
15953 o->write_characters(
"\": ", 3);
15956 o->write_character(
'\n');
15957 o->write_characters(
indent_string.c_str(), current_indent);
15958 o->write_character(
'}');
15962 o->write_character(
'{');
15965 auto i = val.m_value.object->cbegin();
15966 for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i)
15968 o->write_character(
'\"');
15970 o->write_characters(
"\":", 2);
15972 o->write_character(
',');
15977 JSON_ASSERT(std::next(i) == val.m_value.object->cend());
15978 o->write_character(
'\"');
15980 o->write_characters(
"\":", 2);
15983 o->write_character(
'}');
15991 if (val.m_value.array->empty())
15993 o->write_characters(
"[]", 2);
15999 o->write_characters(
"[\n", 2);
16002 const auto new_indent = current_indent + indent_step;
16009 for (
auto i = val.m_value.array->cbegin();
16010 i != val.m_value.array->cend() - 1; ++i)
16014 o->write_characters(
",\n", 2);
16020 dump(val.m_value.array->back(),
true,
ensure_ascii, indent_step, new_indent);
16022 o->write_character(
'\n');
16023 o->write_characters(
indent_string.c_str(), current_indent);
16024 o->write_character(
']');
16028 o->write_character(
'[');
16031 for (
auto i = val.m_value.array->cbegin();
16032 i != val.m_value.array->cend() - 1; ++i)
16035 o->write_character(
',');
16040 dump(val.m_value.array->back(),
false,
ensure_ascii, indent_step, current_indent);
16042 o->write_character(
']');
16050 o->write_character(
'\"');
16052 o->write_character(
'\"');
16060 o->write_characters(
"{\n", 2);
16063 const auto new_indent = current_indent + indent_step;
16071 o->write_characters(
"\"bytes\": [", 10);
16073 if (!val.m_value.binary->empty())
16075 for (
auto i = val.m_value.binary->cbegin();
16076 i != val.m_value.binary->cend() - 1; ++i)
16079 o->write_characters(
", ", 2);
16081 dump_integer(val.m_value.binary->back());
16084 o->write_characters(
"],\n", 3);
16087 o->write_characters(
"\"subtype\": ", 11);
16088 if (val.m_value.binary->has_subtype())
16090 dump_integer(val.m_value.binary->subtype());
16094 o->write_characters(
"null", 4);
16096 o->write_character(
'\n');
16097 o->write_characters(
indent_string.c_str(), current_indent);
16098 o->write_character(
'}');
16102 o->write_characters(
"{\"bytes\":[", 10);
16104 if (!val.m_value.binary->empty())
16106 for (
auto i = val.m_value.binary->cbegin();
16107 i != val.m_value.binary->cend() - 1; ++i)
16110 o->write_character(
',');
16112 dump_integer(val.m_value.binary->back());
16115 o->write_characters(
"],\"subtype\":", 12);
16116 if (val.m_value.binary->has_subtype())
16118 dump_integer(val.m_value.binary->subtype());
16119 o->write_character(
'}');
16123 o->write_characters(
"null}", 5);
16131 if (val.m_value.boolean)
16133 o->write_characters(
"true", 4);
16137 o->write_characters(
"false", 5);
16144 dump_integer(val.m_value.number_integer);
16150 dump_integer(val.m_value.number_unsigned);
16156 dump_float(val.m_value.number_float);
16162 o->write_characters(
"<discarded>", 11);
16168 o->write_characters(
"null", 4);
16202 for (std::size_t i = 0; i < s.size(); ++i)
16204 const auto byte =
static_cast<uint8_t>(s[i]);
16265 if ((codepoint <= 0x1F) || (
ensure_ascii && (codepoint >= 0x7F)))
16267 if (codepoint <= 0xFFFF)
16279 static_cast<std::uint16_t>(0xDC00u + (codepoint & 0x3FFu)));
16314 std::string sn(3,
'\0');
16316 (std::snprintf)(&sn[0], sn.size(),
"%.2X", byte);
16409 std::string sn(3,
'\0');
16411 (std::snprintf)(&sn[0], sn.size(),
"%.2X",
static_cast<std::uint8_t>(s.back()));
16429 o->write_characters(
"\\ufffd", 6);
16433 o->write_characters(
"\xEF\xBF\xBD", 3);
16455 unsigned int n_digits = 1;
16464 return n_digits + 1;
16468 return n_digits + 2;
16472 return n_digits + 3;
16493 void dump_integer(NumberType x)
16495 static constexpr std::array<std::array<char, 2>, 100> digits_to_99
16498 {{
'0',
'0'}}, {{
'0',
'1'}}, {{
'0',
'2'}}, {{
'0',
'3'}}, {{
'0',
'4'}}, {{
'0',
'5'}}, {{
'0',
'6'}}, {{
'0',
'7'}}, {{
'0',
'8'}}, {{
'0',
'9'}},
16499 {{
'1',
'0'}}, {{
'1',
'1'}}, {{
'1',
'2'}}, {{
'1',
'3'}}, {{
'1',
'4'}}, {{
'1',
'5'}}, {{
'1',
'6'}}, {{
'1',
'7'}}, {{
'1',
'8'}}, {{
'1',
'9'}},
16500 {{
'2',
'0'}}, {{
'2',
'1'}}, {{
'2',
'2'}}, {{
'2',
'3'}}, {{
'2',
'4'}}, {{
'2',
'5'}}, {{
'2',
'6'}}, {{
'2',
'7'}}, {{
'2',
'8'}}, {{
'2',
'9'}},
16501 {{
'3',
'0'}}, {{
'3',
'1'}}, {{
'3',
'2'}}, {{
'3',
'3'}}, {{
'3',
'4'}}, {{
'3',
'5'}}, {{
'3',
'6'}}, {{
'3',
'7'}}, {{
'3',
'8'}}, {{
'3',
'9'}},
16502 {{
'4',
'0'}}, {{
'4',
'1'}}, {{
'4',
'2'}}, {{
'4',
'3'}}, {{
'4',
'4'}}, {{
'4',
'5'}}, {{
'4',
'6'}}, {{
'4',
'7'}}, {{
'4',
'8'}}, {{
'4',
'9'}},
16503 {{
'5',
'0'}}, {{
'5',
'1'}}, {{
'5',
'2'}}, {{
'5',
'3'}}, {{
'5',
'4'}}, {{
'5',
'5'}}, {{
'5',
'6'}}, {{
'5',
'7'}}, {{
'5',
'8'}}, {{
'5',
'9'}},
16504 {{
'6',
'0'}}, {{
'6',
'1'}}, {{
'6',
'2'}}, {{
'6',
'3'}}, {{
'6',
'4'}}, {{
'6',
'5'}}, {{
'6',
'6'}}, {{
'6',
'7'}}, {{
'6',
'8'}}, {{
'6',
'9'}},
16505 {{
'7',
'0'}}, {{
'7',
'1'}}, {{
'7',
'2'}}, {{
'7',
'3'}}, {{
'7',
'4'}}, {{
'7',
'5'}}, {{
'7',
'6'}}, {{
'7',
'7'}}, {{
'7',
'8'}}, {{
'7',
'9'}},
16506 {{
'8',
'0'}}, {{
'8',
'1'}}, {{
'8',
'2'}}, {{
'8',
'3'}}, {{
'8',
'4'}}, {{
'8',
'5'}}, {{
'8',
'6'}}, {{
'8',
'7'}}, {{
'8',
'8'}}, {{
'8',
'9'}},
16507 {{
'9',
'0'}}, {{
'9',
'1'}}, {{
'9',
'2'}}, {{
'9',
'3'}}, {{
'9',
'4'}}, {{
'9',
'5'}}, {{
'9',
'6'}}, {{
'9',
'7'}}, {{
'9',
'8'}}, {{
'9',
'9'}},
16514 o->write_character(
'0');
16524 unsigned int n_chars{};
16532 n_chars = 1 + count_digits(abs_value);
16537 n_chars = count_digits(abs_value);
16545 buffer_ptr += n_chars;
16549 while (abs_value >= 100)
16551 const auto digits_index =
static_cast<unsigned>((abs_value % 100));
16553 *(--buffer_ptr) = digits_to_99[digits_index][1];
16554 *(--buffer_ptr) = digits_to_99[digits_index][0];
16557 if (abs_value >= 10)
16559 const auto digits_index =
static_cast<unsigned>(abs_value);
16560 *(--buffer_ptr) = digits_to_99[digits_index][1];
16561 *(--buffer_ptr) = digits_to_99[digits_index][0];
16565 *(--buffer_ptr) =
static_cast<char>(
'0' + abs_value);
16582 if (!std::isfinite(x))
16584 o->write_characters(
"null", 4);
16593 static constexpr
bool is_ieee_single_or_double
16594 = (std::numeric_limits<number_float_t>::is_iec559 && std::numeric_limits<number_float_t>::digits == 24 && std::numeric_limits<number_float_t>::max_exponent == 128) ||
16595 (std::numeric_limits<number_float_t>::is_iec559 && std::numeric_limits<number_float_t>::digits == 53 && std::numeric_limits<number_float_t>::max_exponent == 1024);
16597 dump_float(x, std::integral_constant<bool, is_ieee_single_or_double>());
16605 o->write_characters(begin,
static_cast<size_t>(end - begin));
16611 static constexpr
auto d = std::numeric_limits<number_float_t>::max_digits10;
16642 o->write_characters(
number_buffer.data(),
static_cast<std::size_t
>(len));
16645 const bool value_is_int_like =
16649 return c ==
'.' || c ==
'e';
16652 if (value_is_int_like)
16654 o->write_characters(
".0", 2);
16681 static const std::array<std::uint8_t, 400> utf8d =
16684 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
16685 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
16686 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
16687 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
16688 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
16689 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
16690 8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
16691 0xA, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x4, 0x3, 0x3,
16692 0xB, 0x6, 0x6, 0x6, 0x5, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8,
16693 0x0, 0x1, 0x2, 0x3, 0x5, 0x8, 0x7, 0x1, 0x1, 0x1, 0x4, 0x6, 0x1, 0x1, 0x1, 0x1,
16694 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1,
16695 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
16696 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1,
16697 1, 3, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
16705 ? (
byte & 0x3fu) | (codep << 6u)
16706 : (0xFFu >>
type) & (byte);
16708 std::size_t index = 256u +
static_cast<size_t>(
state) * 16u +
static_cast<size_t>(
type);
16710 state = utf8d[index];
16736 JSON_ASSERT(x < 0 && x < (std::numeric_limits<number_integer_t>::max)());
16742 output_adapter_t<char> o =
nullptr;
16775 #include <functional>
16776 #include <initializer_list>
16777 #include <iterator>
16779 #include <stdexcept>
16780 #include <type_traits>
16792 template <
class Key,
class T,
class IgnoredLess = std::less<Key>,
16793 class Allocator = std::allocator<std::pair<const Key, T>>>
16799 using typename Container::iterator;
16800 using typename Container::const_iterator;
16802 using typename Container::value_type;
16807 template <
class It>
16815 for (
auto it = this->begin(); it != this->end(); ++it)
16817 if (it->first == key)
16819 return {it,
false};
16822 Container::emplace_back(key, t);
16823 return {--this->end(),
true};
16828 return emplace(key, T{}).first->second;
16838 for (
auto it = this->begin(); it != this->end(); ++it)
16840 if (it->first == key)
16846 JSON_THROW(std::out_of_range(
"key not found"));
16849 const T&
at(
const Key& key)
const
16851 for (
auto it = this->begin(); it != this->end(); ++it)
16853 if (it->first == key)
16859 JSON_THROW(std::out_of_range(
"key not found"));
16864 for (
auto it = this->begin(); it != this->end(); ++it)
16866 if (it->first == key)
16869 for (
auto next = it; ++next != this->end(); ++it)
16872 new (&*it) value_type{std::move(*next)};
16874 Container::pop_back();
16886 for (
auto next = it; ++next != this->end(); ++it)
16889 new (&*it) value_type{std::move(*next)};
16891 Container::pop_back();
16897 for (
auto it = this->begin(); it != this->end(); ++it)
16899 if (it->first == key)
16909 for (
auto it = this->begin(); it != this->end(); ++it)
16911 if (it->first == key)
16916 return Container::end();
16919 const_iterator
find(
const Key& key)
const
16921 for (
auto it = this->begin(); it != this->end(); ++it)
16923 if (it->first == key)
16928 return Container::end();
16931 std::pair<iterator, bool>
insert( value_type&& value )
16936 std::pair<iterator, bool>
insert(
const value_type& value )
16938 for (
auto it = this->begin(); it != this->end(); ++it)
16940 if (it->first ==
value.first)
16942 return {it,
false};
16945 Container::push_back(
value);
16946 return {--this->end(),
true};
16949 template<
typename InputIt>
16950 using require_input_iter =
typename std::enable_if<std::is_convertible<typename std::iterator_traits<InputIt>::iterator_category,
16951 std::input_iterator_tag>::value>
::type;
16953 template<
typename InputIt,
typename = require_input_iter<InputIt>>
16956 for (
auto it = first; it != last; ++it)
16966 #if defined(JSON_HAS_CPP_17)
16967 #include <string_view>
17067 friend ::nlohmann::json_pointer<basic_json>;
17069 template<
typename BasicJsonType,
typename InputType>
17070 friend class ::nlohmann::detail::parser;
17071 friend ::nlohmann::detail::serializer<basic_json>;
17072 template<
typename BasicJsonType>
17073 friend class ::nlohmann::detail::iter_impl;
17074 template<
typename BasicJsonType,
typename CharType>
17075 friend class ::nlohmann::detail::binary_writer;
17076 template<
typename BasicJsonType,
typename InputType,
typename SAX>
17077 friend class ::nlohmann::detail::binary_reader;
17078 template<
typename BasicJsonType>
17079 friend class ::nlohmann::detail::json_sax_dom_parser;
17080 template<
typename BasicJsonType>
17081 friend class ::nlohmann::detail::json_sax_dom_callback_parser;
17082 friend class ::nlohmann::detail::exception;
17091 template<
typename InputAdapterType>
17092 static ::nlohmann::detail::parser<basic_json, InputAdapterType>
parser(
17093 InputAdapterType adapter,
17095 const bool allow_exceptions =
true,
17096 const bool ignore_comments =
false
17099 return ::nlohmann::detail::parser<basic_json, InputAdapterType>(std::move(adapter),
17100 std::move(cb), allow_exceptions, ignore_comments);
17105 template<
typename BasicJsonType>
17107 template<
typename BasicJsonType>
17109 template<
typename Iterator>
17113 template<
typename CharType>
17116 template<
typename InputType>
17127 template<
typename T,
typename SFINAE>
17192 using const_pointer =
typename std::allocator_traits<allocator_type>::const_pointer;
17245 result[
"copyright"] =
"(C) 2013-2021 Niels Lohmann";
17246 result[
"name"] =
"JSON for Modern C++";
17247 result[
"url"] =
"https://github.com/nlohmann/json";
17248 result[
"version"][
"string"] =
17257 result[
"platform"] =
"win32";
17258 #elif defined __linux__
17259 result[
"platform"] =
"linux";
17260 #elif defined __APPLE__
17261 result[
"platform"] =
"apple";
17262 #elif defined __unix__
17263 result[
"platform"] =
"unix";
17265 result[
"platform"] =
"unknown";
17268 #if defined(__ICC) || defined(__INTEL_COMPILER)
17269 result[
"compiler"] = {{
"family",
"icc"}, {
"version", __INTEL_COMPILER}};
17270 #elif defined(__clang__)
17271 result[
"compiler"] = {{
"family",
"clang"}, {
"version", __clang_version__}};
17272 #elif defined(__GNUC__) || defined(__GNUG__)
17274 #elif defined(__HP_cc) || defined(__HP_aCC)
17275 result[
"compiler"] =
"hp"
17276 #elif defined(__IBMCPP__)
17277 result[
"compiler"] = {{
"family",
"ilecpp"}, {
"version", __IBMCPP__}};
17278 #elif defined(_MSC_VER)
17279 result[
"compiler"] = {{
"family",
"msvc"}, {
"version", _MSC_VER}};
17280 #elif defined(__PGI)
17281 result[
"compiler"] = {{
"family",
"pgcpp"}, {
"version", __PGI}};
17282 #elif defined(__SUNPRO_CC)
17283 result[
"compiler"] = {{
"family",
"sunpro"}, {
"version", __SUNPRO_CC}};
17285 result[
"compiler"] = {{
"family",
"unknown"}, {
"version",
"unknown"}};
17291 result[
"compiler"][
"c++"] =
"unknown";
17306 #if defined(JSON_HAS_CPP_14)
17400 AllocatorType<std::pair<
const StringType,
17814 template<
typename T,
typename... Args>
17818 AllocatorType<T> alloc;
17819 using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;
17821 auto deleter = [&](T * obj)
17823 AllocatorTraits::deallocate(alloc, obj, 1);
17825 std::unique_ptr<T, decltype(deleter)> obj(AllocatorTraits::allocate(alloc, 1), deleter);
17826 AllocatorTraits::construct(alloc, obj.get(), std::forward<Args>(args)...);
17828 return obj.release();
17897 object = create<object_t>();
17903 array = create<array_t>();
17909 string = create<string_t>(
"");
17915 binary = create<binary_t>();
17964 string = create<string_t>(
value);
17970 string = create<string_t>(std::move(
value));
17976 object = create<object_t>(
value);
17982 object = create<object_t>(std::move(
value));
18024 std::vector<basic_json> stack;
18029 stack.reserve(
array->size());
18030 std::move(
array->begin(),
array->end(), std::back_inserter(stack));
18035 for (
auto&& it : *
object)
18037 stack.push_back(std::move(it.second));
18041 while (!stack.empty())
18044 basic_json current_item(std::move(stack.back()));
18051 std::move(current_item.
m_value.array->begin(), current_item.
m_value.array->end(),
18052 std::back_inserter(stack));
18054 current_item.
m_value.array->clear();
18058 for (
auto&& it : *current_item.
m_value.object)
18060 stack.push_back(std::move(it.second));
18063 current_item.
m_value.object->clear();
18074 AllocatorType<object_t> alloc;
18075 std::allocator_traits<decltype(alloc)>
::destroy(alloc,
object);
18076 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
object, 1);
18082 AllocatorType<array_t> alloc;
18084 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
array, 1);
18090 AllocatorType<string_t> alloc;
18091 std::allocator_traits<decltype(alloc)>
::destroy(alloc,
string);
18092 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
string, 1);
18098 AllocatorType<binary_t> alloc;
18100 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
binary, 1);
18138 #if JSON_DIAGNOSTICS
18144 return j.m_parent ==
this;
18149 static_cast<void>(check_parents);
18155 #if JSON_DIAGNOSTICS
18160 for (
auto& element : *
m_value.array)
18162 element.m_parent =
this;
18169 for (
auto& element : *
m_value.object)
18171 element.second.m_parent =
this;
18184 #if JSON_DIAGNOSTICS
18187 (it + i)->m_parent =
this;
18190 static_cast<void>(
count);
18197 #if JSON_DIAGNOSTICS
18200 static_cast<void>(j);
18409 template <
typename CompatibleType,
18415 std::forward<CompatibleType>(val))))
18448 template <
typename BasicJsonType,
18453 using other_boolean_t =
typename BasicJsonType::boolean_t;
18454 using other_number_float_t =
typename BasicJsonType::number_float_t;
18455 using other_number_integer_t =
typename BasicJsonType::number_integer_t;
18456 using other_number_unsigned_t =
typename BasicJsonType::number_unsigned_t;
18458 using other_object_t =
typename BasicJsonType::object_t;
18459 using other_array_t =
typename BasicJsonType::array_t;
18460 using other_binary_t =
typename BasicJsonType::binary_t;
18462 switch (val.type())
18576 bool type_deduction =
true,
18581 bool is_an_object = std::all_of(init.begin(), init.end(),
18584 return element_ref->is_array() && element_ref->size() == 2 && (*element_ref)[0].is_string();
18588 if (!type_deduction)
18593 is_an_object =
false;
18609 for (
auto& element_ref : init)
18613 std::move(*((*element.m_value.array)[0].m_value.string)),
18614 std::move((*element.m_value.array)[1]));
18621 m_value.array = create<array_t>(init.begin(), init.end());
18660 res.m_value = init;
18697 res.m_value =
binary_t(init, subtype);
18707 res.m_value = std::move(init);
18717 res.m_value =
binary_t(std::move(init), subtype);
18833 m_value.array = create<array_t>(cnt, val);
18893 template <
class InputIT,
typename std::enable_if <
18908 m_type = first.m_object->m_type;
18920 || !last.m_it.primitive_iterator.is_end()))
18935 m_value.number_integer = first.m_object->m_value.number_integer;
18941 m_value.number_unsigned = first.m_object->m_value.number_unsigned;
18947 m_value.number_float = first.m_object->m_value.number_float;
18953 m_value.boolean = first.m_object->m_value.boolean;
18959 m_value = *first.m_object->m_value.string;
18965 m_value.object = create<object_t>(first.m_it.object_iterator,
18966 last.m_it.object_iterator);
18972 m_value.array = create<array_t>(first.m_it.array_iterator,
18973 last.m_it.array_iterator);
18979 m_value = *first.m_object->m_value.binary;
18996 template<
typename JsonRef,
18998 std::is_same<typename JsonRef::value_type, basic_json>>
::value,
int> = 0 >
19027 : m_type(other.m_type)
19117 : m_type(std::move(other.m_type)),
19118 m_value(std::move(other.m_value))
19121 other.assert_invariant(
false);
19125 other.m_value = {};
19165 swap(m_type, other.m_type);
19253 const char indent_char =
' ',
19254 const bool ensure_ascii =
false,
19262 s.dump(*
this,
true, ensure_ascii,
static_cast<unsigned int>(indent));
19266 s.dump(*
this,
false, ensure_ascii, 0);
19793 template<
typename ReferenceType,
typename ThisType>
19896 template <
typename ValueTypeCV,
typename ValueType = detail::uncvref_t<ValueTypeCV>,
19897 detail::enable_if_t <
19898 !detail::is_basic_json<ValueType>::value &&
19899 detail::has_from_json<basic_json_t, ValueType>::value &&
19900 !detail::has_non_default_from_json<basic_json_t, ValueType>::value,
19909 "get() cannot be used with reference types, you might want to use get_ref()");
19911 "types must be DefaultConstructible when used with get()");
19949 template <
typename ValueTypeCV,
typename ValueType = detail::uncvref_t<ValueTypeCV>,
19950 detail::enable_if_t < !std::is_same<basic_json_t, ValueType>::value &&
19951 detail::has_non_default_from_json<basic_json_t, ValueType>::value,
19957 "get() cannot be used with reference types, you might want to use get_ref()");
19994 template <
typename ValueType,
19999 ValueType &
get_to(ValueType& v)
const noexcept(noexcept(
20008 template<
typename ValueType,
20019 typename T, std::size_t
N,
20020 typename Array = T (&)[
N],
20025 std::declval<const basic_json_t&>(), v)))
20058 template<
typename PointerType,
typename std::enable_if<
20063 return get_impl_ptr(
static_cast<PointerType
>(
nullptr));
20070 template <
typename PointerType,
typename std::enable_if <
20076 return get_impl_ptr(
static_cast<PointerType
>(
nullptr));
20106 template<
typename PointerType,
typename std::enable_if<
20111 return get_ptr<PointerType>();
20118 template<
typename PointerType,
typename std::enable_if<
20123 return get_ptr<PointerType>();
20152 template<
typename ReferenceType,
typename std::enable_if<
20157 return get_ref_impl<ReferenceType>(*
this);
20164 template <
typename ReferenceType,
typename std::enable_if <
20170 return get_ref_impl<ReferenceType>(*
this);
20202 template <
typename ValueType,
typename std::enable_if <
20204 !std::is_same<ValueType, detail::json_ref<basic_json>>
::value&&
20207 && !std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>
::value
20208 #if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER <= 1914))
20216 return get<ValueType>();
20235 return *get_ptr<binary_t*>();
20246 return *get_ptr<const binary_t*>();
20340 return m_value.array->at(idx);
20442 return m_value.object->at(key);
20487 m_value.array = create<array_t>();
20495 if (idx >=
m_value.array->size())
20497 #if JSON_DIAGNOSTICS
20499 const auto previous_size =
m_value.array->size();
20501 m_value.array->resize(idx + 1);
20503 #if JSON_DIAGNOSTICS
20509 return m_value.array->operator[](idx);
20539 return m_value.array->operator[](idx);
20578 m_value.object = create<object_t>();
20627 return m_value.object->find(key)->second;
20660 template<
typename T>
20711 template<
typename T>
20719 return m_value.object->find(key)->second;
20776 template <
class ValueType,
typename std::enable_if <
20779 ValueType
value(
const typename object_t::key_type& key,
const ValueType& default_value)
const
20785 const auto it =
find(key);
20788 return it->template get<ValueType>();
20791 return default_value;
20801 string_t value(
const typename object_t::key_type& key,
const char* default_value)
const
20849 template<
class ValueType,
typename std::enable_if<
20859 return ptr.
get_checked(
this).template get<ValueType>();
20863 return default_value;
21012 template <
class IteratorType,
typename std::enable_if <
21024 IteratorType result =
end();
21042 AllocatorType<string_t> alloc;
21044 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
m_value.string, 1);
21049 AllocatorType<binary_t> alloc;
21051 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
m_value.binary, 1);
21062 result.m_it.object_iterator =
m_value.object->erase(
pos.m_it.object_iterator);
21068 result.m_it.array_iterator =
m_value.array->erase(
pos.m_it.array_iterator);
21125 template <
class IteratorType,
typename std::enable_if <
21129 IteratorType
erase(IteratorType first, IteratorType last)
21137 IteratorType result =
end();
21149 || !last.m_it.primitive_iterator.is_end()))
21156 AllocatorType<string_t> alloc;
21158 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
m_value.string, 1);
21163 AllocatorType<binary_t> alloc;
21165 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
m_value.binary, 1);
21176 result.m_it.object_iterator =
m_value.object->erase(first.m_it.object_iterator,
21177 last.m_it.object_iterator);
21183 result.m_it.array_iterator =
m_value.array->erase(first.m_it.array_iterator,
21184 last.m_it.array_iterator);
21229 return m_value.object->erase(key);
21311 template<
typename KeyT>
21314 auto result =
end();
21318 result.m_it.object_iterator =
m_value.object->find(std::forward<KeyT>(key));
21328 template<
typename KeyT>
21331 auto result =
cend();
21335 result.m_it.object_iterator =
m_value.object->find(std::forward<KeyT>(key));
21362 template<
typename KeyT>
21394 template <
typename KeyT,
typename std::enable_if <
21469 result.set_begin();
21509 result.set_begin();
21776 return ref.items();
21785 return ref.items();
21934 return m_value.array->empty();
21940 return m_value.object->empty();
22007 return m_value.array->size();
22013 return m_value.object->size();
22072 return m_value.array->max_size();
22078 return m_value.object->max_size();
22230 m_value.array->push_back(std::move(val));
22266 m_value.array->push_back(val);
22317 auto res =
m_value.object->insert(val);
22358 if (
is_object() && init.size() == 2 && (*init.begin())->is_string())
22360 basic_json&& key = init.begin()->moved_or_copied();
22361 push_back(
typename object_t::value_type(
22362 std::move(key.get_ref<
string_t&>()), (init.begin() + 1)->moved_or_copied()));
22403 template<
class... Args>
22421 #ifdef JSON_HAS_CPP_17
22424 m_value.array->emplace_back(std::forward<Args>(args)...);
22456 template<
class... Args>
22474 auto res =
m_value.object->emplace(std::forward<Args>(args)...);
22479 it.m_it.object_iterator = res.first;
22482 return {it, res.second};
22488 template<
typename... Args>
22494 auto insert_pos = std::distance(
m_value.array->begin(),
pos.m_it.array_iterator);
22495 m_value.array->insert(
pos.m_it.array_iterator, std::forward<Args>(args)...);
22768 m_value.object = create<object_t>();
22781 for (
auto it = j.
cbegin(); it != j.
cend(); ++it)
22783 m_value.object->operator[](it.key()) = it.value();
22819 m_value.object = create<object_t>();
22836 || !last.m_object->is_object()))
22841 for (
auto it = first; it != last; ++it)
22843 m_value.object->operator[](it.key()) = it.value();
22875 other.set_parents();
23120 const auto lhs_type = lhs.type();
23121 const auto rhs_type = rhs.type();
23123 if (lhs_type == rhs_type)
23128 return *lhs.m_value.array == *rhs.m_value.array;
23131 return *lhs.m_value.object == *rhs.m_value.object;
23137 return *lhs.m_value.string == *rhs.m_value.string;
23140 return lhs.m_value.boolean == rhs.m_value.boolean;
23143 return lhs.m_value.number_integer == rhs.m_value.number_integer;
23146 return lhs.m_value.number_unsigned == rhs.m_value.number_unsigned;
23149 return lhs.m_value.number_float == rhs.m_value.number_float;
23152 return *lhs.m_value.binary == *rhs.m_value.binary;
23160 return static_cast<number_float_t>(lhs.m_value.number_integer) == rhs.m_value.number_float;
23164 return lhs.m_value.number_float ==
static_cast<number_float_t>(rhs.m_value.number_integer);
23168 return static_cast<number_float_t>(lhs.m_value.number_unsigned) == rhs.m_value.number_float;
23172 return lhs.m_value.number_float ==
static_cast<number_float_t>(rhs.m_value.number_unsigned);
23176 return static_cast<number_integer_t>(lhs.m_value.number_unsigned) == rhs.m_value.number_integer;
23180 return lhs.m_value.number_integer ==
static_cast<number_integer_t>(rhs.m_value.number_unsigned);
23190 template<
typename ScalarType,
typename std::enable_if<
23201 template<
typename ScalarType,
typename std::enable_if<
23228 return !(lhs == rhs);
23235 template<
typename ScalarType,
typename std::enable_if<
23246 template<
typename ScalarType,
typename std::enable_if<
23281 const auto lhs_type = lhs.type();
23282 const auto rhs_type = rhs.type();
23284 if (lhs_type == rhs_type)
23291 return (*lhs.m_value.array) < (*rhs.m_value.array);
23294 return (*lhs.m_value.object) < (*rhs.m_value.object);
23300 return (*lhs.m_value.string) < (*rhs.m_value.string);
23303 return (lhs.m_value.boolean) < (rhs.m_value.boolean);
23306 return (lhs.m_value.number_integer) < (rhs.m_value.number_integer);
23309 return (lhs.m_value.number_unsigned) < (rhs.m_value.number_unsigned);
23312 return (lhs.m_value.number_float) < (rhs.m_value.number_float);
23315 return (*lhs.m_value.binary) < (*rhs.m_value.binary);
23323 return static_cast<number_float_t>(lhs.m_value.number_integer) < rhs.m_value.number_float;
23327 return lhs.m_value.number_float <
static_cast<number_float_t>(rhs.m_value.number_integer);
23331 return static_cast<number_float_t>(lhs.m_value.number_unsigned) < rhs.m_value.number_float;
23335 return lhs.m_value.number_float <
static_cast<number_float_t>(rhs.m_value.number_unsigned);
23339 return lhs.m_value.number_integer <
static_cast<number_integer_t>(rhs.m_value.number_unsigned);
23343 return static_cast<number_integer_t>(lhs.m_value.number_unsigned) < rhs.m_value.number_integer;
23356 template<
typename ScalarType,
typename std::enable_if<
23367 template<
typename ScalarType,
typename std::enable_if<
23395 return !(rhs < lhs);
23402 template<
typename ScalarType,
typename std::enable_if<
23413 template<
typename ScalarType,
typename std::enable_if<
23441 return !(lhs <= rhs);
23448 template<
typename ScalarType,
typename std::enable_if<
23459 template<
typename ScalarType,
typename std::enable_if<
23487 return !(lhs < rhs);
23494 template<
typename ScalarType,
typename std::enable_if<
23505 template<
typename ScalarType,
typename std::enable_if<
23555 const bool pretty_print = o.width() > 0;
23556 const auto indentation = pretty_print ? o.width() : 0;
23563 s.dump(j, pretty_print,
false,
static_cast<unsigned int>(indentation));
23642 template<
typename InputType>
23646 const bool allow_exceptions =
true,
23647 const bool ignore_comments =
false)
23680 template<
typename IteratorType>
23685 const bool allow_exceptions =
true,
23686 const bool ignore_comments =
false)
23697 const bool allow_exceptions = true,
23698 const bool ignore_comments = false)
23701 parser(i.get(), cb, allow_exceptions, ignore_comments).parse(
true, result);
23735 template<
typename InputType>
23737 const bool ignore_comments =
false)
23742 template<
typename IteratorType>
23743 static bool accept(IteratorType first, IteratorType last,
23744 const bool ignore_comments =
false)
23752 const bool ignore_comments = false)
23754 return parser(i.get(),
nullptr,
false, ignore_comments).accept(
true);
23797 template <
typename InputType,
typename SAX>
23801 const bool strict = true,
23802 const bool ignore_comments = false)
23806 ?
parser(std::move(ia),
nullptr,
true, ignore_comments).sax_parse(sax, strict)
23810 template<
class IteratorType,
class SAX>
23812 static
bool sax_parse(IteratorType first, IteratorType last, SAX* sax,
23814 const bool strict = true,
23815 const bool ignore_comments = false)
23819 ?
parser(std::move(ia),
nullptr,
true, ignore_comments).sax_parse(sax, strict)
23823 template <
typename SAX>
23828 const bool strict = true,
23829 const bool ignore_comments = false)
23834 ?
parser(std::move(ia),
nullptr,
true, ignore_comments).sax_parse(sax, strict)
23940 return "discarded";
23959 #if JSON_DIAGNOSTICS
24068 std::vector<uint8_t> result;
24163 std::vector<uint8_t> result;
24265 const bool use_size =
false,
24266 const bool use_type =
false)
24268 std::vector<uint8_t> result;
24269 to_ubjson(j, result, use_size, use_type);
24274 const bool use_size =
false,
const bool use_type =
false)
24280 const bool use_size =
false,
const bool use_type =
false)
24344 std::vector<uint8_t> result;
24473 template<
typename InputType>
24476 const bool strict =
true,
24477 const bool allow_exceptions =
true,
24490 template<
typename IteratorType>
24493 const bool strict =
true,
24494 const bool allow_exceptions =
true,
24504 template<
typename T>
24508 const bool strict = true,
24509 const bool allow_exceptions = true,
24512 return from_cbor(ptr, ptr + len, strict, allow_exceptions, tag_handler);
24519 const bool strict = true,
24520 const bool allow_exceptions = true,
24617 template<
typename InputType>
24620 const bool strict =
true,
24621 const bool allow_exceptions =
true)
24633 template<
typename IteratorType>
24636 const bool strict =
true,
24637 const bool allow_exceptions =
true)
24647 template<
typename T>
24651 const bool strict = true,
24652 const bool allow_exceptions = true)
24654 return from_msgpack(ptr, ptr + len, strict, allow_exceptions);
24660 const bool strict = true,
24661 const bool allow_exceptions = true)
24734 template<
typename InputType>
24737 const bool strict =
true,
24738 const bool allow_exceptions =
true)
24750 template<
typename IteratorType>
24753 const bool strict =
true,
24754 const bool allow_exceptions =
true)
24763 template<
typename T>
24767 const bool strict = true,
24768 const bool allow_exceptions = true)
24770 return from_ubjson(ptr, ptr + len, strict, allow_exceptions);
24776 const bool strict = true,
24777 const bool allow_exceptions = true)
24848 template<
typename InputType>
24851 const bool strict =
true,
24852 const bool allow_exceptions =
true)
24864 template<
typename IteratorType>
24867 const bool strict =
true,
24868 const bool allow_exceptions =
true)
24877 template<
typename T>
24881 const bool strict = true,
24882 const bool allow_exceptions = true)
24884 return from_bson(ptr, ptr + len, strict, allow_exceptions);
24890 const bool strict = true,
24891 const bool allow_exceptions = true)
25187 enum class patch_operations {add, remove, replace, move, copy, test, invalid};
25189 const auto get_op = [](
const std::string & op)
25193 return patch_operations::add;
25195 if (op ==
"remove")
25197 return patch_operations::remove;
25199 if (op ==
"replace")
25201 return patch_operations::replace;
25205 return patch_operations::move;
25209 return patch_operations::copy;
25213 return patch_operations::test;
25216 return patch_operations::invalid;
25231 if (top_pointer != ptr)
25233 result.
at(top_pointer);
25237 const auto last_path = ptr.
back();
25241 switch (parent.m_type)
25247 parent[last_path] = val;
25253 if (last_path ==
"-")
25280 const auto operation_remove = [
this, &result](
json_pointer & ptr)
25283 const auto last_path = ptr.
back();
25291 auto it = parent.
find(last_path);
25315 for (
const auto& val : json_patch)
25318 const auto get_value = [&val](
const std::string & op,
25319 const std::string & member,
25323 auto it = val.
m_value.object->find(member);
25326 const auto error_msg = (op ==
"op") ?
"operation" :
"operation '" + op +
"'";
25353 const auto op = get_value(
"op",
"op",
true).template get<std::string>();
25354 const auto path = get_value(op,
"path",
true).template get<std::string>();
25357 switch (get_op(op))
25359 case patch_operations::add:
25361 operation_add(ptr, get_value(
"add",
"value",
false));
25365 case patch_operations::remove:
25367 operation_remove(ptr);
25371 case patch_operations::replace:
25374 result.
at(ptr) = get_value(
"replace",
"value",
false);
25378 case patch_operations::move:
25380 const auto from_path = get_value(
"move",
"from",
true).template get<std::string>();
25390 operation_remove(from_ptr);
25391 operation_add(ptr, v);
25395 case patch_operations::copy:
25397 const auto from_path = get_value(
"copy",
"from",
true).template get<std::string>();
25406 operation_add(ptr, v);
25410 case patch_operations::test:
25412 bool success =
false;
25417 success = (result.
at(ptr) == get_value(
"test",
"value",
false));
25480 const std::string& path =
"")
25496 {
"op",
"replace"}, {
"path", path}, {
"value", target}
25507 while (i <
source.size() && i < target.
size())
25511 result.
insert(result.
end(), temp_diff.begin(), temp_diff.end());
25520 while (i <
source.size())
25533 while (i < target.
size())
25538 {
"path", path +
"/-"},
25539 {
"value", target[i]}
25550 for (
auto it =
source.cbegin(); it !=
source.cend(); ++it)
25555 if (target.
find(it.key()) != target.
end())
25558 auto temp_diff =
diff(it.value(), target[it.key()], path_key);
25559 result.
insert(result.
end(), temp_diff.begin(), temp_diff.end());
25566 {
"op",
"remove"}, {
"path", path_key}
25572 for (
auto it = target.
cbegin(); it != target.
cend(); ++it)
25580 {
"op",
"add"}, {
"path", path_key},
25581 {
"value", it.value()}
25594 {
"op",
"replace"}, {
"path", path}, {
"value", target}
25662 for (
auto it = apply_patch.
begin(); it != apply_patch.
end(); ++it)
25664 if (it.value().is_null())
25676 *
this = apply_patch;
25740 #ifndef JSON_HAS_CPP_20
25802 #if defined(__clang__)
25803 #pragma GCC diagnostic pop
25808 #undef JSON_INTERNAL_CATCH
25812 #undef JSON_PRIVATE_UNLESS_TESTED
25813 #undef JSON_HAS_CPP_14
25814 #undef JSON_HAS_CPP_17
25815 #undef NLOHMANN_BASIC_JSON_TPL_DECLARATION
25816 #undef NLOHMANN_BASIC_JSON_TPL
25817 #undef JSON_EXPLICIT
25822 #undef JSON_HEDLEY_ALWAYS_INLINE
25823 #undef JSON_HEDLEY_ARM_VERSION
25824 #undef JSON_HEDLEY_ARM_VERSION_CHECK
25825 #undef JSON_HEDLEY_ARRAY_PARAM
25826 #undef JSON_HEDLEY_ASSUME
25827 #undef JSON_HEDLEY_BEGIN_C_DECLS
25828 #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE
25829 #undef JSON_HEDLEY_CLANG_HAS_BUILTIN
25830 #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE
25831 #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE
25832 #undef JSON_HEDLEY_CLANG_HAS_EXTENSION
25833 #undef JSON_HEDLEY_CLANG_HAS_FEATURE
25834 #undef JSON_HEDLEY_CLANG_HAS_WARNING
25835 #undef JSON_HEDLEY_COMPCERT_VERSION
25836 #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK
25837 #undef JSON_HEDLEY_CONCAT
25838 #undef JSON_HEDLEY_CONCAT3
25839 #undef JSON_HEDLEY_CONCAT3_EX
25840 #undef JSON_HEDLEY_CONCAT_EX
25841 #undef JSON_HEDLEY_CONST
25842 #undef JSON_HEDLEY_CONSTEXPR
25843 #undef JSON_HEDLEY_CONST_CAST
25844 #undef JSON_HEDLEY_CPP_CAST
25845 #undef JSON_HEDLEY_CRAY_VERSION
25846 #undef JSON_HEDLEY_CRAY_VERSION_CHECK
25847 #undef JSON_HEDLEY_C_DECL
25848 #undef JSON_HEDLEY_DEPRECATED
25849 #undef JSON_HEDLEY_DEPRECATED_FOR
25850 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
25851 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_
25852 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
25853 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES
25854 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
25855 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION
25856 #undef JSON_HEDLEY_DIAGNOSTIC_POP
25857 #undef JSON_HEDLEY_DIAGNOSTIC_PUSH
25858 #undef JSON_HEDLEY_DMC_VERSION
25859 #undef JSON_HEDLEY_DMC_VERSION_CHECK
25860 #undef JSON_HEDLEY_EMPTY_BASES
25861 #undef JSON_HEDLEY_EMSCRIPTEN_VERSION
25862 #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK
25863 #undef JSON_HEDLEY_END_C_DECLS
25864 #undef JSON_HEDLEY_FLAGS
25865 #undef JSON_HEDLEY_FLAGS_CAST
25866 #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE
25867 #undef JSON_HEDLEY_GCC_HAS_BUILTIN
25868 #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE
25869 #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE
25870 #undef JSON_HEDLEY_GCC_HAS_EXTENSION
25871 #undef JSON_HEDLEY_GCC_HAS_FEATURE
25872 #undef JSON_HEDLEY_GCC_HAS_WARNING
25873 #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK
25874 #undef JSON_HEDLEY_GCC_VERSION
25875 #undef JSON_HEDLEY_GCC_VERSION_CHECK
25876 #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE
25877 #undef JSON_HEDLEY_GNUC_HAS_BUILTIN
25878 #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE
25879 #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE
25880 #undef JSON_HEDLEY_GNUC_HAS_EXTENSION
25881 #undef JSON_HEDLEY_GNUC_HAS_FEATURE
25882 #undef JSON_HEDLEY_GNUC_HAS_WARNING
25883 #undef JSON_HEDLEY_GNUC_VERSION
25884 #undef JSON_HEDLEY_GNUC_VERSION_CHECK
25885 #undef JSON_HEDLEY_HAS_ATTRIBUTE
25886 #undef JSON_HEDLEY_HAS_BUILTIN
25887 #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE
25888 #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS
25889 #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE
25890 #undef JSON_HEDLEY_HAS_EXTENSION
25891 #undef JSON_HEDLEY_HAS_FEATURE
25892 #undef JSON_HEDLEY_HAS_WARNING
25893 #undef JSON_HEDLEY_IAR_VERSION
25894 #undef JSON_HEDLEY_IAR_VERSION_CHECK
25895 #undef JSON_HEDLEY_IBM_VERSION
25896 #undef JSON_HEDLEY_IBM_VERSION_CHECK
25897 #undef JSON_HEDLEY_IMPORT
25898 #undef JSON_HEDLEY_INLINE
25899 #undef JSON_HEDLEY_INTEL_CL_VERSION
25900 #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK
25901 #undef JSON_HEDLEY_INTEL_VERSION
25902 #undef JSON_HEDLEY_INTEL_VERSION_CHECK
25903 #undef JSON_HEDLEY_IS_CONSTANT
25904 #undef JSON_HEDLEY_IS_CONSTEXPR_
25905 #undef JSON_HEDLEY_LIKELY
25906 #undef JSON_HEDLEY_MALLOC
25907 #undef JSON_HEDLEY_MCST_LCC_VERSION
25908 #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK
25909 #undef JSON_HEDLEY_MESSAGE
25910 #undef JSON_HEDLEY_MSVC_VERSION
25911 #undef JSON_HEDLEY_MSVC_VERSION_CHECK
25912 #undef JSON_HEDLEY_NEVER_INLINE
25913 #undef JSON_HEDLEY_NON_NULL
25914 #undef JSON_HEDLEY_NO_ESCAPE
25915 #undef JSON_HEDLEY_NO_RETURN
25916 #undef JSON_HEDLEY_NO_THROW
25917 #undef JSON_HEDLEY_NULL
25918 #undef JSON_HEDLEY_PELLES_VERSION
25919 #undef JSON_HEDLEY_PELLES_VERSION_CHECK
25920 #undef JSON_HEDLEY_PGI_VERSION
25921 #undef JSON_HEDLEY_PGI_VERSION_CHECK
25922 #undef JSON_HEDLEY_PREDICT
25923 #undef JSON_HEDLEY_PRINTF_FORMAT
25924 #undef JSON_HEDLEY_PRIVATE
25925 #undef JSON_HEDLEY_PUBLIC
25926 #undef JSON_HEDLEY_PURE
25927 #undef JSON_HEDLEY_REINTERPRET_CAST
25928 #undef JSON_HEDLEY_REQUIRE
25929 #undef JSON_HEDLEY_REQUIRE_CONSTEXPR
25930 #undef JSON_HEDLEY_REQUIRE_MSG
25931 #undef JSON_HEDLEY_RESTRICT
25932 #undef JSON_HEDLEY_RETURNS_NON_NULL
25933 #undef JSON_HEDLEY_SENTINEL
25934 #undef JSON_HEDLEY_STATIC_ASSERT
25935 #undef JSON_HEDLEY_STATIC_CAST
25936 #undef JSON_HEDLEY_STRINGIFY
25937 #undef JSON_HEDLEY_STRINGIFY_EX
25938 #undef JSON_HEDLEY_SUNPRO_VERSION
25939 #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK
25940 #undef JSON_HEDLEY_TINYC_VERSION
25941 #undef JSON_HEDLEY_TINYC_VERSION_CHECK
25942 #undef JSON_HEDLEY_TI_ARMCL_VERSION
25943 #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK
25944 #undef JSON_HEDLEY_TI_CL2000_VERSION
25945 #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK
25946 #undef JSON_HEDLEY_TI_CL430_VERSION
25947 #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK
25948 #undef JSON_HEDLEY_TI_CL6X_VERSION
25949 #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK
25950 #undef JSON_HEDLEY_TI_CL7X_VERSION
25951 #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK
25952 #undef JSON_HEDLEY_TI_CLPRU_VERSION
25953 #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK
25954 #undef JSON_HEDLEY_TI_VERSION
25955 #undef JSON_HEDLEY_TI_VERSION_CHECK
25956 #undef JSON_HEDLEY_UNAVAILABLE
25957 #undef JSON_HEDLEY_UNLIKELY
25958 #undef JSON_HEDLEY_UNPREDICTABLE
25959 #undef JSON_HEDLEY_UNREACHABLE
25960 #undef JSON_HEDLEY_UNREACHABLE_RETURN
25961 #undef JSON_HEDLEY_VERSION
25962 #undef JSON_HEDLEY_VERSION_DECODE_MAJOR
25963 #undef JSON_HEDLEY_VERSION_DECODE_MINOR
25964 #undef JSON_HEDLEY_VERSION_DECODE_REVISION
25965 #undef JSON_HEDLEY_VERSION_ENCODE
25966 #undef JSON_HEDLEY_WARNING
25967 #undef JSON_HEDLEY_WARN_UNUSED_RESULT
25968 #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG
25969 #undef JSON_HEDLEY_FALL_THROUGH
#define NLOHMANN_BASIC_JSON_TPL_DECLARATION
Definition: json.hpp:2330
#define JSON_HEDLEY_CONST
Definition: json.hpp:1667
#define JSON_HEDLEY_DIAGNOSTIC_PUSH
Definition: json.hpp:951
#define JSON_HEDLEY_WARN_UNUSED_RESULT
Definition: json.hpp:1297
#define JSON_PRIVATE_UNLESS_TESTED
Definition: json.hpp:2293
#define NLOHMANN_JSON_VERSION_PATCH
Definition: json.hpp:35
#define JSON_HEDLEY_LIKELY(expr)
Definition: json.hpp:1562
#define JSON_HEDLEY_NON_NULL(...)
Definition: json.hpp:1455
#define JSON_INTERNAL_CATCH(exception)
Definition: json.hpp:2260
#define JSON_HEDLEY_RETURNS_NON_NULL
Definition: json.hpp:1896
#define JSON_CATCH(exception)
Definition: json.hpp:2259
#define JSON_ASSERT(x)
Definition: json.hpp:2286
#define JSON_THROW(exception)
Definition: json.hpp:2257
#define NLOHMANN_JSON_VERSION_MAJOR
Definition: json.hpp:33
#define NLOHMANN_BASIC_JSON_TPL
Definition: json.hpp:2339
#define JSON_HEDLEY_UNLIKELY(expr)
Definition: json.hpp:1563
#define JSON_TRY
Definition: json.hpp:2258
#define NLOHMANN_JSON_VERSION_MINOR
Definition: json.hpp:34
#define JSON_HEDLEY_DIAGNOSTIC_POP
Definition: json.hpp:952
#define JSON_EXPLICIT
Definition: json.hpp:2503
#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement)
Definition: json.hpp:1245
#define JSON_HEDLEY_PURE
Definition: json.hpp:1636
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
Definition: json.hpp:25318
basic_json<> json
default specialization
Definition: json.hpp:3554
ArrayType
Definition: Xml.h:25
Represents a JSON value. Use Value for UTF8 encoding and default allocator.
Definition: document.h:585
namespace for Niels Lohmann
Definition: json.hpp:20203
JSON_PRIVATE_UNLESS_TESTED const_reference rhs
Definition: json.hpp:23791
ValueType value(const typename object_t::key_type &key, const ValueType &default_value) const
access specified object element with default value
Definition: json.hpp:22357
constexpr bool is_begin() const noexcept
return whether the iterator can be dereferenced
Definition: json.hpp:13528
void set_end() noexcept
set iterator to a defined past the end
Definition: json.hpp:13522
constexpr difference_type get_value() const noexcept
Definition: json.hpp:13510
void set_begin() noexcept
set iterator to a defined beginning
Definition: json.hpp:13516
JSON Pointer defines a string syntax for identifying a specific value within a JSON document.
Definition: json.hpp:14616
a class to store JSON values
Definition: json.hpp:17064
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json binary(typename binary_t::container_type &&init, std::uint8_t subtype)
explicitly create a binary array (with subtype)
Definition: json.hpp:18713
constexpr auto get() const noexcept -> decltype(std::declval< const basic_json_t & >().template get_ptr< PointerType >())
get a pointer value (explicit)
Definition: json.hpp:20120
void insert(const_iterator first, const_iterator last)
inserts elements
Definition: json.hpp:22720
detail::parser_callback_t< basic_json > parser_callback_t
per-element parser callback type
Definition: json.hpp:18276
bool contains(KeyT &&key) const
check the existence of an element in a JSON object
Definition: json.hpp:21396
const_reverse_iterator crbegin() const noexcept
returns a const reverse iterator to the last element
Definition: json.hpp:21681
number_unsigned_t number_unsigned
number (unsigned integer)
Definition: json.hpp:17876
const_reference operator[](const json_pointer &ptr) const
access specified element via JSON Pointer
Definition: json.hpp:24970
basic_json get() const
get special-case overload
Definition: json.hpp:19829
reference operator[](const json_pointer &ptr)
access specified element via JSON Pointer
Definition: json.hpp:24942
friend bool operator==(const_reference lhs, ScalarType rhs) noexcept
comparison: equal
Definition: json.hpp:23192
ValueType value(const typename object_t::key_type &key, const ValueType &default_value) const
access specified object element with default value
Definition: json.hpp:20779
constexpr bool is_number_float() const noexcept
return whether value is a floating-point number
Definition: json.hpp:19522
NumberIntegerType number_integer_t
a type for a number (integer)
Definition: json.hpp:17598
friend bool operator==(const_reference lhs, const_reference rhs) noexcept
comparison: equal
Definition: json.hpp:23118
NLOHMANN_BASIC_JSON_TPL basic_json_t
workaround type for MSVC
Definition: json.hpp:17085
static bool sax_parse(InputType &&i, SAX *sax, input_format_t format=input_format_t::json, const bool strict=true, const bool ignore_comments=false)
generate SAX events
Definition: json.hpp:23799
constexpr const number_integer_t * get_impl_ptr(const number_integer_t *) const noexcept
get a pointer to the value (integer number)
Definition: json.hpp:19741
ReferenceType get_ref()
get a reference value (implicit)
Definition: json.hpp:20154
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json parse(InputType &&i, const parser_callback_t cb=nullptr, const bool allow_exceptions=true, const bool ignore_comments=false)
deserialize from a compatible input
Definition: json.hpp:23644
reference emplace_back(Args &&... args)
add an object to an array
Definition: json.hpp:22404
const_iterator find(KeyT &&key) const
find an element in a JSON object
Definition: json.hpp:21329
basic_json(const value_t v)
create an empty value with a given type
Definition: json.hpp:18317
static void to_ubjson(const basic_json &j, detail::output_adapter< uint8_t > o, const bool use_size=false, const bool use_type=false)
Definition: json.hpp:24273
basic_json & operator=(basic_json other) noexcept(std::is_nothrow_move_constructible< value_t >::value &&std::is_nothrow_move_assignable< value_t >::value &&std::is_nothrow_move_constructible< json_value >::value &&std::is_nothrow_move_assignable< json_value >::value)
copy assignment
Definition: json.hpp:19154
size_type max_size() const noexcept
returns the maximum possible number of elements
Definition: json.hpp:22065
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json diff(const basic_json &source, const basic_json &target, const std::string &path="")
creates a diff as a JSON patch
Definition: json.hpp:25479
void erase(const size_type idx)
remove element from a JSON array given an index
Definition: json.hpp:21259
const_reverse_iterator crend() const noexcept
returns a const reverse iterator to one before the first
Definition: json.hpp:21710
const_reference at(const typename object_t::key_type &key) const
access specified object element with bounds checking
Definition: json.hpp:20435
static iteration_proxy< iterator > iterator_wrapper(reference ref) noexcept
wrapper to access iterator member functions in range-based for
Definition: json.hpp:21774
reference at(const typename object_t::key_type &key)
access specified object element with bounds checking
Definition: json.hpp:20384
iterator begin() noexcept
returns an iterator to the first element
Definition: json.hpp:21466
basic_json(InputIT first, InputIT last)
construct a JSON container given an iterator range
Definition: json.hpp:18896
friend bool operator==(ScalarType lhs, const_reference rhs) noexcept
comparison: equal
Definition: json.hpp:23203
static std::vector< uint8_t > to_ubjson(const basic_json &j, const bool use_size=false, const bool use_type=false)
create a UBJSON serialization of a given JSON value
Definition: json.hpp:24264
json_value(object_t &&value)
constructor for rvalue objects
Definition: json.hpp:17980
boolean_t * get_impl_ptr(boolean_t *) noexcept
get a pointer to the value (boolean)
Definition: json.hpp:19723
basic_json(const JsonRef &ref)
Definition: json.hpp:18999
static void to_cbor(const basic_json &j, detail::output_adapter< uint8_t > o)
Definition: json.hpp:24073
string_t * get_impl_ptr(string_t *) noexcept
get a pointer to the value (string)
Definition: json.hpp:19711
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json array(initializer_list_t init={})
explicitly create an array from an initializer list
Definition: json.hpp:18759
json_value(number_float_t v) noexcept
constructor for numbers (floating-point)
Definition: json.hpp:17889
const_reverse_iterator rend() const noexcept
returns a const reverse iterator to one before the first
Definition: json.hpp:21652
void assert_invariant(bool check_parents=true) const noexcept
checks the class invariants
Definition: json.hpp:18131
json_value(string_t &&value)
constructor for rvalue strings
Definition: json.hpp:17968
const_iterator cend() const noexcept
returns a const iterator to one past the last element
Definition: json.hpp:21577
json_value(number_integer_t v) noexcept
constructor for numbers (integer)
Definition: json.hpp:17885
reference back()
access the last element
Definition: json.hpp:20949
static bool accept(InputType &&i, const bool ignore_comments=false)
check if the input is valid JSON
Definition: json.hpp:23736
StringType string_t
a type for a string
Definition: json.hpp:17500
size_type size() const noexcept
returns the number of elements
Definition: json.hpp:21994
void push_back(const basic_json &val)
add an object to an array
Definition: json.hpp:22249
friend std::ostream & operator>>(const basic_json &j, std::ostream &o)
serialize to stream
Definition: json.hpp:23576
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json meta()
returns version information on the library
Definition: json.hpp:17241
ValueType value(const json_pointer &ptr, const ValueType &default_value) const
access specified object element via JSON Pointer with default value
Definition: json.hpp:20851
void update(const_reference j)
updates a JSON object from another object, overwriting existing keys
Definition: json.hpp:22762
constexpr const binary_t * get_impl_ptr(const binary_t *) const noexcept
get a pointer to the value (binary)
Definition: json.hpp:19777
std::size_t size_type
a type to represent container sizes
Definition: json.hpp:17184
array_t * get_impl_ptr(array_t *) noexcept
get a pointer to the value (array)
Definition: json.hpp:19699
std::ptrdiff_t difference_type
a type to represent differences between iterators
Definition: json.hpp:17182
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json binary(const typename binary_t::container_type &init)
explicitly create a binary array (without subtype)
Definition: json.hpp:18656
reference operator[](const typename object_t::key_type &key)
access specified object element
Definition: json.hpp:20572
number_float_t * get_impl_ptr(number_float_t *) noexcept
get a pointer to the value (floating-point number)
Definition: json.hpp:19759
json_value(number_unsigned_t v) noexcept
constructor for numbers (unsigned)
Definition: json.hpp:17887
reference operator+=(basic_json &&val)
add an object to an array
Definition: json.hpp:22239
basic_json(const BasicJsonType &val)
create a JSON value from an existing one
Definition: json.hpp:18451
typename std::allocator_traits< allocator_type >::const_pointer const_pointer
the type of an element const pointer
Definition: json.hpp:17192
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json from_bson(IteratorType first, IteratorType last, const bool strict=true, const bool allow_exceptions=true)
Create a JSON value from an input in BSON format.
Definition: json.hpp:24866
typename std::allocator_traits< allocator_type >::pointer pointer
the type of an element pointer
Definition: json.hpp:17190
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json from_cbor(InputType &&i, const bool strict=true, const bool allow_exceptions=true, const cbor_tag_handler_t tag_handler=cbor_tag_handler_t::error)
create a JSON value from an input in CBOR format
Definition: json.hpp:24475
BooleanType boolean_t
a type for a boolean
Definition: json.hpp:17526
void push_back(initializer_list_t init)
add an object to an object
Definition: json.hpp:22356
JSON_HEDLEY_RETURNS_NON_NULL const char * type_name() const noexcept
return the type as string
Definition: json.hpp:23922
boolean_t get_impl(boolean_t *) const
get a boolean (explicit)
Definition: json.hpp:19676
string_t dump(const int indent=-1, const char indent_char=' ', const bool ensure_ascii=false, const error_handler_t error_handler=error_handler_t::strict) const
serialization
Definition: json.hpp:19252
static bool accept(IteratorType first, IteratorType last, const bool ignore_comments=false)
Definition: json.hpp:23743
IteratorType erase(IteratorType pos)
remove element given an iterator
Definition: json.hpp:21016
friend bool operator!=(const_reference lhs, ScalarType rhs) noexcept
comparison: not equal
Definition: json.hpp:23237
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json from_bson(InputType &&i, const bool strict=true, const bool allow_exceptions=true)
Create a JSON value from an input in BSON format.
Definition: json.hpp:24850
constexpr bool is_structured() const noexcept
return whether type is structured
Definition: json.hpp:19363
friend bool operator<=(ScalarType lhs, const_reference rhs) noexcept
comparison: less than or equal
Definition: json.hpp:23415
const_iterator begin() const noexcept
returns a const iterator to the first element
Definition: json.hpp:21476
iteration_proxy< const_iterator > items() const noexcept
helper to access iterator member functions in range-based for
Definition: json.hpp:21864
friend bool operator<(const_reference lhs, ScalarType rhs) noexcept
comparison: less than
Definition: json.hpp:23358
reference at(size_type idx)
access specified array element with bounds checking
Definition: json.hpp:20286
reference front()
access the first element
Definition: json.hpp:20905
constexpr bool is_primitive() const noexcept
return whether type is primitive
Definition: json.hpp:19336
constexpr bool is_number_unsigned() const noexcept
return whether value is an unsigned integer number
Definition: json.hpp:19494
static void to_cbor(const basic_json &j, detail::output_adapter< char > o)
Definition: json.hpp:24078
void swap(object_t &other)
exchanges the values
Definition: json.hpp:22960
constexpr bool is_object() const noexcept
return whether value is an object
Definition: json.hpp:19544
const_reference front() const
access the first element
Definition: json.hpp:20913
binary_t * get_impl_ptr(binary_t *) noexcept
get a pointer to the value (binary)
Definition: json.hpp:19771
constexpr value_t type() const noexcept
return the type of the JSON value (explicit)
Definition: json.hpp:19305
NumberFloatType number_float_t
a type for a number (floating-point)
Definition: json.hpp:17737
json_reverse_iterator< typename basic_json::iterator > reverse_iterator
a reverse iterator for a basic_json container
Definition: json.hpp:17199
friend bool operator<=(const_reference lhs, const_reference rhs) noexcept
comparison: less than or equal
Definition: json.hpp:23393
bool empty() const noexcept
checks whether the container is empty.
Definition: json.hpp:21921
constexpr const number_unsigned_t * get_impl_ptr(const number_unsigned_t *) const noexcept
get a pointer to the value (unsigned number)
Definition: json.hpp:19753
friend std::ostream & operator<<(std::ostream &o, const basic_json &j)
serialize to stream
Definition: json.hpp:23552
json_value(value_t t)
constructor for empty values of a given type
Definition: json.hpp:17891
basic_json(const basic_json &other)
copy constructor
Definition: json.hpp:19026
constexpr const boolean_t * get_impl_ptr(const boolean_t *) const noexcept
get a pointer to the value (boolean)
Definition: json.hpp:19729
~basic_json() noexcept
destructor
Definition: json.hpp:19188
BasicJsonType get() const
get special-case overload
Definition: json.hpp:19852
basic_json(basic_json &&other) noexcept
move constructor
Definition: json.hpp:19116
static void to_bson(const basic_json &j, detail::output_adapter< uint8_t > o)
Serializes the given JSON object j to BSON and forwards the corresponding BSON-representation to the ...
Definition: json.hpp:24357
friend bool operator>(ScalarType lhs, const_reference rhs) noexcept
comparison: greater than
Definition: json.hpp:23461
static void to_ubjson(const basic_json &j, detail::output_adapter< char > o, const bool use_size=false, const bool use_type=false)
Definition: json.hpp:24279
friend bool operator!=(const_reference lhs, const_reference rhs) noexcept
comparison: not equal
Definition: json.hpp:23226
iterator insert(const_iterator pos, size_type cnt, const basic_json &val)
inserts elements
Definition: json.hpp:22578
friend bool operator<(ScalarType lhs, const_reference rhs) noexcept
comparison: less than
Definition: json.hpp:23369
json_value m_value
the value of the current element
Definition: json.hpp:23957
boolean_t boolean
boolean
Definition: json.hpp:17872
void swap(typename binary_t::container_type &other)
exchanges the values
Definition: json.hpp:23040
friend bool operator>=(const_reference lhs, const_reference rhs) noexcept
comparison: greater than or equal
Definition: json.hpp:23485
constexpr const object_t * get_impl_ptr(const object_t *) const noexcept
get a pointer to the value (object)
Definition: json.hpp:19693
void swap(array_t &other)
exchanges the values
Definition: json.hpp:22927
reverse_iterator rend() noexcept
returns an iterator to the reverse-end
Definition: json.hpp:21644
json_value(const string_t &value)
constructor for strings
Definition: json.hpp:17962
json_value(const binary_t &value)
constructor for binary arrays (internal type)
Definition: json.hpp:18010
ReferenceType get_ref() const
get a reference value (implicit)
Definition: json.hpp:20167
json_value(const array_t &value)
constructor for arrays
Definition: json.hpp:17986
iterator insert(const_iterator pos, const_iterator first, const_iterator last)
inserts elements
Definition: json.hpp:22626
auto get() noexcept -> decltype(std::declval< basic_json_t & >().template get_ptr< PointerType >())
get a pointer value (explicit)
Definition: json.hpp:20108
const_reference at(const json_pointer &ptr) const
access specified element via JSON Pointer
Definition: json.hpp:25056
const_iterator end() const noexcept
returns a const iterator to one past the last element
Definition: json.hpp:21547
void merge_patch(const basic_json &apply_patch)
applies a JSON Merge Patch
Definition: json.hpp:25654
auto get_ptr() noexcept -> decltype(std::declval< basic_json_t & >().get_impl_ptr(std::declval< PointerType >()))
get a pointer value (implicit)
Definition: json.hpp:20060
iterator insert(const_iterator pos, initializer_list_t ilist)
inserts elements
Definition: json.hpp:22679
ArrayType< basic_json, AllocatorType< basic_json > > array_t
a type for an array
Definition: json.hpp:17447
Array get_to(T(&v)[N]) const noexcept(noexcept(JSONSerializer< Array >::from_json(std::declval< const basic_json_t & >(), v)))
Definition: json.hpp:20023
friend bool operator>(const_reference lhs, const_reference rhs) noexcept
comparison: greater than
Definition: json.hpp:23439
json_value(const object_t &value)
constructor for objects
Definition: json.hpp:17974
IteratorType erase(IteratorType first, IteratorType last)
remove elements given an iterator range
Definition: json.hpp:21129
object_t * get_impl_ptr(object_t *) noexcept
get a pointer to the value (object)
Definition: json.hpp:19687
json_value(typename binary_t::container_type &&value)
constructor for rvalue binary arrays
Definition: json.hpp:18004
json_value(boolean_t v) noexcept
constructor for booleans
Definition: json.hpp:17883
ValueType get() const noexcept(noexcept(JSONSerializer< ValueType >::from_json(std::declval< const basic_json_t & >(), std::declval< ValueType & >())))
get a value (explicit)
Definition: json.hpp:19902
constexpr bool is_boolean() const noexcept
return whether value is a boolean
Definition: json.hpp:19407
iteration_proxy< iterator > items() noexcept
helper to access iterator member functions in range-based for
Definition: json.hpp:21856
iterator end() noexcept
returns an iterator to one past the last element
Definition: json.hpp:21537
void swap(reference other) noexcept(std::is_nothrow_move_constructible< value_t >::value &&std::is_nothrow_move_assignable< value_t >::value &&std::is_nothrow_move_constructible< json_value >::value &&std::is_nothrow_move_assignable< json_value >::value)
exchanges the values
Definition: json.hpp:22864
void clear() noexcept
clears the contents
Definition: json.hpp:22136
friend bool operator>=(ScalarType lhs, const_reference rhs) noexcept
comparison: greater than or equal
Definition: json.hpp:23507
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json from_msgpack(IteratorType first, IteratorType last, const bool strict=true, const bool allow_exceptions=true)
create a JSON value from an input in MessagePack format
Definition: json.hpp:24635
constexpr bool is_binary() const noexcept
return whether value is a binary array
Definition: json.hpp:19610
static std::vector< uint8_t > to_msgpack(const basic_json &j)
create a MessagePack serialization of a given JSON value
Definition: json.hpp:24161
binary_t * binary
binary (stored with pointer to save storage)
Definition: json.hpp:17870
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json object(initializer_list_t init={})
explicitly create an object from an initializer list
Definition: json.hpp:18803
constexpr const number_float_t * get_impl_ptr(const number_float_t *) const noexcept
get a pointer to the value (floating-point number)
Definition: json.hpp:19765
iterator insert(const_iterator pos, basic_json &&val)
inserts element
Definition: json.hpp:22549
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json from_ubjson(IteratorType first, IteratorType last, const bool strict=true, const bool allow_exceptions=true)
create a JSON value from an input in UBJSON format
Definition: json.hpp:24752
reference operator[](size_type idx)
access specified array element
Definition: json.hpp:20481
friend bool operator>(const_reference lhs, ScalarType rhs) noexcept
comparison: greater than
Definition: json.hpp:23450
static void to_bson(const basic_json &j, detail::output_adapter< char > o)
Serializes the given JSON object j to BSON and forwards the corresponding BSON-representation to the ...
Definition: json.hpp:24365
void update(const_iterator first, const_iterator last)
updates a JSON object from another object, overwriting existing keys
Definition: json.hpp:22813
reference at(const json_pointer &ptr)
access specified element via JSON Pointer
Definition: json.hpp:25013
ValueType & get_to(ValueType &v) const noexcept(noexcept(JSONSerializer< ValueType >::from_json(std::declval< const basic_json_t & >(), v)))
get a value (explicit)
Definition: json.hpp:19999
void swap(binary_t &other)
exchanges the values
Definition: json.hpp:23026
static std::vector< uint8_t > to_bson(const basic_json &j)
Serializes the given JSON object j to BSON and returns a vector containing the corresponding BSON-rep...
Definition: json.hpp:24342
json_reverse_iterator< typename basic_json::const_iterator > const_reverse_iterator
a const reverse iterator for a basic_json container
Definition: json.hpp:17201
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json from_ubjson(InputType &&i, const bool strict=true, const bool allow_exceptions=true)
create a JSON value from an input in UBJSON format
Definition: json.hpp:24736
::nlohmann::json_pointer< basic_json > json_pointer
JSON Pointer, see nlohmann::json_pointer.
Definition: json.hpp:17126
static void to_msgpack(const basic_json &j, detail::output_adapter< uint8_t > o)
Definition: json.hpp:24168
friend bool operator!=(ScalarType lhs, const_reference rhs) noexcept
comparison: not equal
Definition: json.hpp:23248
static ::nlohmann::detail::parser< basic_json, InputAdapterType > parser(InputAdapterType adapter, detail::parser_callback_t< basic_json >cb=nullptr, const bool allow_exceptions=true, const bool ignore_comments=false)
Definition: json.hpp:17092
number_unsigned_t * get_impl_ptr(number_unsigned_t *) noexcept
get a pointer to the value (unsigned number)
Definition: json.hpp:19747
const_reverse_iterator rbegin() const noexcept
returns a const reverse iterator to the last element
Definition: json.hpp:21615
binary_t & get_binary()
Definition: json.hpp:20228
void swap(string_t &other)
exchanges the values
Definition: json.hpp:22993
const_reference back() const
access the last element
Definition: json.hpp:20959
friend bool operator<(const_reference lhs, const_reference rhs) noexcept
comparison: less than
Definition: json.hpp:23279
friend std::istream & operator>>(std::istream &i, basic_json &j)
deserialize from stream
Definition: json.hpp:23878
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json binary(typename binary_t::container_type &&init)
explicitly create a binary array (without subtype)
Definition: json.hpp:18703
constexpr bool is_string() const noexcept
return whether value is a string
Definition: json.hpp:19588
number_integer_t * get_impl_ptr(number_integer_t *) noexcept
get a pointer to the value (integer number)
Definition: json.hpp:19735
constexpr bool is_array() const noexcept
return whether value is an array
Definition: json.hpp:19566
iterator insert_iterator(const_iterator pos, Args &&... args)
Definition: json.hpp:22489
basic_json flatten() const
return flattened JSON value
Definition: json.hpp:25083
friend bool operator>=(const_reference lhs, ScalarType rhs) noexcept
comparison: greater than or equal
Definition: json.hpp:23496
void push_back(basic_json &&val)
add an object to an array
Definition: json.hpp:22213
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json from_cbor(IteratorType first, IteratorType last, const bool strict=true, const bool allow_exceptions=true, const cbor_tag_handler_t tag_handler=cbor_tag_handler_t::error)
create a JSON value from an input in CBOR format
Definition: json.hpp:24492
size_type count(KeyT &&key) const
returns the number of occurrences of a key in a JSON object
Definition: json.hpp:21363
json_value(const typename binary_t::container_type &value)
constructor for binary arrays
Definition: json.hpp:17998
const binary_t & get_binary() const
Definition: json.hpp:20239
json_value()=default
default constructor (for null values)
constexpr bool is_number() const noexcept
return whether value is a number
Definition: json.hpp:19437
number_float_t number_float
number (floating-point)
Definition: json.hpp:17878
std::less< StringType > object_comparator_t
Definition: json.hpp:17311
string_t * string
string (stored with pointer to save storage)
Definition: json.hpp:17868
std::pair< iterator, bool > emplace(Args &&... args)
add an object to an object if key does not exist
Definition: json.hpp:22457
reference operator+=(initializer_list_t init)
add an object to an object
Definition: json.hpp:22374
::nlohmann::detail::output_adapter_t< CharType > output_adapter_t
Definition: json.hpp:17114
constexpr bool is_number_integer() const noexcept
return whether value is an integer number
Definition: json.hpp:19466
static JSON_HEDLEY_RETURNS_NON_NULL T * create(Args &&... args)
helper for exception-safe object creation
Definition: json.hpp:17816
std::initializer_list< detail::json_ref< basic_json > > initializer_list_t
helper type for initializer lists of basic_json values
Definition: json.hpp:17134
constexpr const array_t * get_impl_ptr(const array_t *) const noexcept
get a pointer to the value (array)
Definition: json.hpp:19705
detail::value_t value_t
Definition: json.hpp:17124
ValueType & get_to(ValueType &v) const
Definition: json.hpp:20012
json_value(binary_t &&value)
constructor for rvalue binary arrays (internal type)
Definition: json.hpp:18016
static void to_msgpack(const basic_json &j, detail::output_adapter< char > o)
Definition: json.hpp:24173
const_reference operator[](const typename object_t::key_type &key) const
read-only access specified object element
Definition: json.hpp:20621
iterator set_parents(iterator it, typename iterator::difference_type count)
Definition: json.hpp:18182
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json binary(const typename binary_t::container_type &init, std::uint8_t subtype)
explicitly create a binary array (with subtype)
Definition: json.hpp:18693
iterator find(KeyT &&key)
find an element in a JSON object
Definition: json.hpp:21312
basic_json(std::nullptr_t=nullptr) noexcept
create a null object
Definition: json.hpp:18341
const_reference operator[](size_type idx) const
access specified array element
Definition: json.hpp:20534
array_t * array
array (stored with pointer to save storage)
Definition: json.hpp:17866
AllocatorType< basic_json > allocator_type
the allocator type
Definition: json.hpp:17187
nlohmann::byte_container_with_subtype< BinaryType > binary_t
a type for a packed binary type
Definition: json.hpp:17808
JSONSerializer< T, SFINAE > json_serializer
Definition: json.hpp:17128
void push_back(const typename object_t::value_type &val)
add an object to an object
Definition: json.hpp:22300
ValueType get() const noexcept(noexcept(JSONSerializer< ValueType >::from_json(std::declval< const basic_json_t & >())))
get a value (explicit); special case
Definition: json.hpp:19953
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json parse(IteratorType first, IteratorType last, const parser_callback_t cb=nullptr, const bool allow_exceptions=true, const bool ignore_comments=false)
deserialize from a pair of character iterators
Definition: json.hpp:23682
number_integer_t number_integer
number (integer)
Definition: json.hpp:17874
constexpr const string_t * get_impl_ptr(const string_t *) const noexcept
get a pointer to the value (string)
Definition: json.hpp:19717
static std::vector< uint8_t > to_cbor(const basic_json &j)
create a CBOR serialization of a given JSON value
Definition: json.hpp:24066
bool contains(const json_pointer &ptr) const
check the existence of an element in a JSON object given a JSON pointer
Definition: json.hpp:21427
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json from_msgpack(InputType &&i, const bool strict=true, const bool allow_exceptions=true)
create a JSON value from an input in MessagePack format
Definition: json.hpp:24619
void destroy(value_t t) noexcept
Definition: json.hpp:18021
basic_json patch(const basic_json &json_patch) const
applies a JSON patch
Definition: json.hpp:25181
string_t value(const typename object_t::key_type &key, const char *default_value) const
overload for a default value of type const char*
Definition: json.hpp:20801
basic_json(CompatibleType &&val) noexcept(noexcept(//NOLINT(bugprone-forwarding-reference-overload, bugprone-exception-escape) JSONSerializer< U >::to_json(std::declval< basic_json_t & >(), std::forward< CompatibleType >(val))))
create a JSON value
Definition: json.hpp:18413
void set_parents()
Definition: json.hpp:18153
basic_json unflatten() const
unflatten a previously flattened JSON value
Definition: json.hpp:25120
NumberUnsignedType number_unsigned_t
a type for a number (unsigned)
Definition: json.hpp:17669
reference operator+=(const typename object_t::value_type &val)
add an object to an object
Definition: json.hpp:22325
const_iterator cbegin() const noexcept
returns a const iterator to the first element
Definition: json.hpp:21506
friend bool operator<=(const_reference lhs, ScalarType rhs) noexcept
comparison: less than or equal
Definition: json.hpp:23404
json_value(array_t &&value)
constructor for rvalue arrays
Definition: json.hpp:17992
basic_json(initializer_list_t init, bool type_deduction=true, value_t manual_type=value_t::array)
create a container (array or object) from an initializer list
Definition: json.hpp:18575
const_reference at(size_type idx) const
access specified array element with bounds checking
Definition: json.hpp:20333
iterator insert(const_iterator pos, const basic_json &val)
inserts element
Definition: json.hpp:22527
constexpr bool is_discarded() const noexcept
return whether value is discarded
Definition: json.hpp:19637
constexpr bool is_null() const noexcept
return whether value is null
Definition: json.hpp:19385
reference set_parent(reference j)
Definition: json.hpp:18195
friend void swap(reference left, reference right) noexcept(std::is_nothrow_move_constructible< value_t >::value &&std::is_nothrow_move_assignable< value_t >::value &&std::is_nothrow_move_constructible< json_value >::value &&std::is_nothrow_move_assignable< json_value >::value)
exchanges the values
Definition: json.hpp:22897
ObjectType< StringType, basic_json, object_comparator_t, AllocatorType< std::pair< const StringType, basic_json > >> object_t
a type for an object
Definition: json.hpp:17401
reference operator+=(const basic_json &val)
add an object to an array
Definition: json.hpp:22274
size_type erase(const typename object_t::key_type &key)
remove element from a JSON object given a key
Definition: json.hpp:21224
static ReferenceType get_ref_impl(ThisType &obj)
helper function to implement get_ref()
Definition: json.hpp:19794
basic_json(size_type cnt, const basic_json &val)
construct an array with count copies of given value
Definition: json.hpp:18830
static allocator_type get_allocator()
returns the allocator associated with the container
Definition: json.hpp:17209
constexpr auto get_ptr() const noexcept -> decltype(std::declval< const basic_json_t & >().get_impl_ptr(std::declval< PointerType >()))
get a pointer value (implicit)
Definition: json.hpp:20073
reverse_iterator rbegin() noexcept
returns an iterator to the reverse-beginning
Definition: json.hpp:21607
an internal type for a backed binary type
Definition: json.hpp:4803
BinaryType container_type
the type of the underlying container
Definition: json.hpp:4806
void set_subtype(std::uint8_t subtype_) noexcept
sets the binary subtype
Definition: json.hpp:4861
byte_container_with_subtype(const container_type &b) noexcept(noexcept(container_type(b)))
Definition: json.hpp:4812
bool m_has_subtype
Definition: json.hpp:4941
byte_container_with_subtype(container_type &&b) noexcept(noexcept(container_type(std::move(b))))
Definition: json.hpp:4816
bool operator!=(const byte_container_with_subtype &rhs) const
Definition: json.hpp:4838
void clear_subtype() noexcept
clears the binary subtype
Definition: json.hpp:4933
byte_container_with_subtype() noexcept(noexcept(container_type()))
Definition: json.hpp:4808
byte_container_with_subtype(const container_type &b, std::uint8_t subtype_) noexcept(noexcept(container_type(b)))
Definition: json.hpp:4820
constexpr bool has_subtype() const noexcept
return whether the value has a subtype
Definition: json.hpp:4909
byte_container_with_subtype(container_type &&b, std::uint8_t subtype_) noexcept(noexcept(container_type(std::move(b))))
Definition: json.hpp:4826
constexpr std::uint8_t subtype() const noexcept
return the binary subtype
Definition: json.hpp:4888
std::uint8_t m_subtype
Definition: json.hpp:4940
bool operator==(const byte_container_with_subtype &rhs) const
Definition: json.hpp:4832
deserialization of CBOR, MessagePack, and UBJSON values
Definition: json.hpp:8109
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition: json.hpp:8111
bool get_msgpack_array(const std::size_t len)
Definition: json.hpp:9754
bool get_bson_string(const NumberType len, string_t &result)
Parses a zero-terminated string of length len from the BSON input.
Definition: json.hpp:8262
bool parse_bson_element_internal(const char_int_type element_type, const std::size_t element_type_parse_position)
Read a BSON document element of the given element_type.
Definition: json.hpp:8309
bool parse_bson_array()
Reads an array from the BSON input and passes it to the SAX-parser.
Definition: json.hpp:8425
char_int_type get_ignore_noop()
Definition: json.hpp:10313
bool get_ubjson_high_precision_number()
Definition: json.hpp:10242
binary_reader(InputAdapterType &&adapter) noexcept
create a binary reader
Definition: json.hpp:8125
typename BasicJsonType::number_integer_t number_integer_t
Definition: json.hpp:8110
bool get_bson_cstr(string_t &result)
Parses a C-style string from the BSON input.
Definition: json.hpp:8232
binary_reader & operator=(const binary_reader &)=delete
bool get_cbor_array(const std::size_t len, const cbor_tag_handler_t tag_handler)
Definition: json.hpp:9090
bool get_msgpack_binary(binary_t &result)
reads a MessagePack byte array
Definition: json.hpp:9643
bool get_cbor_object(const std::size_t len, const cbor_tag_handler_t tag_handler)
Definition: json.hpp:9128
bool get_ubjson_string(string_t &result, const bool get_char=true)
reads a UBJSON string
Definition: json.hpp:9832
SAX json_sax_t
Definition: json.hpp:8115
bool parse_bson_element_list(const bool is_array)
Read a BSON element list (as specified in the BSON-spec)
Definition: json.hpp:8387
bool parse_cbor_internal(const bool get_char, const cbor_tag_handler_t tag_handler)
Definition: json.hpp:8455
bool get_string(const input_format_t format, const NumberType len, string_t &result)
create a string by reading characters from the input
Definition: json.hpp:10381
bool get_cbor_string(string_t &result)
reads a CBOR string
Definition: json.hpp:8901
InputAdapterType ia
input adapter
Definition: json.hpp:10497
bool get_binary(const input_format_t format, const NumberType len, binary_t &result)
create a byte array by reading bytes from the input
Definition: json.hpp:10414
bool parse_ubjson_internal(const bool get_char=true)
Definition: json.hpp:9813
bool unexpect_eof(const input_format_t format, const char *context) const
Definition: json.hpp:10438
bool get_ubjson_size_type(std::pair< std::size_t, char_int_type > &result)
determine the type and size for a container
Definition: json.hpp:9963
std::string get_token_string() const
Definition: json.hpp:10451
bool get_ubjson_value(const char_int_type prefix)
Definition: json.hpp:10004
typename BasicJsonType::string_t string_t
Definition: json.hpp:8113
bool get_msgpack_object(const std::size_t len)
Definition: json.hpp:9776
bool get_bson_binary(const NumberType len, binary_t &result)
Parses a byte array input of length len from the BSON input.
Definition: json.hpp:8283
std::string exception_message(const input_format_t format, const std::string &detail, const std::string &context) const
Definition: json.hpp:10464
std::size_t chars_read
the number of characters read
Definition: json.hpp:10503
typename std::char_traits< char_type >::int_type char_int_type
Definition: json.hpp:8117
binary_reader(const binary_reader &)=delete
char_int_type current
the current character
Definition: json.hpp:10500
bool sax_parse(const input_format_t format, json_sax_t *sax_, const bool strict=true, const cbor_tag_handler_t tag_handler=cbor_tag_handler_t::error)
Definition: json.hpp:8146
json_sax_t * sax
the SAX parser
Definition: json.hpp:10509
bool get_ubjson_size_value(std::size_t &result)
Definition: json.hpp:9886
typename InputAdapterType::char_type char_type
Definition: json.hpp:8116
bool parse_bson_internal()
Reads in a BSON-object and passes it to the SAX-parser.
Definition: json.hpp:8207
bool get_number(const input_format_t format, NumberType &result)
Definition: json.hpp:10338
bool get_cbor_binary(binary_t &result)
reads a CBOR byte array
Definition: json.hpp:8996
binary_reader(binary_reader &&)=default
typename BasicJsonType::binary_t binary_t
Definition: json.hpp:8114
char_int_type get()
get next character from the input
Definition: json.hpp:10304
binary_reader & operator=(binary_reader &&)=default
const bool is_little_endian
whether we can assume little endianess
Definition: json.hpp:10506
bool get_msgpack_string(string_t &result)
reads a MessagePack string
Definition: json.hpp:9561
bool get_ubjson_object()
Definition: json.hpp:10167
bool parse_msgpack_internal()
Definition: json.hpp:9181
typename BasicJsonType::number_float_t number_float_t
Definition: json.hpp:8112
bool get_ubjson_array()
Definition: json.hpp:10105
serialization to CBOR and MessagePack values
Definition: json.hpp:13132
void write_bson_array(const string_t &name, const typename BasicJsonType::array_t &value)
Writes a BSON element with key name and array value.
Definition: json.hpp:14177
void write_number_with_ubjson_prefix(const NumberType n, const bool add_prefix)
Definition: json.hpp:14366
void write_ubjson(const BasicJsonType &j, const bool use_count, const bool use_type, const bool add_prefix=true)
Definition: json.hpp:13801
static std::size_t calc_bson_entry_header_size(const string_t &name, const BasicJsonType &j)
Definition: json.hpp:14008
static constexpr CharType get_ubjson_float_prefix(double)
Definition: json.hpp:14591
void write_bson_entry_header(const string_t &name, const std::uint8_t element_type)
Writes the given element_type and name to the output adapter.
Definition: json.hpp:14022
static std::size_t calc_bson_element_size(const string_t &name, const BasicJsonType &j)
Calculates the size necessary to serialize the JSON value j with its name.
Definition: json.hpp:14211
void write_bson_double(const string_t &name, const double value)
Writes a BSON element with key name and double value value.
Definition: json.hpp:14044
void write_bson_object(const typename BasicJsonType::object_t &value)
Definition: json.hpp:14319
typename BasicJsonType::string_t string_t
Definition: json.hpp:13133
static constexpr CharType get_cbor_float_prefix(float)
Definition: json.hpp:14335
static constexpr CharType to_char_type(InputCharType x) noexcept
Definition: json.hpp:14684
typename BasicJsonType::binary_t binary_t
Definition: json.hpp:13134
binary_writer(output_adapter_t< CharType > adapter)
create a binary writer
Definition: json.hpp:13143
static constexpr CharType get_msgpack_float_prefix(double)
Definition: json.hpp:14354
CharType ubjson_prefix(const BasicJsonType &j) const noexcept
determine the type prefix of container values
Definition: json.hpp:14506
void write_bson_integer(const string_t &name, const std::int64_t value)
Writes a BSON element with key name and integer value.
Definition: json.hpp:14094
static CharType to_char_type(std::uint8_t x) noexcept
Definition: json.hpp:14662
void write_bson_string(const string_t &name, const string_t &value)
Writes a BSON element with key name and string value value.
Definition: json.hpp:14062
void write_bson_object_entry(const string_t &name, const typename BasicJsonType::object_t &value)
Writes a BSON element with key name and object value.
Definition: json.hpp:14144
static constexpr CharType get_ubjson_float_prefix(float)
Definition: json.hpp:14586
void write_number(const NumberType n)
Definition: json.hpp:14612
void write_bson_element(const string_t &name, const BasicJsonType &j)
Serializes the JSON value j to BSON and associates it with the key name.
Definition: json.hpp:14258
void write_bson_binary(const string_t &name, const binary_t &value)
Writes a BSON element with key name and binary value value.
Definition: json.hpp:14196
void write_bson_null(const string_t &name)
Writes a BSON element with key name and null value.
Definition: json.hpp:14076
static std::size_t calc_bson_binary_size(const typename BasicJsonType::binary_t &value)
Definition: json.hpp:14169
void write_bson(const BasicJsonType &j)
Definition: json.hpp:13152
void write_cbor(const BasicJsonType &j)
Definition: json.hpp:13172
static constexpr std::size_t calc_bson_unsigned_size(const std::uint64_t value) noexcept
Definition: json.hpp:14112
static constexpr CharType to_char_type(std::uint8_t x) noexcept
Definition: json.hpp:14655
typename BasicJsonType::number_float_t number_float_t
Definition: json.hpp:13135
void write_bson_unsigned(const string_t &name, const BasicJsonType &j)
Writes a BSON element with key name and unsigned value.
Definition: json.hpp:14122
static std::size_t calc_bson_object_size(const typename BasicJsonType::object_t &value)
Calculates the size of the BSON serialization of the given JSON-object j.
Definition: json.hpp:14304
static constexpr CharType get_msgpack_float_prefix(float)
Definition: json.hpp:14349
void write_bson_boolean(const string_t &name, const bool value)
Writes a BSON element with key name and boolean value value.
Definition: json.hpp:14034
void write_msgpack(const BasicJsonType &j)
Definition: json.hpp:13477
void write_compact_float(const number_float_t n, detail::input_format_t format)
Definition: json.hpp:14628
static std::size_t calc_bson_string_size(const string_t &value)
Definition: json.hpp:14054
static std::size_t calc_bson_integer_size(const std::int64_t value)
Definition: json.hpp:14084
static std::size_t calc_bson_array_size(const typename BasicJsonType::array_t &value)
Definition: json.hpp:14154
static constexpr CharType get_cbor_float_prefix(double)
Definition: json.hpp:14340
general exception of the basic_json class
Definition: json.hpp:2637
const char * what() const noexcept override
returns the explanatory string
Definition: json.hpp:2640
const int id
the id of the exception
Definition: json.hpp:2646
static std::string diagnostics(const BasicJsonType &leaf_element)
Definition: json.hpp:2658
static std::string name(const std::string &ename, int id_)
Definition: json.hpp:2652
std::runtime_error m
an exception object as storage for error messages
Definition: json.hpp:2715
exception indicating errors with iterators
Definition: json.hpp:2852
static invalid_iterator create(int id_, const std::string &what_arg, const BasicJsonType &context)
Definition: json.hpp:2855
invalid_iterator(int id_, const char *what_arg)
Definition: json.hpp:2863
a template for a bidirectional iterator for the basic_json class This class implements a both iterato...
Definition: json.hpp:11218
bool operator<(const iter_impl &other) const
comparison: smaller
Definition: json.hpp:11619
iter_impl operator-(difference_type i) const
subtract from iterator
Definition: json.hpp:11733
const object_t::key_type & key() const
return the key of an object iterator
Definition: json.hpp:11796
bool operator!=(const IterImpl &other) const
comparison: not equal
Definition: json.hpp:11610
iter_impl const operator--(int)
post-decrement (it–)
Definition: json.hpp:11538
void set_end() noexcept
set the iterator past the last value
Definition: json.hpp:11393
typename BasicJsonType::difference_type difference_type
a type to represent differences between iterators
Definition: json.hpp:11245
iter_impl & operator+=(difference_type i)
add to iterator
Definition: json.hpp:11673
difference_type operator-(const iter_impl &other) const
return difference
Definition: json.hpp:11744
typename std::conditional< std::is_const< BasicJsonType >::value, typename BasicJsonType::const_reference, typename BasicJsonType::reference >::type reference
defines a reference to the type iterated over (value_type)
Definition: json.hpp:11254
reference operator*() const
return a reference to the value pointed to by the iterator
Definition: json.hpp:11424
iter_impl(iter_impl &&) noexcept=default
bool operator>=(const iter_impl &other) const
comparison: greater than or equal
Definition: json.hpp:11664
typename std::conditional< std::is_const< BasicJsonType >::value, typename BasicJsonType::const_pointer, typename BasicJsonType::pointer >::type pointer
defines a pointer to the type iterated over (value_type)
Definition: json.hpp:11249
pointer operator->() const
dereference the iterator
Definition: json.hpp:11461
iter_impl & operator=(const iter_impl< typename std::remove_const< BasicJsonType >::type > &other) noexcept
converting assignment
Definition: json.hpp:11344
iter_impl(const iter_impl< const BasicJsonType > &other) noexcept
const copy constructor
Definition: json.hpp:11309
iter_impl const operator++(int)
post-increment (it++)
Definition: json.hpp:11495
iter_impl & operator--()
pre-decrement (–it)
Definition: json.hpp:11549
iter_impl(const iter_impl< typename std::remove_const< BasicJsonType >::type > &other) noexcept
converting constructor
Definition: json.hpp:11334
internal_iterator< typename std::remove_const< BasicJsonType >::type > m_it
the actual iterator of the associated instance
Definition: json.hpp:11821
iter_impl operator+(difference_type i) const
add to iterator
Definition: json.hpp:11711
friend iter_impl operator+(difference_type i, const iter_impl &it)
addition of distance and iterator
Definition: json.hpp:11722
iter_impl & operator=(const iter_impl< const BasicJsonType > &other) noexcept
converting assignment
Definition: json.hpp:11319
bool operator==(const IterImpl &other) const
comparison: equal
Definition: json.hpp:11582
bool operator>(const iter_impl &other) const
comparison: greater than
Definition: json.hpp:11655
typename BasicJsonType::value_type value_type
the type of the values when the iterator is dereferenced
Definition: json.hpp:11243
reference value() const
return the value of an iterator
Definition: json.hpp:11812
typename BasicJsonType::object_t object_t
Definition: json.hpp:11227
friend other_iter_impl
allow basic_json to access private members
Definition: json.hpp:11222
iter_impl & operator-=(difference_type i)
subtract from iterator
Definition: json.hpp:11702
iter_impl & operator++()
pre-increment (++it)
Definition: json.hpp:11506
friend BasicJsonType
Definition: json.hpp:11223
reference operator[](difference_type n) const
access to successor
Definition: json.hpp:11765
bool operator<=(const iter_impl &other) const
comparison: less than or equal
Definition: json.hpp:11646
std::bidirectional_iterator_tag iterator_category
Definition: json.hpp:11240
typename BasicJsonType::array_t array_t
Definition: json.hpp:11228
Definition: json.hpp:4201
IteratorType anchor
the iterator
Definition: json.hpp:4212
iteration_proxy_value & operator*()
dereference operator (needed for range-based for)
Definition: json.hpp:4228
std::input_iterator_tag iterator_category
Definition: json.hpp:4207
typename std::remove_cv< typename std::remove_reference< decltype(std::declval< IteratorType >().key()) >::type >::type string_type
Definition: json.hpp:4208
const string_type empty_str
an empty string (to return a reference for primitive values)
Definition: json.hpp:4220
iteration_proxy_value(IteratorType it) noexcept
Definition: json.hpp:4223
bool operator!=(const iteration_proxy_value &o) const
inequality operator (needed for range-based for)
Definition: json.hpp:4249
std::size_t array_index_last
last stringified array index
Definition: json.hpp:4216
string_type array_index_str
a string representation of the array index
Definition: json.hpp:4218
IteratorType::reference value() const
return value of the iterator
Definition: json.hpp:4283
std::size_t array_index
an index for arrays (used to create key names)
Definition: json.hpp:4214
std::ptrdiff_t difference_type
Definition: json.hpp:4203
iteration_proxy_value & operator++()
increment operator (needed for range-based for)
Definition: json.hpp:4234
const string_type & key() const
return key of the iterator
Definition: json.hpp:4255
bool operator==(const iteration_proxy_value &o) const
equality operator (needed for InputIterator)
Definition: json.hpp:4243
proxy class for the items() function
Definition: json.hpp:4291
iteration_proxy_value< IteratorType > begin() noexcept
return iterator begin (needed for range-based for)
Definition: json.hpp:4302
IteratorType::reference container
the container to iterate
Definition: json.hpp:4294
iteration_proxy_value< IteratorType > end() noexcept
return iterator end (needed for range-based for)
Definition: json.hpp:4308
iteration_proxy(typename IteratorType::reference cont) noexcept
construct iteration proxy from a container
Definition: json.hpp:4298
Definition: json.hpp:12906
value_type const * value_ref
Definition: json.hpp:12957
json_ref(json_ref &&) noexcept=default
value_type owned_value
Definition: json.hpp:12956
BasicJsonType value_type
Definition: json.hpp:12908
json_ref(Args &&... args)
Definition: json.hpp:12925
json_ref(const value_type &value)
Definition: json.hpp:12914
value_type const & operator*() const
Definition: json.hpp:12945
value_type const * operator->() const
Definition: json.hpp:12950
json_ref(std::initializer_list< json_ref > init)
Definition: json.hpp:12918
json_ref(value_type &&value)
Definition: json.hpp:12910
value_type moved_or_copied() const
Definition: json.hpp:12936
a template for a reverse iterator class
Definition: json.hpp:11863
json_reverse_iterator(const typename base_iterator::iterator_type &it) noexcept
create reverse iterator from iterator
Definition: json.hpp:11872
json_reverse_iterator & operator--()
pre-decrement (–it)
Definition: json.hpp:11897
json_reverse_iterator & operator++()
pre-increment (++it)
Definition: json.hpp:11885
json_reverse_iterator const operator--(int)
post-decrement (it–)
Definition: json.hpp:11891
typename Base::reference reference
the reference type for the pointed-to element
Definition: json.hpp:11869
json_reverse_iterator & operator+=(difference_type i)
add to iterator
Definition: json.hpp:11903
json_reverse_iterator operator-(difference_type i) const
subtract from iterator
Definition: json.hpp:11915
std::reverse_iterator< Base > base_iterator
shortcut to the reverse iterator adapter
Definition: json.hpp:11867
json_reverse_iterator(const base_iterator &it) noexcept
create reverse iterator from base class
Definition: json.hpp:11876
reference operator[](difference_type n) const
access to successor
Definition: json.hpp:11927
std::ptrdiff_t difference_type
Definition: json.hpp:11865
difference_type operator-(const json_reverse_iterator &other) const
return difference
Definition: json.hpp:11921
json_reverse_iterator operator+(difference_type i) const
add to iterator
Definition: json.hpp:11909
json_reverse_iterator const operator++(int)
post-increment (it++)
Definition: json.hpp:11879
auto key() const -> decltype(std::declval< Base >().key())
return the key of an object iterator
Definition: json.hpp:11933
reference value() const
return the value of an iterator
Definition: json.hpp:11940
Definition: json.hpp:6212
bool end_array()
Definition: json.hpp:6275
typename BasicJsonType::string_t string_t
Definition: json.hpp:6217
bool binary(binary_t &)
Definition: json.hpp:6250
bool boolean(bool)
Definition: json.hpp:6225
typename BasicJsonType::number_integer_t number_integer_t
Definition: json.hpp:6214
typename BasicJsonType::number_float_t number_float_t
Definition: json.hpp:6216
typename BasicJsonType::binary_t binary_t
Definition: json.hpp:6218
bool key(string_t &)
Definition: json.hpp:6260
bool start_object(std::size_t=std::size_t(-1))
Definition: json.hpp:6255
bool start_array(std::size_t=std::size_t(-1))
Definition: json.hpp:6270
bool end_object()
Definition: json.hpp:6265
bool parse_error(std::size_t, const std::string &, const detail::exception &)
Definition: json.hpp:6280
bool number_integer(number_integer_t)
Definition: json.hpp:6230
bool string(string_t &)
Definition: json.hpp:6245
bool number_unsigned(number_unsigned_t)
Definition: json.hpp:6235
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition: json.hpp:6215
bool number_float(number_float_t, const string_t &)
Definition: json.hpp:6240
Definition: json.hpp:5905
typename BasicJsonType::string_t string_t
Definition: json.hpp:5910
bool start_object(std::size_t len)
Definition: json.hpp:5972
bool key(string_t &val)
Definition: json.hpp:5990
constexpr bool is_errored() const
Definition: json.hpp:6105
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition: json.hpp:5908
typename BasicJsonType::number_integer_t number_integer_t
Definition: json.hpp:5907
typename BasicJsonType::parser_callback_t parser_callback_t
Definition: json.hpp:5912
bool start_array(std::size_t len)
Definition: json.hpp:6043
~json_sax_dom_callback_parser()=default
json_sax_dom_callback_parser(const json_sax_dom_callback_parser &)=delete
typename BasicJsonType::binary_t binary_t
Definition: json.hpp:5911
json_sax_dom_callback_parser & operator=(const json_sax_dom_callback_parser &)=delete
json_sax_dom_callback_parser & operator=(json_sax_dom_callback_parser &&)=default
bool binary(binary_t &val)
Definition: json.hpp:5966
bool number_integer(number_integer_t val)
Definition: json.hpp:5942
BasicJsonType & root
the parsed JSON value
Definition: json.hpp:6191
std::pair< bool, BasicJsonType * > handle_value(Value &&v, const bool skip_callback=false)
Definition: json.hpp:6127
typename BasicJsonType::number_float_t number_float_t
Definition: json.hpp:5909
bool end_array()
Definition: json.hpp:6060
typename BasicJsonType::parse_event_t parse_event_t
Definition: json.hpp:5913
bool boolean(bool val)
Definition: json.hpp:5936
bool number_unsigned(number_unsigned_t val)
Definition: json.hpp:5948
bool string(string_t &val)
Definition: json.hpp:5960
bool number_float(number_float_t val, const string_t &)
Definition: json.hpp:5954
bool end_object()
Definition: json.hpp:6007
json_sax_dom_callback_parser(json_sax_dom_callback_parser &&)=default
bool parse_error(std::size_t, const std::string &, const Exception &ex)
Definition: json.hpp:6093
json_sax_dom_callback_parser(BasicJsonType &r, const parser_callback_t cb, const bool allow_exceptions_=true)
Definition: json.hpp:5915
SAX implementation to create a JSON value from SAX events.
Definition: json.hpp:5731
bool start_array(std::size_t len)
Definition: json.hpp:5823
json_sax_dom_parser(const json_sax_dom_parser &)=delete
typename BasicJsonType::binary_t binary_t
Definition: json.hpp:5737
bool number_unsigned(number_unsigned_t val)
Definition: json.hpp:5773
typename BasicJsonType::number_integer_t number_integer_t
Definition: json.hpp:5733
bool boolean(bool val)
Definition: json.hpp:5761
~json_sax_dom_parser()=default
bool parse_error(std::size_t, const std::string &, const Exception &ex)
Definition: json.hpp:5843
bool string(string_t &val)
Definition: json.hpp:5785
bool end_object()
Definition: json.hpp:5816
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition: json.hpp:5734
json_sax_dom_parser & operator=(const json_sax_dom_parser &)=delete
bool start_object(std::size_t len)
Definition: json.hpp:5797
JSON_HEDLEY_RETURNS_NON_NULL BasicJsonType * handle_value(Value &&v)
Definition: json.hpp:5869
bool binary(binary_t &val)
Definition: json.hpp:5791
constexpr bool is_errored() const
Definition: json.hpp:5855
bool key(string_t &val)
Definition: json.hpp:5809
json_sax_dom_parser(json_sax_dom_parser &&)=default
typename BasicJsonType::number_float_t number_float_t
Definition: json.hpp:5735
BasicJsonType & root
the parsed JSON value
Definition: json.hpp:5892
bool number_float(number_float_t val, const string_t &)
Definition: json.hpp:5779
bool end_array()
Definition: json.hpp:5835
json_sax_dom_parser(BasicJsonType &r, const bool allow_exceptions_=true)
Definition: json.hpp:5744
typename BasicJsonType::string_t string_t
Definition: json.hpp:5736
bool number_integer(number_integer_t val)
Definition: json.hpp:5767
json_sax_dom_parser & operator=(json_sax_dom_parser &&)=default
Definition: json.hpp:6319
token_type
token types for the parser
Definition: json.hpp:6323
@ value_float
an floating point number – use get_number_float() for actual value
@ begin_array
the character for array begin [
@ value_string
a string – use get_string() for actual value
@ end_array
the character for array end ]
@ uninitialized
indicating the scanner is uninitialized
@ parse_error
indicating a parse error
@ value_integer
a signed integer – use get_number_integer() for actual value
@ value_separator
the value separator ,
@ end_object
the character for object end }
@ literal_true
the true literal
@ begin_object
the character for object begin {
@ value_unsigned
an unsigned integer – use get_number_unsigned() for actual value
@ literal_null
the null literal
@ end_of_input
indicating the end of the input buffer
@ name_separator
the name separator :
@ literal_or_value
a literal or the begin of a value (only for diagnostics)
@ literal_false
the false literal
JSON_HEDLEY_RETURNS_NON_NULL static JSON_HEDLEY_CONST const char * token_type_name(const token_type t) noexcept
return name of values of type token_type (only used for errors)
Definition: json.hpp:6346
lexical analysis
Definition: json.hpp:6396
number_float_t value_float
Definition: json.hpp:7909
const bool ignore_comments
whether comments should be ignored (true) or signaled as errors (false)
Definition: json.hpp:7886
lexer & operator=(lexer &&)=default
void add(char_int_type c)
add a character to token_buffer
Definition: json.hpp:7685
void reset() noexcept
reset token_buffer; current character is beginning of token
Definition: json.hpp:7604
token_type scan()
Definition: json.hpp:7793
bool next_unget
whether the next get() call should just return current
Definition: json.hpp:7892
char_int_type current
the current character
Definition: json.hpp:7889
typename BasicJsonType::number_float_t number_float_t
Definition: json.hpp:6399
void skip_whitespace()
Definition: json.hpp:7784
typename std::char_traits< char_type >::int_type char_int_type
Definition: json.hpp:6402
static JSON_HEDLEY_PURE char get_decimal_point() noexcept
return the locale-dependent decimal point
Definition: json.hpp:6427
number_integer_t value_integer
Definition: json.hpp:7907
InputAdapterType ia
input adapter
Definition: json.hpp:7883
typename BasicJsonType::number_integer_t number_integer_t
Definition: json.hpp:6397
static void strtof(float &f, const char *str, char **endptr) noexcept
Definition: json.hpp:7196
const char_int_type decimal_point_char
the decimal point
Definition: json.hpp:7912
string_t & get_string()
return current string value (implicitly resets the token; useful only once)
Definition: json.hpp:7714
bool skip_bom()
skip the UTF-8 byte order mark
Definition: json.hpp:7770
const char * error_message
a description of occurred lexer errors
Definition: json.hpp:7904
lexer(InputAdapterType &&adapter, bool ignore_comments_=false) noexcept
Definition: json.hpp:6407
position_t position
the start position of the current token
Definition: json.hpp:7895
constexpr position_t get_position() const noexcept
return position of last read token
Definition: json.hpp:7724
std::vector< char_type > token_string
raw input token string (for error messages)
Definition: json.hpp:7898
constexpr number_integer_t get_number_integer() const noexcept
return integer value
Definition: json.hpp:7696
constexpr JSON_HEDLEY_RETURNS_NON_NULL const char * get_error_message() const noexcept
return syntax error message
Definition: json.hpp:7757
typename lexer_base< BasicJsonType >::token_type token_type
Definition: json.hpp:6405
typename InputAdapterType::char_type char_type
Definition: json.hpp:6401
char_int_type get()
Definition: json.hpp:7621
token_type scan_number()
scan a number literal
Definition: json.hpp:7253
void unget()
unget current character (read it again on next get)
Definition: json.hpp:7658
token_type scan_string()
scan a string literal
Definition: json.hpp:6538
lexer(const lexer &)=delete
constexpr number_unsigned_t get_number_unsigned() const noexcept
return unsigned integer value
Definition: json.hpp:7702
string_t token_buffer
buffer for variable-length tokens (numbers, strings)
Definition: json.hpp:7901
token_type scan_literal(const char_type *literal_text, const std::size_t length, token_type return_type)
Definition: json.hpp:7584
constexpr number_float_t get_number_float() const noexcept
return floating-point value
Definition: json.hpp:7708
int get_codepoint()
get codepoint from 4 hex characters following \u
Definition: json.hpp:6453
std::string get_token_string() const
Definition: json.hpp:7732
number_unsigned_t value_unsigned
Definition: json.hpp:7908
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition: json.hpp:6398
bool next_byte_in_range(std::initializer_list< char_int_type > ranges)
check if the next byte(s) are inside a given range
Definition: json.hpp:6501
lexer & operator=(lexer &)=delete
typename BasicJsonType::string_t string_t
Definition: json.hpp:6400
bool scan_comment()
scan a comment
Definition: json.hpp:7128
exception indicating other library errors
Definition: json.hpp:2994
static other_error create(int id_, const std::string &what_arg, const BasicJsonType &context)
Definition: json.hpp:2997
other_error(int id_, const char *what_arg)
Definition: json.hpp:3005
exception indicating access out of the defined range
Definition: json.hpp:2955
static out_of_range create(int id_, const std::string &what_arg, const BasicJsonType &context)
Definition: json.hpp:2958
out_of_range(int id_, const char *what_arg)
Definition: json.hpp:2966
Definition: json.hpp:13096
output_adapter(std::vector< CharType > &vec)
Definition: json.hpp:13098
output_adapter(std::basic_ostream< CharType > &s)
Definition: json.hpp:13101
output_adapter(StringType &s)
Definition: json.hpp:13104
output adapter for output streams
Definition: json.hpp:13049
void write_character(CharType c) override
Definition: json.hpp:13055
std::basic_ostream< CharType > & stream
Definition: json.hpp:13067
output_stream_adapter(std::basic_ostream< CharType > &s) noexcept
Definition: json.hpp:13051
output adapter for basic_string
Definition: json.hpp:13073
void write_character(CharType c) override
Definition: json.hpp:13079
StringType & str
Definition: json.hpp:13091
output_string_adapter(StringType &s) noexcept
Definition: json.hpp:13075
output adapter for byte vectors
Definition: json.hpp:13025
std::vector< CharType > & v
Definition: json.hpp:13043
output_vector_adapter(std::vector< CharType > &vec) noexcept
Definition: json.hpp:13027
void write_character(CharType c) override
Definition: json.hpp:13031
exception indicating a parse error
Definition: json.hpp:2764
parse_error(int id_, std::size_t byte_, const char *what_arg)
Definition: json.hpp:2804
static parse_error create(int id_, std::size_t byte_, const std::string &what_arg, const BasicJsonType &context)
Definition: json.hpp:2784
const std::size_t byte
byte index of the parse error
Definition: json.hpp:2801
static parse_error create(int id_, const position_t &pos, const std::string &what_arg, const BasicJsonType &context)
create a parse error exception
Definition: json.hpp:2776
static std::string position_string(const position_t &pos)
Definition: json.hpp:2807
syntax analysis
Definition: json.hpp:10578
lexer_t m_lexer
the lexer
Definition: json.hpp:11011
bool sax_parse(SAX *sax, const bool strict=true)
Definition: json.hpp:10678
token_type get_token()
get next token from lexer
Definition: json.hpp:10971
token_type last_token
the type of the last read token
Definition: json.hpp:11009
parser(InputAdapterType &&adapter, const parser_callback_t< BasicJsonType > cb=nullptr, const bool allow_exceptions_=true, const bool skip_comments=false)
a parser reading from an input adapter
Definition: json.hpp:10588
bool accept(const bool strict=true)
public accept interface
Definition: json.hpp:10670
typename BasicJsonType::string_t string_t
Definition: json.hpp:10582
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition: json.hpp:10580
typename lexer_t::token_type token_type
Definition: json.hpp:10584
bool sax_parse_internal(SAX *sax)
Definition: json.hpp:10697
const parser_callback_t< BasicJsonType > callback
callback function
Definition: json.hpp:11007
void parse(const bool strict, BasicJsonType &result)
public parser interface
Definition: json.hpp:10610
std::string exception_message(const token_type expected, const std::string &context)
Definition: json.hpp:10976
typename BasicJsonType::number_float_t number_float_t
Definition: json.hpp:10581
const bool allow_exceptions
whether to throw exceptions in case of errors
Definition: json.hpp:11013
typename BasicJsonType::number_integer_t number_integer_t
Definition: json.hpp:10579
Definition: json.hpp:11045
primitive_iterator_t operator+(difference_type n) noexcept
Definition: json.hpp:11095
primitive_iterator_t & operator-=(difference_type n) noexcept
Definition: json.hpp:11139
constexpr bool is_end() const noexcept
return whether the iterator is at end
Definition: json.hpp:11080
constexpr friend bool operator<(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
Definition: json.hpp:11090
constexpr friend difference_type operator-(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
Definition: json.hpp:11102
constexpr bool is_begin() const noexcept
return whether the iterator can be dereferenced
Definition: json.hpp:11074
void set_begin() noexcept
set iterator to a defined beginning
Definition: json.hpp:11062
primitive_iterator_t const operator++(int) noexcept
Definition: json.hpp:11113
static constexpr difference_type end_value
Definition: json.hpp:11049
primitive_iterator_t & operator--() noexcept
Definition: json.hpp:11120
primitive_iterator_t & operator++() noexcept
Definition: json.hpp:11107
void set_end() noexcept
set iterator to a defined past the end
Definition: json.hpp:11068
constexpr difference_type get_value() const noexcept
Definition: json.hpp:11056
primitive_iterator_t & operator+=(difference_type n) noexcept
Definition: json.hpp:11133
primitive_iterator_t const operator--(int) noexcept
Definition: json.hpp:11126
std::ptrdiff_t difference_type
Definition: json.hpp:11047
constexpr friend bool operator==(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
Definition: json.hpp:11085
static constexpr difference_type begin_value
Definition: json.hpp:11048
Definition: json.hpp:15853
const error_handler_t error_handler
error_handler how to react on decoding errors
Definition: json.hpp:16763
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition: json.hpp:15857
const std::lconv * loc
the locale
Definition: json.hpp:16748
std::array< char, 64 > number_buffer
a (hopefully) large enough character buffer
Definition: json.hpp:16745
static constexpr std::uint8_t UTF8_ACCEPT
Definition: json.hpp:15859
serializer(serializer &&)=delete
const char decimal_point
the locale's decimal point character
Definition: json.hpp:16752
std::uint8_t state
Definition: json.hpp:16195
std::size_t bytes
Definition: json.hpp:16196
typename BasicJsonType::number_float_t number_float_t
Definition: json.hpp:15855
serializer & operator=(const serializer &)=delete
const char thousands_sep
the locale's thousand separator character
Definition: json.hpp:16750
std::size_t undumped_chars
Definition: json.hpp:16200
static constexpr std::uint8_t UTF8_REJECT
Definition: json.hpp:15860
void dump(const BasicJsonType &val, const bool pretty_print, const bool ensure_ascii, const unsigned int indent_step, const unsigned int current_indent=0)
internal implementation of the serialization function
Definition: json.hpp:15908
const char indent_char
the indentation character
Definition: json.hpp:16758
std::size_t bytes_after_last_accept
Definition: json.hpp:16199
std::array< char, 512 > string_buffer
string buffer
Definition: json.hpp:16755
typename BasicJsonType::binary_t::value_type binary_char_t
Definition: json.hpp:15858
JSON_PRIVATE_UNLESS_TESTED const bool ensure_ascii
Definition: json.hpp:16193
serializer(output_adapter_t< char > s, const char ichar, error_handler_t error_handler_=error_handler_t::strict)
Definition: json.hpp:15868
serializer & operator=(serializer &&)=delete
typename BasicJsonType::string_t string_t
Definition: json.hpp:15854
serializer(const serializer &)=delete
typename BasicJsonType::number_integer_t number_integer_t
Definition: json.hpp:15856
string_t indent_string
the indentation string
Definition: json.hpp:16760
exception indicating executing a member function with a wrong type
Definition: json.hpp:2907
static type_error create(int id_, const std::string &what_arg, const BasicJsonType &context)
Definition: json.hpp:2910
type_error(int id_, const char *what_arg)
Definition: json.hpp:2918
JSON Pointer.
Definition: json.hpp:11975
std::vector< std::string > reference_tokens
the reference tokens
Definition: json.hpp:12887
JSON_PRIVATE_UNLESS_TESTED JSON pointer has no BasicJsonType()))
const std::string & back() const
return last reference token
Definition: json.hpp:12226
BasicJsonType & get_checked(BasicJsonType *ptr) const
Definition: json.hpp:12485
std::string to_string() const
return a string representation of the JSON pointer
Definition: json.hpp:12020
friend bool operator==(json_pointer const &lhs, json_pointer const &rhs) noexcept
compares two JSON pointers for equality
Definition: json.hpp:12863
result reference_tokens
Definition: json.hpp:12341
void pop_back()
remove last reference token
Definition: json.hpp:12202
const BasicJsonType & get_checked(const BasicJsonType *ptr) const
Definition: json.hpp:12574
BasicJsonType & get_unchecked(BasicJsonType *ptr) const
return a reference to the pointed to value
Definition: json.hpp:12426
BasicJsonType & get_and_create(BasicJsonType &j) const
create and return a reference to the pointed to value
Definition: json.hpp:12354
bool empty() const noexcept
return whether pointer points to the root document
Definition: json.hpp:12273
friend bool operator!=(json_pointer const &lhs, json_pointer const &rhs) noexcept
compares two JSON pointers for inequality
Definition: json.hpp:12880
void push_back(const std::string &token)
append an unescaped token at the end of the reference pointer
Definition: json.hpp:12248
json_pointer & operator/=(const json_pointer &ptr)
append another JSON pointer at the end of this JSON pointer
Definition: json.hpp:12052
json_pointer & operator/=(std::size_t array_idx)
append an array index at the end of this JSON pointer
Definition: json.hpp:12098
json_pointer(const std::string &s="")
create JSON pointer
Definition: json.hpp:12002
return result
Definition: json.hpp:12342
friend json_pointer operator/(const json_pointer &lhs, const json_pointer &rhs)
create a new JSON pointer by appending the right JSON pointer at the end of the left JSON pointer
Definition: json.hpp:12118
bool contains(const BasicJsonType *ptr) const
Definition: json.hpp:12614
static BasicJsonType unflatten(const BasicJsonType &value)
Definition: json.hpp:12825
friend json_pointer operator/(const json_pointer &ptr, std::string token)
create a new JSON pointer by appending the unescaped token at the end of the JSON pointer
Definition: json.hpp:12139
static void flatten(const std::string &reference_string, const BasicJsonType &value, BasicJsonType &result)
Definition: json.hpp:12762
json_pointer & operator/=(std::string token)
append an unescaped reference token at the end of this JSON pointer
Definition: json.hpp:12076
void push_back(std::string &&token)
append an unescaped token at the end of the reference pointer
Definition: json.hpp:12254
const BasicJsonType & get_unchecked(const BasicJsonType *ptr) const
return a const reference to the pointed to value
Definition: json.hpp:12534
static std::vector< std::string > split(const std::string &reference_string)
split the string input to reference tokens
Definition: json.hpp:12694
static BasicJsonType::size_type array_index(const std::string &s)
Definition: json.hpp:12289
json_pointer result
Definition: json.hpp:12340
friend json_pointer operator/(const json_pointer &ptr, std::size_t array_idx)
create a new JSON pointer by appending the array-index-token at the end of the JSON pointer
Definition: json.hpp:12159
json_pointer parent_pointer() const
returns the parent of this JSON pointer
Definition: json.hpp:12177
Concept for allocating, resizing and freeing memory block.
decltype(get< N >(std::declval< ::nlohmann::detail::iteration_proxy_value< IteratorType > >())) type
Definition: json.hpp:5695
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2117
v1d & operator+=(v1d &a, cv1d &b)
Definition: Tools.cpp:29
v1d operator-(v1d a, double &b)
Definition: Tools.cpp:17
@ pos
Definition: Typedefs.h:19
v1d operator+(v1d a, double b)
Definition: Tools.cpp:13
std::string decode(std::string const &encoded_string)
Definition: base64.hpp:89
type
The type the bitset is encoded with.
Definition: bitset.hpp:44
C const & container(std::queue< T, C > const &queue)
Allows access to the protected container in queue.
Definition: queue.hpp:48
CEREAL_SIZE_TYPE size_type
The size type used by cereal.
Definition: helpers.hpp:61
detail namespace with internal helper functions
Definition: json.hpp:260
typename std::enable_if< B, T >::type enable_if_t
Definition: json.hpp:3225
void grisu2(char *buf, int &len, int &decimal_exponent, diyfp m_minus, diyfp v, diyfp m_plus)
Definition: json.hpp:15537
Target reinterpret_bits(const Source source)
Definition: json.hpp:14757
boundaries compute_boundaries(FloatType value)
Definition: json.hpp:14898
int find_largest_pow10(const std::uint32_t n, std::uint32_t &pow10)
Definition: json.hpp:15201
constexpr int kGamma
Definition: json.hpp:15021
void grisu2_round(char *buf, int len, std::uint64_t dist, std::uint64_t delta, std::uint64_t rest, std::uint64_t ten_k)
Definition: json.hpp:15255
void grisu2_digit_gen(char *buffer, int &length, int &decimal_exponent, diyfp M_minus, diyfp w, diyfp M_plus)
Definition: json.hpp:15296
JSON_HEDLEY_RETURNS_NON_NULL char * format_buffer(char *buf, int len, int decimal_exponent, int min_exp, int max_exp)
prettify v = buf * 10^decimal_exponent
Definition: json.hpp:15689
constexpr int kAlpha
Definition: json.hpp:15020
JSON_HEDLEY_RETURNS_NON_NULL char * append_exponent(char *buf, int e)
appends a decimal representation of e to buf
Definition: json.hpp:15637
cached_power get_cached_power_for_binary_exponent(int e)
Definition: json.hpp:15037
typename std::enable_if< B, T >::type enable_if_t
Definition: json.hpp:3042
typename T::reference reference_t
Definition: json.hpp:3454
bool operator<(const value_t lhs, const value_t rhs) noexcept
comparison operator for JSON types
Definition: json.hpp:144
static void unescape(std::string &s)
string unescaping as described in RFC 6901 (Sect. 4)
Definition: json.hpp:2559
decltype(T::from_json(std::declval< Args >()...)) from_json_function
Definition: json.hpp:3466
void to_json(BasicJsonType &j, T b) noexcept
Definition: json.hpp:4580
value_t
the JSON type enumeration
Definition: json.hpp:118
@ number_integer
number value (signed integer)
@ discarded
discarded by the parser callback function
@ binary
binary array (ordered collection of bytes)
@ object
object (unordered set of name/value pairs)
@ number_float
number value (floating-point)
@ number_unsigned
number value (unsigned integer)
@ array
array (ordered collection of values)
void from_json(const BasicJsonType &j, typename std::nullptr_t &n)
Definition: json.hpp:3785
make_index_sequence< sizeof...(Ts)> index_sequence_for
Definition: json.hpp:3146
decltype(std::declval< T & >().parse_error(std::declval< std::size_t >(), std::declval< const std::string & >(), std::declval< const Exception & >())) parse_error_function_t
Definition: json.hpp:7983
typename T::pointer pointer_t
Definition: json.hpp:3451
decltype(std::declval< T & >().string(std::declval< String & >())) string_function_t
Definition: json.hpp:7956
void from_json_tuple_impl(const BasicJsonType &j, Tuple &t, index_sequence< Idx... >)
Definition: json.hpp:4091
std::function< bool(int, parse_event_t, BasicJsonType &)> parser_callback_t
Definition: json.hpp:10569
parse_event_t
Definition: json.hpp:10552
@ value
the parser finished reading a JSON value
@ key
the parser read a key of a value in an object
@ array_end
the parser read ] and finished processing a JSON array
@ array_start
the parser read [ and started to process a JSON array
@ object_start
the parser read { and started to process a JSON object
@ object_end
the parser read } and finished processing a JSON object
typename T::difference_type difference_type_t
Definition: json.hpp:3448
typename detector< nonesuch, void, Op, Args... >::type detected_t
Definition: json.hpp:3293
void int_to_string(string_type &target, std::size_t value)
Definition: json.hpp:4194
void from_json_array_impl(const BasicJsonType &j, typename BasicJsonType::array_t &arr, priority_tag< 3 >)
Definition: json.hpp:3933
integer_sequence< size_t, Ints... > index_sequence
Definition: json.hpp:3084
decltype(std::declval< T & >().key(std::declval< String & >())) key_function_t
Definition: json.hpp:7968
decltype(std::declval< T & >().boolean(std::declval< bool >())) boolean_function_t
Definition: json.hpp:7940
decltype(std::declval< T & >().binary(std::declval< Binary & >())) binary_function_t
Definition: json.hpp:7960
decltype(std::declval< T & >().number_integer(std::declval< Integer >())) number_integer_function_t
Definition: json.hpp:7944
void to_json_tuple_impl(BasicJsonType &j, const Tuple &t, index_sequence< Idx... >)
Definition: json.hpp:4703
std::is_convertible< detected_t< Op, Args... >, To > is_detected_convertible
Definition: json.hpp:3306
typename std::remove_cv< typename std::remove_reference< T >::type >::type uncvref_t
Definition: json.hpp:3028
cbor_tag_handler_t
how to treat CBOR tags
Definition: json.hpp:8082
@ error
throw a parse_error exception in case of a tag
error_handler_t
how to treat decoding errors
Definition: json.hpp:15845
@ strict
throw a type_error exception in case of invalid UTF-8
@ ignore
ignore invalid UTF-8 sequences
@ replace
replace invalid UTF-8 sequences with U+FFFD
decltype(std::declval< T & >().start_object(std::declval< std::size_t >())) start_object_function_t
Definition: json.hpp:7964
typename T::key_type key_type_t
Definition: json.hpp:3442
std::size_t combine(std::size_t seed, std::size_t h) noexcept
Definition: json.hpp:4968
std::size_t hash(const BasicJsonType &j)
hash a JSON value
Definition: json.hpp:4986
JSON_HEDLEY_RETURNS_NON_NULL char * to_chars(char *first, const char *last, FloatType value)
generates a decimal representation of the floating-point number value in [first, last).
Definition: json.hpp:15774
typename utility_internal::Gen< T, N >::type make_integer_sequence
Definition: json.hpp:3130
decltype(std::declval< T & >().number_unsigned(std::declval< Unsigned >())) number_unsigned_function_t
Definition: json.hpp:7948
std::is_same< Expected, detected_t< Op, Args... > > is_detected_exact
Definition: json.hpp:3302
typename detected_or< Default, Op, Args... >::type detected_or_t
Definition: json.hpp:3299
decltype(std::declval< T & >().start_array(std::declval< std::size_t >())) start_array_function_t
Definition: json.hpp:7975
void get_arithmetic_value(const BasicJsonType &j, ArithmeticType &val)
Definition: json.hpp:3799
typename detector< nonesuch, void, Op, Args... >::value_t is_detected
Definition: json.hpp:3290
typename make_void< Ts... >::type void_t
Definition: json.hpp:3193
make_integer_sequence< size_t, N > make_index_sequence
Definition: json.hpp:3138
std::shared_ptr< output_adapter_protocol< CharType > > output_adapter_t
a type to simplify interfaces
Definition: json.hpp:13020
typename T::mapped_type mapped_type_t
Definition: json.hpp:3439
std::string escape(std::string s)
string escaping as described in RFC 6901 (Sect. 4)
Definition: json.hpp:2545
typename T::iterator iterator_t
Definition: json.hpp:3460
input_format_t
the supported input formats
Definition: json.hpp:5119
void to_json(BasicJsonType &j, const T &b)
Definition: json.hpp:4697
decltype(std::declval< T >().template get< U >()) get_template_function
Definition: json.hpp:3469
decltype(input_adapter(std::declval< const char * >(), std::declval< const char * >())) contiguous_bytes_input_adapter
Definition: json.hpp:5518
decltype(std::declval< T & >().null()) null_function_t
Definition: json.hpp:7936
auto get(const nlohmann::detail::iteration_proxy_value< IteratorType > &i) -> decltype(i.key())
Definition: json.hpp:4317
void replace_substring(std::string &s, const std::string &f, const std::string &t)
replace all occurrences of a substring by another string
Definition: json.hpp:2527
iterator_input_adapter_factory< IteratorType >::adapter_type input_adapter(IteratorType first, IteratorType last)
Definition: json.hpp:5463
typename T::iterator_category iterator_category_t
Definition: json.hpp:3457
static bool little_endianess(int num=1) noexcept
determine system byte order
Definition: json.hpp:8094
decltype(std::declval< T & >().number_float(std::declval< Float >(), std::declval< const String & >())) number_float_function_t
Definition: json.hpp:7952
decltype(std::declval< T & >().end_array()) end_array_function_t
Definition: json.hpp:7978
void from_json(const BasicJsonType &j, std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > &m)
Definition: json.hpp:4125
decltype(std::declval< T & >().end_object()) end_object_function_t
Definition: json.hpp:7971
decltype(T::to_json(std::declval< Args >()...)) to_json_function
Definition: json.hpp:3463
typename T::value_type value_type_t
Definition: json.hpp:3445
namespace for Niels Lohmann
Definition: json.hpp:86
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
Definition: json.hpp:25693
std::basic_string< PUGIXML_CHAR, std::char_traits< PUGIXML_CHAR >, std::allocator< PUGIXML_CHAR > > string_t
Definition: pugixml.hpp:141
Definition: json.hpp:5678
NLOHMANN_BASIC_JSON_TPL_DECLARATION void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL &j1, nlohmann::NLOHMANN_BASIC_JSON_TPL &j2) noexcept(//NOLINT(readability-inconsistent-declaration-parameter-name, cert-dcl58-cpp) is_nothrow_move_constructible< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value &&//NOLINT(misc-redundant-expression, cppcoreguidelines-noexcept-swap, performance-noexcept-swap) is_nothrow_move_assignable< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value)
exchanges the values of two JSON objects
Definition: json.hpp:25399
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1282
const GenericPointer< typename T::ValueType > & pointer
Definition: pointer.h:1181
const CharType(& source)[N]
Definition: pointer.h:1204
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1181
PUGI_IMPL_FN void reverse(I begin, I end)
Definition: pugixml.cpp:7615
PUGI_IMPL_FN bool is_little_endian()
Definition: pugixml.cpp:1931
signed short int16_t
Definition: stdint.h:122
unsigned short uint16_t
Definition: stdint.h:125
signed __int64 int64_t
Definition: stdint.h:135
unsigned int uint32_t
Definition: stdint.h:126
signed int int32_t
Definition: stdint.h:123
unsigned char uint8_t
Definition: stdint.h:124
unsigned __int64 uint64_t
Definition: stdint.h:136
signed char int8_t
Definition: stdint.h:121
namespace for Niels Lohmann
Definition: json.hpp:6181
BasicJsonType::array_t::iterator array_iterator
iterator for JSON arrays
Definition: json.hpp:13619
primitive_iterator_t primitive_iterator
generic iterator for all other types
Definition: json.hpp:13621
BasicJsonType::object_t::iterator object_iterator
iterator for JSON objects
Definition: json.hpp:13617
Definition: pugixml.cpp:7582
default JSONSerializer template argument
Definition: json.hpp:4740
static auto to_json(BasicJsonType &j, ValueType &&val) noexcept(noexcept(::nlohmann::to_json(j, std::forward< ValueType >(val)))) -> decltype(::nlohmann::to_json(j, std::forward< ValueType >(val)), void())
convert any value type to a JSON value
Definition: json.hpp:4768
static auto from_json(BasicJsonType &&j, ValueType &val) noexcept(noexcept(::nlohmann::from_json(std::forward< BasicJsonType >(j), val))) -> decltype(::nlohmann::from_json(std::forward< BasicJsonType >(j), val), void())
convert a JSON value to any value type
Definition: json.hpp:4751
Definition: json.hpp:3764
Definition: json.hpp:3763
Op< Args... > type
Definition: json.hpp:3286
std::true_type value_t
Definition: json.hpp:3285
Definition: json.hpp:3277
Default type
Definition: json.hpp:3279
std::false_type value_t
Definition: json.hpp:3278
Definition: json.hpp:14885
diyfp plus
Definition: json.hpp:14888
diyfp w
Definition: json.hpp:14886
diyfp minus
Definition: json.hpp:14887
Definition: json.hpp:15024
std::uint64_t f
Definition: json.hpp:15025
int k
Definition: json.hpp:15027
int e
Definition: json.hpp:15026
Definition: json.hpp:14767
static constexpr int kPrecision
Definition: json.hpp:14768
static diyfp normalize(diyfp x) noexcept
normalize x such that the significand is >= 2^(q-1)
Definition: json.hpp:14856
static diyfp normalize_to(const diyfp &x, const int target_exponent) noexcept
normalize x such that the result has the exponent E
Definition: json.hpp:14873
static diyfp mul(const diyfp &x, const diyfp &y) noexcept
returns x * y
Definition: json.hpp:14791
constexpr diyfp(std::uint64_t f_, int e_) noexcept
Definition: json.hpp:14773
int e
Definition: json.hpp:14771
std::uint64_t f
Definition: json.hpp:14770
static diyfp sub(const diyfp &x, const diyfp &y) noexcept
returns x - y
Definition: json.hpp:14779
static void construct(BasicJsonType &j, const CompatibleArrayType &arr)
Definition: json.hpp:4499
static void construct(BasicJsonType &j, const std::valarray< T > &arr)
Definition: json.hpp:4525
static void construct(BasicJsonType &j, const std::vector< bool > &arr)
Definition: json.hpp:4510
static void construct(BasicJsonType &j, typename BasicJsonType::array_t &&arr)
Definition: json.hpp:4488
static void construct(BasicJsonType &j, const typename BasicJsonType::array_t &arr)
Definition: json.hpp:4479
static void construct(BasicJsonType &j, const typename BasicJsonType::binary_t &b)
Definition: json.hpp:4423
static void construct(BasicJsonType &j, typename BasicJsonType::binary_t &&b)
Definition: json.hpp:4431
static void construct(BasicJsonType &j, typename BasicJsonType::boolean_t b) noexcept
Definition: json.hpp:4381
static void construct(BasicJsonType &j, typename BasicJsonType::number_float_t val) noexcept
Definition: json.hpp:4443
static void construct(BasicJsonType &j, typename BasicJsonType::number_integer_t val) noexcept
Definition: json.hpp:4467
static void construct(BasicJsonType &j, typename BasicJsonType::number_unsigned_t val) noexcept
Definition: json.hpp:4455
static void construct(BasicJsonType &j, typename BasicJsonType::object_t &&obj)
Definition: json.hpp:4552
static void construct(BasicJsonType &j, const typename BasicJsonType::object_t &obj)
Definition: json.hpp:4543
static void construct(BasicJsonType &j, const CompatibleObjectType &obj)
Definition: json.hpp:4562
static void construct(BasicJsonType &j, typename BasicJsonType::string_t &&s)
Definition: json.hpp:4401
static void construct(BasicJsonType &j, const CompatibleStringType &str)
Definition: json.hpp:4411
static void construct(BasicJsonType &j, const typename BasicJsonType::string_t &s)
Definition: json.hpp:4393
Definition: json.hpp:4375
Definition: json.hpp:4143
auto operator()(const BasicJsonType &j, T &val) const noexcept(noexcept(from_json(j, val))) -> decltype(from_json(j, val), void())
Definition: json.hpp:4145
typename BasicJsonType::template json_serializer< T, void > serializer
Definition: json.hpp:3489
Definition: json.hpp:3473
typename BasicJsonType::template json_serializer< T, void > serializer
Definition: json.hpp:3504
Definition: json.hpp:3499
typename BasicJsonType::template json_serializer< T, void > serializer
Definition: json.hpp:3519
Definition: json.hpp:3514
Definition: json.hpp:3070
T value_type
Definition: json.hpp:3071
static constexpr std::size_t size() noexcept
Definition: json.hpp:3072
an iterator value
Definition: json.hpp:11160
primitive_iterator_t primitive_iterator
generic iterator for all other types
Definition: json.hpp:11166
BasicJsonType::array_t::iterator array_iterator
iterator for JSON arrays
Definition: json.hpp:11164
BasicJsonType::object_t::iterator object_iterator
iterator for JSON objects
Definition: json.hpp:11162
Definition: json.hpp:3416
Definition: json.hpp:3654
Definition: json.hpp:3674
std::numeric_limits< CompatibleNumberIntegerType > CompatibleLimits
Definition: json.hpp:3732
std::numeric_limits< RealIntegerType > RealLimits
Definition: json.hpp:3731
Definition: json.hpp:3721
Definition: json.hpp:3744
typename BasicJsonType::object_t object_t
Definition: json.hpp:3569
Definition: json.hpp:3561
Definition: json.hpp:3581
Definition: json.hpp:3618
Definition: json.hpp:3632
Definition: json.hpp:3747
Definition: json.hpp:3760
Definition: json.hpp:3554
Definition: json.hpp:3677
Definition: json.hpp:3717
typename BasicJsonType::object_t object_t
Definition: json.hpp:3593
Definition: json.hpp:3585
Definition: json.hpp:3614
Definition: json.hpp:3636
Definition: json.hpp:3651
Definition: json.hpp:3770
Definition: json.hpp:3481
static constexpr bool value
Definition: json.hpp:3482
Definition: json.hpp:5439
typename std::iterator_traits< T >::value_type value_type
Definition: json.hpp:5440
Definition: json.hpp:3532
Definition: json.hpp:3429
Definition: json.hpp:8018
typename BasicJsonType::string_t string_t
Definition: json.hpp:8026
typename BasicJsonType::exception exception_t
Definition: json.hpp:8028
typename BasicJsonType::number_integer_t number_integer_t
Definition: json.hpp:8023
typename BasicJsonType::number_float_t number_float_t
Definition: json.hpp:8025
typename BasicJsonType::binary_t binary_t
Definition: json.hpp:8027
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition: json.hpp:8024
Definition: json.hpp:7987
typename BasicJsonType::number_float_t number_float_t
Definition: json.hpp:7994
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition: json.hpp:7993
typename BasicJsonType::exception exception_t
Definition: json.hpp:7997
static constexpr bool value
Definition: json.hpp:8000
typename BasicJsonType::number_integer_t number_integer_t
Definition: json.hpp:7992
typename BasicJsonType::string_t string_t
Definition: json.hpp:7995
typename BasicJsonType::binary_t binary_t
Definition: json.hpp:7996
T & reference
Definition: json.hpp:3240
T * pointer
Definition: json.hpp:3239
T value_type
Definition: json.hpp:3237
std::random_access_iterator_tag iterator_category
Definition: json.hpp:3236
ptrdiff_t difference_type
Definition: json.hpp:3238
Definition: json.hpp:3224
typename It::difference_type difference_type
Definition: json.hpp:3213
typename It::reference reference
Definition: json.hpp:3216
typename It::iterator_category iterator_category
Definition: json.hpp:3217
typename It::pointer pointer
Definition: json.hpp:3215
typename It::value_type value_type
Definition: json.hpp:3214
Definition: json.hpp:3205
Definition: json.hpp:3190
void type
Definition: json.hpp:3191
Definition: json.hpp:3263
nonesuch(nonesuch const &)=delete
void operator=(nonesuch &&)=delete
nonesuch(nonesuch const &&)=delete
void operator=(nonesuch const &)=delete
abstract output adapter interface
Definition: json.hpp:13006
virtual void write_characters(const CharType *s, std::size_t length)=0
virtual void write_character(CharType c)=0
output_adapter_protocol(output_adapter_protocol &&) noexcept=default
virtual ~output_adapter_protocol()=default
output_adapter_protocol(const output_adapter_protocol &)=default
output_adapter_protocol()=default
struct to capture the start position of the current token
Definition: json.hpp:2579
std::size_t lines_read
the number of lines read
Definition: json.hpp:2585
std::size_t chars_read_current_line
the number of characters read in the current line
Definition: json.hpp:2583
std::size_t chars_read_total
the total number of characters read
Definition: json.hpp:2581
Definition: json.hpp:3154
Definition: json.hpp:3153
Definition: json.hpp:3159
static constexpr T value
Definition: json.hpp:3160
Definition: json.hpp:4715
auto operator()(BasicJsonType &j, T &&val) const noexcept(noexcept(to_json(j, std::forward< T >(val)))) -> decltype(to_json(j, std::forward< T >(val)), void())
Definition: json.hpp:4717
Definition: json.hpp:3090
Definition: json.hpp:3109
typename Extend< typename Gen< T, N/2 >::type, N/2, N % 2 >::type type
Definition: json.hpp:3111
SAX interface.
Definition: json.hpp:5600
virtual bool start_object(std::size_t elements)=0
the beginning of an object was read
virtual bool string(string_t &val)=0
a string was read
typename BasicJsonType::number_integer_t number_integer_t
Definition: json.hpp:5601
typename BasicJsonType::binary_t binary_t
Definition: json.hpp:5605
virtual bool end_array()=0
the end of an array was read
virtual bool key(string_t &val)=0
an object key was read
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition: json.hpp:5602
virtual bool binary(binary_t &val)=0
a binary string was read
typename BasicJsonType::number_float_t number_float_t
Definition: json.hpp:5603
virtual bool start_array(std::size_t elements)=0
the beginning of an array was read
virtual bool parse_error(std::size_t position, const std::string &last_token, const detail::exception &ex)=0
a parse error occurred
json_sax(json_sax &&) noexcept=default
virtual bool boolean(bool val)=0
a boolean value was read
json_sax(const json_sax &)=default
virtual bool end_object()=0
the end of an object was read
virtual bool number_unsigned(number_unsigned_t val)=0
an unsigned integer number was read
typename BasicJsonType::string_t string_t
Definition: json.hpp:5604
virtual bool number_float(number_float_t val, const string_t &s)=0
an floating-point number was read
virtual bool number_integer(number_integer_t val)=0
an integer number was read
Definition: json.hpp:16795
std::pair< iterator, bool > insert(const value_type &value)
Definition: json.hpp:16936
ordered_map(std::initializer_list< T > init, const Allocator &alloc=Allocator())
Definition: json.hpp:16810
std::vector< std::pair< const Key, T >, Allocator > Container
Definition: json.hpp:16798
T mapped_type
Definition: json.hpp:16797
iterator find(const Key &key)
Definition: json.hpp:16907
iterator erase(iterator pos)
Definition: json.hpp:16881
void insert(InputIt first, InputIt last)
Definition: json.hpp:16954
std::pair< iterator, bool > emplace(const key_type &key, T &&t)
Definition: json.hpp:16813
const_iterator find(const Key &key) const
Definition: json.hpp:16919
std::pair< iterator, bool > insert(value_type &&value)
Definition: json.hpp:16931
Key key_type
Definition: json.hpp:16796
size_type erase(const Key &key)
Definition: json.hpp:16862
const T & operator[](const Key &key) const
Definition: json.hpp:16831
ordered_map(const Allocator &alloc=Allocator())
Definition: json.hpp:16806
typename std::enable_if< std::is_convertible< typename std::iterator_traits< InputIt >::iterator_category, std::input_iterator_tag >::value >::type require_input_iter
Definition: json.hpp:16951
const T & at(const Key &key) const
Definition: json.hpp:16849
ordered_map(It first, It last, const Allocator &alloc=Allocator())
Definition: json.hpp:16808
T & at(const Key &key)
Definition: json.hpp:16836
T & operator[](const Key &key)
Definition: json.hpp:16826
size_type count(const Key &key) const
Definition: json.hpp:16895
std::size_t operator()(const nlohmann::json &j) const
return a hash value for a JSON object
Definition: json.hpp:25716
bool operator()(nlohmann::detail::value_t lhs, nlohmann::detail::value_t rhs) const noexcept
compare two value_t enum values
Definition: json.hpp:25732
#define const
Definition: zconf.h:233