18#ifndef INCLUDE_NLOHMANN_JSON_HPP_
19#define INCLUDE_NLOHMANN_JSON_HPP_
24#include <initializer_list>
60#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK
61 #if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH)
62 #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 3
63 #warning "Already included a different version of the library!"
68#define NLOHMANN_JSON_VERSION_MAJOR 3
69#define NLOHMANN_JSON_VERSION_MINOR 11
70#define NLOHMANN_JSON_VERSION_PATCH 3
72#ifndef JSON_DIAGNOSTICS
73 #define JSON_DIAGNOSTICS 0
76#ifndef JSON_DIAGNOSTIC_POSITIONS
77 #define JSON_DIAGNOSTIC_POSITIONS 0
80#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
81 #define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0
85 #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag
87 #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS
90#if JSON_DIAGNOSTIC_POSITIONS
91 #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTIC_POSITIONS _dp
93 #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTIC_POSITIONS
96#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
97 #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp
99 #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON
102#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION
103 #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0
107#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b, c) json_abi ## a ## b ## c
108#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b, c) \
109 NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b, c)
111#define NLOHMANN_JSON_ABI_TAGS \
112 NLOHMANN_JSON_ABI_TAGS_CONCAT( \
113 NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \
114 NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON, \
115 NLOHMANN_JSON_ABI_TAG_DIAGNOSTIC_POSITIONS)
118#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \
119 _v ## major ## _ ## minor ## _ ## patch
120#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \
121 NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch)
123#if NLOHMANN_JSON_NAMESPACE_NO_VERSION
124#define NLOHMANN_JSON_NAMESPACE_VERSION
126#define NLOHMANN_JSON_NAMESPACE_VERSION \
127 NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \
128 NLOHMANN_JSON_VERSION_MINOR, \
129 NLOHMANN_JSON_VERSION_PATCH)
133#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b
134#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \
135 NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b)
137#ifndef NLOHMANN_JSON_NAMESPACE
138#define NLOHMANN_JSON_NAMESPACE \
139 nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \
140 NLOHMANN_JSON_ABI_TAGS, \
141 NLOHMANN_JSON_NAMESPACE_VERSION)
144#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN
145#define NLOHMANN_JSON_NAMESPACE_BEGIN \
148 inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \
149 NLOHMANN_JSON_ABI_TAGS, \
150 NLOHMANN_JSON_NAMESPACE_VERSION) \
154#ifndef NLOHMANN_JSON_NAMESPACE_END
155#define NLOHMANN_JSON_NAMESPACE_END \
173#include <forward_list>
176#ifdef JSON_HAS_CPP_17
181#include <type_traits>
182#include <unordered_map>
245#include <type_traits>
290template<
class Default,
292 template<
class...>
class Op,
300template<
class Default,
template<
class...>
class Op,
class... Args>
307template<
template<
class...>
class Op,
class... Args>
310template<
template<
class...>
class Op,
class... Args>
313template<
template<
class...>
class Op,
class... Args>
316template<
class Default,
template<
class...>
class Op,
class... Args>
319template<
class Default,
template<
class...>
class Op,
class... Args>
322template<
class Expected,
template<
class...>
class Op,
class... Args>
325template<
class To,
template<
class...>
class Op,
class... Args>
327 std::is_convertible<
detected_t<Op, Args...>, To>;
348#if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 15)
349#if defined(JSON_HEDLEY_VERSION)
350 #undef JSON_HEDLEY_VERSION
352#define JSON_HEDLEY_VERSION 15
354#if defined(JSON_HEDLEY_STRINGIFY_EX)
355 #undef JSON_HEDLEY_STRINGIFY_EX
357#define JSON_HEDLEY_STRINGIFY_EX(x) #x
359#if defined(JSON_HEDLEY_STRINGIFY)
360 #undef JSON_HEDLEY_STRINGIFY
362#define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x)
364#if defined(JSON_HEDLEY_CONCAT_EX)
365 #undef JSON_HEDLEY_CONCAT_EX
367#define JSON_HEDLEY_CONCAT_EX(a,b) a##b
369#if defined(JSON_HEDLEY_CONCAT)
370 #undef JSON_HEDLEY_CONCAT
372#define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b)
374#if defined(JSON_HEDLEY_CONCAT3_EX)
375 #undef JSON_HEDLEY_CONCAT3_EX
377#define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c
379#if defined(JSON_HEDLEY_CONCAT3)
380 #undef JSON_HEDLEY_CONCAT3
382#define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c)
384#if defined(JSON_HEDLEY_VERSION_ENCODE)
385 #undef JSON_HEDLEY_VERSION_ENCODE
387#define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision))
389#if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR)
390 #undef JSON_HEDLEY_VERSION_DECODE_MAJOR
392#define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000)
394#if defined(JSON_HEDLEY_VERSION_DECODE_MINOR)
395 #undef JSON_HEDLEY_VERSION_DECODE_MINOR
397#define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000)
399#if defined(JSON_HEDLEY_VERSION_DECODE_REVISION)
400 #undef JSON_HEDLEY_VERSION_DECODE_REVISION
402#define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000)
404#if defined(JSON_HEDLEY_GNUC_VERSION)
405 #undef JSON_HEDLEY_GNUC_VERSION
407#if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__)
408 #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
409#elif defined(__GNUC__)
410 #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0)
413#if defined(JSON_HEDLEY_GNUC_VERSION_CHECK)
414 #undef JSON_HEDLEY_GNUC_VERSION_CHECK
416#if defined(JSON_HEDLEY_GNUC_VERSION)
417 #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
419 #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0)
422#if defined(JSON_HEDLEY_MSVC_VERSION)
423 #undef JSON_HEDLEY_MSVC_VERSION
425#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL)
426 #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100)
427#elif defined(_MSC_FULL_VER) && !defined(__ICL)
428 #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10)
429#elif defined(_MSC_VER) && !defined(__ICL)
430 #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0)
433#if defined(JSON_HEDLEY_MSVC_VERSION_CHECK)
434 #undef JSON_HEDLEY_MSVC_VERSION_CHECK
436#if !defined(JSON_HEDLEY_MSVC_VERSION)
437 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0)
438#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
439 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch)))
440#elif defined(_MSC_VER) && (_MSC_VER >= 1200)
441 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch)))
443 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor)))
446#if defined(JSON_HEDLEY_INTEL_VERSION)
447 #undef JSON_HEDLEY_INTEL_VERSION
449#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL)
450 #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE)
451#elif defined(__INTEL_COMPILER) && !defined(__ICL)
452 #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0)
455#if defined(JSON_HEDLEY_INTEL_VERSION_CHECK)
456 #undef JSON_HEDLEY_INTEL_VERSION_CHECK
458#if defined(JSON_HEDLEY_INTEL_VERSION)
459 #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
461 #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0)
464#if defined(JSON_HEDLEY_INTEL_CL_VERSION)
465 #undef JSON_HEDLEY_INTEL_CL_VERSION
467#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL)
468 #define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0)
471#if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK)
472 #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK
474#if defined(JSON_HEDLEY_INTEL_CL_VERSION)
475 #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
477 #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0)
480#if defined(JSON_HEDLEY_PGI_VERSION)
481 #undef JSON_HEDLEY_PGI_VERSION
483#if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__)
484 #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__)
487#if defined(JSON_HEDLEY_PGI_VERSION_CHECK)
488 #undef JSON_HEDLEY_PGI_VERSION_CHECK
490#if defined(JSON_HEDLEY_PGI_VERSION)
491 #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
493 #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0)
496#if defined(JSON_HEDLEY_SUNPRO_VERSION)
497 #undef JSON_HEDLEY_SUNPRO_VERSION
499#if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000)
500 #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)
501#elif defined(__SUNPRO_C)
502 #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf)
503#elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000)
504 #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)
505#elif defined(__SUNPRO_CC)
506 #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf)
509#if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK)
510 #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK
512#if defined(JSON_HEDLEY_SUNPRO_VERSION)
513 #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
515 #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0)
518#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION)
519 #undef JSON_HEDLEY_EMSCRIPTEN_VERSION
521#if defined(__EMSCRIPTEN__)
522 #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__)
525#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK)
526 #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK
528#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION)
529 #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
531 #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0)
534#if defined(JSON_HEDLEY_ARM_VERSION)
535 #undef JSON_HEDLEY_ARM_VERSION
537#if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION)
538 #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100)
539#elif defined(__CC_ARM) && defined(__ARMCC_VERSION)
540 #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100)
543#if defined(JSON_HEDLEY_ARM_VERSION_CHECK)
544 #undef JSON_HEDLEY_ARM_VERSION_CHECK
546#if defined(JSON_HEDLEY_ARM_VERSION)
547 #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
549 #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0)
552#if defined(JSON_HEDLEY_IBM_VERSION)
553 #undef JSON_HEDLEY_IBM_VERSION
555#if defined(__ibmxl__)
556 #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__)
557#elif defined(__xlC__) && defined(__xlC_ver__)
558 #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff)
559#elif defined(__xlC__)
560 #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0)
563#if defined(JSON_HEDLEY_IBM_VERSION_CHECK)
564 #undef JSON_HEDLEY_IBM_VERSION_CHECK
566#if defined(JSON_HEDLEY_IBM_VERSION)
567 #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
569 #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0)
572#if defined(JSON_HEDLEY_TI_VERSION)
573 #undef JSON_HEDLEY_TI_VERSION
576 defined(__TI_COMPILER_VERSION__) && \
578 defined(__TMS470__) || defined(__TI_ARM__) || \
579 defined(__MSP430__) || \
580 defined(__TMS320C2000__) \
582#if (__TI_COMPILER_VERSION__ >= 16000000)
583 #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
587#if defined(JSON_HEDLEY_TI_VERSION_CHECK)
588 #undef JSON_HEDLEY_TI_VERSION_CHECK
590#if defined(JSON_HEDLEY_TI_VERSION)
591 #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
593 #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0)
596#if defined(JSON_HEDLEY_TI_CL2000_VERSION)
597 #undef JSON_HEDLEY_TI_CL2000_VERSION
599#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__)
600 #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
603#if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK)
604 #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK
606#if defined(JSON_HEDLEY_TI_CL2000_VERSION)
607 #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
609 #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0)
612#if defined(JSON_HEDLEY_TI_CL430_VERSION)
613 #undef JSON_HEDLEY_TI_CL430_VERSION
615#if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__)
616 #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
619#if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK)
620 #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK
622#if defined(JSON_HEDLEY_TI_CL430_VERSION)
623 #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
625 #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0)
628#if defined(JSON_HEDLEY_TI_ARMCL_VERSION)
629 #undef JSON_HEDLEY_TI_ARMCL_VERSION
631#if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__))
632 #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
635#if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK)
636 #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK
638#if defined(JSON_HEDLEY_TI_ARMCL_VERSION)
639 #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
641 #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0)
644#if defined(JSON_HEDLEY_TI_CL6X_VERSION)
645 #undef JSON_HEDLEY_TI_CL6X_VERSION
647#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__)
648 #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
651#if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK)
652 #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK
654#if defined(JSON_HEDLEY_TI_CL6X_VERSION)
655 #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
657 #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0)
660#if defined(JSON_HEDLEY_TI_CL7X_VERSION)
661 #undef JSON_HEDLEY_TI_CL7X_VERSION
663#if defined(__TI_COMPILER_VERSION__) && defined(__C7000__)
664 #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
667#if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK)
668 #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK
670#if defined(JSON_HEDLEY_TI_CL7X_VERSION)
671 #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
673 #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0)
676#if defined(JSON_HEDLEY_TI_CLPRU_VERSION)
677 #undef JSON_HEDLEY_TI_CLPRU_VERSION
679#if defined(__TI_COMPILER_VERSION__) && defined(__PRU__)
680 #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
683#if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK)
684 #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK
686#if defined(JSON_HEDLEY_TI_CLPRU_VERSION)
687 #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
689 #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0)
692#if defined(JSON_HEDLEY_CRAY_VERSION)
693 #undef JSON_HEDLEY_CRAY_VERSION
696 #if defined(_RELEASE_PATCHLEVEL)
697 #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL)
699 #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0)
703#if defined(JSON_HEDLEY_CRAY_VERSION_CHECK)
704 #undef JSON_HEDLEY_CRAY_VERSION_CHECK
706#if defined(JSON_HEDLEY_CRAY_VERSION)
707 #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
709 #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0)
712#if defined(JSON_HEDLEY_IAR_VERSION)
713 #undef JSON_HEDLEY_IAR_VERSION
715#if defined(__IAR_SYSTEMS_ICC__)
717 #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000))
719 #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(__VER__ / 100, __VER__ % 100, 0)
723#if defined(JSON_HEDLEY_IAR_VERSION_CHECK)
724 #undef JSON_HEDLEY_IAR_VERSION_CHECK
726#if defined(JSON_HEDLEY_IAR_VERSION)
727 #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
729 #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0)
732#if defined(JSON_HEDLEY_TINYC_VERSION)
733 #undef JSON_HEDLEY_TINYC_VERSION
735#if defined(__TINYC__)
736 #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100)
739#if defined(JSON_HEDLEY_TINYC_VERSION_CHECK)
740 #undef JSON_HEDLEY_TINYC_VERSION_CHECK
742#if defined(JSON_HEDLEY_TINYC_VERSION)
743 #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
745 #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0)
748#if defined(JSON_HEDLEY_DMC_VERSION)
749 #undef JSON_HEDLEY_DMC_VERSION
752 #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf)
755#if defined(JSON_HEDLEY_DMC_VERSION_CHECK)
756 #undef JSON_HEDLEY_DMC_VERSION_CHECK
758#if defined(JSON_HEDLEY_DMC_VERSION)
759 #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
761 #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0)
764#if defined(JSON_HEDLEY_COMPCERT_VERSION)
765 #undef JSON_HEDLEY_COMPCERT_VERSION
767#if defined(__COMPCERT_VERSION__)
768 #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100)
771#if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK)
772 #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK
774#if defined(JSON_HEDLEY_COMPCERT_VERSION)
775 #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
777 #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0)
780#if defined(JSON_HEDLEY_PELLES_VERSION)
781 #undef JSON_HEDLEY_PELLES_VERSION
784 #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0)
787#if defined(JSON_HEDLEY_PELLES_VERSION_CHECK)
788 #undef JSON_HEDLEY_PELLES_VERSION_CHECK
790#if defined(JSON_HEDLEY_PELLES_VERSION)
791 #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
793 #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0)
796#if defined(JSON_HEDLEY_MCST_LCC_VERSION)
797 #undef JSON_HEDLEY_MCST_LCC_VERSION
799#if defined(__LCC__) && defined(__LCC_MINOR__)
800 #define JSON_HEDLEY_MCST_LCC_VERSION JSON_HEDLEY_VERSION_ENCODE(__LCC__ / 100, __LCC__ % 100, __LCC_MINOR__)
803#if defined(JSON_HEDLEY_MCST_LCC_VERSION_CHECK)
804 #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK
806#if defined(JSON_HEDLEY_MCST_LCC_VERSION)
807 #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_MCST_LCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
809 #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (0)
812#if defined(JSON_HEDLEY_GCC_VERSION)
813 #undef JSON_HEDLEY_GCC_VERSION
816 defined(JSON_HEDLEY_GNUC_VERSION) && \
817 !defined(__clang__) && \
818 !defined(JSON_HEDLEY_INTEL_VERSION) && \
819 !defined(JSON_HEDLEY_PGI_VERSION) && \
820 !defined(JSON_HEDLEY_ARM_VERSION) && \
821 !defined(JSON_HEDLEY_CRAY_VERSION) && \
822 !defined(JSON_HEDLEY_TI_VERSION) && \
823 !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \
824 !defined(JSON_HEDLEY_TI_CL430_VERSION) && \
825 !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \
826 !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \
827 !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \
828 !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \
829 !defined(__COMPCERT__) && \
830 !defined(JSON_HEDLEY_MCST_LCC_VERSION)
831 #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION
834#if defined(JSON_HEDLEY_GCC_VERSION_CHECK)
835 #undef JSON_HEDLEY_GCC_VERSION_CHECK
837#if defined(JSON_HEDLEY_GCC_VERSION)
838 #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
840 #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0)
843#if defined(JSON_HEDLEY_HAS_ATTRIBUTE)
844 #undef JSON_HEDLEY_HAS_ATTRIBUTE
847 defined(__has_attribute) && \
849 (!defined(JSON_HEDLEY_IAR_VERSION) || JSON_HEDLEY_IAR_VERSION_CHECK(8,5,9)) \
851# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute)
853# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0)
856#if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE)
857 #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE
859#if defined(__has_attribute)
860 #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute)
862 #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
865#if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE)
866 #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE
868#if defined(__has_attribute)
869 #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute)
871 #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
874#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE)
875 #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE
878 defined(__has_cpp_attribute) && \
879 defined(__cplusplus) && \
880 (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0))
881 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute)
883 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0)
886#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS)
887 #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS
889#if !defined(__cplusplus) || !defined(__has_cpp_attribute)
890 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0)
892 !defined(JSON_HEDLEY_PGI_VERSION) && \
893 !defined(JSON_HEDLEY_IAR_VERSION) && \
894 (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \
895 (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0))
896 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute)
898 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0)
901#if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE)
902 #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE
904#if defined(__has_cpp_attribute) && defined(__cplusplus)
905 #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute)
907 #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
910#if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE)
911 #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE
913#if defined(__has_cpp_attribute) && defined(__cplusplus)
914 #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute)
916 #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
919#if defined(JSON_HEDLEY_HAS_BUILTIN)
920 #undef JSON_HEDLEY_HAS_BUILTIN
922#if defined(__has_builtin)
923 #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin)
925 #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0)
928#if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN)
929 #undef JSON_HEDLEY_GNUC_HAS_BUILTIN
931#if defined(__has_builtin)
932 #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin)
934 #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
937#if defined(JSON_HEDLEY_GCC_HAS_BUILTIN)
938 #undef JSON_HEDLEY_GCC_HAS_BUILTIN
940#if defined(__has_builtin)
941 #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin)
943 #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
946#if defined(JSON_HEDLEY_HAS_FEATURE)
947 #undef JSON_HEDLEY_HAS_FEATURE
949#if defined(__has_feature)
950 #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature)
952 #define JSON_HEDLEY_HAS_FEATURE(feature) (0)
955#if defined(JSON_HEDLEY_GNUC_HAS_FEATURE)
956 #undef JSON_HEDLEY_GNUC_HAS_FEATURE
958#if defined(__has_feature)
959 #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature)
961 #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
964#if defined(JSON_HEDLEY_GCC_HAS_FEATURE)
965 #undef JSON_HEDLEY_GCC_HAS_FEATURE
967#if defined(__has_feature)
968 #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature)
970 #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
973#if defined(JSON_HEDLEY_HAS_EXTENSION)
974 #undef JSON_HEDLEY_HAS_EXTENSION
976#if defined(__has_extension)
977 #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension)
979 #define JSON_HEDLEY_HAS_EXTENSION(extension) (0)
982#if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION)
983 #undef JSON_HEDLEY_GNUC_HAS_EXTENSION
985#if defined(__has_extension)
986 #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension)
988 #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
991#if defined(JSON_HEDLEY_GCC_HAS_EXTENSION)
992 #undef JSON_HEDLEY_GCC_HAS_EXTENSION
994#if defined(__has_extension)
995 #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension)
997 #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
1000#if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE)
1001 #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE
1003#if defined(__has_declspec_attribute)
1004 #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute)
1006 #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0)
1009#if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE)
1010 #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE
1012#if defined(__has_declspec_attribute)
1013 #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute)
1015 #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
1018#if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE)
1019 #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE
1021#if defined(__has_declspec_attribute)
1022 #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute)
1024 #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
1027#if defined(JSON_HEDLEY_HAS_WARNING)
1028 #undef JSON_HEDLEY_HAS_WARNING
1030#if defined(__has_warning)
1031 #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning)
1033 #define JSON_HEDLEY_HAS_WARNING(warning) (0)
1036#if defined(JSON_HEDLEY_GNUC_HAS_WARNING)
1037 #undef JSON_HEDLEY_GNUC_HAS_WARNING
1039#if defined(__has_warning)
1040 #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning)
1042 #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
1045#if defined(JSON_HEDLEY_GCC_HAS_WARNING)
1046 #undef JSON_HEDLEY_GCC_HAS_WARNING
1048#if defined(__has_warning)
1049 #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning)
1051 #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
1055 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \
1056 defined(__clang__) || \
1057 JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \
1058 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1059 JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \
1060 JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \
1061 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1062 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1063 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \
1064 JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \
1065 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \
1066 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \
1067 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1068 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1069 JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \
1070 JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \
1071 JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \
1072 (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR))
1073 #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value)
1074#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
1075 #define JSON_HEDLEY_PRAGMA(value) __pragma(value)
1077 #define JSON_HEDLEY_PRAGMA(value)
1080#if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH)
1081 #undef JSON_HEDLEY_DIAGNOSTIC_PUSH
1083#if defined(JSON_HEDLEY_DIAGNOSTIC_POP)
1084 #undef JSON_HEDLEY_DIAGNOSTIC_POP
1086#if defined(__clang__)
1087 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
1088 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
1089#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
1090 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
1091 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
1092#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0)
1093 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
1094 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
1096 JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \
1097 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1098 #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push))
1099 #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop))
1100#elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0)
1101 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push")
1102 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop")
1104 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1105 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1106 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \
1107 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \
1108 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1109 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
1110 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push")
1111 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop")
1112#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0)
1113 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
1114 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
1116 #define JSON_HEDLEY_DIAGNOSTIC_PUSH
1117 #define JSON_HEDLEY_DIAGNOSTIC_POP
1122#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_)
1123 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_
1125#if defined(__cplusplus)
1126# if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat")
1127# if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions")
1128# if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions")
1129# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
1130 JSON_HEDLEY_DIAGNOSTIC_PUSH \
1131 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
1132 _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \
1133 _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \
1135 JSON_HEDLEY_DIAGNOSTIC_POP
1137# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
1138 JSON_HEDLEY_DIAGNOSTIC_PUSH \
1139 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
1140 _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \
1142 JSON_HEDLEY_DIAGNOSTIC_POP
1145# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
1146 JSON_HEDLEY_DIAGNOSTIC_PUSH \
1147 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
1149 JSON_HEDLEY_DIAGNOSTIC_POP
1153#if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_)
1154 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x
1157#if defined(JSON_HEDLEY_CONST_CAST)
1158 #undef JSON_HEDLEY_CONST_CAST
1160#if defined(__cplusplus)
1161# define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast<T>(expr))
1163 JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \
1164 JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \
1165 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
1166# define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \
1167 JSON_HEDLEY_DIAGNOSTIC_PUSH \
1168 JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \
1170 JSON_HEDLEY_DIAGNOSTIC_POP \
1173# define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr))
1176#if defined(JSON_HEDLEY_REINTERPRET_CAST)
1177 #undef JSON_HEDLEY_REINTERPRET_CAST
1179#if defined(__cplusplus)
1180 #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast<T>(expr))
1182 #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr))
1185#if defined(JSON_HEDLEY_STATIC_CAST)
1186 #undef JSON_HEDLEY_STATIC_CAST
1188#if defined(__cplusplus)
1189 #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast<T>(expr))
1191 #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr))
1194#if defined(JSON_HEDLEY_CPP_CAST)
1195 #undef JSON_HEDLEY_CPP_CAST
1197#if defined(__cplusplus)
1198# if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast")
1199# define JSON_HEDLEY_CPP_CAST(T, expr) \
1200 JSON_HEDLEY_DIAGNOSTIC_PUSH \
1201 _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \
1203 JSON_HEDLEY_DIAGNOSTIC_POP
1204# elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0)
1205# define JSON_HEDLEY_CPP_CAST(T, expr) \
1206 JSON_HEDLEY_DIAGNOSTIC_PUSH \
1207 _Pragma("diag_suppress=Pe137") \
1208 JSON_HEDLEY_DIAGNOSTIC_POP
1210# define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr))
1213# define JSON_HEDLEY_CPP_CAST(T, expr) (expr)
1216#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED)
1217 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
1219#if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations")
1220 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
1221#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
1222 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)")
1223#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1224 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786))
1225#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0)
1226 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445")
1227#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
1228 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444")
1229#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0)
1230 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
1231#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
1232 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996))
1233#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1234 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444")
1236 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1237 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1238 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1239 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1240 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1241 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1242 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1243 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1244 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1245 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1246 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
1247 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718")
1248#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus)
1249 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)")
1250#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus)
1251 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)")
1252#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1253 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215")
1254#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0)
1255 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)")
1257 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
1260#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS)
1261 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
1263#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas")
1264 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"")
1265#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
1266 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)")
1267#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1268 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161))
1269#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
1270 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675")
1271#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0)
1272 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"")
1273#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
1274 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068))
1276 JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \
1277 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \
1278 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1279 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0)
1280 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163")
1281#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0)
1282 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163")
1283#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1284 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161")
1285#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1286 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 161")
1288 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
1291#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES)
1292 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES
1294#if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes")
1295 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"")
1296#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0)
1297 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
1298#elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0)
1299 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)")
1300#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1301 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292))
1302#elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0)
1303 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030))
1304#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0)
1305 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098")
1306#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
1307 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097")
1308#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)
1309 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)")
1311 JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \
1312 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \
1313 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0)
1314 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173")
1315#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1316 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097")
1317#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1318 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097")
1320 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES
1323#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL)
1324 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
1326#if JSON_HEDLEY_HAS_WARNING("-Wcast-qual")
1327 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"")
1328#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
1329 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)")
1330#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0)
1331 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"")
1333 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
1336#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION)
1337 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION
1339#if JSON_HEDLEY_HAS_WARNING("-Wunused-function")
1340 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("clang diagnostic ignored \"-Wunused-function\"")
1341#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0)
1342 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("GCC diagnostic ignored \"-Wunused-function\"")
1343#elif JSON_HEDLEY_MSVC_VERSION_CHECK(1,0,0)
1344 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION __pragma(warning(disable:4505))
1345#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1346 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("diag_suppress 3142")
1348 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION
1351#if defined(JSON_HEDLEY_DEPRECATED)
1352 #undef JSON_HEDLEY_DEPRECATED
1354#if defined(JSON_HEDLEY_DEPRECATED_FOR)
1355 #undef JSON_HEDLEY_DEPRECATED_FOR
1358 JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \
1359 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1360 #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since))
1361 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement))
1363 (JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) && !defined(JSON_HEDLEY_IAR_VERSION)) || \
1364 JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \
1365 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1366 JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \
1367 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \
1368 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
1369 JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \
1370 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \
1371 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \
1372 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1373 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) || \
1374 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1375 #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since)))
1376 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement)))
1377#elif defined(__cplusplus) && (__cplusplus >= 201402L)
1378 #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]])
1379 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]])
1381 JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \
1382 JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
1383 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1384 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1385 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1386 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1387 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1388 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1389 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1390 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1391 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1392 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1393 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1394 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1395 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \
1396 JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0)
1397 #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__))
1398 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__))
1400 JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
1401 JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \
1402 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1403 #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated)
1404 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated)
1405#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1406 #define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated")
1407 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated")
1409 #define JSON_HEDLEY_DEPRECATED(since)
1410 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement)
1413#if defined(JSON_HEDLEY_UNAVAILABLE)
1414 #undef JSON_HEDLEY_UNAVAILABLE
1417 JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \
1418 JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \
1419 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1420 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1421 #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since)))
1423 #define JSON_HEDLEY_UNAVAILABLE(available_since)
1426#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT)
1427 #undef JSON_HEDLEY_WARN_UNUSED_RESULT
1429#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG)
1430 #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG
1433 JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \
1434 JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \
1435 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1436 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1437 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1438 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1439 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1440 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1441 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1442 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1443 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1444 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1445 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1446 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1447 (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \
1448 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
1449 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1450 #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
1451 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__))
1452#elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L)
1453 #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
1454 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]])
1455#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard)
1456 #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
1457 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
1458#elif defined(_Check_return_)
1459 #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_
1460 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_
1462 #define JSON_HEDLEY_WARN_UNUSED_RESULT
1463 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg)
1466#if defined(JSON_HEDLEY_SENTINEL)
1467 #undef JSON_HEDLEY_SENTINEL
1470 JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \
1471 JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \
1472 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1473 JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \
1474 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1475 #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position)))
1477 #define JSON_HEDLEY_SENTINEL(position)
1480#if defined(JSON_HEDLEY_NO_RETURN)
1481 #undef JSON_HEDLEY_NO_RETURN
1483#if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1484 #define JSON_HEDLEY_NO_RETURN __noreturn
1486 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1487 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1488 #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__))
1489#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
1490 #define JSON_HEDLEY_NO_RETURN _Noreturn
1491#elif defined(__cplusplus) && (__cplusplus >= 201103L)
1492 #define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]])
1494 JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \
1495 JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \
1496 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1497 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1498 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1499 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1500 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1501 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1502 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1503 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1504 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1505 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1506 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1507 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1508 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1509 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1510 JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0)
1511 #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__))
1512#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
1513 #define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return")
1515 JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
1516 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1517 #define JSON_HEDLEY_NO_RETURN __declspec(noreturn)
1518#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus)
1519 #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;")
1520#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0)
1521 #define JSON_HEDLEY_NO_RETURN __attribute((noreturn))
1522#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0)
1523 #define JSON_HEDLEY_NO_RETURN __declspec(noreturn)
1525 #define JSON_HEDLEY_NO_RETURN
1528#if defined(JSON_HEDLEY_NO_ESCAPE)
1529 #undef JSON_HEDLEY_NO_ESCAPE
1531#if JSON_HEDLEY_HAS_ATTRIBUTE(noescape)
1532 #define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__))
1534 #define JSON_HEDLEY_NO_ESCAPE
1537#if defined(JSON_HEDLEY_UNREACHABLE)
1538 #undef JSON_HEDLEY_UNREACHABLE
1540#if defined(JSON_HEDLEY_UNREACHABLE_RETURN)
1541 #undef JSON_HEDLEY_UNREACHABLE_RETURN
1543#if defined(JSON_HEDLEY_ASSUME)
1544 #undef JSON_HEDLEY_ASSUME
1547 JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
1548 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1549 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1550 #define JSON_HEDLEY_ASSUME(expr) __assume(expr)
1551#elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume)
1552 #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr)
1554 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \
1555 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0)
1556 #if defined(__cplusplus)
1557 #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr)
1559 #define JSON_HEDLEY_ASSUME(expr) _nassert(expr)
1563 (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \
1564 JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \
1565 JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \
1566 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1567 JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) || \
1568 JSON_HEDLEY_CRAY_VERSION_CHECK(10,0,0) || \
1569 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1570 #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable()
1571#elif defined(JSON_HEDLEY_ASSUME)
1572 #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0)
1574#if !defined(JSON_HEDLEY_ASSUME)
1575 #if defined(JSON_HEDLEY_UNREACHABLE)
1576 #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1)))
1578 #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr)
1581#if defined(JSON_HEDLEY_UNREACHABLE)
1583 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \
1584 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0)
1585 #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value))
1587 #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE()
1590 #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value)
1592#if !defined(JSON_HEDLEY_UNREACHABLE)
1593 #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0)
1597#if JSON_HEDLEY_HAS_WARNING("-Wpedantic")
1598 #pragma clang diagnostic ignored "-Wpedantic"
1600#if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus)
1601 #pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
1603#if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0)
1604 #if defined(__clang__)
1605 #pragma clang diagnostic ignored "-Wvariadic-macros"
1606 #elif defined(JSON_HEDLEY_GCC_VERSION)
1607 #pragma GCC diagnostic ignored "-Wvariadic-macros"
1610#if defined(JSON_HEDLEY_NON_NULL)
1611 #undef JSON_HEDLEY_NON_NULL
1614 JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \
1615 JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
1616 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1617 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0)
1618 #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__)))
1620 #define JSON_HEDLEY_NON_NULL(...)
1624#if defined(JSON_HEDLEY_PRINTF_FORMAT)
1625 #undef JSON_HEDLEY_PRINTF_FORMAT
1627#if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO)
1628 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check)))
1629#elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO)
1630 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check)))
1632 JSON_HEDLEY_HAS_ATTRIBUTE(format) || \
1633 JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
1634 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1635 JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \
1636 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1637 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1638 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1639 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1640 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1641 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1642 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1643 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1644 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1645 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1646 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1647 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1648 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1649 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check)))
1650#elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0)
1651 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check))
1653 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check)
1656#if defined(JSON_HEDLEY_CONSTEXPR)
1657 #undef JSON_HEDLEY_CONSTEXPR
1659#if defined(__cplusplus)
1660 #if __cplusplus >= 201103L
1661 #define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr)
1664#if !defined(JSON_HEDLEY_CONSTEXPR)
1665 #define JSON_HEDLEY_CONSTEXPR
1668#if defined(JSON_HEDLEY_PREDICT)
1669 #undef JSON_HEDLEY_PREDICT
1671#if defined(JSON_HEDLEY_LIKELY)
1672 #undef JSON_HEDLEY_LIKELY
1674#if defined(JSON_HEDLEY_UNLIKELY)
1675 #undef JSON_HEDLEY_UNLIKELY
1677#if defined(JSON_HEDLEY_UNPREDICTABLE)
1678 #undef JSON_HEDLEY_UNPREDICTABLE
1680#if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable)
1681 #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr))
1684 (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \
1685 JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) || \
1686 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1687# define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability))
1688# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability))
1689# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability))
1690# define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 )
1691# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 )
1693 (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \
1694 JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \
1695 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1696 (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \
1697 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1698 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1699 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1700 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \
1701 JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \
1702 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \
1703 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \
1704 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1705 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1706 JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \
1707 JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \
1708 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1709# define JSON_HEDLEY_PREDICT(expr, expected, probability) \
1710 (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)))
1711# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \
1713 double hedley_probability_ = (probability); \
1714 ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \
1716# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \
1718 double hedley_probability_ = (probability); \
1719 ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \
1721# define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1)
1722# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0)
1724# define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))
1725# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr))
1726# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr))
1727# define JSON_HEDLEY_LIKELY(expr) (!!(expr))
1728# define JSON_HEDLEY_UNLIKELY(expr) (!!(expr))
1730#if !defined(JSON_HEDLEY_UNPREDICTABLE)
1731 #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5)
1734#if defined(JSON_HEDLEY_MALLOC)
1735 #undef JSON_HEDLEY_MALLOC
1738 JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \
1739 JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
1740 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1741 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1742 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1743 JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \
1744 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1745 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1746 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1747 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1748 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1749 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1750 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1751 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1752 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1753 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1754 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1755 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1756 #define JSON_HEDLEY_MALLOC __attribute__((__malloc__))
1757#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
1758 #define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory")
1760 JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \
1761 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1762 #define JSON_HEDLEY_MALLOC __declspec(restrict)
1764 #define JSON_HEDLEY_MALLOC
1767#if defined(JSON_HEDLEY_PURE)
1768 #undef JSON_HEDLEY_PURE
1771 JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \
1772 JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \
1773 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1774 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1775 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1776 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1777 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1778 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1779 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1780 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1781 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1782 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1783 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1784 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1785 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1786 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1787 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1788 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
1789 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1790# define JSON_HEDLEY_PURE __attribute__((__pure__))
1791#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
1792# define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data")
1793#elif defined(__cplusplus) && \
1795 JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \
1796 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \
1797 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \
1799# define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;")
1801# define JSON_HEDLEY_PURE
1804#if defined(JSON_HEDLEY_CONST)
1805 #undef JSON_HEDLEY_CONST
1808 JSON_HEDLEY_HAS_ATTRIBUTE(const) || \
1809 JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \
1810 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1811 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1812 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1813 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1814 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1815 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1816 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1817 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1818 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1819 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1820 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1821 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1822 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1823 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1824 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1825 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
1826 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1827 #define JSON_HEDLEY_CONST __attribute__((__const__))
1829 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
1830 #define JSON_HEDLEY_CONST _Pragma("no_side_effect")
1832 #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE
1835#if defined(JSON_HEDLEY_RESTRICT)
1836 #undef JSON_HEDLEY_RESTRICT
1838#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus)
1839 #define JSON_HEDLEY_RESTRICT restrict
1841 JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
1842 JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \
1843 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1844 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \
1845 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1846 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1847 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
1848 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1849 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \
1850 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \
1851 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1852 (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \
1853 JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \
1854 defined(__clang__) || \
1855 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1856 #define JSON_HEDLEY_RESTRICT __restrict
1857#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus)
1858 #define JSON_HEDLEY_RESTRICT _Restrict
1860 #define JSON_HEDLEY_RESTRICT
1863#if defined(JSON_HEDLEY_INLINE)
1864 #undef JSON_HEDLEY_INLINE
1867 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \
1868 (defined(__cplusplus) && (__cplusplus >= 199711L))
1869 #define JSON_HEDLEY_INLINE inline
1871 defined(JSON_HEDLEY_GCC_VERSION) || \
1872 JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0)
1873 #define JSON_HEDLEY_INLINE __inline__
1875 JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \
1876 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \
1877 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1878 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \
1879 JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \
1880 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \
1881 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \
1882 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1883 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1884 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
1885 #define JSON_HEDLEY_INLINE __inline
1887 #define JSON_HEDLEY_INLINE
1890#if defined(JSON_HEDLEY_ALWAYS_INLINE)
1891 #undef JSON_HEDLEY_ALWAYS_INLINE
1894 JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \
1895 JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \
1896 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1897 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1898 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1899 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1900 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1901 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1902 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1903 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1904 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1905 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1906 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1907 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1908 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1909 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1910 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1911 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \
1912 JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0)
1913# define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE
1915 JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \
1916 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1917# define JSON_HEDLEY_ALWAYS_INLINE __forceinline
1918#elif defined(__cplusplus) && \
1920 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1921 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1922 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1923 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \
1924 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1925 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \
1927# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;")
1928#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1929# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced")
1931# define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE
1934#if defined(JSON_HEDLEY_NEVER_INLINE)
1935 #undef JSON_HEDLEY_NEVER_INLINE
1938 JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \
1939 JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \
1940 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1941 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1942 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1943 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
1944 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
1945 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1946 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
1947 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1948 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
1949 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1950 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
1951 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1952 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
1953 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
1954 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
1955 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \
1956 JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0)
1957 #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__))
1959 JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
1960 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
1961 #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline)
1962#elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0)
1963 #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline")
1964#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus)
1965 #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;")
1966#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
1967 #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never")
1968#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0)
1969 #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline))
1970#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0)
1971 #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline)
1973 #define JSON_HEDLEY_NEVER_INLINE
1976#if defined(JSON_HEDLEY_PRIVATE)
1977 #undef JSON_HEDLEY_PRIVATE
1979#if defined(JSON_HEDLEY_PUBLIC)
1980 #undef JSON_HEDLEY_PUBLIC
1982#if defined(JSON_HEDLEY_IMPORT)
1983 #undef JSON_HEDLEY_IMPORT
1985#if defined(_WIN32) || defined(__CYGWIN__)
1986# define JSON_HEDLEY_PRIVATE
1987# define JSON_HEDLEY_PUBLIC __declspec(dllexport)
1988# define JSON_HEDLEY_IMPORT __declspec(dllimport)
1991 JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \
1992 JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
1993 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
1994 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
1995 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
1996 JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \
1998 defined(__TI_EABI__) && \
2000 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
2001 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \
2004 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
2005# define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden")))
2006# define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default")))
2008# define JSON_HEDLEY_PRIVATE
2009# define JSON_HEDLEY_PUBLIC
2011# define JSON_HEDLEY_IMPORT extern
2014#if defined(JSON_HEDLEY_NO_THROW)
2015 #undef JSON_HEDLEY_NO_THROW
2018 JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \
2019 JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
2020 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
2021 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
2022 #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__))
2024 JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \
2025 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \
2026 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0)
2027 #define JSON_HEDLEY_NO_THROW __declspec(nothrow)
2029 #define JSON_HEDLEY_NO_THROW
2032#if defined(JSON_HEDLEY_FALL_THROUGH)
2033 #undef JSON_HEDLEY_FALL_THROUGH
2036 JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \
2037 JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) || \
2038 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
2039 #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__))
2040#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough)
2041 #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]])
2042#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough)
2043 #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]])
2044#elif defined(__fallthrough)
2045 #define JSON_HEDLEY_FALL_THROUGH __fallthrough
2047 #define JSON_HEDLEY_FALL_THROUGH
2050#if defined(JSON_HEDLEY_RETURNS_NON_NULL)
2051 #undef JSON_HEDLEY_RETURNS_NON_NULL
2054 JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \
2055 JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \
2056 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
2057 #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__))
2058#elif defined(_Ret_notnull_)
2059 #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_
2061 #define JSON_HEDLEY_RETURNS_NON_NULL
2064#if defined(JSON_HEDLEY_ARRAY_PARAM)
2065 #undef JSON_HEDLEY_ARRAY_PARAM
2068 defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
2069 !defined(__STDC_NO_VLA__) && \
2070 !defined(__cplusplus) && \
2071 !defined(JSON_HEDLEY_PGI_VERSION) && \
2072 !defined(JSON_HEDLEY_TINYC_VERSION)
2073 #define JSON_HEDLEY_ARRAY_PARAM(name) (name)
2075 #define JSON_HEDLEY_ARRAY_PARAM(name)
2078#if defined(JSON_HEDLEY_IS_CONSTANT)
2079 #undef JSON_HEDLEY_IS_CONSTANT
2081#if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR)
2082 #undef JSON_HEDLEY_REQUIRE_CONSTEXPR
2086#if defined(JSON_HEDLEY_IS_CONSTEXPR_)
2087 #undef JSON_HEDLEY_IS_CONSTEXPR_
2090 JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \
2091 JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \
2092 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
2093 JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \
2094 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
2095 JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \
2096 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \
2097 (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \
2098 JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \
2099 JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10)
2100 #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr)
2102#if !defined(__cplusplus)
2104 JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \
2105 JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \
2106 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
2107 JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \
2108 JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \
2109 JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \
2110 JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24)
2111#if defined(__INTPTR_TYPE__)
2112 #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*)
2115 #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*)
2119 defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \
2120 !defined(JSON_HEDLEY_SUNPRO_VERSION) && \
2121 !defined(JSON_HEDLEY_PGI_VERSION) && \
2122 !defined(JSON_HEDLEY_IAR_VERSION)) || \
2123 (JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) && !defined(JSON_HEDLEY_IAR_VERSION)) || \
2124 JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \
2125 JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \
2126 JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \
2127 JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0)
2128#if defined(__INTPTR_TYPE__)
2129 #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0)
2132 #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0)
2135 defined(JSON_HEDLEY_GCC_VERSION) || \
2136 defined(JSON_HEDLEY_INTEL_VERSION) || \
2137 defined(JSON_HEDLEY_TINYC_VERSION) || \
2138 defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \
2139 JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \
2140 defined(JSON_HEDLEY_TI_CL2000_VERSION) || \
2141 defined(JSON_HEDLEY_TI_CL6X_VERSION) || \
2142 defined(JSON_HEDLEY_TI_CL7X_VERSION) || \
2143 defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \
2145# define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \
2149 ((void*) ((expr) * 0L) ) : \
2150((struct { char v[sizeof(void) * 2]; } *) 1) \
2156#if defined(JSON_HEDLEY_IS_CONSTEXPR_)
2157 #if !defined(JSON_HEDLEY_IS_CONSTANT)
2158 #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr)
2160 #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1))
2162 #if !defined(JSON_HEDLEY_IS_CONSTANT)
2163 #define JSON_HEDLEY_IS_CONSTANT(expr) (0)
2165 #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr)
2168#if defined(JSON_HEDLEY_BEGIN_C_DECLS)
2169 #undef JSON_HEDLEY_BEGIN_C_DECLS
2171#if defined(JSON_HEDLEY_END_C_DECLS)
2172 #undef JSON_HEDLEY_END_C_DECLS
2174#if defined(JSON_HEDLEY_C_DECL)
2175 #undef JSON_HEDLEY_C_DECL
2177#if defined(__cplusplus)
2178 #define JSON_HEDLEY_BEGIN_C_DECLS extern "C" {
2179 #define JSON_HEDLEY_END_C_DECLS }
2180 #define JSON_HEDLEY_C_DECL extern "C"
2182 #define JSON_HEDLEY_BEGIN_C_DECLS
2183 #define JSON_HEDLEY_END_C_DECLS
2184 #define JSON_HEDLEY_C_DECL
2187#if defined(JSON_HEDLEY_STATIC_ASSERT)
2188 #undef JSON_HEDLEY_STATIC_ASSERT
2191 !defined(__cplusplus) && ( \
2192 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \
2193 (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \
2194 JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \
2195 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
2196 defined(_Static_assert) \
2198# define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message)
2200 (defined(__cplusplus) && (__cplusplus >= 201103L)) || \
2201 JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \
2202 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
2203# define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message))
2205# define JSON_HEDLEY_STATIC_ASSERT(expr, message)
2208#if defined(JSON_HEDLEY_NULL)
2209 #undef JSON_HEDLEY_NULL
2211#if defined(__cplusplus)
2212 #if __cplusplus >= 201103L
2213 #define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr)
2215 #define JSON_HEDLEY_NULL NULL
2217 #define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0)
2220 #define JSON_HEDLEY_NULL NULL
2222 #define JSON_HEDLEY_NULL ((void*) 0)
2225#if defined(JSON_HEDLEY_MESSAGE)
2226 #undef JSON_HEDLEY_MESSAGE
2228#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas")
2229# define JSON_HEDLEY_MESSAGE(msg) \
2230 JSON_HEDLEY_DIAGNOSTIC_PUSH \
2231 JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
2232 JSON_HEDLEY_PRAGMA(message msg) \
2233 JSON_HEDLEY_DIAGNOSTIC_POP
2235 JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \
2236 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
2237# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg)
2238#elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0)
2239# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg)
2240#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
2241# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg))
2242#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0)
2243# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg))
2245# define JSON_HEDLEY_MESSAGE(msg)
2248#if defined(JSON_HEDLEY_WARNING)
2249 #undef JSON_HEDLEY_WARNING
2251#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas")
2252# define JSON_HEDLEY_WARNING(msg) \
2253 JSON_HEDLEY_DIAGNOSTIC_PUSH \
2254 JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
2255 JSON_HEDLEY_PRAGMA(clang warning msg) \
2256 JSON_HEDLEY_DIAGNOSTIC_POP
2258 JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \
2259 JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \
2260 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
2261# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg)
2263 JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \
2264 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
2265# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg))
2267# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg)
2270#if defined(JSON_HEDLEY_REQUIRE)
2271 #undef JSON_HEDLEY_REQUIRE
2273#if defined(JSON_HEDLEY_REQUIRE_MSG)
2274 #undef JSON_HEDLEY_REQUIRE_MSG
2276#if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if)
2277# if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat")
2278# define JSON_HEDLEY_REQUIRE(expr) \
2279 JSON_HEDLEY_DIAGNOSTIC_PUSH \
2280 _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \
2281 __attribute__((diagnose_if(!(expr), #expr, "error"))) \
2282 JSON_HEDLEY_DIAGNOSTIC_POP
2283# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \
2284 JSON_HEDLEY_DIAGNOSTIC_PUSH \
2285 _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \
2286 __attribute__((diagnose_if(!(expr), msg, "error"))) \
2287 JSON_HEDLEY_DIAGNOSTIC_POP
2289# define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error")))
2290# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error")))
2293# define JSON_HEDLEY_REQUIRE(expr)
2294# define JSON_HEDLEY_REQUIRE_MSG(expr,msg)
2297#if defined(JSON_HEDLEY_FLAGS)
2298 #undef JSON_HEDLEY_FLAGS
2300#if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) && (!defined(__cplusplus) || JSON_HEDLEY_HAS_WARNING("-Wbitfield-enum-conversion"))
2301 #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__))
2303 #define JSON_HEDLEY_FLAGS
2306#if defined(JSON_HEDLEY_FLAGS_CAST)
2307 #undef JSON_HEDLEY_FLAGS_CAST
2309#if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0)
2310# define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \
2311 JSON_HEDLEY_DIAGNOSTIC_PUSH \
2312 _Pragma("warning(disable:188)") \
2314 JSON_HEDLEY_DIAGNOSTIC_POP \
2317# define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr)
2320#if defined(JSON_HEDLEY_EMPTY_BASES)
2321 #undef JSON_HEDLEY_EMPTY_BASES
2324 (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \
2325 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0)
2326 #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases)
2328 #define JSON_HEDLEY_EMPTY_BASES
2333#if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK)
2334 #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK
2336#if defined(__clang__)
2337 #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0)
2339 #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
2342#if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE)
2343 #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE
2345#define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute)
2347#if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE)
2348 #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE
2350#define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute)
2352#if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN)
2353 #undef JSON_HEDLEY_CLANG_HAS_BUILTIN
2355#define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin)
2357#if defined(JSON_HEDLEY_CLANG_HAS_FEATURE)
2358 #undef JSON_HEDLEY_CLANG_HAS_FEATURE
2360#define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature)
2362#if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION)
2363 #undef JSON_HEDLEY_CLANG_HAS_EXTENSION
2365#define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension)
2367#if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE)
2368 #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE
2370#define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute)
2372#if defined(JSON_HEDLEY_CLANG_HAS_WARNING)
2373 #undef JSON_HEDLEY_CLANG_HAS_WARNING
2375#define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning)
2387#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK)
2388 #if defined(__clang__)
2389 #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400
2390 #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers"
2392 #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER))
2393 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800
2394 #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
2401#if !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11)
2402 #if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)
2403 #define JSON_HAS_CPP_20
2404 #define JSON_HAS_CPP_17
2405 #define JSON_HAS_CPP_14
2406 #elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1)
2407 #define JSON_HAS_CPP_17
2408 #define JSON_HAS_CPP_14
2409 #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)
2410 #define JSON_HAS_CPP_14
2413 #define JSON_HAS_CPP_11
2417 #if __has_include(<version>)
2422#if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM)
2423 #ifdef JSON_HAS_CPP_17
2424 #if defined(__cpp_lib_filesystem)
2425 #define JSON_HAS_FILESYSTEM 1
2426 #elif defined(__cpp_lib_experimental_filesystem)
2427 #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1
2428 #elif !defined(__has_include)
2429 #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1
2430 #elif __has_include(<filesystem>)
2431 #define JSON_HAS_FILESYSTEM 1
2432 #elif __has_include(<experimental/filesystem>)
2433 #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1
2437 #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ == 8
2438 #undef JSON_HAS_FILESYSTEM
2439 #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM
2443 #if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 8
2444 #undef JSON_HAS_FILESYSTEM
2445 #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM
2449 #if defined(__clang_major__) && __clang_major__ < 7
2450 #undef JSON_HAS_FILESYSTEM
2451 #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM
2455 #if defined(_MSC_VER) && _MSC_VER < 1914
2456 #undef JSON_HAS_FILESYSTEM
2457 #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM
2461 #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000
2462 #undef JSON_HAS_FILESYSTEM
2463 #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM
2467 #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500
2468 #undef JSON_HAS_FILESYSTEM
2469 #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM
2474#ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM
2475 #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 0
2478#ifndef JSON_HAS_FILESYSTEM
2479 #define JSON_HAS_FILESYSTEM 0
2482#ifndef JSON_HAS_THREE_WAY_COMPARISON
2483 #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L \
2484 && defined(__cpp_lib_three_way_comparison) && __cpp_lib_three_way_comparison >= 201907L
2485 #define JSON_HAS_THREE_WAY_COMPARISON 1
2487 #define JSON_HAS_THREE_WAY_COMPARISON 0
2491#ifndef JSON_HAS_RANGES
2493 #if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427
2494 #define JSON_HAS_RANGES 0
2495 #elif defined(__cpp_lib_ranges)
2496 #define JSON_HAS_RANGES 1
2498 #define JSON_HAS_RANGES 0
2502#ifndef JSON_HAS_STATIC_RTTI
2503 #if !defined(_HAS_STATIC_RTTI) || _HAS_STATIC_RTTI != 0
2504 #define JSON_HAS_STATIC_RTTI 1
2506 #define JSON_HAS_STATIC_RTTI 0
2510#ifdef JSON_HAS_CPP_17
2511 #define JSON_INLINE_VARIABLE inline
2513 #define JSON_INLINE_VARIABLE
2516#if JSON_HEDLEY_HAS_ATTRIBUTE(no_unique_address)
2517 #define JSON_NO_UNIQUE_ADDRESS [[no_unique_address]]
2519 #define JSON_NO_UNIQUE_ADDRESS
2523#if defined(__clang__)
2524 #pragma clang diagnostic push
2525 #pragma clang diagnostic ignored "-Wdocumentation"
2526 #pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
2530#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION)
2531 #define JSON_THROW(exception) throw exception
2532 #define JSON_TRY try
2533 #define JSON_CATCH(exception) catch(exception)
2534 #define JSON_INTERNAL_CATCH(exception) catch(exception)
2537 #define JSON_THROW(exception) std::abort()
2538 #define JSON_TRY if(true)
2539 #define JSON_CATCH(exception) if(false)
2540 #define JSON_INTERNAL_CATCH(exception) if(false)
2544#if defined(JSON_THROW_USER)
2546 #define JSON_THROW JSON_THROW_USER
2548#if defined(JSON_TRY_USER)
2550 #define JSON_TRY JSON_TRY_USER
2552#if defined(JSON_CATCH_USER)
2554 #define JSON_CATCH JSON_CATCH_USER
2555 #undef JSON_INTERNAL_CATCH
2556 #define JSON_INTERNAL_CATCH JSON_CATCH_USER
2558#if defined(JSON_INTERNAL_CATCH_USER)
2559 #undef JSON_INTERNAL_CATCH
2560 #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER
2564#if !defined(JSON_ASSERT)
2566 #define JSON_ASSERT(x) assert(x)
2570#if defined(JSON_TESTS_PRIVATE)
2571 #define JSON_PRIVATE_UNLESS_TESTED public
2573 #define JSON_PRIVATE_UNLESS_TESTED private
2581#define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \
2582 template<typename BasicJsonType> \
2583 inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \
2586 static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \
2588 static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \
2589 auto it = std::find_if(std::begin(m), std::end(m), \
2590 [e](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \
2592 return ej_pair.first == e; \
2594 j = ((it != std::end(m)) ? it : std::begin(m))->second; \
2596 template<typename BasicJsonType> \
2597 inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \
2600 static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \
2602 static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \
2603 auto it = std::find_if(std::begin(m), std::end(m), \
2604 [&j](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \
2606 return ej_pair.second == j; \
2608 e = ((it != std::end(m)) ? it : std::begin(m))->first; \
2614#define NLOHMANN_BASIC_JSON_TPL_DECLARATION \
2615 template<template<typename, typename, typename...> class ObjectType, \
2616 template<typename, typename...> class ArrayType, \
2617 class StringType, class BooleanType, class NumberIntegerType, \
2618 class NumberUnsignedType, class NumberFloatType, \
2619 template<typename> class AllocatorType, \
2620 template<typename, typename = void> class JSONSerializer, \
2622 class CustomBaseClass>
2624#define NLOHMANN_BASIC_JSON_TPL \
2625 basic_json<ObjectType, ArrayType, StringType, BooleanType, \
2626 NumberIntegerType, NumberUnsignedType, NumberFloatType, \
2627 AllocatorType, JSONSerializer, BinaryType, CustomBaseClass>
2631#define NLOHMANN_JSON_EXPAND( x ) x
2632#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
2633#define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \
2634 NLOHMANN_JSON_PASTE64, \
2635 NLOHMANN_JSON_PASTE63, \
2636 NLOHMANN_JSON_PASTE62, \
2637 NLOHMANN_JSON_PASTE61, \
2638 NLOHMANN_JSON_PASTE60, \
2639 NLOHMANN_JSON_PASTE59, \
2640 NLOHMANN_JSON_PASTE58, \
2641 NLOHMANN_JSON_PASTE57, \
2642 NLOHMANN_JSON_PASTE56, \
2643 NLOHMANN_JSON_PASTE55, \
2644 NLOHMANN_JSON_PASTE54, \
2645 NLOHMANN_JSON_PASTE53, \
2646 NLOHMANN_JSON_PASTE52, \
2647 NLOHMANN_JSON_PASTE51, \
2648 NLOHMANN_JSON_PASTE50, \
2649 NLOHMANN_JSON_PASTE49, \
2650 NLOHMANN_JSON_PASTE48, \
2651 NLOHMANN_JSON_PASTE47, \
2652 NLOHMANN_JSON_PASTE46, \
2653 NLOHMANN_JSON_PASTE45, \
2654 NLOHMANN_JSON_PASTE44, \
2655 NLOHMANN_JSON_PASTE43, \
2656 NLOHMANN_JSON_PASTE42, \
2657 NLOHMANN_JSON_PASTE41, \
2658 NLOHMANN_JSON_PASTE40, \
2659 NLOHMANN_JSON_PASTE39, \
2660 NLOHMANN_JSON_PASTE38, \
2661 NLOHMANN_JSON_PASTE37, \
2662 NLOHMANN_JSON_PASTE36, \
2663 NLOHMANN_JSON_PASTE35, \
2664 NLOHMANN_JSON_PASTE34, \
2665 NLOHMANN_JSON_PASTE33, \
2666 NLOHMANN_JSON_PASTE32, \
2667 NLOHMANN_JSON_PASTE31, \
2668 NLOHMANN_JSON_PASTE30, \
2669 NLOHMANN_JSON_PASTE29, \
2670 NLOHMANN_JSON_PASTE28, \
2671 NLOHMANN_JSON_PASTE27, \
2672 NLOHMANN_JSON_PASTE26, \
2673 NLOHMANN_JSON_PASTE25, \
2674 NLOHMANN_JSON_PASTE24, \
2675 NLOHMANN_JSON_PASTE23, \
2676 NLOHMANN_JSON_PASTE22, \
2677 NLOHMANN_JSON_PASTE21, \
2678 NLOHMANN_JSON_PASTE20, \
2679 NLOHMANN_JSON_PASTE19, \
2680 NLOHMANN_JSON_PASTE18, \
2681 NLOHMANN_JSON_PASTE17, \
2682 NLOHMANN_JSON_PASTE16, \
2683 NLOHMANN_JSON_PASTE15, \
2684 NLOHMANN_JSON_PASTE14, \
2685 NLOHMANN_JSON_PASTE13, \
2686 NLOHMANN_JSON_PASTE12, \
2687 NLOHMANN_JSON_PASTE11, \
2688 NLOHMANN_JSON_PASTE10, \
2689 NLOHMANN_JSON_PASTE9, \
2690 NLOHMANN_JSON_PASTE8, \
2691 NLOHMANN_JSON_PASTE7, \
2692 NLOHMANN_JSON_PASTE6, \
2693 NLOHMANN_JSON_PASTE5, \
2694 NLOHMANN_JSON_PASTE4, \
2695 NLOHMANN_JSON_PASTE3, \
2696 NLOHMANN_JSON_PASTE2, \
2697 NLOHMANN_JSON_PASTE1)(__VA_ARGS__))
2698#define NLOHMANN_JSON_PASTE2(func, v1) func(v1)
2699#define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2)
2700#define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3)
2701#define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4)
2702#define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5)
2703#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)
2704#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)
2705#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)
2706#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)
2707#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)
2708#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)
2709#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)
2710#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)
2711#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)
2712#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)
2713#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)
2714#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)
2715#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)
2716#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)
2717#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)
2718#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)
2719#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)
2720#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)
2721#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)
2722#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)
2723#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)
2724#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)
2725#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)
2726#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)
2727#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)
2728#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)
2729#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)
2730#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)
2731#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)
2732#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)
2733#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)
2734#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)
2735#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)
2736#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)
2737#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)
2738#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)
2739#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)
2740#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)
2741#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)
2742#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)
2743#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)
2744#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)
2745#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)
2746#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)
2747#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)
2748#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)
2749#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)
2750#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)
2751#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)
2752#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)
2753#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)
2754#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)
2755#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)
2756#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)
2757#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)
2758#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)
2759#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)
2760#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)
2762#define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1;
2763#define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1);
2764#define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) nlohmann_json_t.v1 = !nlohmann_json_j.is_null() ? nlohmann_json_j.value(#v1, nlohmann_json_default_obj.v1) : nlohmann_json_default_obj.v1;
2772#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \
2773 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2774 friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
2775 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2776 friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
2784#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \
2785 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2786 friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
2787 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2788 friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }
2796#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE(Type, ...) \
2797 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2798 friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) }
2806#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \
2807 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2808 void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
2809 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2810 void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
2818#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, ...) \
2819 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2820 void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
2821 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2822 void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }
2830#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(Type, ...) \
2831 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2832 void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) }
2840#define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(Type, BaseType, ...) \
2841 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2842 friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast<const BaseType &>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
2843 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2844 friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast<BaseType&>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
2852#define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT(Type, BaseType, ...) \
2853 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2854 friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast<const BaseType&>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
2855 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2856 friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast<BaseType&>(nlohmann_json_t)); const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }
2864#define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE(Type, BaseType, ...) \
2865 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2866 friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast<const BaseType &>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) }
2874#define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE(Type, BaseType, ...) \
2875 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2876 void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast<const BaseType &>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
2877 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2878 void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast<BaseType&>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
2886#define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, BaseType, ...) \
2887 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2888 void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast<const BaseType &>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
2889 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2890 void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast<BaseType&>(nlohmann_json_t)); const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }
2898#define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(Type, BaseType, ...) \
2899 template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
2900 void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast<const BaseType &>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) }
2908#define NLOHMANN_CAN_CALL_STD_FUNC_IMPL(std_name) \
2909 namespace detail { \
2910 using std::std_name; \
2912 template<typename... T> \
2913 using result_of_##std_name = decltype(std_name(std::declval<T>()...)); \
2916 namespace detail2 { \
2917 struct std_name##_tag \
2921 template<typename... T> \
2922 std_name##_tag std_name(T&&...); \
2924 template<typename... T> \
2925 using result_of_##std_name = decltype(std_name(std::declval<T>()...)); \
2927 template<typename... T> \
2928 struct would_call_std_##std_name \
2930 static constexpr auto const value = ::nlohmann::detail:: \
2931 is_detected_exact<std_name##_tag, result_of_##std_name, T...>::value; \
2935 template<typename... T> \
2936 struct would_call_std_##std_name : detail2::would_call_std_##std_name<T...> \
2940#ifndef JSON_USE_IMPLICIT_CONVERSIONS
2941 #define JSON_USE_IMPLICIT_CONVERSIONS 1
2944#if JSON_USE_IMPLICIT_CONVERSIONS
2945 #define JSON_EXPLICIT
2947 #define JSON_EXPLICIT explicit
2950#ifndef JSON_DISABLE_ENUM_SERIALIZATION
2951 #define JSON_DISABLE_ENUM_SERIALIZATION 0
2954#ifndef JSON_USE_GLOBAL_UDLS
2955 #define JSON_USE_GLOBAL_UDLS 1
2958#if JSON_HAS_THREE_WAY_COMPARISON
3021#if JSON_HAS_THREE_WAY_COMPARISON
3022 inline std::partial_ordering operator<=>(
const value_t lhs,
const value_t rhs)
noexcept
3027 static constexpr std::array<std::uint8_t, 9> order = {{
3034 const auto l_index =
static_cast<std::size_t
>(lhs);
3035 const auto r_index =
static_cast<std::size_t
>(rhs);
3036#if JSON_HAS_THREE_WAY_COMPARISON
3037 if (l_index < order.size() && r_index < order.size())
3039 return order[l_index] <=> order[r_index];
3041 return std::partial_ordering::unordered;
3043 return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index];
3051#if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__)
3054 return std::is_lt(lhs <=> rhs);
3092template<
typename StringType>
3094 const StringType& t)
3097 for (
auto pos = s.find(f);
3098 pos != StringType::npos;
3099 s.replace(pos, f.size(), t),
3100 pos = s.find(f, pos + t.size()))
3111template<
typename StringType>
3126template<
typename StringType>
3167 constexpr operator size_t()
const
3192#include <type_traits>
3203using uncvref_t =
typename std::remove_cv<typename std::remove_reference<T>::type>::type;
3205#ifdef JSON_HAS_CPP_14
3208using std::enable_if_t;
3209using std::index_sequence;
3210using std::make_index_sequence;
3211using std::index_sequence_for;
3216template<
bool B,
typename T =
void>
3243template <
typename T, T... Ints>
3247 static constexpr std::size_t
size() noexcept
3249 return sizeof...(Ints);
3258template <
size_t... Ints>
3264template <
typename Seq,
size_t SeqSize,
size_t Rem>
3268template <
typename T, T... Ints,
size_t SeqSize>
3274template <
typename T, T... Ints,
size_t SeqSize>
3282template <
typename T,
size_t N>
3289template <
typename T>
3304template <
typename T, T N>
3320template <
typename... Ts>
3338#ifndef JSON_HAS_CPP_17
3339 template<
typename T>
3343template<
typename T,
typename... Args>
3344constexpr std::array<T,
sizeof...(Args)>
make_array(Args&& ... args)
3346 return std::array<T,
sizeof...(Args)> {{
static_cast<T
>(std::forward<Args>(args))...}};
3366#include <type_traits>
3393template<
typename It,
typename =
void>
3396template<
typename It>
3400 typename It::reference, typename It::iterator_category >>
3411template<
typename T,
typename =
void>
3490#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_
3491 #define INCLUDE_NLOHMANN_JSON_FWD_HPP_
3516 template<
typename T =
void,
typename SFINAE =
void>
3521 template<
template<
typename U,
typename V,
typename... Args>
class ObjectType =
3523 template<
typename U,
typename... Args>
class ArrayType = std::vector,
3524 class StringType = std::string,
class BooleanType = bool,
3525 class NumberIntegerType = std::int64_t,
3526 class NumberUnsignedType = std::uint64_t,
3527 class NumberFloatType = double,
3528 template<
typename U>
class AllocatorType = std::allocator,
3529 template<
typename T,
typename SFINAE =
void>
class JSONSerializer =
3531 class BinaryType = std::vector<std::uint8_t>,
3532 class CustomBaseClass =
void>
3537 template<
typename RefStringType>
3548 template<
class Key,
class T,
class IgnoredLess,
class Allocator>
3593template<
typename BasicJsonContext>
3595 std::integral_constant < bool,
3596 is_basic_json<typename std::remove_cv<typename std::remove_pointer<BasicJsonContext>::type>::type>::value
3597 || std::is_same<BasicJsonContext, std::nullptr_t>::value >
3638template<
typename T,
typename... Args>
3641template<
typename T,
typename... Args>
3644template<
typename T,
typename U>
3648template<
typename BasicJsonType,
typename T,
typename =
void>
3655template <
typename BasicJsonType,
typename T>
3661template<
typename BasicJsonType,
typename T>
3664 using serializer =
typename BasicJsonType::template json_serializer<T, void>;
3668 const BasicJsonType&, T&>
::value;
3673template<
typename BasicJsonType,
typename T,
typename =
void>
3676template<
typename BasicJsonType,
typename T>
3679 using serializer =
typename BasicJsonType::template json_serializer<T, void>;
3688template<
typename BasicJsonType,
typename T,
typename =
void>
3691template<
typename BasicJsonType,
typename T>
3694 using serializer =
typename BasicJsonType::template json_serializer<T, void>;
3705struct has_key_compare : std::integral_constant<bool, is_detected<detect_key_compare, T>::value> {};
3708template<
typename BasicJsonType>
3713 using type =
typename std::conditional < has_key_compare<object_t>::value,
3717template<
typename BasicJsonType>
3749 return static_cast<int_type>(std::char_traits<char>::eof());
3773 return static_cast<int_type>(std::char_traits<char>::eof());
3784template<
class B,
class... Bn>
3786: std::conditional<static_cast<bool>(B::value), conjunction<Bn...>, B>::type {};
3789template<
class B>
struct negation : std::integral_constant < bool, !B::value > { };
3794template <
typename T>
3797template <
typename T1,
typename T2>
3799 :
conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
3801template <
typename T1,
typename T2>
3803 :
conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
3805template <
typename... Ts>
3807 :
conjunction<is_default_constructible<Ts>...> {};
3809template <
typename... Ts>
3811 :
conjunction<is_default_constructible<Ts>...> {};
3813template <
typename T,
typename... Args>
3816template <
typename T1,
typename T2>
3819template <
typename T1,
typename T2>
3822template <
typename... Ts>
3825template <
typename... Ts>
3828template<
typename T,
typename =
void>
3850 using t_ref =
typename std::add_lvalue_reference<T>::type;
3862 static constexpr bool value = !std::is_same<iterator, nonesuch>::value && !std::is_same<sentinel, nonesuch>::value &&
is_iterator_begin;
3875template<
typename T,
typename =
void>
3881template<
typename BasicJsonType,
typename CompatibleObjectType,
3885template<
typename BasicJsonType,
typename CompatibleObjectType>
3887 BasicJsonType, CompatibleObjectType,
3896 typename CompatibleObjectType::key_type>
::value &&
3898 typename CompatibleObjectType::mapped_type>
::value;
3901template<
typename BasicJsonType,
typename CompatibleObjectType>
3905template<
typename BasicJsonType,
typename ConstructibleObjectType,
3909template<
typename BasicJsonType,
typename ConstructibleObjectType>
3911 BasicJsonType, ConstructibleObjectType,
3919 (std::is_move_assignable<ConstructibleObjectType>::value ||
3920 std::is_copy_assignable<ConstructibleObjectType>::value) &&
3922 typename object_t::key_type>
::value &&
3924 typename object_t::mapped_type,
3925 typename ConstructibleObjectType::mapped_type >
::value)) ||
3927 typename ConstructibleObjectType::mapped_type>
::value ||
3930 typename ConstructibleObjectType::mapped_type >
::value);
3933template<
typename BasicJsonType,
typename ConstructibleObjectType>
3936 ConstructibleObjectType> {};
3938template<
typename BasicJsonType,
typename CompatibleStringType>
3945template<
typename BasicJsonType,
typename ConstructibleStringType>
3949#ifdef __INTEL_COMPILER
3950 using laundered_type =
decltype(std::declval<ConstructibleStringType>());
3962template<
typename BasicJsonType,
typename CompatibleArrayType,
typename =
void>
3965template<
typename BasicJsonType,
typename CompatibleArrayType>
3967 BasicJsonType, CompatibleArrayType,
3973 !std::is_same<CompatibleArrayType, detected_t<range_value_t, CompatibleArrayType>>
::value >>
3980template<
typename BasicJsonType,
typename CompatibleArrayType>
3984template<
typename BasicJsonType,
typename ConstructibleArrayType,
typename =
void>
3987template<
typename BasicJsonType,
typename ConstructibleArrayType>
3989 BasicJsonType, ConstructibleArrayType,
3991 typename BasicJsonType::value_type>
::value >>
3992 : std::true_type {};
3994template<
typename BasicJsonType,
typename ConstructibleArrayType>
3996 BasicJsonType, ConstructibleArrayType,
3998 typename BasicJsonType::value_type>
::value&&
4001(std::is_move_assignable<ConstructibleArrayType>::value ||
4002 std::is_copy_assignable<ConstructibleArrayType>::value)&&
4008!std::is_same<ConstructibleArrayType, detected_t<range_value_t, ConstructibleArrayType>>
::value&&
4010detected_t<range_value_t, ConstructibleArrayType >>
::value >>
4016 typename BasicJsonType::array_t::value_type>
::value ||
4024template<
typename BasicJsonType,
typename ConstructibleArrayType>
4028template<
typename RealIntegerType,
typename CompatibleNumberIntegerType,
4032template<
typename RealIntegerType,
typename CompatibleNumberIntegerType>
4034 RealIntegerType, CompatibleNumberIntegerType,
4036 std::is_integral<CompatibleNumberIntegerType>
::value&&
4037 !std::is_same<bool, CompatibleNumberIntegerType>
::value >>
4045 CompatibleNumberIntegerType>
::value &&
4046 CompatibleLimits::is_integer &&
4047 RealLimits::is_signed == CompatibleLimits::is_signed;
4050template<
typename RealIntegerType,
typename CompatibleNumberIntegerType>
4053 CompatibleNumberIntegerType> {};
4055template<
typename BasicJsonType,
typename CompatibleType,
typename =
void>
4058template<
typename BasicJsonType,
typename CompatibleType>
4060 BasicJsonType, CompatibleType,
4067template<
typename BasicJsonType,
typename CompatibleType>
4071template<
typename T1,
typename T2>
4074template<
typename T1,
typename... Args>
4077template<
typename BasicJsonType,
typename T>
4080template<
typename BasicJsonType>
4083template<
typename BasicJsonType>
4088template<
template <
typename...>
class Primary,
typename T>
4091template<
template <
typename...>
class Primary,
typename... Args>
4098template<
typename Compare,
typename A,
typename B,
typename =
void>
4101template<
typename Compare,
typename A,
typename B>
4103decltype(
std::declval<Compare>()(std::declval<A>(), std::declval<B>())),
4104decltype(std::declval<Compare>()(std::declval<B>(), std::declval<A>()))
4105>> : std::true_type {};
4112template<
typename Comparator,
typename ObjectKeyType,
typename KeyTypeCVRef,
bool RequireTransparentComparator =
true,
4116 && !(ExcludeObjectKeyType && std::is_same<KeyType,
4118 && (!RequireTransparentComparator
4119 || is_detected <detect_is_transparent, Comparator>::value)
4122 std::false_type >::type;
4130template<
typename BasicJsonType,
typename KeyTypeCVRef,
bool RequireTransparentComparator =
true,
4134 typename BasicJsonType::object_t::key_type, KeyTypeCVRef,
4135 RequireTransparentComparator, ExcludeObjectKeyType>
::value
4138 std::false_type >::type;
4140template<
typename ObjectType,
typename KeyType>
4144template<
typename BasicJsonType,
typename KeyType>
4148 typename BasicJsonType::object_t, KeyType >
::value,
4150 std::false_type >::type;
4154template <
typename T>
4164 template <
typename C>
static one test(
decltype(&C::capacity) ) ;
4171template < typename T, typename U, enable_if_t < !std::is_same<T, U>::value,
int > = 0 >
4174 return static_cast<T
>(
value);
4177template<typename T, typename U, enable_if_t<std::is_same<T, U>::value,
int> = 0>
4183template<
typename... Types>
4186template<
typename... Types>
4189template<
typename... Types>
4193template<
typename... Types>
4197template<
typename OfType,
typename T>
4199 (std::is_signed<OfType>::value && (
sizeof(T) <
sizeof(OfType)))
4202template<
typename OfType,
typename T,
4203 bool OfTypeSigned = std::is_signed<OfType>::value,
4204 bool TSigned = std::is_signed<T>::value>
4207template<
typename OfType,
typename T>
4212 using CommonType =
typename std::common_type<OfType, T>::type;
4213 return static_cast<CommonType
>(val) <=
static_cast<CommonType
>((std::numeric_limits<OfType>::max)());
4217template<
typename OfType,
typename T>
4222 using CommonType =
typename std::common_type<OfType, T>::type;
4223 return static_cast<CommonType
>(val) <=
static_cast<CommonType
>((std::numeric_limits<OfType>::max)());
4227template<
typename OfType,
typename T>
4232 using CommonType =
typename std::common_type<OfType, T>::type;
4233 return val >= 0 &&
static_cast<CommonType
>(val) <=
static_cast<CommonType
>((std::numeric_limits<OfType>::max)());
4237template<
typename OfType,
typename T>
4242 using CommonType =
typename std::common_type<OfType, T>::type;
4243 return static_cast<CommonType
>(val) >=
static_cast<CommonType
>((std::numeric_limits<OfType>::min)())
4244 &&
static_cast<CommonType
>(val) <=
static_cast<CommonType
>((std::numeric_limits<OfType>::max)());
4248template<
typename OfType,
typename T,
4249 bool NeverOutOfRange = never_out_of_range<OfType, T>::value,
4253template<
typename OfType,
typename T>
4262template<
typename OfType,
typename T>
4271template<
typename OfType,
typename T>
4290 using TUnExt =
typename std::remove_extent<T>::type;
4291 using TUnCVExt =
typename std::remove_cv<TUnExt>::type;
4292 using TUnPtr =
typename std::remove_pointer<T>::type;
4293 using TUnCVPtr =
typename std::remove_cv<TUnPtr>::type;
4295 (std::is_array<T>::value && std::is_same<TUnCVExt, char>::value)
4296 || (std::is_pointer<T>::value && std::is_same<TUnCVPtr, char>::value);
4361template<
typename... Args>
4362inline std::size_t
concat_length(
const char* cstr,
const Args& ... rest);
4364template<
typename StringType,
typename... Args>
4365inline std::size_t
concat_length(
const StringType& str,
const Args& ... rest);
4367template<
typename... Args>
4373template<
typename... Args>
4380template<
typename StringType,
typename... Args>
4386template<
typename OutStringType>
4390template<
typename StringType,
typename Arg>
4393template<
typename StringType,
typename Arg>
4396template<
typename StringType,
typename Arg>
4399template<
typename StringType,
typename Arg>
4402template<
typename StringType,
typename Arg>
4403using string_can_append_iter =
decltype(std::declval<StringType&>().append(std::declval<const Arg&>().begin(), std::declval<const Arg&>().end()));
4405template<
typename StringType,
typename Arg>
4408template<
typename StringType,
typename Arg>
4409using string_can_append_data =
decltype(std::declval<StringType&>().append(std::declval<const Arg&>().data(), std::declval<const Arg&>().size()));
4411template<
typename StringType,
typename Arg>
4414template <
typename OutStringType,
typename Arg,
typename... Args,
4415 enable_if_t < !detect_string_can_append<OutStringType, Arg>::value
4417inline void concat_into(OutStringType& out, Arg && arg, Args && ... rest);
4419template <
typename OutStringType,
typename Arg,
typename... Args,
4420 enable_if_t < !detect_string_can_append<OutStringType, Arg>::value
4423inline void concat_into(OutStringType& out,
const Arg& arg, Args && ... rest);
4425template <
typename OutStringType,
typename Arg,
typename... Args,
4426 enable_if_t < !detect_string_can_append<OutStringType, Arg>::value
4430inline void concat_into(OutStringType& out,
const Arg& arg, Args && ... rest);
4432template<
typename OutStringType,
typename Arg,
typename... Args,
4434inline void concat_into(OutStringType& out, Arg && arg, Args && ... rest)
4436 out.append(std::forward<Arg>(arg));
4440template <
typename OutStringType,
typename Arg,
typename... Args,
4441 enable_if_t < !detect_string_can_append<OutStringType, Arg>::value
4442 && detect_string_can_append_op<OutStringType, Arg>::value,
int > >
4443inline void concat_into(OutStringType& out, Arg&& arg, Args&& ... rest)
4445 out += std::forward<Arg>(arg);
4449template <
typename OutStringType,
typename Arg,
typename... Args,
4450 enable_if_t < !detect_string_can_append<OutStringType, Arg>::value
4453inline void concat_into(OutStringType& out,
const Arg& arg, Args&& ... rest)
4455 out.append(arg.begin(), arg.end());
4459template <
typename OutStringType,
typename Arg,
typename... Args,
4460 enable_if_t < !detect_string_can_append<OutStringType, Arg>::value
4461 && !detect_string_can_append_op<OutStringType, Arg>::value
4462 && !detect_string_can_append_iter<OutStringType, Arg>::value
4463 && detect_string_can_append_data<OutStringType, Arg>::value,
int > >
4464inline void concat_into(OutStringType& out,
const Arg& arg, Args&& ... rest)
4466 out.append(arg.data(), arg.size());
4470template<
typename OutStringType = std::string,
typename... Args>
4490#if defined(__clang__)
4491 #pragma clang diagnostic push
4492 #pragma clang diagnostic ignored "-Wweak-vtables"
4509 const char*
what() const noexcept
override
4519 exception(
int id_, const
char* what_arg) :
id(id_),
m(what_arg) {}
4521 static std::string
name(
const std::string& ename,
int id_)
4523 return concat(
"[json.exception.", ename,
'.', std::to_string(id_),
"] ");
4531 template<
typename BasicJsonType>
4535 std::vector<std::string> tokens;
4536 for (
const auto* current = leaf_element; current !=
nullptr && current->m_parent !=
nullptr; current = current->m_parent)
4538 switch (current->m_parent->type())
4542 for (std::size_t i = 0; i < current->m_parent->m_data.m_value.array->size(); ++i)
4544 if (¤t->m_parent->m_data.m_value.array->operator[](i) == current)
4546 tokens.emplace_back(std::to_string(i));
4555 for (
const auto& element : *current->m_parent->m_data.m_value.object)
4557 if (&element.second == current)
4559 tokens.emplace_back(element.first.c_str());
4584 auto str = std::accumulate(tokens.rbegin(), tokens.rend(), std::string{},
4585 [](
const std::string & a,
const std::string & b)
4587 return concat(a,
'/', detail::escape(b));
4598 std::runtime_error
m;
4599#if JSON_DIAGNOSTIC_POSITIONS
4600 template<
typename BasicJsonType>
4603 if ((leaf_element->start_pos() != std::string::npos) && (leaf_element->end_pos() != std::string::npos))
4605 return concat(
"(bytes ", std::to_string(leaf_element->start_pos()),
"-", std::to_string(leaf_element->end_pos()),
") ");
4610 template<
typename BasicJsonType>
4613 static_cast<void>(leaf_element);
4633 template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value,
int> = 0>
4641 template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value,
int> = 0>
4642 static parse_error create(
int id_, std::size_t byte_,
const std::string& what_arg, BasicJsonContext context)
4645 (byte_ != 0 ? (
concat(
" at byte ", std::to_string(byte_))) :
""),
4647 return {id_, byte_, w.c_str()};
4677 template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value,
int> = 0>
4681 return {id_, w.c_str()};
4695 template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value,
int> = 0>
4699 return {id_, w.c_str()};
4712 template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value,
int> = 0>
4716 return {id_, w.c_str()};
4729 template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value,
int> = 0>
4733 return {id_, w.c_str()};
4744#if defined(__clang__)
4745 #pragma clang diagnostic pop
4790#if JSON_HAS_EXPERIMENTAL_FILESYSTEM
4791#include <experimental/filesystem>
4795namespace std_fs = std::experimental::filesystem;
4798#elif JSON_HAS_FILESYSTEM
4799#include <filesystem>
4803namespace std_fs = std::filesystem;
4819template<
typename BasicJsonType>
4820inline void from_json(
const BasicJsonType& j,
typename std::nullptr_t& n)
4829#ifdef JSON_HAS_CPP_17
4830#ifndef JSON_USE_IMPLICIT_CONVERSIONS
4831template<
typename BasicJsonType,
typename T>
4832void from_json(
const BasicJsonType& j, std::optional<T>& opt)
4840 opt.emplace(j.template
get<T>());
4848template <
typename BasicJsonType,
typename ArithmeticType,
4849 enable_if_t < std::is_arithmetic<ArithmeticType>::value&&
4850 !std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value,
4854 switch (
static_cast<value_t>(j))
4858 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>());
4863 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>());
4868 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>());
4884template<
typename BasicJsonType>
4885inline void from_json(
const BasicJsonType& j,
typename BasicJsonType::boolean_t& b)
4891 b = *j.template get_ptr<const typename BasicJsonType::boolean_t*>();
4894template<
typename BasicJsonType>
4895inline void from_json(
const BasicJsonType& j,
typename BasicJsonType::string_t& s)
4901 s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
4905 typename BasicJsonType,
typename StringType,
4907 std::is_assignable<StringType&, const typename BasicJsonType::string_t>::value
4908 && is_detected_exact<typename BasicJsonType::string_t::value_type, value_type_t, StringType>::value
4909 && !std::is_same<typename BasicJsonType::string_t, StringType>::value
4910 && !is_json_ref<StringType>::value,
int > = 0 >
4918 s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
4921template<
typename BasicJsonType>
4922inline void from_json(
const BasicJsonType& j,
typename BasicJsonType::number_float_t& val)
4927template<
typename BasicJsonType>
4928inline void from_json(
const BasicJsonType& j,
typename BasicJsonType::number_unsigned_t& val)
4933template<
typename BasicJsonType>
4934inline void from_json(
const BasicJsonType& j,
typename BasicJsonType::number_integer_t& val)
4939#if !JSON_DISABLE_ENUM_SERIALIZATION
4940template<
typename BasicJsonType,
typename EnumType,
4941 enable_if_t<std::is_enum<EnumType>::value,
int> = 0>
4944 typename std::underlying_type<EnumType>::type val;
4946 e =
static_cast<EnumType
>(val);
4951template<
typename BasicJsonType,
typename T,
typename Allocator,
4952 enable_if_t<is_getable<BasicJsonType, T>::value,
int> = 0>
4953inline void from_json(
const BasicJsonType& j, std::forward_list<T, Allocator>& l)
4960 std::transform(j.rbegin(), j.rend(),
4961 std::front_inserter(l), [](
const BasicJsonType & i)
4963 return i.template get<T>();
4968template<
typename BasicJsonType,
typename T,
4969 enable_if_t<is_getable<BasicJsonType, T>::value,
int> = 0>
4970inline void from_json(
const BasicJsonType& j, std::valarray<T>& l)
4977 std::transform(j.begin(), j.end(), std::begin(l),
4978 [](
const BasicJsonType & elem)
4980 return elem.template get<T>();
4984template<
typename BasicJsonType,
typename T, std::
size_t N>
4986->
decltype(j.template
get<T>(), void())
4988 for (std::size_t i = 0; i < N; ++i)
4990 arr[i] = j.at(i).template
get<T>();
4994template<
typename BasicJsonType,
typename T, std::
size_t N1, std::
size_t N2>
4996->
decltype(j.template
get<T>(), void())
4998 for (std::size_t i1 = 0; i1 < N1; ++i1)
5000 for (std::size_t i2 = 0; i2 < N2; ++i2)
5002 arr[i1][i2] = j.at(i1).at(i2).template
get<T>();
5007template<
typename BasicJsonType,
typename T, std::
size_t N1, std::
size_t N2, std::
size_t N3>
5009->
decltype(j.template
get<T>(), void())
5011 for (std::size_t i1 = 0; i1 < N1; ++i1)
5013 for (std::size_t i2 = 0; i2 < N2; ++i2)
5015 for (std::size_t i3 = 0; i3 < N3; ++i3)
5017 arr[i1][i2][i3] = j.at(i1).at(i2).at(i3).template
get<T>();
5023template<
typename BasicJsonType,
typename T, std::
size_t N1, std::
size_t N2, std::
size_t N3, std::
size_t N4>
5024auto from_json(
const BasicJsonType& j, T (&arr)[N1][N2][N3][N4])
5025->
decltype(j.template
get<T>(), void())
5027 for (std::size_t i1 = 0; i1 < N1; ++i1)
5029 for (std::size_t i2 = 0; i2 < N2; ++i2)
5031 for (std::size_t i3 = 0; i3 < N3; ++i3)
5033 for (std::size_t i4 = 0; i4 < N4; ++i4)
5035 arr[i1][i2][i3][i4] = j.at(i1).at(i2).at(i3).at(i4).template
get<T>();
5042template<
typename BasicJsonType>
5045 arr = *j.template get_ptr<const typename BasicJsonType::array_t*>();
5048template<
typename BasicJsonType,
typename T, std::
size_t N>
5051->
decltype(j.template
get<T>(), void())
5053 for (std::size_t i = 0; i < N; ++i)
5055 arr[i] = j.at(i).template
get<T>();
5059template<
typename BasicJsonType,
typename ConstructibleArrayType,
5061 std::is_assignable<ConstructibleArrayType&, ConstructibleArrayType>::value,
5065 arr.reserve(std::declval<typename ConstructibleArrayType::size_type>()),
5071 ConstructibleArrayType ret;
5072 ret.reserve(j.size());
5073 std::transform(j.begin(), j.end(),
5074 std::inserter(ret, end(ret)), [](
const BasicJsonType & i)
5080 arr = std::move(ret);
5083template<
typename BasicJsonType,
typename ConstructibleArrayType,
5085 std::is_assignable<ConstructibleArrayType&, ConstructibleArrayType>::value,
5092 ConstructibleArrayType ret;
5094 j.begin(), j.end(), std::inserter(ret, end(ret)),
5095 [](
const BasicJsonType & i)
5101 arr = std::move(ret);
5104template <
typename BasicJsonType,
typename ConstructibleArrayType,
5106 is_constructible_array_type<BasicJsonType, ConstructibleArrayType>::value&&
5107 !is_constructible_object_type<BasicJsonType, ConstructibleArrayType>::value&&
5109 !std::is_same<ConstructibleArrayType, typename BasicJsonType::binary_t>::value&&
5110 !is_basic_json<ConstructibleArrayType>::value,
5112auto from_json(
const BasicJsonType& j, ConstructibleArrayType& arr)
5125template <
typename BasicJsonType,
typename T, std::size_t... Idx >
5129 return { { std::forward<BasicJsonType>(j).at(Idx).template
get<T>()... } };
5132template <
typename BasicJsonType,
typename T, std::
size_t N >
5144template<
typename BasicJsonType>
5145inline void from_json(
const BasicJsonType& j,
typename BasicJsonType::binary_t& bin)
5152 bin = *j.template get_ptr<const typename BasicJsonType::binary_t*>();
5155template<
typename BasicJsonType,
typename ConstructibleObjectType,
5156 enable_if_t<is_constructible_object_type<BasicJsonType, ConstructibleObjectType>::value,
int> = 0>
5157inline void from_json(
const BasicJsonType& j, ConstructibleObjectType& obj)
5164 ConstructibleObjectType ret;
5165 const auto* inner_object = j.template get_ptr<const typename BasicJsonType::object_t*>();
5166 using value_type =
typename ConstructibleObjectType::value_type;
5168 inner_object->begin(), inner_object->end(),
5169 std::inserter(ret, ret.begin()),
5170 [](
typename BasicJsonType::object_t::value_type
const & p)
5172 return value_type(p.first, p.second.template get<typename ConstructibleObjectType::mapped_type>());
5174 obj = std::move(ret);
5181template <
typename BasicJsonType,
typename ArithmeticType,
5183 std::is_arithmetic<ArithmeticType>::value&&
5184 !std::is_same<ArithmeticType, typename BasicJsonType::number_unsigned_t>::value&&
5185 !std::is_same<ArithmeticType, typename BasicJsonType::number_integer_t>::value&&
5186 !std::is_same<ArithmeticType, typename BasicJsonType::number_float_t>::value&&
5187 !std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value,
5189inline void from_json(
const BasicJsonType& j, ArithmeticType& val)
5191 switch (
static_cast<value_t>(j))
5195 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>());
5200 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>());
5205 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>());
5210 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::boolean_t*>());
5225template<
typename BasicJsonType,
typename... Args, std::size_t... Idx>
5228 return std::make_tuple(std::forward<BasicJsonType>(j).at(Idx).
template get<Args>()...);
5231template<
typename BasicJsonType>
5237template <
typename BasicJsonType,
class A1,
class A2 >
5240 return {std::forward<BasicJsonType>(j).at(0).template
get<A1>(),
5241 std::forward<BasicJsonType>(j).at(1).template
get<A2>()};
5244template<
typename BasicJsonType,
typename A1,
typename A2>
5250template<
typename BasicJsonType,
typename... Args>
5256template<
typename BasicJsonType,
typename... Args>
5262template<
typename BasicJsonType,
typename TupleRelated>
5274template <
typename BasicJsonType,
typename Key,
typename Value,
typename Compare,
typename Allocator,
5276 typename BasicJsonType::string_t, Key >
::value >>
5277inline void from_json(
const BasicJsonType& j, std::map<Key, Value, Compare, Allocator>& m)
5284 for (
const auto& p : j)
5294template <
typename BasicJsonType,
typename Key,
typename Value,
typename Hash,
typename KeyEqual,
typename Allocator,
5296 typename BasicJsonType::string_t, Key >
::value >>
5297inline void from_json(
const BasicJsonType& j, std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>& m)
5304 for (
const auto& p : j)
5314#if JSON_HAS_FILESYSTEM || JSON_HAS_EXPERIMENTAL_FILESYSTEM
5315template<
typename BasicJsonType>
5316inline void from_json(
const BasicJsonType& j, std_fs::path& p)
5322 p = *j.template get_ptr<const typename BasicJsonType::string_t*>();
5328 template<
typename BasicJsonType,
typename T>
5330 noexcept(
noexcept(
from_json(j, std::forward<T>(val))))
5331 ->
decltype(
from_json(j, std::forward<T>(val)))
5333 return from_json(j, std::forward<T>(val));
5339#ifndef JSON_HAS_CPP_17
5348#ifndef JSON_HAS_CPP_17
5367#ifdef JSON_HAS_CPP_17
5375#include <type_traits>
5425template<
typename StringType>
5429 using std::to_string;
5433template<
typename StringType>
5459 using string_type =
typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().key() ) >::type >::type;
5476 noexcept(
std::is_nothrow_move_constructible<IteratorType>::
value
5486 noexcept(
std::is_nothrow_move_constructible<IteratorType>::
value
5489 noexcept(
std::is_nothrow_move_assignable<IteratorType>::
value
5533 switch (
anchor.m_object->type())
5565 typename IteratorType::reference
value()
const
5607template<std::
size_t N,
typename IteratorType, enable_if_t<N == 0,
int> = 0>
5608auto get(
const nlohmann::detail::iteration_proxy_value<IteratorType>& i) ->
decltype(i.key())
5615template<std::
size_t N,
typename IteratorType, enable_if_t<N == 1,
int> = 0>
5616auto get(
const nlohmann::detail::iteration_proxy_value<IteratorType>& i) ->
decltype(i.value())
5631#if defined(__clang__)
5633 #pragma clang diagnostic push
5634 #pragma clang diagnostic ignored "-Wmismatched-tags"
5636template<
typename IteratorType>
5637class tuple_size<::nlohmann::detail::iteration_proxy_value<IteratorType>>
5638 :
public std::integral_constant<std::size_t, 2> {};
5640template<std::
size_t N,
typename IteratorType>
5641class tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >>
5645 get<N>(std::declval <
5646 ::nlohmann::detail::iteration_proxy_value<IteratorType >> ()));
5648#if defined(__clang__)
5649 #pragma clang diagnostic pop
5655 template <
typename IteratorType>
5656 inline constexpr bool ::std::ranges::enable_borrowed_range<::nlohmann::detail::iteration_proxy<IteratorType>> =
true;
5688 template<
typename BasicJsonType>
5689 static void construct(BasicJsonType& j,
typename BasicJsonType::boolean_t b)
noexcept
5691 j.m_data.m_value.destroy(j.m_data.m_type);
5693 j.m_data.m_value = b;
5694 j.assert_invariant();
5701 template<
typename BasicJsonType>
5702 static void construct(BasicJsonType& j,
const typename BasicJsonType::string_t& s)
5704 j.m_data.m_value.destroy(j.m_data.m_type);
5706 j.m_data.m_value = s;
5707 j.assert_invariant();
5710 template<
typename BasicJsonType>
5711 static void construct(BasicJsonType& j,
typename BasicJsonType::string_t&& s)
5713 j.m_data.m_value.destroy(j.m_data.m_type);
5715 j.m_data.m_value = std::move(s);
5716 j.assert_invariant();
5719 template <
typename BasicJsonType,
typename CompatibleStringType,
5720 enable_if_t < !std::is_same<CompatibleStringType, typename BasicJsonType::string_t>::value,
5722 static void construct(BasicJsonType& j,
const CompatibleStringType& str)
5724 j.m_data.m_value.destroy(j.m_data.m_type);
5726 j.m_data.m_value.string = j.template create<typename BasicJsonType::string_t>(str);
5727 j.assert_invariant();
5734 template<
typename BasicJsonType>
5735 static void construct(BasicJsonType& j,
const typename BasicJsonType::binary_t& b)
5737 j.m_data.m_value.destroy(j.m_data.m_type);
5739 j.m_data.m_value =
typename BasicJsonType::binary_t(b);
5740 j.assert_invariant();
5743 template<
typename BasicJsonType>
5744 static void construct(BasicJsonType& j,
typename BasicJsonType::binary_t&& b)
5746 j.m_data.m_value.destroy(j.m_data.m_type);
5748 j.m_data.m_value =
typename BasicJsonType::binary_t(std::move(b));
5749 j.assert_invariant();
5756 template<
typename BasicJsonType>
5757 static void construct(BasicJsonType& j,
typename BasicJsonType::number_float_t val)
noexcept
5759 j.m_data.m_value.destroy(j.m_data.m_type);
5761 j.m_data.m_value = val;
5762 j.assert_invariant();
5769 template<
typename BasicJsonType>
5770 static void construct(BasicJsonType& j,
typename BasicJsonType::number_unsigned_t val)
noexcept
5772 j.m_data.m_value.destroy(j.m_data.m_type);
5774 j.m_data.m_value = val;
5775 j.assert_invariant();
5782 template<
typename BasicJsonType>
5783 static void construct(BasicJsonType& j,
typename BasicJsonType::number_integer_t val)
noexcept
5785 j.m_data.m_value.destroy(j.m_data.m_type);
5787 j.m_data.m_value = val;
5788 j.assert_invariant();
5795 template<
typename BasicJsonType>
5796 static void construct(BasicJsonType& j,
const typename BasicJsonType::array_t& arr)
5798 j.m_data.m_value.destroy(j.m_data.m_type);
5800 j.m_data.m_value = arr;
5802 j.assert_invariant();
5805 template<
typename BasicJsonType>
5806 static void construct(BasicJsonType& j,
typename BasicJsonType::array_t&& arr)
5808 j.m_data.m_value.destroy(j.m_data.m_type);
5810 j.m_data.m_value = std::move(arr);
5812 j.assert_invariant();
5815 template <
typename BasicJsonType,
typename CompatibleArrayType,
5816 enable_if_t < !std::is_same<CompatibleArrayType, typename BasicJsonType::array_t>::value,
5818 static void construct(BasicJsonType& j,
const CompatibleArrayType& arr)
5823 j.m_data.m_value.destroy(j.m_data.m_type);
5825 j.m_data.m_value.array = j.template create<typename BasicJsonType::array_t>(begin(arr), end(arr));
5827 j.assert_invariant();
5830 template<
typename BasicJsonType>
5831 static void construct(BasicJsonType& j,
const std::vector<bool>& arr)
5833 j.m_data.m_value.destroy(j.m_data.m_type);
5836 j.m_data.m_value.array->reserve(arr.size());
5837 for (
const bool x : arr)
5839 j.m_data.m_value.array->push_back(x);
5840 j.set_parent(j.m_data.m_value.array->back());
5842 j.assert_invariant();
5845 template<
typename BasicJsonType,
typename T,
5847 static void construct(BasicJsonType& j,
const std::valarray<T>& arr)
5849 j.m_data.m_value.destroy(j.m_data.m_type);
5852 j.m_data.m_value.array->resize(arr.size());
5855 std::copy(std::begin(arr), std::end(arr), j.m_data.m_value.array->begin());
5858 j.assert_invariant();
5865 template<
typename BasicJsonType>
5866 static void construct(BasicJsonType& j,
const typename BasicJsonType::object_t& obj)
5868 j.m_data.m_value.destroy(j.m_data.m_type);
5870 j.m_data.m_value = obj;
5872 j.assert_invariant();
5875 template<
typename BasicJsonType>
5876 static void construct(BasicJsonType& j,
typename BasicJsonType::object_t&& obj)
5878 j.m_data.m_value.destroy(j.m_data.m_type);
5880 j.m_data.m_value = std::move(obj);
5882 j.assert_invariant();
5885 template <
typename BasicJsonType,
typename CompatibleObjectType,
5886 enable_if_t < !std::is_same<CompatibleObjectType, typename BasicJsonType::object_t>::value,
int > = 0 >
5887 static void construct(BasicJsonType& j,
const CompatibleObjectType& obj)
5892 j.m_data.m_value.destroy(j.m_data.m_type);
5894 j.m_data.m_value.object = j.template create<typename BasicJsonType::object_t>(begin(obj), end(obj));
5896 j.assert_invariant();
5904#ifdef JSON_HAS_CPP_17
5905template<
typename BasicJsonType,
typename T,
5906 enable_if_t<std::is_constructible<BasicJsonType, T>::value,
int> = 0>
5907void to_json(BasicJsonType& j,
const std::optional<T>& opt)
5909 if (opt.has_value())
5920template<
typename BasicJsonType,
typename T,
5922inline void to_json(BasicJsonType& j, T b)
noexcept
5927template <
typename BasicJsonType,
typename BoolRef,
5929 ((std::is_same<std::vector<bool>::reference, BoolRef>
::value
5930 && !std::is_same <std::vector<bool>::reference,
typename BasicJsonType::boolean_t&>
::value)
5931 || (std::is_same<std::vector<bool>::const_reference, BoolRef>
::value
5932 && !std::is_same <detail::uncvref_t<std::vector<bool>::const_reference>,
5933 typename BasicJsonType::boolean_t >
::value))
5934 && std::is_convertible<const BoolRef&, typename BasicJsonType::boolean_t>::value,
int > = 0 >
5935inline void to_json(BasicJsonType& j,
const BoolRef& b)
noexcept
5940template<
typename BasicJsonType,
typename CompatibleString,
5941 enable_if_t<std::is_constructible<typename BasicJsonType::string_t, CompatibleString>::value,
int> = 0>
5942inline void to_json(BasicJsonType& j,
const CompatibleString& s)
5947template<
typename BasicJsonType>
5948inline void to_json(BasicJsonType& j,
typename BasicJsonType::string_t&& s)
5953template<
typename BasicJsonType,
typename FloatType,
5954 enable_if_t<std::is_floating_point<FloatType>::value,
int> = 0>
5955inline void to_json(BasicJsonType& j, FloatType val)
noexcept
5960template<
typename BasicJsonType,
typename CompatibleNumberUnsignedType,
5961 enable_if_t<is_compatible_integer_type<typename BasicJsonType::number_unsigned_t, CompatibleNumberUnsignedType>::value,
int> = 0>
5962inline void to_json(BasicJsonType& j, CompatibleNumberUnsignedType val)
noexcept
5967template<
typename BasicJsonType,
typename CompatibleNumberIntegerType,
5968 enable_if_t<is_compatible_integer_type<typename BasicJsonType::number_integer_t, CompatibleNumberIntegerType>::value,
int> = 0>
5969inline void to_json(BasicJsonType& j, CompatibleNumberIntegerType val)
noexcept
5974#if !JSON_DISABLE_ENUM_SERIALIZATION
5975template<
typename BasicJsonType,
typename EnumType,
5976 enable_if_t<std::is_enum<EnumType>::value,
int> = 0>
5977inline void to_json(BasicJsonType& j, EnumType e)
noexcept
5979 using underlying_type =
typename std::underlying_type<EnumType>::type;
5985template<
typename BasicJsonType>
5986inline void to_json(BasicJsonType& j,
const std::vector<bool>& e)
5991template <
typename BasicJsonType,
typename CompatibleArrayType,
5992 enable_if_t < is_compatible_array_type<BasicJsonType,
5994 !is_compatible_object_type<BasicJsonType, CompatibleArrayType>::value&&
5996 !std::is_same<typename BasicJsonType::binary_t, CompatibleArrayType>::value&&
5997 !is_basic_json<CompatibleArrayType>::value,
5999inline void to_json(BasicJsonType& j,
const CompatibleArrayType& arr)
6004template<
typename BasicJsonType>
6005inline void to_json(BasicJsonType& j,
const typename BasicJsonType::binary_t& bin)
6010template<
typename BasicJsonType,
typename T,
6011 enable_if_t<std::is_convertible<T, BasicJsonType>::value,
int> = 0>
6012inline void to_json(BasicJsonType& j,
const std::valarray<T>& arr)
6017template<
typename BasicJsonType>
6018inline void to_json(BasicJsonType& j,
typename BasicJsonType::array_t&& arr)
6023template <
typename BasicJsonType,
typename CompatibleObjectType,
6024 enable_if_t < is_compatible_object_type<BasicJsonType, CompatibleObjectType>::value&& !is_basic_json<CompatibleObjectType>::value,
int > = 0 >
6025inline void to_json(BasicJsonType& j,
const CompatibleObjectType& obj)
6030template<
typename BasicJsonType>
6031inline void to_json(BasicJsonType& j,
typename BasicJsonType::object_t&& obj)
6037 typename BasicJsonType,
typename T, std::size_t N,
6038 enable_if_t < !std::is_constructible<
typename BasicJsonType::string_t,
6041inline void to_json(BasicJsonType& j,
const T(&arr)[N])
6046template < typename BasicJsonType, typename T1, typename T2, enable_if_t < std::is_constructible<BasicJsonType, T1>::value&& std::is_constructible<BasicJsonType, T2>::value,
int > = 0 >
6047inline void to_json(BasicJsonType& j,
const std::pair<T1, T2>& p)
6049 j = { p.first, p.second };
6053template<
typename BasicJsonType,
typename T,
6057 j = { {b.key(), b.value()} };
6060template<
typename BasicJsonType,
typename Tuple, std::size_t... Idx>
6063 j = { std::get<Idx>(t)... };
6066template<
typename BasicJsonType,
typename Tuple>
6069 using array_t =
typename BasicJsonType::array_t;
6073template<typename BasicJsonType, typename T, enable_if_t<is_constructible_tuple<BasicJsonType, T>::value,
int > = 0>
6074inline void to_json(BasicJsonType& j,
const T& t)
6079#if JSON_HAS_FILESYSTEM || JSON_HAS_EXPERIMENTAL_FILESYSTEM
6080template<
typename BasicJsonType>
6081inline void to_json(BasicJsonType& j,
const std_fs::path& p)
6089 template<
typename BasicJsonType,
typename T>
6090 auto operator()(BasicJsonType& j, T&& val)
const noexcept(
noexcept(
to_json(j, std::forward<T>(val))))
6091 ->
decltype(
to_json(j, std::forward<T>(val)),
void())
6093 return to_json(j, std::forward<T>(val));
6098#ifndef JSON_HAS_CPP_17
6107#ifndef JSON_HAS_CPP_17
6119template<
typename ValueType,
typename>
6124 template<
typename BasicJsonType,
typename TargetType = ValueType>
6125 static auto from_json(BasicJsonType && j, TargetType& val)
noexcept(
6126 noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val)))
6127 ->
decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val),
void())
6129 ::nlohmann::from_json(std::forward<BasicJsonType>(j), val);
6134 template<
typename BasicJsonType,
typename TargetType = ValueType>
6139 return ::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {});
6144 template<
typename BasicJsonType,
typename TargetType = ValueType>
6145 static auto to_json(BasicJsonType& j, TargetType && val)
noexcept(
6146 noexcept(::nlohmann::to_json(j, std::forward<TargetType>(val))))
6147 ->
decltype(::nlohmann::to_json(j, std::forward<TargetType>(val)),
void())
6149 ::nlohmann::to_json(j, std::forward<TargetType>(val));
6177template<
typename BinaryType>
6221 return !(rhs == *
this);
6280#include <functional>
6292inline std::size_t
combine(std::size_t seed, std::size_t h)
noexcept
6294 seed ^= h + 0x9e3779b9 + (seed << 6U) + (seed >> 2U);
6309template<
typename BasicJsonType>
6310std::size_t
hash(
const BasicJsonType& j)
6312 using string_t =
typename BasicJsonType::string_t;
6313 using number_integer_t =
typename BasicJsonType::number_integer_t;
6314 using number_unsigned_t =
typename BasicJsonType::number_unsigned_t;
6315 using number_float_t =
typename BasicJsonType::number_float_t;
6317 const auto type =
static_cast<std::size_t
>(j.type());
6320 case BasicJsonType::value_t::null:
6321 case BasicJsonType::value_t::discarded:
6326 case BasicJsonType::value_t::object:
6328 auto seed =
combine(type, j.size());
6329 for (
const auto& element : j.items())
6331 const auto h = std::hash<string_t> {}(element.key());
6338 case BasicJsonType::value_t::array:
6340 auto seed =
combine(type, j.size());
6341 for (
const auto& element : j)
6348 case BasicJsonType::value_t::string:
6350 const auto h = std::hash<string_t> {}(j.template get_ref<const string_t&>());
6354 case BasicJsonType::value_t::boolean:
6356 const auto h = std::hash<bool> {}(j.template
get<bool>());
6360 case BasicJsonType::value_t::number_integer:
6366 case BasicJsonType::value_t::number_unsigned:
6372 case BasicJsonType::value_t::number_float:
6378 case BasicJsonType::value_t::binary:
6380 auto seed =
combine(type, j.get_binary().size());
6381 const auto h = std::hash<bool> {}(j.get_binary().has_subtype());
6383 seed =
combine(seed,
static_cast<std::size_t
>(j.get_binary().subtype()));
6384 for (
const auto byte : j.get_binary())
6386 seed =
combine(seed, std::hash<std::uint8_t> {}(byte));
6423#ifdef __cpp_lib_byteswap
6447#include <type_traits>
6501 return std::fgetc(
m_file);
6508 return fread(dest, 1,
sizeof(T) * count,
m_file);
6536 is->clear(
is->rdstate() & std::ios::eofbit);
6541 :
is(&i),
sb(i.rdbuf())
6550 :
is(rhs.is),
sb(rhs.sb)
6561 auto res =
sb->sbumpc();
6565 is->clear(
is->rdstate() | std::ios::eofbit);
6573 auto res =
static_cast<std::size_t
>(
sb->sgetn(
reinterpret_cast<char*
>(dest),
static_cast<std::streamsize
>(count *
sizeof(T))));
6576 is->clear(
is->rdstate() | std::ios::eofbit);
6583 std::istream*
is =
nullptr;
6584 std::streambuf*
sb =
nullptr;
6590template<
typename IteratorType>
6594 using char_type =
typename std::iterator_traits<IteratorType>::value_type;
6616 auto* ptr =
reinterpret_cast<char*
>(dest);
6617 for (std::size_t read_index = 0; read_index < count *
sizeof(T); ++read_index)
6621 ptr[read_index] =
static_cast<char>(*current);
6629 return count *
sizeof(T);
6636 template<
typename BaseInputAdapter,
size_t T>
6645template<
typename BaseInputAdapter,
size_t T>
6648template<
typename BaseInputAdapter>
6653 std::array<std::char_traits<char>::int_type, 4>& utf8_bytes,
6654 size_t& utf8_bytes_index,
6655 size_t& utf8_bytes_filled)
6657 utf8_bytes_index = 0;
6661 utf8_bytes[0] = std::char_traits<char>::eof();
6662 utf8_bytes_filled = 1;
6667 const auto wc = input.get_character();
6672 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(wc);
6673 utf8_bytes_filled = 1;
6675 else if (wc <= 0x7FF)
6677 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xC0u | ((
static_cast<unsigned int>(wc) >> 6u) & 0x1Fu));
6678 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
6679 utf8_bytes_filled = 2;
6681 else if (wc <= 0xFFFF)
6683 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xE0u | ((
static_cast<unsigned int>(wc) >> 12u) & 0x0Fu));
6684 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((
static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));
6685 utf8_bytes[2] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
6686 utf8_bytes_filled = 3;
6688 else if (wc <= 0x10FFFF)
6690 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xF0u | ((
static_cast<unsigned int>(wc) >> 18u) & 0x07u));
6691 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((
static_cast<unsigned int>(wc) >> 12u) & 0x3Fu));
6692 utf8_bytes[2] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((
static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));
6693 utf8_bytes[3] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
6694 utf8_bytes_filled = 4;
6699 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(wc);
6700 utf8_bytes_filled = 1;
6706template<
typename BaseInputAdapter>
6711 std::array<std::char_traits<char>::int_type, 4>& utf8_bytes,
6712 size_t& utf8_bytes_index,
6713 size_t& utf8_bytes_filled)
6715 utf8_bytes_index = 0;
6719 utf8_bytes[0] = std::char_traits<char>::eof();
6720 utf8_bytes_filled = 1;
6725 const auto wc = input.get_character();
6730 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(wc);
6731 utf8_bytes_filled = 1;
6733 else if (wc <= 0x7FF)
6735 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xC0u | ((
static_cast<unsigned int>(wc) >> 6u)));
6736 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
6737 utf8_bytes_filled = 2;
6739 else if (0xD800 > wc || wc >= 0xE000)
6741 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xE0u | ((
static_cast<unsigned int>(wc) >> 12u)));
6742 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((
static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));
6743 utf8_bytes[2] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
6744 utf8_bytes_filled = 3;
6750 const auto wc2 =
static_cast<unsigned int>(input.get_character());
6751 const auto charcode = 0x10000u + (((
static_cast<unsigned int>(wc) & 0x3FFu) << 10u) | (wc2 & 0x3FFu));
6752 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xF0u | (charcode >> 18u));
6753 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((charcode >> 12u) & 0x3Fu));
6754 utf8_bytes[2] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((charcode >> 6u) & 0x3Fu));
6755 utf8_bytes[3] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (charcode & 0x3Fu));
6756 utf8_bytes_filled = 4;
6760 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(wc);
6761 utf8_bytes_filled = 1;
6769template<
typename BaseInputAdapter,
typename W
ideCharType>
6812 std::array<std::char_traits<char>::int_type, 4>
utf8_bytes = {{0, 0, 0, 0}};
6820template<
typename IteratorType,
typename Enable =
void>
6824 using char_type =
typename std::iterator_traits<iterator_type>::value_type;
6829 return adapter_type(std::move(first), std::move(last));
6843template<
typename IteratorType>
6847 using char_type =
typename std::iterator_traits<iterator_type>::value_type;
6858template<
typename IteratorType>
6862 return factory_type::create(first, last);
6875template<
typename ContainerType,
typename Enable =
void>
6878template<
typename ContainerType>
6880 void_t<decltype(begin(
std::declval<ContainerType>()), end(std::declval<ContainerType>()))>>
6892template<
typename ContainerType>
6905 if (file ==
nullptr)
6907 JSON_THROW(
parse_error::create(101, 0,
"attempting to parse an empty input; check that your input string or stream contains the expected JSON",
nullptr));
6926template <
typename CharT,
6927 typename std::enable_if <
6928 std::is_pointer<CharT>::value&&
6929 !std::is_array<CharT>::value&&
6930 std::is_integral<typename std::remove_pointer<CharT>::type>
::value&&
6931 sizeof(
typename std::remove_pointer<CharT>::type) == 1,
6937 JSON_THROW(
parse_error::create(101, 0,
"attempting to parse an empty input; check that your input string or stream contains the expected JSON",
nullptr));
6939 auto length = std::strlen(
reinterpret_cast<const char*
>(b));
6940 const auto* ptr =
reinterpret_cast<const char*
>(b);
6944template<
typename T, std::
size_t N>
6956 template <
typename CharT,
6957 typename std::enable_if <
6958 std::is_pointer<CharT>::value&&
6959 std::is_integral<typename std::remove_pointer<CharT>::type>
::value&&
6960 sizeof(
typename std::remove_pointer<CharT>::type) == 1,
6963 :
ia(
reinterpret_cast<const char*
>(b),
reinterpret_cast<const char*
>(b) + l) {}
6965 template<
class IteratorType,
6966 typename std::enable_if<
6967 std::is_same<typename iterator_traits<IteratorType>::iterator_category, std::random_access_iterator_tag>
::value,
6974 return std::move(
ia);
6997#include <type_traits>
7019#include <initializer_list>
7041template<
typename BasicJsonType>
7075 return "<uninitialized>";
7077 return "true literal";
7079 return "false literal";
7081 return "null literal";
7083 return "string literal";
7087 return "number literal";
7101 return "<parse error>";
7103 return "end of input";
7105 return "'[', '{', or a literal";
7108 return "unknown token";
7118template<
typename BasicJsonType,
typename InputAdapterType>
7131 explicit lexer(InputAdapterType&& adapter,
bool ignore_comments_ =
false) noexcept
7132 :
ia(
std::move(adapter))
7153 const auto* loc = localeconv();
7155 return (loc->decimal_point ==
nullptr) ?
'.' : *(loc->decimal_point);
7183 const auto factors = { 12u, 8u, 4u, 0u };
7184 for (
const auto factor : factors)
7190 codepoint +=
static_cast<int>((
static_cast<unsigned int>(
current) - 0x30u) << factor);
7194 codepoint +=
static_cast<int>((
static_cast<unsigned int>(
current) - 0x37u) << factor);
7198 codepoint +=
static_cast<int>((
static_cast<unsigned int>(
current) - 0x57u) << factor);
7206 JSON_ASSERT(0x0000 <= codepoint && codepoint <= 0xFFFF);
7227 JSON_ASSERT(ranges.size() == 2 || ranges.size() == 4 || ranges.size() == 6);
7230 for (
auto range = ranges.begin(); range != ranges.end(); ++range)
7279 return token_type::parse_error;
7285 return token_type::value_string;
7330 int codepoint = codepoint1;
7334 error_message =
"invalid string: '\\u' must be followed by 4 hex digits";
7335 return token_type::parse_error;
7339 if (0xD800 <= codepoint1 && codepoint1 <= 0xDBFF)
7348 error_message =
"invalid string: '\\u' must be followed by 4 hex digits";
7349 return token_type::parse_error;
7356 codepoint =
static_cast<int>(
7358 (
static_cast<unsigned int>(codepoint1) << 10u)
7360 +
static_cast<unsigned int>(codepoint2)
7368 error_message =
"invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF";
7369 return token_type::parse_error;
7374 error_message =
"invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF";
7375 return token_type::parse_error;
7382 error_message =
"invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF";
7383 return token_type::parse_error;
7388 JSON_ASSERT(0x00 <= codepoint && codepoint <= 0x10FFFF);
7391 if (codepoint < 0x80)
7396 else if (codepoint <= 0x7FF)
7399 add(
static_cast<char_int_type>(0xC0u | (
static_cast<unsigned int>(codepoint) >> 6u)));
7400 add(
static_cast<char_int_type>(0x80u | (
static_cast<unsigned int>(codepoint) & 0x3Fu)));
7402 else if (codepoint <= 0xFFFF)
7405 add(
static_cast<char_int_type>(0xE0u | (
static_cast<unsigned int>(codepoint) >> 12u)));
7406 add(
static_cast<char_int_type>(0x80u | ((
static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu)));
7407 add(
static_cast<char_int_type>(0x80u | (
static_cast<unsigned int>(codepoint) & 0x3Fu)));
7412 add(
static_cast<char_int_type>(0xF0u | (
static_cast<unsigned int>(codepoint) >> 18u)));
7413 add(
static_cast<char_int_type>(0x80u | ((
static_cast<unsigned int>(codepoint) >> 12u) & 0x3Fu)));
7414 add(
static_cast<char_int_type>(0x80u | ((
static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu)));
7415 add(
static_cast<char_int_type>(0x80u | (
static_cast<unsigned int>(codepoint) & 0x3Fu)));
7423 error_message =
"invalid string: forbidden character after backslash";
7424 return token_type::parse_error;
7433 error_message =
"invalid string: control character U+0000 (NUL) must be escaped to \\u0000";
7434 return token_type::parse_error;
7439 error_message =
"invalid string: control character U+0001 (SOH) must be escaped to \\u0001";
7440 return token_type::parse_error;
7445 error_message =
"invalid string: control character U+0002 (STX) must be escaped to \\u0002";
7446 return token_type::parse_error;
7451 error_message =
"invalid string: control character U+0003 (ETX) must be escaped to \\u0003";
7452 return token_type::parse_error;
7457 error_message =
"invalid string: control character U+0004 (EOT) must be escaped to \\u0004";
7458 return token_type::parse_error;
7463 error_message =
"invalid string: control character U+0005 (ENQ) must be escaped to \\u0005";
7464 return token_type::parse_error;
7469 error_message =
"invalid string: control character U+0006 (ACK) must be escaped to \\u0006";
7470 return token_type::parse_error;
7475 error_message =
"invalid string: control character U+0007 (BEL) must be escaped to \\u0007";
7476 return token_type::parse_error;
7481 error_message =
"invalid string: control character U+0008 (BS) must be escaped to \\u0008 or \\b";
7482 return token_type::parse_error;
7487 error_message =
"invalid string: control character U+0009 (HT) must be escaped to \\u0009 or \\t";
7488 return token_type::parse_error;
7493 error_message =
"invalid string: control character U+000A (LF) must be escaped to \\u000A or \\n";
7494 return token_type::parse_error;
7499 error_message =
"invalid string: control character U+000B (VT) must be escaped to \\u000B";
7500 return token_type::parse_error;
7505 error_message =
"invalid string: control character U+000C (FF) must be escaped to \\u000C or \\f";
7506 return token_type::parse_error;
7511 error_message =
"invalid string: control character U+000D (CR) must be escaped to \\u000D or \\r";
7512 return token_type::parse_error;
7517 error_message =
"invalid string: control character U+000E (SO) must be escaped to \\u000E";
7518 return token_type::parse_error;
7523 error_message =
"invalid string: control character U+000F (SI) must be escaped to \\u000F";
7524 return token_type::parse_error;
7529 error_message =
"invalid string: control character U+0010 (DLE) must be escaped to \\u0010";
7530 return token_type::parse_error;
7535 error_message =
"invalid string: control character U+0011 (DC1) must be escaped to \\u0011";
7536 return token_type::parse_error;
7541 error_message =
"invalid string: control character U+0012 (DC2) must be escaped to \\u0012";
7542 return token_type::parse_error;
7547 error_message =
"invalid string: control character U+0013 (DC3) must be escaped to \\u0013";
7548 return token_type::parse_error;
7553 error_message =
"invalid string: control character U+0014 (DC4) must be escaped to \\u0014";
7554 return token_type::parse_error;
7559 error_message =
"invalid string: control character U+0015 (NAK) must be escaped to \\u0015";
7560 return token_type::parse_error;
7565 error_message =
"invalid string: control character U+0016 (SYN) must be escaped to \\u0016";
7566 return token_type::parse_error;
7571 error_message =
"invalid string: control character U+0017 (ETB) must be escaped to \\u0017";
7572 return token_type::parse_error;
7577 error_message =
"invalid string: control character U+0018 (CAN) must be escaped to \\u0018";
7578 return token_type::parse_error;
7583 error_message =
"invalid string: control character U+0019 (EM) must be escaped to \\u0019";
7584 return token_type::parse_error;
7589 error_message =
"invalid string: control character U+001A (SUB) must be escaped to \\u001A";
7590 return token_type::parse_error;
7595 error_message =
"invalid string: control character U+001B (ESC) must be escaped to \\u001B";
7596 return token_type::parse_error;
7601 error_message =
"invalid string: control character U+001C (FS) must be escaped to \\u001C";
7602 return token_type::parse_error;
7607 error_message =
"invalid string: control character U+001D (GS) must be escaped to \\u001D";
7608 return token_type::parse_error;
7613 error_message =
"invalid string: control character U+001E (RS) must be escaped to \\u001E";
7614 return token_type::parse_error;
7619 error_message =
"invalid string: control character U+001F (US) must be escaped to \\u001F";
7620 return token_type::parse_error;
7757 return token_type::parse_error;
7767 return token_type::parse_error;
7791 return token_type::parse_error;
7801 return token_type::parse_error;
7811 return token_type::parse_error;
7823 return token_type::parse_error;
7833 return token_type::parse_error;
7842 return token_type::parse_error;
7913 error_message =
"invalid comment; expecting '/' or '*' after '/'";
7920 static
void strtof(
float& f, const
char* str,
char** endptr) noexcept
7922 f = std::strtof(str, endptr);
7926 static
void strtof(
double& f, const
char* str,
char** endptr) noexcept
7928 f = std::strtod(str, endptr);
7932 static
void strtof(
long double& f, const
char* str,
char** endptr) noexcept
7934 f = std::strtold(str, endptr);
7984 token_type number_type = token_type::value_unsigned;
7992 goto scan_number_minus;
7998 goto scan_number_zero;
8012 goto scan_number_any1;
8022 number_type = token_type::value_integer;
8028 goto scan_number_zero;
8042 goto scan_number_any1;
8048 return token_type::parse_error;
8060 goto scan_number_decimal1;
8067 goto scan_number_exponent;
8071 goto scan_number_done;
8090 goto scan_number_any1;
8097 goto scan_number_decimal1;
8104 goto scan_number_exponent;
8108 goto scan_number_done;
8111scan_number_decimal1:
8113 number_type = token_type::value_float;
8128 goto scan_number_decimal2;
8134 return token_type::parse_error;
8138scan_number_decimal2:
8154 goto scan_number_decimal2;
8161 goto scan_number_exponent;
8165 goto scan_number_done;
8168scan_number_exponent:
8170 number_type = token_type::value_float;
8177 goto scan_number_sign;
8192 goto scan_number_any2;
8198 "invalid number; expected '+', '-', or digit after exponent";
8199 return token_type::parse_error;
8219 goto scan_number_any2;
8224 error_message =
"invalid number; expected digit after exponent sign";
8225 return token_type::parse_error;
8245 goto scan_number_any2;
8249 goto scan_number_done;
8257 char* endptr =
nullptr;
8261 if (number_type == token_type::value_unsigned)
8263 const auto x = std::strtoull(
token_buffer.data(), &endptr, 10);
8268 if (errno != ERANGE)
8273 return token_type::value_unsigned;
8277 else if (number_type == token_type::value_integer)
8279 const auto x = std::strtoll(
token_buffer.data(), &endptr, 10);
8284 if (errno != ERANGE)
8289 return token_type::value_integer;
8301 return token_type::value_float;
8314 for (std::size_t i = 1; i < length; ++i)
8319 return token_type::parse_error;
8351 ++
position.chars_read_current_line;
8371 position.chars_read_current_line = 0;
8392 if (
position.chars_read_current_line == 0)
8401 --
position.chars_read_current_line;
8414 token_buffer.push_back(
static_cast<typename string_t::value_type
>(c));
8470 if (
static_cast<unsigned char>(c) <=
'\x1F')
8473 std::array<char, 9> cs{{}};
8474 static_cast<void>((std::snprintf)(cs.data(), cs.size(),
"<U+%.4X>",
static_cast<unsigned char>(c)));
8475 result += cs.data();
8480 result.push_back(
static_cast<std::string::value_type
>(c));
8507 return get() == 0xBB &&
get() == 0xBF;
8530 error_message =
"invalid BOM; must be 0xEF 0xBB 0xBF if given";
8531 return token_type::parse_error;
8542 return token_type::parse_error;
8553 return token_type::begin_array;
8555 return token_type::end_array;
8557 return token_type::begin_object;
8559 return token_type::end_object;
8561 return token_type::name_separator;
8563 return token_type::value_separator;
8569 return scan_literal(true_literal.data(), true_literal.size(), token_type::literal_true);
8574 return scan_literal(false_literal.data(), false_literal.size(), token_type::literal_false);
8579 return scan_literal(null_literal.data(), null_literal.size(), token_type::literal_null);
8604 return token_type::end_of_input;
8609 return token_type::parse_error;
8666template<
typename BasicJsonType>
8770 const std::string& last_token,
8785 return (std::numeric_limits<std::size_t>::max)();
8801template<
typename BasicJsonType,
typename InputAdapterType>
8874#if JSON_DIAGNOSTIC_POSITIONS
8908#if JSON_DIAGNOSTIC_POSITIONS
8925#if JSON_DIAGNOSTIC_POSITIONS
8947#if JSON_DIAGNOSTIC_POSITIONS
8960 template<
class Exception>
8962 const Exception& ex)
8965 static_cast<void>(ex);
8980#if JSON_DIAGNOSTIC_POSITIONS
8981 void handle_diagnostic_positions_for_json_value(BasicJsonType& v)
8988 v.end_position = m_lexer_ref->get_position();
8995 v.start_position = v.end_position - (v.m_data.m_value.boolean ? 4 : 5);
9002 v.start_position = v.end_position - 4;
9006 case value_t::string:
9009 v.start_position = v.end_position - v.m_data.m_value.string->size() - 2;
9018 case value_t::discarded:
9020 v.end_position = std::string::npos;
9021 v.start_position = v.end_position;
9025 case value_t::binary:
9026 case value_t::number_integer:
9027 case value_t::number_unsigned:
9028 case value_t::number_float:
9030 v.start_position = v.end_position - m_lexer_ref->get_string().size();
9033 case value_t::object:
9034 case value_t::array:
9054 template<
typename Value>
9060 root = BasicJsonType(std::forward<Value>(v));
9062#if JSON_DIAGNOSTIC_POSITIONS
9063 handle_diagnostic_positions_for_json_value(
root);
9073 ref_stack.back()->m_data.m_value.array->emplace_back(std::forward<Value>(v));
9075#if JSON_DIAGNOSTIC_POSITIONS
9076 handle_diagnostic_positions_for_json_value(
ref_stack.back()->m_data.m_value.array->back());
9079 return &(
ref_stack.back()->m_data.m_value.array->back());
9086#if JSON_DIAGNOSTIC_POSITIONS
9107template<
typename BasicJsonType,
typename InputAdapterType>
9122 const bool allow_exceptions_ =
true,
9184 auto val =
handle_value(BasicJsonType::value_t::object,
true);
9190#if JSON_DIAGNOSTIC_POSITIONS
9212 BasicJsonType k = BasicJsonType(val);
9236#if JSON_DIAGNOSTIC_POSITIONS
9238 handle_diagnostic_positions_for_json_value(*
ref_stack.back());
9244#if JSON_DIAGNOSTIC_POSITIONS
9266 if (it->is_discarded())
9282 auto val =
handle_value(BasicJsonType::value_t::array,
true);
9288#if JSON_DIAGNOSTIC_POSITIONS
9319#if JSON_DIAGNOSTIC_POSITIONS
9334#if JSON_DIAGNOSTIC_POSITIONS
9336 handle_diagnostic_positions_for_json_value(*
ref_stack.back());
9349 ref_stack.back()->m_data.m_value.array->pop_back();
9355 template<
class Exception>
9357 const Exception& ex)
9360 static_cast<void>(ex);
9375#if JSON_DIAGNOSTIC_POSITIONS
9376 void handle_diagnostic_positions_for_json_value(BasicJsonType& v)
9383 v.end_position = m_lexer_ref->get_position();
9390 v.start_position = v.end_position - (v.m_data.m_value.boolean ? 4 : 5);
9397 v.start_position = v.end_position - 4;
9401 case value_t::string:
9404 v.start_position = v.end_position - v.m_data.m_value.string->size() - 2;
9408 case value_t::discarded:
9410 v.end_position = std::string::npos;
9411 v.start_position = v.end_position;
9415 case value_t::binary:
9416 case value_t::number_integer:
9417 case value_t::number_unsigned:
9418 case value_t::number_float:
9420 v.start_position = v.end_position - m_lexer_ref->get_string().size();
9424 case value_t::object:
9425 case value_t::array:
9454 template<
typename Value>
9455 std::pair<bool, BasicJsonType*>
handle_value(Value&& v,
const bool skip_callback =
false)
9463 return {
false,
nullptr};
9467 auto value = BasicJsonType(std::forward<Value>(v));
9469#if JSON_DIAGNOSTIC_POSITIONS
9470 handle_diagnostic_positions_for_json_value(
value);
9479 return {
false,
nullptr};
9485 return {
true, &
root};
9492 return {
false,
nullptr};
9501 ref_stack.back()->m_data.m_value.array->emplace_back(std::move(
value));
9502 return {
true, & (
ref_stack.back()->m_data.m_value.array->back())};
9514 return {
false,
nullptr};
9539 BasicJsonType
discarded = BasicJsonType::value_t::discarded;
9544template<
typename BasicJsonType>
9658 decltype(std::declval<T&>().boolean(std::declval<bool>()));
9660template<
typename T,
typename Integer>
9662 decltype(std::declval<T&>().number_integer(std::declval<Integer>()));
9664template<
typename T,
typename Un
signed>
9666 decltype(std::declval<T&>().number_unsigned(std::declval<Unsigned>()));
9668template<
typename T,
typename Float,
typename String>
9670 std::declval<Float>(), std::declval<const String&>()));
9672template<
typename T,
typename String>
9674 decltype(std::declval<T&>().string(std::declval<String&>()));
9676template<
typename T,
typename Binary>
9678 decltype(std::declval<T&>().binary(std::declval<Binary&>()));
9682 decltype(std::declval<T&>().start_object(std::declval<std::size_t>()));
9684template<
typename T,
typename String>
9686 decltype(std::declval<T&>().key(std::declval<String&>()));
9693 decltype(std::declval<T&>().start_array(std::declval<std::size_t>()));
9698template<
typename T,
typename Exception>
9700 std::declval<std::size_t>(), std::declval<const std::string&>(),
9701 std::declval<const Exception&>()));
9703template<
typename SAX,
typename BasicJsonType>
9708 "BasicJsonType must be of type basic_json<...>");
9734template<
typename SAX,
typename BasicJsonType>
9739 "BasicJsonType must be of type basic_json<...>");
9750 "Missing/invalid function: bool null()");
9752 "Missing/invalid function: bool boolean(bool)");
9754 "Missing/invalid function: bool boolean(bool)");
9758 "Missing/invalid function: bool number_integer(number_integer_t)");
9762 "Missing/invalid function: bool number_unsigned(number_unsigned_t)");
9765 "Missing/invalid function: bool number_float(number_float_t, const string_t&)");
9768 "Missing/invalid function: bool string(string_t&)");
9771 "Missing/invalid function: bool binary(binary_t&)");
9773 "Missing/invalid function: bool start_object(std::size_t)");
9775 "Missing/invalid function: bool key(string_t&)");
9777 "Missing/invalid function: bool end_object()");
9779 "Missing/invalid function: bool start_array(std::size_t)");
9781 "Missing/invalid function: bool end_array()");
9784 "Missing/invalid function: bool parse_error(std::size_t, const "
9785 "std::string&, const exception&)");
9819 return *
reinterpret_cast<char*
>(&num) == 1;
9829template<
typename BasicJsonType,
typename InputAdapterType,
typename SAX = json_sax_dom_parser<BasicJsonType, InputAdapterType>>
9870 const
bool strict = true,
9874 bool result =
false;
9933 std::int32_t document_size{};
9946 return sax->end_object();
9958 auto out = std::back_inserter(result);
9970 *out++ =
static_cast<typename string_t::value_type
>(
current);
9985 template<
typename NumberType>
10007 template<
typename NumberType>
10018 std::uint8_t subtype{};
10020 result.set_subtype(subtype);
10036 const std::size_t element_type_parse_position)
10038 switch (element_type)
10048 std::int32_t len{};
10065 std::int32_t len{};
10072 return sax->boolean(
get() != 0);
10077 return sax->null();
10082 std::int32_t
value{};
10088 std::int64_t
value{};
10094 std::uint64_t
value{};
10100 std::array<char, 3> cr{{}};
10101 static_cast<void>((std::snprintf)(cr.data(), cr.size(),
"%.2hhX",
static_cast<unsigned char>(element_type)));
10102 const std::string cr_str{cr.data()};
10103 return sax->parse_error(element_type_parse_position, cr_str,
10125 while (
auto element_type =
get())
10132 const std::size_t element_type_parse_position =
chars_read;
10138 if (!is_array && !
sax->key(
key))
10161 std::int32_t document_size{};
10174 return sax->end_array();
10227 std::uint8_t number{};
10233 std::uint16_t number{};
10239 std::uint32_t number{};
10245 std::uint64_t number{};
10274 return sax->number_integer(
static_cast<std::int8_t
>(0x20 - 1 -
current));
10278 std::uint8_t number{};
10284 std::uint16_t number{};
10290 std::uint32_t number{};
10296 std::uint64_t number{};
10401 std::uint8_t len{};
10407 std::uint16_t len{};
10413 std::uint32_t len{};
10419 std::uint64_t len{};
10455 std::uint8_t len{};
10461 std::uint16_t len{};
10467 std::uint32_t len{};
10473 std::uint64_t len{};
10500 switch (tag_handler)
10516 std::uint8_t subtype_to_ignore{};
10522 std::uint16_t subtype_to_ignore{};
10528 std::uint32_t subtype_to_ignore{};
10534 std::uint64_t subtype_to_ignore{};
10552 std::uint8_t subtype{};
10559 std::uint16_t subtype{};
10566 std::uint32_t subtype{};
10573 std::uint64_t subtype{};
10592 return sax->boolean(
false);
10595 return sax->boolean(
true);
10598 return sax->null();
10602 const auto byte1_raw =
get();
10607 const auto byte2_raw =
get();
10613 const auto byte1 =
static_cast<unsigned char>(byte1_raw);
10614 const auto byte2 =
static_cast<unsigned char>(byte2_raw);
10624 const auto half =
static_cast<unsigned int>((byte1 << 8u) + byte2);
10625 const double val = [&half]
10627 const int exp = (half >> 10u) & 0x1Fu;
10628 const unsigned int mant = half & 0x3FFu;
10634 return std::ldexp(mant, -24);
10637 ? std::numeric_limits<double>::infinity()
10638 : std::numeric_limits<double>::quiet_NaN();
10640 return std::ldexp(mant + 1024, exp - 25);
10643 return sax->number_float((half & 0x8000u) != 0
10720 std::uint8_t len{};
10726 std::uint16_t len{};
10732 std::uint32_t len{};
10738 std::uint64_t len{};
10744 while (
get() != 0xFF)
10751 result.append(chunk);
10816 std::uint8_t len{};
10823 std::uint16_t len{};
10830 std::uint32_t len{};
10837 std::uint64_t len{};
10844 while (
get() != 0xFF)
10851 result.insert(result.end(), chunk.begin(), chunk.end());
10881 for (std::size_t i = 0; i < len; ++i)
10891 while (
get() != 0xFF)
10900 return sax->end_array();
10922 for (std::size_t i = 0; i < len; ++i)
10939 while (
get() != 0xFF)
10955 return sax->end_object();
11184 return sax->null();
11187 return sax->boolean(
false);
11190 return sax->boolean(
true);
11222 std::uint8_t number{};
11228 std::uint16_t number{};
11234 std::uint32_t number{};
11240 std::uint64_t number{};
11246 std::int8_t number{};
11252 std::int16_t number{};
11258 std::int32_t number{};
11264 std::int64_t number{};
11270 std::uint16_t len{};
11276 std::uint32_t len{};
11282 std::uint16_t len{};
11288 std::uint32_t len{};
11325 return sax->number_integer(
static_cast<std::int8_t
>(
current));
11394 std::uint8_t len{};
11400 std::uint16_t len{};
11406 std::uint32_t len{};
11432 auto assign_and_return_true = [&result](std::int8_t subtype)
11434 result.set_subtype(
static_cast<std::uint8_t
>(subtype));
11442 std::uint8_t len{};
11449 std::uint16_t len{};
11456 std::uint32_t len{};
11463 std::uint8_t len{};
11464 std::int8_t subtype{};
11468 assign_and_return_true(subtype);
11473 std::uint16_t len{};
11474 std::int8_t subtype{};
11478 assign_and_return_true(subtype);
11483 std::uint32_t len{};
11484 std::int8_t subtype{};
11488 assign_and_return_true(subtype);
11493 std::int8_t subtype{};
11496 assign_and_return_true(subtype);
11501 std::int8_t subtype{};
11504 assign_and_return_true(subtype);
11509 std::int8_t subtype{};
11512 assign_and_return_true(subtype);
11517 std::int8_t subtype{};
11520 assign_and_return_true(subtype);
11525 std::int8_t subtype{};
11528 assign_and_return_true(subtype);
11547 for (std::size_t i = 0; i < len; ++i)
11555 return sax->end_array();
11570 for (std::size_t i = 0; i < len; ++i)
11585 return sax->end_object();
11634 std::uint8_t len{};
11646 std::int16_t len{};
11652 std::int32_t len{};
11658 std::int64_t len{};
11668 std::uint16_t len{};
11678 std::uint32_t len{};
11688 std::uint64_t len{};
11696 std::string message;
11700 message =
"expected length type specification (U, i, I, l, L); last byte: 0x" + last_token;
11704 message =
"expected length type specification (U, i, u, I, m, l, M, L); last byte: 0x" + last_token;
11715 std::pair<std::size_t, char_int_type> size_and_type;
11717 bool no_ndarray =
true;
11724 if (size_and_type.first !=
npos)
11726 if (size_and_type.second != 0)
11728 if (size_and_type.second !=
'N')
11730 for (std::size_t i = 0; i < size_and_type.first; ++i)
11736 dim.push_back(dimlen);
11742 for (std::size_t i = 0; i < size_and_type.first; ++i)
11748 dim.push_back(dimlen);
11760 dim.push_back(dimlen);
11789 std::uint8_t number{};
11794 result =
static_cast<std::size_t
>(number);
11800 std::int8_t number{};
11810 result =
static_cast<std::size_t
>(number);
11816 std::int16_t number{};
11826 result =
static_cast<std::size_t
>(number);
11832 std::int32_t number{};
11842 result =
static_cast<std::size_t
>(number);
11848 std::int64_t number{};
11863 result =
static_cast<std::size_t
>(number);
11873 std::uint16_t number{};
11878 result =
static_cast<std::size_t
>(number);
11888 std::uint32_t number{};
11903 std::uint64_t number{};
11927 std::vector<size_t> dim;
11932 if (dim.size() == 1 || (dim.size() == 2 && dim.at(0) == 1))
11934 result = dim.at(dim.size() - 1);
11957 if (result == 0 || result ==
npos)
11967 return sax->end_array();
11977 std::string message;
11981 message =
"expected length type specification (U, i, I, l, L) after '#'; last byte: 0x" + last_token;
11985 message =
"expected length type specification (U, i, u, I, m, l, M, L) after '#'; last byte: 0x" + last_token;
12003 result.first =
npos;
12005 bool is_ndarray =
false;
12011 result.second =
get();
12013 &&
JSON_HEDLEY_UNLIKELY(std::binary_search(bjd_optimized_type_markers.begin(), bjd_optimized_type_markers.end(), result.second)))
12040 if (inside_ndarray)
12045 result.second |= (1 << 8);
12076 return sax->boolean(
true);
12078 return sax->boolean(
false);
12081 return sax->null();
12089 std::uint8_t number{};
12095 std::uint8_t number{};
12101 std::int8_t number{};
12107 std::int16_t number{};
12113 std::int32_t number{};
12119 std::int64_t number{};
12129 std::uint16_t number{};
12139 std::uint32_t number{};
12149 std::uint64_t number{};
12159 const auto byte1_raw =
get();
12164 const auto byte2_raw =
get();
12170 const auto byte1 =
static_cast<unsigned char>(byte1_raw);
12171 const auto byte2 =
static_cast<unsigned char>(byte2_raw);
12181 const auto half =
static_cast<unsigned int>((byte2 << 8u) + byte1);
12182 const double val = [&half]
12184 const int exp = (half >> 10u) & 0x1Fu;
12185 const unsigned int mant = half & 0x3FFu;
12191 return std::ldexp(mant, -24);
12194 ? std::numeric_limits<double>::infinity()
12195 : std::numeric_limits<double>::quiet_NaN();
12197 return std::ldexp(mant + 1024, exp - 25);
12200 return sax->number_float((half & 0x8000u) != 0
12236 return sax->string(s);
12263 std::pair<std::size_t, char_int_type> size_and_type;
12274 size_and_type.second &= ~(
static_cast<char_int_type>(1) << 8);
12277 return p.first < t;
12293 if (size_and_type.second ==
'C' || size_and_type.second ==
'B')
12295 size_and_type.second =
'U';
12298 key =
"_ArrayData_";
12304 for (std::size_t i = 0; i < size_and_type.first; ++i)
12312 return (
sax->end_array() &&
sax->end_object());
12322 if (size_and_type.first !=
npos)
12329 if (size_and_type.second != 0)
12331 if (size_and_type.second !=
'N')
12333 for (std::size_t i = 0; i < size_and_type.first; ++i)
12344 for (std::size_t i = 0; i < size_and_type.first; ++i)
12370 return sax->end_array();
12378 std::pair<std::size_t, char_int_type> size_and_type;
12393 if (size_and_type.first !=
npos)
12400 if (size_and_type.second != 0)
12402 for (std::size_t i = 0; i < size_and_type.first; ++i)
12417 for (std::size_t i = 0; i < size_and_type.first; ++i)
12453 return sax->end_object();
12462 std::size_t size{};
12463 bool no_ndarray =
true;
12471 std::vector<char> number_vector;
12472 for (std::size_t i = 0; i < size; ++i)
12479 number_vector.push_back(
static_cast<char>(
current));
12485 const auto result_number = number_lexer.scan();
12486 const auto number_string = number_lexer.get_token_string();
12487 const auto result_remainder = number_lexer.scan();
12497 switch (result_number)
12499 case token_type::value_integer:
12500 return sax->number_integer(number_lexer.get_number_integer());
12501 case token_type::value_unsigned:
12502 return sax->number_unsigned(number_lexer.get_number_unsigned());
12503 case token_type::value_float:
12504 return sax->number_float(number_lexer.get_number_float(), std::move(number_string));
12505 case token_type::uninitialized:
12506 case token_type::literal_true:
12507 case token_type::literal_false:
12508 case token_type::literal_null:
12509 case token_type::value_string:
12510 case token_type::begin_array:
12511 case token_type::begin_object:
12512 case token_type::end_array:
12513 case token_type::end_object:
12514 case token_type::name_separator:
12515 case token_type::value_separator:
12516 case token_type::parse_error:
12517 case token_type::end_of_input:
12518 case token_type::literal_or_value:
12555 auto new_chars_read =
ia.get_elements(&dest);
12581 template<
class NumberType>
12584 constexpr std::size_t sz =
sizeof(number);
12585#ifdef __cpp_lib_byteswap
12586 if constexpr (sz == 1)
12590 if constexpr(std::is_integral_v<NumberType>)
12592 number = std::byteswap(number);
12596 auto* ptr =
reinterpret_cast<std::uint8_t*
>(&number);
12597 for (std::size_t i = 0; i < sz / 2; ++i)
12618 template<
typename NumberType,
bool InputIsLittleEndian = false>
12648 template<
typename NumberType>
12650 const NumberType len,
12653 bool success =
true;
12654 for (NumberType i = 0; i < len; i++)
12662 result.push_back(
static_cast<typename string_t::value_type
>(
current));
12681 template<
typename NumberType>
12683 const NumberType len,
12686 bool success =
true;
12687 for (NumberType i = 0; i < len; i++)
12695 result.push_back(
static_cast<std::uint8_t
>(
current));
12721 std::array<char, 3> cr{{}};
12722 static_cast<void>((std::snprintf)(cr.data(), cr.size(),
"%.2hhX",
static_cast<unsigned char>(
current)));
12723 return std::string{cr.data()};
12733 const std::string&
detail,
12734 const std::string& context)
const
12736 std::string error_msg =
"syntax error while parsing ";
12741 error_msg +=
"CBOR";
12745 error_msg +=
"MessagePack";
12749 error_msg +=
"UBJSON";
12753 error_msg +=
"BSON";
12757 error_msg +=
"BJData";
12790#define JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_ \
12791 make_array<char_int_type>('F', 'H', 'N', 'S', 'T', 'Z', '[', '{')
12793#define JSON_BINARY_READER_MAKE_BJD_TYPES_MAP_ \
12794 make_array<bjd_type>( \
12795 bjd_type{'B', "byte"}, \
12796 bjd_type{'C', "char"}, \
12797 bjd_type{'D', "double"}, \
12798 bjd_type{'I', "int16"}, \
12799 bjd_type{'L', "int64"}, \
12800 bjd_type{'M', "uint64"}, \
12801 bjd_type{'U', "uint8"}, \
12802 bjd_type{'d', "single"}, \
12803 bjd_type{'i', "int8"}, \
12804 bjd_type{'l', "int32"}, \
12805 bjd_type{'m', "uint32"}, \
12806 bjd_type{'u', "uint16"})
12819#undef JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_
12820#undef JSON_BINARY_READER_MAKE_BJD_TYPES_MAP_
12823#ifndef JSON_HAS_CPP_17
12824 template<
typename BasicJsonType,
typename InputAdapterType,
typename SAX>
12848#include <functional>
12893template<
typename BasicJsonType>
12895 std::function<bool(
int ,
parse_event_t , BasicJsonType& )>;
12902template<
typename BasicJsonType,
typename InputAdapterType>
12916 const bool allow_exceptions_ =
true,
12917 const bool skip_comments =
false)
12919 ,
m_lexer(
std::move(adapter), skip_comments)
12961 if (result.is_discarded())
12987 result.assert_invariant();
13002 template<
typename SAX>
13012 return sax->parse_error(
m_lexer.get_position(),
13021 template<
typename SAX>
13027 std::vector<bool> states;
13029 bool skip_to_state_evaluation =
false;
13033 if (!skip_to_state_evaluation)
13038 case token_type::begin_object:
13046 if (
get_token() == token_type::end_object)
13058 return sax->parse_error(
m_lexer.get_position(),
13070 return sax->parse_error(
m_lexer.get_position(),
13076 states.push_back(
false);
13083 case token_type::begin_array:
13091 if (
get_token() == token_type::end_array)
13101 states.push_back(
true);
13107 case token_type::value_float:
13109 const auto res =
m_lexer.get_number_float();
13113 return sax->parse_error(
m_lexer.get_position(),
13126 case token_type::literal_false:
13135 case token_type::literal_null:
13144 case token_type::literal_true:
13153 case token_type::value_integer:
13162 case token_type::value_string:
13171 case token_type::value_unsigned:
13180 case token_type::parse_error:
13183 return sax->parse_error(
m_lexer.get_position(),
13187 case token_type::end_of_input:
13191 return sax->parse_error(
m_lexer.get_position(),
13194 "attempting to parse an empty input; check that your input string or stream contains the expected JSON",
nullptr));
13197 return sax->parse_error(
m_lexer.get_position(),
13201 case token_type::uninitialized:
13202 case token_type::end_array:
13203 case token_type::end_object:
13204 case token_type::name_separator:
13205 case token_type::value_separator:
13206 case token_type::literal_or_value:
13209 return sax->parse_error(
m_lexer.get_position(),
13217 skip_to_state_evaluation =
false;
13221 if (states.empty())
13230 if (
get_token() == token_type::value_separator)
13251 skip_to_state_evaluation =
true;
13255 return sax->parse_error(
m_lexer.get_position(),
13263 if (
get_token() == token_type::value_separator)
13268 return sax->parse_error(
m_lexer.get_position(),
13281 return sax->parse_error(
m_lexer.get_position(),
13305 skip_to_state_evaluation =
true;
13309 return sax->parse_error(
m_lexer.get_position(),
13323 std::string error_msg =
"syntax error ";
13325 if (!context.empty())
13327 error_msg +=
concat(
"while parsing ", context,
' ');
13334 error_msg +=
concat(
m_lexer.get_error_message(),
"; last read: '",
13335 m_lexer.get_token_string(),
'\'');
13342 if (expected != token_type::uninitialized)
13450 return lhs.m_it == rhs.m_it;
13455 return lhs.m_it < rhs.m_it;
13460 auto result = *
this;
13467 return lhs.m_it - rhs.m_it;
13478 auto result = *
this;
13491 auto result = *
this;
13548#include <type_traits>
13570template<
typename IteratorType>
class iteration_proxy;
13571template<
typename IteratorType>
class iteration_proxy_value;
13589template<
typename BasicJsonType>
13604 "iter_impl only accepts (const) basic_json");
13606 static_assert(std::is_base_of<std::bidirectional_iterator_tag, std::bidirectional_iterator_tag>::value
13607 && std::is_base_of<std::bidirectional_iterator_tag, typename std::iterator_traits<typename array_t::iterator>::iterator_category>
::value,
13608 "basic_json iterator assumes array and object type iterators satisfy the LegacyBidirectionalIterator named requirement.");
13623 using pointer =
typename std::conditional<std::is_const<BasicJsonType>::value,
13624 typename BasicJsonType::const_pointer,
13625 typename BasicJsonType::pointer>::type;
13628 typename std::conditional<std::is_const<BasicJsonType>::value,
13629 typename BasicJsonType::const_reference,
13630 typename BasicJsonType::reference>::type;
13647 switch (m_object->m_data.m_type)
13651 m_it.object_iterator =
typename object_t::iterator();
13657 m_it.array_iterator =
typename array_t::iterator();
13694 : m_object(other.m_object),
m_it(other.m_it)
13705 if (&other !=
this)
13707 m_object = other.m_object;
13719 : m_object(other.m_object),
m_it(other.m_it)
13730 m_object = other.m_object;
13740 void set_begin() noexcept
13744 switch (m_object->m_data.m_type)
13748 m_it.object_iterator = m_object->m_data.m_value.object->begin();
13754 m_it.array_iterator = m_object->m_data.m_value.array->begin();
13761 m_it.primitive_iterator.set_end();
13774 m_it.primitive_iterator.set_begin();
13788 switch (m_object->m_data.m_type)
13792 m_it.object_iterator = m_object->m_data.m_value.object->end();
13798 m_it.array_iterator = m_object->m_data.m_value.array->end();
13812 m_it.primitive_iterator.set_end();
13827 switch (m_object->m_data.m_type)
13831 JSON_ASSERT(
m_it.object_iterator != m_object->m_data.m_value.object->end());
13832 return m_it.object_iterator->second;
13837 JSON_ASSERT(
m_it.array_iterator != m_object->m_data.m_value.array->end());
13838 return *
m_it.array_iterator;
13871 switch (m_object->m_data.m_type)
13875 JSON_ASSERT(
m_it.object_iterator != m_object->m_data.m_value.object->end());
13876 return &(
m_it.object_iterator->second);
13881 JSON_ASSERT(
m_it.array_iterator != m_object->m_data.m_value.array->end());
13882 return &*
m_it.array_iterator;
13911 auto result = *
this;
13924 switch (m_object->m_data.m_type)
13928 std::advance(
m_it.object_iterator, 1);
13934 std::advance(
m_it.array_iterator, 1);
13948 ++
m_it.primitive_iterator;
13962 auto result = *
this;
13975 switch (m_object->m_data.m_type)
13979 std::advance(
m_it.object_iterator, -1);
13985 std::advance(
m_it.array_iterator, -1);
13999 --
m_it.primitive_iterator;
14011 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 >
14021 if (m_object ==
nullptr)
14026 switch (m_object->m_data.m_type)
14029 return (
m_it.object_iterator == other.m_it.object_iterator);
14032 return (
m_it.array_iterator == other.m_it.array_iterator);
14043 return (
m_it.primitive_iterator == other.m_it.primitive_iterator);
14051 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 >
14070 if (m_object ==
nullptr)
14076 switch (m_object->m_data.m_type)
14082 return (
m_it.array_iterator < other.
m_it.array_iterator);
14093 return (
m_it.primitive_iterator < other.
m_it.primitive_iterator);
14103 return !other.operator < (*this);
14132 switch (m_object->m_data.m_type)
14139 std::advance(
m_it.array_iterator, i);
14153 m_it.primitive_iterator += i;
14176 auto result = *
this;
14198 auto result = *
this;
14211 switch (m_object->m_data.m_type)
14217 return m_it.array_iterator - other.
m_it.array_iterator;
14228 return m_it.primitive_iterator - other.
m_it.primitive_iterator;
14240 switch (m_object->m_data.m_type)
14246 return *std::next(
m_it.array_iterator, n);
14274 const typename object_t::key_type&
key()
const
14280 return m_it.object_iterator->first;
14351template<
typename Base>
14425 auto it = --this->base();
14432 auto it = --this->base();
14433 return it.operator * ();
14453#include <type_traits>
14476 std::is_same<T, void>::value,
14495#include <algorithm>
14523template<
typename RefStringType>
14533 template<
typename T>
14563 return detail::concat(a,
'/', detail::escape(b));
14607 return *
this /= std::to_string(array_idx);
14702 template<
typename BasicJsonType>
14705 using size_type =
typename BasicJsonType::size_type;
14719 const char* p = s.c_str();
14720 char* p_end =
nullptr;
14722 const unsigned long long res = std::strtoull(p, &p_end, 10);
14732 if (res >=
static_cast<unsigned long long>((std::numeric_limits<size_type>::max)()))
14737 return static_cast<size_type
>(res);
14762 template<
typename BasicJsonType>
14775 if (reference_token ==
"0")
14842 template<
typename BasicJsonType>
14848 if (ptr->is_null())
14852 std::all_of(reference_token.begin(), reference_token.end(),
14853 [](
const unsigned char x)
14855 return std::isdigit(x);
14859 *ptr = (nums || reference_token ==
"-")
14864 switch (ptr->type())
14869 ptr = &ptr->operator[](reference_token);
14875 if (reference_token ==
"-")
14878 ptr = &ptr->operator[](ptr->m_data.m_value.array->size());
14910 template<
typename BasicJsonType>
14915 switch (ptr->type())
14920 ptr = &ptr->at(reference_token);
14930 "array index '-' (", std::to_string(ptr->m_data.m_value.array->size()),
14931 ") is out of range"), ptr));
14968 template<
typename BasicJsonType>
14973 switch (ptr->type())
14978 ptr = &ptr->operator[](reference_token);
15017 template<
typename BasicJsonType>
15022 switch (ptr->type())
15027 ptr = &ptr->at(reference_token);
15037 "array index '-' (", std::to_string(ptr->m_data.m_value.array->size()),
15038 ") is out of range"), ptr));
15066 template<
typename BasicJsonType>
15071 switch (ptr->type())
15075 if (!ptr->contains(reference_token))
15081 ptr = &ptr->operator[](reference_token);
15092 if (
JSON_HEDLEY_UNLIKELY(reference_token.size() == 1 && !(
"0" <= reference_token && reference_token <=
"9")))
15104 for (std::size_t i = 1; i < reference_token.size(); i++)
15115 if (idx >= ptr->size())
15121 ptr = &ptr->operator[](idx);
15157 std::vector<string_t>
result;
15160 if (reference_string.empty())
15176 std::size_t slash = reference_string.find_first_of(
'/', 1),
15183 start = (slash == string_t::npos) ? 0 : slash + 1,
15185 slash = reference_string.find_first_of(
'/', start))
15189 auto reference_token = reference_string.substr(start, slash - start);
15192 for (std::size_t pos = reference_token.find_first_of(
'~');
15193 pos != string_t::npos;
15194 pos = reference_token.find_first_of(
'~', pos + 1))
15200 (reference_token[pos + 1] !=
'0' &&
15201 reference_token[pos + 1] !=
'1')))
15209 result.push_back(reference_token);
15223 template<
typename BasicJsonType>
15225 const BasicJsonType& value,
15228 switch (value.type())
15232 if (value.m_data.m_value.array->empty())
15235 result[reference_string] =
nullptr;
15240 for (std::size_t i = 0; i < value.m_data.m_value.array->size(); ++i)
15243 value.m_data.m_value.array->operator[](i),
result);
15251 if (value.m_data.m_value.object->empty())
15254 result[reference_string] =
nullptr;
15259 for (
const auto& element : *value.m_data.m_value.object)
15278 result[reference_string] = value;
15294 template<
typename BasicJsonType>
15295 static BasicJsonType
15306 for (
const auto& element : *value.m_data.m_value.object)
15339#if JSON_HAS_THREE_WAY_COMPARISON
15342 template<
typename RefStringTypeRhs>
15345 return reference_tokens == rhs.reference_tokens;
15353 return *
this == json_pointer(rhs);
15357 template<
typename RefStringTypeRhs>
15358 std::strong_ordering operator<=>(
const json_pointer<RefStringTypeRhs>& rhs)
const noexcept
15360 return reference_tokens <=> rhs.reference_tokens;
15365 template<
typename RefStringTypeLhs,
typename RefStringTypeRhs>
15367 friend bool operator==(
const json_pointer<RefStringTypeLhs>& lhs,
15368 const json_pointer<RefStringTypeRhs>& rhs)
noexcept;
15372 template<
typename RefStringTypeLhs,
typename StringType>
15374 friend bool operator==(
const json_pointer<RefStringTypeLhs>& lhs,
15375 const StringType& rhs);
15379 template<
typename RefStringTypeRhs,
typename StringType>
15381 friend bool operator==(
const StringType& lhs,
15382 const json_pointer<RefStringTypeRhs>& rhs);
15386 template<
typename RefStringTypeLhs,
typename RefStringTypeRhs>
15388 friend bool operator!=(
const json_pointer<RefStringTypeLhs>& lhs,
15389 const json_pointer<RefStringTypeRhs>& rhs)
noexcept;
15393 template<
typename RefStringTypeLhs,
typename StringType>
15395 friend bool operator!=(
const json_pointer<RefStringTypeLhs>& lhs,
15396 const StringType& rhs);
15400 template<
typename RefStringTypeRhs,
typename StringType>
15402 friend bool operator!=(
const StringType& lhs,
15403 const json_pointer<RefStringTypeRhs>& rhs);
15406 template<
typename RefStringTypeLhs,
typename RefStringTypeRhs>
15408 friend bool operator<(
const json_pointer<RefStringTypeLhs>& lhs,
15409 const json_pointer<RefStringTypeRhs>& rhs)
noexcept;
15417#if !JSON_HAS_THREE_WAY_COMPARISON
15419template<
typename RefStringTypeLhs,
typename RefStringTypeRhs>
15423 return lhs.reference_tokens == rhs.reference_tokens;
15426template<
typename RefStringTypeLhs,
15430 const StringType& rhs)
15435template<
typename RefStringTypeRhs,
15438inline
bool operator==(const StringType& lhs,
15444template<
typename RefStringTypeLhs,
typename RefStringTypeRhs>
15448 return !(lhs == rhs);
15451template<
typename RefStringTypeLhs,
15455 const StringType& rhs)
15457 return !(lhs == rhs);
15460template<
typename RefStringTypeRhs,
15463inline
bool operator!=(const StringType& lhs,
15466 return !(lhs == rhs);
15469template<
typename RefStringTypeLhs,
typename RefStringTypeRhs>
15473 return lhs.reference_tokens < rhs.reference_tokens;
15490#include <initializer_list>
15502template<
typename BasicJsonType>
15584#include <algorithm>
15610#include <algorithm>
15644template<typename CharType>
15648template<typename CharType, typename AllocatorType =
std::allocator<CharType>>
15664 v.insert(
v.end(), s, s + length);
15668 std::vector<CharType, AllocatorType>&
v;
15673template<
typename CharType>
15689 stream.write(s,
static_cast<std::streamsize
>(length));
15698template<
typename CharType,
typename StringType = std::basic_
string<CharType>>
15714 str.append(s, length);
15721template<
typename CharType,
typename StringType = std::basic_
string<CharType>>
15725 template<
typename AllocatorType = std::allocator<CharType>>
15770template<
typename BasicJsonType,
typename CharType>
15833 oa->write_character(j.m_data.m_value.boolean
15841 if (j.m_data.m_value.number_integer >= 0)
15846 if (j.m_data.m_value.number_integer <= 0x17)
15848 write_number(
static_cast<std::uint8_t
>(j.m_data.m_value.number_integer));
15850 else if (j.m_data.m_value.number_integer <= (std::numeric_limits<std::uint8_t>::max)())
15853 write_number(
static_cast<std::uint8_t
>(j.m_data.m_value.number_integer));
15855 else if (j.m_data.m_value.number_integer <= (std::numeric_limits<std::uint16_t>::max)())
15858 write_number(
static_cast<std::uint16_t
>(j.m_data.m_value.number_integer));
15860 else if (j.m_data.m_value.number_integer <= (std::numeric_limits<std::uint32_t>::max)())
15863 write_number(
static_cast<std::uint32_t
>(j.m_data.m_value.number_integer));
15868 write_number(
static_cast<std::uint64_t
>(j.m_data.m_value.number_integer));
15875 const auto positive_number = -1 - j.m_data.m_value.number_integer;
15876 if (j.m_data.m_value.number_integer >= -24)
15878 write_number(
static_cast<std::uint8_t
>(0x20 + positive_number));
15880 else if (positive_number <= (std::numeric_limits<std::uint8_t>::max)())
15883 write_number(
static_cast<std::uint8_t
>(positive_number));
15885 else if (positive_number <= (std::numeric_limits<std::uint16_t>::max)())
15888 write_number(
static_cast<std::uint16_t
>(positive_number));
15890 else if (positive_number <= (std::numeric_limits<std::uint32_t>::max)())
15893 write_number(
static_cast<std::uint32_t
>(positive_number));
15898 write_number(
static_cast<std::uint64_t
>(positive_number));
15906 if (j.m_data.m_value.number_unsigned <= 0x17)
15908 write_number(
static_cast<std::uint8_t
>(j.m_data.m_value.number_unsigned));
15910 else if (j.m_data.m_value.number_unsigned <= (std::numeric_limits<std::uint8_t>::max)())
15913 write_number(
static_cast<std::uint8_t
>(j.m_data.m_value.number_unsigned));
15915 else if (j.m_data.m_value.number_unsigned <= (std::numeric_limits<std::uint16_t>::max)())
15918 write_number(
static_cast<std::uint16_t
>(j.m_data.m_value.number_unsigned));
15920 else if (j.m_data.m_value.number_unsigned <= (std::numeric_limits<std::uint32_t>::max)())
15923 write_number(
static_cast<std::uint32_t
>(j.m_data.m_value.number_unsigned));
15928 write_number(
static_cast<std::uint64_t
>(j.m_data.m_value.number_unsigned));
15935 if (std::isnan(j.m_data.m_value.number_float))
15942 else if (std::isinf(j.m_data.m_value.number_float))
15959 const auto N = j.m_data.m_value.string->size();
15964 else if (N <= (std::numeric_limits<std::uint8_t>::max)())
15969 else if (N <= (std::numeric_limits<std::uint16_t>::max)())
15974 else if (N <= (std::numeric_limits<std::uint32_t>::max)())
15980 else if (N <= (std::numeric_limits<std::uint64_t>::max)())
15988 oa->write_characters(
15989 reinterpret_cast<const CharType*
>(j.m_data.m_value.string->c_str()),
15990 j.m_data.m_value.string->size());
15997 const auto N = j.m_data.m_value.array->size();
16002 else if (N <= (std::numeric_limits<std::uint8_t>::max)())
16007 else if (N <= (std::numeric_limits<std::uint16_t>::max)())
16012 else if (N <= (std::numeric_limits<std::uint32_t>::max)())
16018 else if (N <= (std::numeric_limits<std::uint64_t>::max)())
16026 for (
const auto& el : *j.m_data.m_value.array)
16035 if (j.m_data.m_value.binary->has_subtype())
16037 if (j.m_data.m_value.binary->subtype() <= (std::numeric_limits<std::uint8_t>::max)())
16040 write_number(
static_cast<std::uint8_t
>(j.m_data.m_value.binary->subtype()));
16042 else if (j.m_data.m_value.binary->subtype() <= (std::numeric_limits<std::uint16_t>::max)())
16045 write_number(
static_cast<std::uint16_t
>(j.m_data.m_value.binary->subtype()));
16047 else if (j.m_data.m_value.binary->subtype() <= (std::numeric_limits<std::uint32_t>::max)())
16050 write_number(
static_cast<std::uint32_t
>(j.m_data.m_value.binary->subtype()));
16052 else if (j.m_data.m_value.binary->subtype() <= (std::numeric_limits<std::uint64_t>::max)())
16055 write_number(
static_cast<std::uint64_t
>(j.m_data.m_value.binary->subtype()));
16060 const auto N = j.m_data.m_value.binary->size();
16065 else if (N <= (std::numeric_limits<std::uint8_t>::max)())
16070 else if (N <= (std::numeric_limits<std::uint16_t>::max)())
16075 else if (N <= (std::numeric_limits<std::uint32_t>::max)())
16081 else if (N <= (std::numeric_limits<std::uint64_t>::max)())
16089 oa->write_characters(
16090 reinterpret_cast<const CharType*
>(j.m_data.m_value.binary->data()),
16099 const auto N = j.m_data.m_value.object->size();
16104 else if (N <= (std::numeric_limits<std::uint8_t>::max)())
16109 else if (N <= (std::numeric_limits<std::uint16_t>::max)())
16114 else if (N <= (std::numeric_limits<std::uint32_t>::max)())
16120 else if (N <= (std::numeric_limits<std::uint64_t>::max)())
16128 for (
const auto& el : *j.m_data.m_value.object)
16157 oa->write_character(j.m_data.m_value.boolean
16165 if (j.m_data.m_value.number_integer >= 0)
16170 if (j.m_data.m_value.number_unsigned < 128)
16173 write_number(
static_cast<std::uint8_t
>(j.m_data.m_value.number_integer));
16175 else if (j.m_data.m_value.number_unsigned <= (std::numeric_limits<std::uint8_t>::max)())
16179 write_number(
static_cast<std::uint8_t
>(j.m_data.m_value.number_integer));
16181 else if (j.m_data.m_value.number_unsigned <= (std::numeric_limits<std::uint16_t>::max)())
16185 write_number(
static_cast<std::uint16_t
>(j.m_data.m_value.number_integer));
16187 else if (j.m_data.m_value.number_unsigned <= (std::numeric_limits<std::uint32_t>::max)())
16191 write_number(
static_cast<std::uint32_t
>(j.m_data.m_value.number_integer));
16193 else if (j.m_data.m_value.number_unsigned <= (std::numeric_limits<std::uint64_t>::max)())
16197 write_number(
static_cast<std::uint64_t
>(j.m_data.m_value.number_integer));
16202 if (j.m_data.m_value.number_integer >= -32)
16205 write_number(
static_cast<std::int8_t
>(j.m_data.m_value.number_integer));
16207 else if (j.m_data.m_value.number_integer >= (std::numeric_limits<std::int8_t>::min)() &&
16208 j.m_data.m_value.number_integer <= (std::numeric_limits<std::int8_t>::max)())
16212 write_number(
static_cast<std::int8_t
>(j.m_data.m_value.number_integer));
16214 else if (j.m_data.m_value.number_integer >= (std::numeric_limits<std::int16_t>::min)() &&
16215 j.m_data.m_value.number_integer <= (std::numeric_limits<std::int16_t>::max)())
16219 write_number(
static_cast<std::int16_t
>(j.m_data.m_value.number_integer));
16221 else if (j.m_data.m_value.number_integer >= (std::numeric_limits<std::int32_t>::min)() &&
16222 j.m_data.m_value.number_integer <= (std::numeric_limits<std::int32_t>::max)())
16226 write_number(
static_cast<std::int32_t
>(j.m_data.m_value.number_integer));
16228 else if (j.m_data.m_value.number_integer >= (std::numeric_limits<std::int64_t>::min)() &&
16229 j.m_data.m_value.number_integer <= (std::numeric_limits<std::int64_t>::max)())
16233 write_number(
static_cast<std::int64_t
>(j.m_data.m_value.number_integer));
16241 if (j.m_data.m_value.number_unsigned < 128)
16244 write_number(
static_cast<std::uint8_t
>(j.m_data.m_value.number_integer));
16246 else if (j.m_data.m_value.number_unsigned <= (std::numeric_limits<std::uint8_t>::max)())
16250 write_number(
static_cast<std::uint8_t
>(j.m_data.m_value.number_integer));
16252 else if (j.m_data.m_value.number_unsigned <= (std::numeric_limits<std::uint16_t>::max)())
16256 write_number(
static_cast<std::uint16_t
>(j.m_data.m_value.number_integer));
16258 else if (j.m_data.m_value.number_unsigned <= (std::numeric_limits<std::uint32_t>::max)())
16262 write_number(
static_cast<std::uint32_t
>(j.m_data.m_value.number_integer));
16264 else if (j.m_data.m_value.number_unsigned <= (std::numeric_limits<std::uint64_t>::max)())
16268 write_number(
static_cast<std::uint64_t
>(j.m_data.m_value.number_integer));
16282 const auto N = j.m_data.m_value.string->size();
16288 else if (N <= (std::numeric_limits<std::uint8_t>::max)())
16294 else if (N <= (std::numeric_limits<std::uint16_t>::max)())
16300 else if (N <= (std::numeric_limits<std::uint32_t>::max)())
16308 oa->write_characters(
16309 reinterpret_cast<const CharType*
>(j.m_data.m_value.string->c_str()),
16310 j.m_data.m_value.string->size());
16317 const auto N = j.m_data.m_value.array->size();
16323 else if (N <= (std::numeric_limits<std::uint16_t>::max)())
16329 else if (N <= (std::numeric_limits<std::uint32_t>::max)())
16337 for (
const auto& el : *j.m_data.m_value.array)
16348 const bool use_ext = j.m_data.m_value.binary->has_subtype();
16351 const auto N = j.m_data.m_value.binary->size();
16352 if (N <= (std::numeric_limits<std::uint8_t>::max)())
16354 std::uint8_t output_type{};
16361 output_type = 0xD4;
16364 output_type = 0xD5;
16367 output_type = 0xD6;
16370 output_type = 0xD7;
16373 output_type = 0xD8;
16376 output_type = 0xC7;
16384 output_type = 0xC4;
16394 else if (N <= (std::numeric_limits<std::uint16_t>::max)())
16396 const std::uint8_t output_type = use_ext
16403 else if (N <= (std::numeric_limits<std::uint32_t>::max)())
16405 const std::uint8_t output_type = use_ext
16416 write_number(
static_cast<std::int8_t
>(j.m_data.m_value.binary->subtype()));
16420 oa->write_characters(
16421 reinterpret_cast<const CharType*
>(j.m_data.m_value.binary->data()),
16430 const auto N = j.m_data.m_value.object->size();
16434 write_number(
static_cast<std::uint8_t
>(0x80 | (N & 0xF)));
16436 else if (N <= (std::numeric_limits<std::uint16_t>::max)())
16442 else if (N <= (std::numeric_limits<std::uint32_t>::max)())
16450 for (
const auto& el : *j.m_data.m_value.object)
16473 const bool use_type,
const bool add_prefix =
true,
16493 oa->write_character(j.m_data.m_value.boolean
16525 oa->write_characters(
16526 reinterpret_cast<const CharType*
>(j.m_data.m_value.string->c_str()),
16527 j.m_data.m_value.string->size());
16538 bool prefix_required =
true;
16539 if (use_type && !j.m_data.m_value.array->empty())
16542 const CharType first_prefix =
ubjson_prefix(j.front(), use_bjdata);
16543 const bool same_prefix = std::all_of(j.begin() + 1, j.end(),
16544 [
this, first_prefix, use_bjdata](
const BasicJsonType & v)
16546 return ubjson_prefix(v, use_bjdata) == first_prefix;
16549 std::vector<CharType> bjdx = {
'[',
'{',
'S',
'H',
'T',
'F',
'N',
'Z'};
16551 if (same_prefix && !(use_bjdata && std::find(bjdx.begin(), bjdx.end(), first_prefix) != bjdx.end()))
16553 prefix_required =
false;
16555 oa->write_character(first_prefix);
16565 for (
const auto& el : *j.m_data.m_value.array)
16567 write_ubjson(el, use_count, use_type, prefix_required, use_bjdata, bjdata_version);
16585 if (use_type && (bjdata_draft3 || !j.m_data.m_value.binary->empty()))
16589 oa->write_character(bjdata_draft3 ?
'B' :
'U');
16600 oa->write_characters(
16601 reinterpret_cast<const CharType*
>(j.m_data.m_value.binary->data()),
16602 j.m_data.m_value.binary->size());
16606 for (
size_t i = 0; i < j.m_data.m_value.binary->size(); ++i)
16609 oa->write_character(j.m_data.m_value.binary->data()[i]);
16623 if (use_bjdata && j.m_data.m_value.object->size() == 3 && j.m_data.m_value.object->find(
"_ArrayType_") != j.m_data.m_value.object->end() && j.m_data.m_value.object->find(
"_ArraySize_") != j.m_data.m_value.object->end() && j.m_data.m_value.object->find(
"_ArrayData_") != j.m_data.m_value.object->end())
16636 bool prefix_required =
true;
16637 if (use_type && !j.m_data.m_value.object->empty())
16640 const CharType first_prefix =
ubjson_prefix(j.front(), use_bjdata);
16641 const bool same_prefix = std::all_of(j.begin(), j.end(),
16642 [
this, first_prefix, use_bjdata](
const BasicJsonType & v)
16644 return ubjson_prefix(v, use_bjdata) == first_prefix;
16647 std::vector<CharType> bjdx = {
'[',
'{',
'S',
'H',
'T',
'F',
'N',
'Z'};
16649 if (same_prefix && !(use_bjdata && std::find(bjdx.begin(), bjdx.end(), first_prefix) != bjdx.end()))
16651 prefix_required =
false;
16653 oa->write_character(first_prefix);
16663 for (
const auto& el : *j.m_data.m_value.object)
16666 oa->write_characters(
16667 reinterpret_cast<const CharType*
>(el.first.c_str()),
16669 write_ubjson(el.second, use_count, use_type, prefix_required, use_bjdata, bjdata_version);
16697 const auto it = name.find(
static_cast<typename string_t::value_type
>(0));
16701 static_cast<void>(j);
16704 return 1ul + name.size() + 1u;
16711 const std::uint8_t element_type)
16714 oa->write_characters(
16715 reinterpret_cast<const CharType*
>(name.c_str()),
16733 const double value)
16744 return sizeof(std::int32_t) +
value.size() + 1ul;
16756 oa->write_characters(
16757 reinterpret_cast<const CharType*
>(
value.c_str()),
16774 return (std::numeric_limits<std::int32_t>::min)() <=
value &&
value <= (std::numeric_limits<std::int32_t>::max)()
16775 ?
sizeof(std::int32_t)
16776 :
sizeof(std::int64_t);
16783 const std::int64_t
value)
16785 if ((std::numeric_limits<std::int32_t>::min)() <=
value &&
value <= (std::numeric_limits<std::int32_t>::max)())
16802 return (
value <=
static_cast<std::uint64_t
>((std::numeric_limits<std::int32_t>::max)()))
16803 ?
sizeof(std::int32_t)
16804 :
sizeof(std::int64_t);
16811 const BasicJsonType& j)
16813 if (j.m_data.m_value.number_unsigned <=
static_cast<std::uint64_t
>((std::numeric_limits<std::int32_t>::max)()))
16818 else if (j.m_data.m_value.number_unsigned <=
static_cast<std::uint64_t
>((std::numeric_limits<std::int64_t>::max)()))
16834 const typename BasicJsonType::object_t&
value)
16845 std::size_t array_index = 0ul;
16847 const std::size_t embedded_document_size = std::accumulate(std::begin(
value), std::end(
value),
static_cast<std::size_t
>(0), [&array_index](std::size_t result,
const typename BasicJsonType::array_t::value_type & el)
16852 return sizeof(std::int32_t) + embedded_document_size + 1ul;
16860 return sizeof(std::int32_t) +
value.size() + 1ul;
16867 const typename BasicJsonType::array_t&
value)
16872 std::size_t array_index = 0ul;
16874 for (
const auto& el :
value)
16891 write_number(
value.has_subtype() ?
static_cast<std::uint8_t
>(
value.subtype()) :
static_cast<std::uint8_t
>(0x00));
16893 oa->write_characters(
reinterpret_cast<const CharType*
>(
value.data()),
value.size());
16901 const BasicJsonType& j)
16916 return header_size + 1ul;
16919 return header_size + 8ul;
16931 return header_size + 0ul;
16949 const BasicJsonType& j)
16997 const std::size_t document_size = std::accumulate(
value.begin(),
value.end(),
static_cast<std::size_t
>(0),
16998 [](
size_t result,
const typename BasicJsonType::object_t::value_type & el)
17000 return result += calc_bson_element_size(el.first, el.second);
17003 return sizeof(std::int32_t) + document_size + 1ul;
17014 for (
const auto& el :
value)
17055 template<
typename NumberType,
typename std::enable_if<
17056 std::is_floating_point<NumberType>::value,
int>::type = 0>
17058 const bool add_prefix,
17059 const bool use_bjdata)
17069 template<
typename NumberType,
typename std::enable_if<
17070 std::is_unsigned<NumberType>::value,
int>::type = 0>
17072 const bool add_prefix,
17073 const bool use_bjdata)
17075 if (n <=
static_cast<std::uint64_t
>((std::numeric_limits<std::int8_t>::max)()))
17081 write_number(
static_cast<std::uint8_t
>(n), use_bjdata);
17083 else if (n <= (std::numeric_limits<std::uint8_t>::max)())
17089 write_number(
static_cast<std::uint8_t
>(n), use_bjdata);
17091 else if (n <=
static_cast<std::uint64_t
>((std::numeric_limits<std::int16_t>::max)()))
17097 write_number(
static_cast<std::int16_t
>(n), use_bjdata);
17099 else if (use_bjdata && n <=
static_cast<uint64_t
>((std::numeric_limits<uint16_t>::max)()))
17105 write_number(
static_cast<std::uint16_t
>(n), use_bjdata);
17107 else if (n <=
static_cast<std::uint64_t
>((std::numeric_limits<std::int32_t>::max)()))
17113 write_number(
static_cast<std::int32_t
>(n), use_bjdata);
17115 else if (use_bjdata && n <=
static_cast<uint64_t
>((std::numeric_limits<uint32_t>::max)()))
17121 write_number(
static_cast<std::uint32_t
>(n), use_bjdata);
17123 else if (n <=
static_cast<std::uint64_t
>((std::numeric_limits<std::int64_t>::max)()))
17129 write_number(
static_cast<std::int64_t
>(n), use_bjdata);
17131 else if (use_bjdata && n <= (std::numeric_limits<uint64_t>::max)())
17137 write_number(
static_cast<std::uint64_t
>(n), use_bjdata);
17146 const auto number = BasicJsonType(n).dump();
17148 for (std::size_t i = 0; i < number.size(); ++i)
17150 oa->write_character(
to_char_type(
static_cast<std::uint8_t
>(number[i])));
17156 template <
typename NumberType,
typename std::enable_if <
17157 std::is_signed<NumberType>::value&&
17158 !std::is_floating_point<NumberType>::value,
int >::type = 0 >
17160 const bool add_prefix,
17161 const bool use_bjdata)
17163 if ((std::numeric_limits<std::int8_t>::min)() <= n && n <= (std::numeric_limits<std::int8_t>::max)())
17169 write_number(
static_cast<std::int8_t
>(n), use_bjdata);
17171 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)()))
17177 write_number(
static_cast<std::uint8_t
>(n), use_bjdata);
17179 else if ((std::numeric_limits<std::int16_t>::min)() <= n && n <= (std::numeric_limits<std::int16_t>::max)())
17185 write_number(
static_cast<std::int16_t
>(n), use_bjdata);
17187 else if (use_bjdata && (
static_cast<std::int64_t
>((std::numeric_limits<std::uint16_t>::min)()) <= n && n <=
static_cast<std::int64_t
>((std::numeric_limits<std::uint16_t>::max)())))
17195 else if ((std::numeric_limits<std::int32_t>::min)() <= n && n <= (std::numeric_limits<std::int32_t>::max)())
17201 write_number(
static_cast<std::int32_t
>(n), use_bjdata);
17203 else if (use_bjdata && (
static_cast<std::int64_t
>((std::numeric_limits<std::uint32_t>::min)()) <= n && n <=
static_cast<std::int64_t
>((std::numeric_limits<std::uint32_t>::max)())))
17211 else if ((std::numeric_limits<std::int64_t>::min)() <= n && n <= (std::numeric_limits<std::int64_t>::max)())
17217 write_number(
static_cast<std::int64_t
>(n), use_bjdata);
17227 const auto number = BasicJsonType(n).dump();
17229 for (std::size_t i = 0; i < number.size(); ++i)
17231 oa->write_character(
to_char_type(
static_cast<std::uint8_t
>(number[i])));
17240 CharType
ubjson_prefix(
const BasicJsonType& j,
const bool use_bjdata)
const noexcept
17248 return j.m_data.m_value.boolean ?
'T' :
'F';
17252 if ((std::numeric_limits<std::int8_t>::min)() <= j.m_data.m_value.number_integer && j.m_data.m_value.number_integer <= (std::numeric_limits<std::int8_t>::max)())
17256 if ((std::numeric_limits<std::uint8_t>::min)() <= j.m_data.m_value.number_integer && j.m_data.m_value.number_integer <= (std::numeric_limits<std::uint8_t>::max)())
17260 if ((std::numeric_limits<std::int16_t>::min)() <= j.m_data.m_value.number_integer && j.m_data.m_value.number_integer <= (std::numeric_limits<std::int16_t>::max)())
17264 if (use_bjdata && ((std::numeric_limits<std::uint16_t>::min)() <= j.m_data.m_value.number_integer && j.m_data.m_value.number_integer <= (std::numeric_limits<std::uint16_t>::max)()))
17268 if ((std::numeric_limits<std::int32_t>::min)() <= j.m_data.m_value.number_integer && j.m_data.m_value.number_integer <= (std::numeric_limits<std::int32_t>::max)())
17272 if (use_bjdata && ((std::numeric_limits<std::uint32_t>::min)() <= j.m_data.m_value.number_integer && j.m_data.m_value.number_integer <= (std::numeric_limits<std::uint32_t>::max)()))
17276 if ((std::numeric_limits<std::int64_t>::min)() <= j.m_data.m_value.number_integer && j.m_data.m_value.number_integer <= (std::numeric_limits<std::int64_t>::max)())
17286 if (j.m_data.m_value.number_unsigned <=
static_cast<std::uint64_t
>((std::numeric_limits<std::int8_t>::max)()))
17290 if (j.m_data.m_value.number_unsigned <=
static_cast<std::uint64_t
>((std::numeric_limits<std::uint8_t>::max)()))
17294 if (j.m_data.m_value.number_unsigned <=
static_cast<std::uint64_t
>((std::numeric_limits<std::int16_t>::max)()))
17298 if (use_bjdata && j.m_data.m_value.number_unsigned <=
static_cast<std::uint64_t
>((std::numeric_limits<std::uint16_t>::max)()))
17302 if (j.m_data.m_value.number_unsigned <=
static_cast<std::uint64_t
>((std::numeric_limits<std::int32_t>::max)()))
17306 if (use_bjdata && j.m_data.m_value.number_unsigned <=
static_cast<std::uint64_t
>((std::numeric_limits<std::uint32_t>::max)()))
17310 if (j.m_data.m_value.number_unsigned <=
static_cast<std::uint64_t
>((std::numeric_limits<std::int64_t>::max)()))
17314 if (use_bjdata && j.m_data.m_value.number_unsigned <= (std::numeric_limits<std::uint64_t>::max)())
17356 std::map<string_t, CharType> bjdtype = {{
"uint8",
'U'}, {
"int8",
'i'}, {
"uint16",
'u'}, {
"int16",
'I'},
17357 {
"uint32",
'm'}, {
"int32",
'l'}, {
"uint64",
'M'}, {
"int64",
'L'}, {
"single",
'd'}, {
"double",
'D'},
17358 {
"char",
'C'}, {
"byte",
'B'}
17363 if (it == bjdtype.end())
17367 CharType dtype = it->second;
17369 key =
"_ArraySize_";
17370 std::size_t len = (
value.at(
key).empty() ? 0 : 1);
17371 for (
const auto& el :
value.at(
key))
17373 len *=
static_cast<std::size_t
>(el.m_data.m_value.number_unsigned);
17376 key =
"_ArrayData_";
17382 oa->write_character(
'[');
17383 oa->write_character(
'$');
17384 oa->write_character(dtype);
17385 oa->write_character(
'#');
17387 key =
"_ArraySize_";
17390 key =
"_ArrayData_";
17391 if (dtype ==
'U' || dtype ==
'C' || dtype ==
'B')
17393 for (
const auto& el :
value.at(
key))
17395 write_number(
static_cast<std::uint8_t
>(el.m_data.m_value.number_unsigned),
true);
17398 else if (dtype ==
'i')
17400 for (
const auto& el :
value.at(
key))
17402 write_number(
static_cast<std::int8_t
>(el.m_data.m_value.number_integer),
true);
17405 else if (dtype ==
'u')
17407 for (
const auto& el :
value.at(
key))
17409 write_number(
static_cast<std::uint16_t
>(el.m_data.m_value.number_unsigned),
true);
17412 else if (dtype ==
'I')
17414 for (
const auto& el :
value.at(
key))
17416 write_number(
static_cast<std::int16_t
>(el.m_data.m_value.number_integer),
true);
17419 else if (dtype ==
'm')
17421 for (
const auto& el :
value.at(
key))
17423 write_number(
static_cast<std::uint32_t
>(el.m_data.m_value.number_unsigned),
true);
17426 else if (dtype ==
'l')
17428 for (
const auto& el :
value.at(
key))
17430 write_number(
static_cast<std::int32_t
>(el.m_data.m_value.number_integer),
true);
17433 else if (dtype ==
'M')
17435 for (
const auto& el :
value.at(
key))
17437 write_number(
static_cast<std::uint64_t
>(el.m_data.m_value.number_unsigned),
true);
17440 else if (dtype ==
'L')
17442 for (
const auto& el :
value.at(
key))
17444 write_number(
static_cast<std::int64_t
>(el.m_data.m_value.number_integer),
true);
17447 else if (dtype ==
'd')
17449 for (
const auto& el :
value.at(
key))
17451 write_number(
static_cast<float>(el.m_data.m_value.number_float),
true);
17454 else if (dtype ==
'D')
17456 for (
const auto& el :
value.at(
key))
17458 write_number(
static_cast<double>(el.m_data.m_value.number_float),
true);
17481 template<
typename NumberType>
17485 std::array<CharType,
sizeof(NumberType)> vec{};
17486 std::memcpy(vec.data(), &n,
sizeof(NumberType));
17492 std::reverse(vec.begin(), vec.end());
17495 oa->write_characters(vec.data(),
sizeof(NumberType));
17501#pragma GCC diagnostic push
17502#pragma GCC diagnostic ignored "-Wfloat-equal"
17504 if (
static_cast<double>(n) >=
static_cast<double>(std::numeric_limits<float>::lowest()) &&
17505 static_cast<double>(n) <=
static_cast<double>((std::numeric_limits<float>::max)()) &&
17506 static_cast<double>(
static_cast<float>(n)) ==
static_cast<double>(n))
17521#pragma GCC diagnostic pop
17530 template <
typename C = CharType,
17531 enable_if_t < std::is_signed<C>::value && std::is_signed<char>::value > * =
nullptr >
17534 return *
reinterpret_cast<char*
>(&x);
17537 template <
typename C = CharType,
17538 enable_if_t < std::is_signed<C>::value && std::is_unsigned<char>::value > * =
nullptr >
17541 static_assert(
sizeof(std::uint8_t) ==
sizeof(CharType),
"size of CharType must be equal to std::uint8_t");
17542 static_assert(std::is_trivial<CharType>::value,
"CharType must be trivial");
17544 std::memcpy(&result, &x,
sizeof(x));
17548 template<
typename C = CharType,
17555 template <
typename InputCharType,
typename C = CharType,
17557 std::is_signed<C>::value &&
17558 std::is_signed<char>::value &&
17559 std::is_same<char, typename std::remove_cv<InputCharType>::type>
::value
17591#include <algorithm>
17601#include <type_traits>
17621#include <type_traits>
17652template<
typename Target,
typename Source>
17655 static_assert(
sizeof(Target) ==
sizeof(Source),
"size mismatch");
17658 std::memcpy(&target, &source,
sizeof(Source));
17669 constexpr diyfp(std::uint64_t f_,
int e_) noexcept :
f(f_),
e(e_) {}
17680 return {x.f - y.f, x.e};
17689 static_assert(
kPrecision == 64,
"internal error");
17714 const std::uint64_t u_lo = x.f & 0xFFFFFFFFu;
17715 const std::uint64_t u_hi = x.f >> 32u;
17716 const std::uint64_t v_lo = y.f & 0xFFFFFFFFu;
17717 const std::uint64_t v_hi = y.f >> 32u;
17719 const std::uint64_t p0 = u_lo * v_lo;
17720 const std::uint64_t p1 = u_lo * v_hi;
17721 const std::uint64_t p2 = u_hi * v_lo;
17722 const std::uint64_t p3 = u_hi * v_hi;
17724 const std::uint64_t p0_hi = p0 >> 32u;
17725 const std::uint64_t p1_lo = p1 & 0xFFFFFFFFu;
17726 const std::uint64_t p1_hi = p1 >> 32u;
17727 const std::uint64_t p2_lo = p2 & 0xFFFFFFFFu;
17728 const std::uint64_t p2_hi = p2 >> 32u;
17730 std::uint64_t Q = p0_hi + p1_lo + p2_lo;
17741 Q += std::uint64_t{1} << (64u - 32u - 1u);
17743 const std::uint64_t h = p3 + p2_hi + p1_hi + (Q >> 32u);
17745 return {h, x.e + y.e + 64};
17756 while ((x.f >> 63u) == 0)
17771 const int delta = x.e - target_exponent;
17776 return {x.f << delta, target_exponent};
17793template<
typename FloatType>
17806 static_assert(std::numeric_limits<FloatType>::is_iec559,
17807 "internal error: dtoa_short requires an IEEE-754 floating-point implementation");
17809 constexpr int kPrecision = std::numeric_limits<FloatType>::digits;
17810 constexpr int kBias = std::numeric_limits<FloatType>::max_exponent - 1 + (kPrecision - 1);
17811 constexpr int kMinExp = 1 - kBias;
17812 constexpr std::uint64_t kHiddenBit = std::uint64_t{1} << (kPrecision - 1);
17814 using bits_type =
typename std::conditional<kPrecision == 24, std::uint32_t, std::uint64_t >::type;
17817 const std::uint64_t E = bits >> (kPrecision - 1);
17818 const std::uint64_t F = bits & (kHiddenBit - 1);
17820 const bool is_denormal = E == 0;
17821 const diyfp v = is_denormal
17822 ?
diyfp(F, kMinExp)
17823 :
diyfp(F + kHiddenBit,
static_cast<int>(E) - kBias);
17846 const bool lower_boundary_is_closer = F == 0 && E > 1;
17848 const diyfp m_minus = lower_boundary_is_closer
17849 ?
diyfp((4 * v.
f) - 1, v.
e - 2)
17850 :
diyfp((2 * v.
f) - 1, v.
e - 1);
17985 constexpr int kCachedPowersMinDecExp = -300;
17986 constexpr int kCachedPowersDecStep = 8;
17988 static constexpr std::array<cached_power, 79> kCachedPowers =
17991 { 0xAB70FE17C79AC6CA, -1060, -300 },
17992 { 0xFF77B1FCBEBCDC4F, -1034, -292 },
17993 { 0xBE5691EF416BD60C, -1007, -284 },
17994 { 0x8DD01FAD907FFC3C, -980, -276 },
17995 { 0xD3515C2831559A83, -954, -268 },
17996 { 0x9D71AC8FADA6C9B5, -927, -260 },
17997 { 0xEA9C227723EE8BCB, -901, -252 },
17998 { 0xAECC49914078536D, -874, -244 },
17999 { 0x823C12795DB6CE57, -847, -236 },
18000 { 0xC21094364DFB5637, -821, -228 },
18001 { 0x9096EA6F3848984F, -794, -220 },
18002 { 0xD77485CB25823AC7, -768, -212 },
18003 { 0xA086CFCD97BF97F4, -741, -204 },
18004 { 0xEF340A98172AACE5, -715, -196 },
18005 { 0xB23867FB2A35B28E, -688, -188 },
18006 { 0x84C8D4DFD2C63F3B, -661, -180 },
18007 { 0xC5DD44271AD3CDBA, -635, -172 },
18008 { 0x936B9FCEBB25C996, -608, -164 },
18009 { 0xDBAC6C247D62A584, -582, -156 },
18010 { 0xA3AB66580D5FDAF6, -555, -148 },
18011 { 0xF3E2F893DEC3F126, -529, -140 },
18012 { 0xB5B5ADA8AAFF80B8, -502, -132 },
18013 { 0x87625F056C7C4A8B, -475, -124 },
18014 { 0xC9BCFF6034C13053, -449, -116 },
18015 { 0x964E858C91BA2655, -422, -108 },
18016 { 0xDFF9772470297EBD, -396, -100 },
18017 { 0xA6DFBD9FB8E5B88F, -369, -92 },
18018 { 0xF8A95FCF88747D94, -343, -84 },
18019 { 0xB94470938FA89BCF, -316, -76 },
18020 { 0x8A08F0F8BF0F156B, -289, -68 },
18021 { 0xCDB02555653131B6, -263, -60 },
18022 { 0x993FE2C6D07B7FAC, -236, -52 },
18023 { 0xE45C10C42A2B3B06, -210, -44 },
18024 { 0xAA242499697392D3, -183, -36 },
18025 { 0xFD87B5F28300CA0E, -157, -28 },
18026 { 0xBCE5086492111AEB, -130, -20 },
18027 { 0x8CBCCC096F5088CC, -103, -12 },
18028 { 0xD1B71758E219652C, -77, -4 },
18029 { 0x9C40000000000000, -50, 4 },
18030 { 0xE8D4A51000000000, -24, 12 },
18031 { 0xAD78EBC5AC620000, 3, 20 },
18032 { 0x813F3978F8940984, 30, 28 },
18033 { 0xC097CE7BC90715B3, 56, 36 },
18034 { 0x8F7E32CE7BEA5C70, 83, 44 },
18035 { 0xD5D238A4ABE98068, 109, 52 },
18036 { 0x9F4F2726179A2245, 136, 60 },
18037 { 0xED63A231D4C4FB27, 162, 68 },
18038 { 0xB0DE65388CC8ADA8, 189, 76 },
18039 { 0x83C7088E1AAB65DB, 216, 84 },
18040 { 0xC45D1DF942711D9A, 242, 92 },
18041 { 0x924D692CA61BE758, 269, 100 },
18042 { 0xDA01EE641A708DEA, 295, 108 },
18043 { 0xA26DA3999AEF774A, 322, 116 },
18044 { 0xF209787BB47D6B85, 348, 124 },
18045 { 0xB454E4A179DD1877, 375, 132 },
18046 { 0x865B86925B9BC5C2, 402, 140 },
18047 { 0xC83553C5C8965D3D, 428, 148 },
18048 { 0x952AB45CFA97A0B3, 455, 156 },
18049 { 0xDE469FBD99A05FE3, 481, 164 },
18050 { 0xA59BC234DB398C25, 508, 172 },
18051 { 0xF6C69A72A3989F5C, 534, 180 },
18052 { 0xB7DCBF5354E9BECE, 561, 188 },
18053 { 0x88FCF317F22241E2, 588, 196 },
18054 { 0xCC20CE9BD35C78A5, 614, 204 },
18055 { 0x98165AF37B2153DF, 641, 212 },
18056 { 0xE2A0B5DC971F303A, 667, 220 },
18057 { 0xA8D9D1535CE3B396, 694, 228 },
18058 { 0xFB9B7CD9A4A7443C, 720, 236 },
18059 { 0xBB764C4CA7A44410, 747, 244 },
18060 { 0x8BAB8EEFB6409C1A, 774, 252 },
18061 { 0xD01FEF10A657842C, 800, 260 },
18062 { 0x9B10A4E5E9913129, 827, 268 },
18063 { 0xE7109BFBA19C0C9D, 853, 276 },
18064 { 0xAC2820D9623BF429, 880, 284 },
18065 { 0x80444B5E7AA7CF85, 907, 292 },
18066 { 0xBF21E44003ACDD2D, 933, 300 },
18067 { 0x8E679C2F5E44FF8F, 960, 308 },
18068 { 0xD433179D9C8CB841, 986, 316 },
18069 { 0x9E19DB92B4E31BA9, 1013, 324 },
18079 const int f =
kAlpha - e - 1;
18080 const int k = ((f * 78913) / (1 << 18)) +
static_cast<int>(f > 0);
18082 const int index = (-kCachedPowersMinDecExp + k + (kCachedPowersDecStep - 1)) / kCachedPowersDecStep;
18084 JSON_ASSERT(
static_cast<std::size_t
>(index) < kCachedPowers.size());
18086 const cached_power cached = kCachedPowers[
static_cast<std::size_t
>(index)];
18100 if (n >= 1000000000)
18102 pow10 = 1000000000;
18106 if (n >= 100000000)
18151inline void grisu2_round(
char* buf,
int len, std::uint64_t dist, std::uint64_t delta,
18152 std::uint64_t rest, std::uint64_t ten_k)
18179 && delta - rest >= ten_k
18180 && (rest + ten_k < dist || dist - rest > rest + ten_k - dist))
18195 static_assert(
kAlpha >= -60,
"internal error");
18196 static_assert(
kGamma <= -32,
"internal error");
18213 std::uint64_t delta =
diyfp::sub(M_plus, M_minus).f;
18214 std::uint64_t dist =
diyfp::sub(M_plus, w ).f;
18223 const diyfp one(std::uint64_t{1} << -M_plus.
e, M_plus.
e);
18225 auto p1 =
static_cast<std::uint32_t
>(M_plus.
f >> -one.e);
18226 std::uint64_t p2 = M_plus.
f & (one.f - 1);
18234 std::uint32_t pow10{};
18262 const std::uint32_t d = p1 / pow10;
18263 const std::uint32_t r = p1 % pow10;
18269 buffer[length++] =
static_cast<char>(
'0' + d);
18288 const std::uint64_t rest = (std::uint64_t{p1} << -one.e) + p2;
18293 decimal_exponent += n;
18304 const std::uint64_t ten_n = std::uint64_t{pow10} << -one.e;
18305 grisu2_round(buffer, length, dist, delta, rest, ten_n);
18366 JSON_ASSERT(p2 <= (std::numeric_limits<std::uint64_t>::max)() / 10);
18368 const std::uint64_t d = p2 >> -one.e;
18369 const std::uint64_t r = p2 & (one.f - 1);
18376 buffer[length++] =
static_cast<char>(
'0' + d);
18401 decimal_exponent -= m;
18409 const std::uint64_t ten_m = one.f;
18433inline
void grisu2(
char* buf,
int& len,
int& decimal_exponent,
18450 const diyfp c_minus_k(cached.
f, cached.
e);
18478 const diyfp M_minus(w_minus.
f + 1, w_minus.
e);
18479 const diyfp M_plus (w_plus.
f - 1, w_plus.
e );
18481 decimal_exponent = -cached.
k;
18491template<
typename FloatType>
18496 "internal error: not enough precision");
18548 auto k =
static_cast<std::uint32_t
>(e);
18554 *buf++ =
static_cast<char>(
'0' + k);
18558 *buf++ =
static_cast<char>(
'0' + (k / 10));
18560 *buf++ =
static_cast<char>(
'0' + k);
18564 *buf++ =
static_cast<char>(
'0' + (k / 100));
18566 *buf++ =
static_cast<char>(
'0' + (k / 10));
18568 *buf++ =
static_cast<char>(
'0' + k);
18586 int min_exp,
int max_exp)
18592 const int n = len + decimal_exponent;
18598 if (k <= n && n <= max_exp)
18603 std::memset(buf + k,
'0',
static_cast<size_t>(n) -
static_cast<size_t>(k));
18607 return buf + (
static_cast<size_t>(n) + 2);
18610 if (0 < n && n <= max_exp)
18617 std::memmove(buf + (
static_cast<size_t>(n) + 1), buf + n,
static_cast<size_t>(k) -
static_cast<size_t>(n));
18619 return buf + (
static_cast<size_t>(k) + 1U);
18622 if (min_exp < n && n <= 0)
18627 std::memmove(buf + (2 +
static_cast<size_t>(-n)), buf,
static_cast<size_t>(k));
18630 std::memset(buf + 2,
'0',
static_cast<size_t>(-n));
18631 return buf + (2U +
static_cast<size_t>(-n) +
static_cast<size_t>(k));
18646 std::memmove(buf + 2, buf + 1,
static_cast<size_t>(k) - 1);
18648 buf += 1 +
static_cast<size_t>(k);
18667template<
typename FloatType>
18672 static_cast<void>(last);
18676 if (std::signbit(
value))
18683#pragma GCC diagnostic push
18684#pragma GCC diagnostic ignored "-Wfloat-equal"
18695#pragma GCC diagnostic pop
18698 JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10);
18705 int decimal_exponent = 0;
18708 JSON_ASSERT(len <= std::numeric_limits<FloatType>::max_digits10);
18711 constexpr int kMinExp = -4;
18713 constexpr int kMaxExp = std::numeric_limits<FloatType>::digits10;
18716 JSON_ASSERT(last - first >= 2 + (-kMinExp - 1) + std::numeric_limits<FloatType>::max_digits10);
18717 JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10 + 6);
18756template<
typename BasicJsonType>
18776 ,
loc(
std::localeconv())
18814 const bool pretty_print,
18816 const unsigned int indent_step,
18817 const unsigned int current_indent = 0)
18819 switch (val.m_data.m_type)
18823 if (val.m_data.m_value.object->empty())
18825 o->write_characters(
"{}", 2);
18831 o->write_characters(
"{\n", 2);
18834 const auto new_indent = current_indent + indent_step;
18841 auto i = val.m_data.m_value.object->cbegin();
18842 for (std::size_t cnt = 0; cnt < val.m_data.m_value.object->size() - 1; ++cnt, ++i)
18845 o->write_character(
'\"');
18847 o->write_characters(
"\": ", 3);
18849 o->write_characters(
",\n", 2);
18853 JSON_ASSERT(i != val.m_data.m_value.object->cend());
18854 JSON_ASSERT(std::next(i) == val.m_data.m_value.object->cend());
18856 o->write_character(
'\"');
18858 o->write_characters(
"\": ", 3);
18861 o->write_character(
'\n');
18862 o->write_characters(
indent_string.c_str(), current_indent);
18863 o->write_character(
'}');
18867 o->write_character(
'{');
18870 auto i = val.m_data.m_value.object->cbegin();
18871 for (std::size_t cnt = 0; cnt < val.m_data.m_value.object->size() - 1; ++cnt, ++i)
18873 o->write_character(
'\"');
18875 o->write_characters(
"\":", 2);
18877 o->write_character(
',');
18881 JSON_ASSERT(i != val.m_data.m_value.object->cend());
18882 JSON_ASSERT(std::next(i) == val.m_data.m_value.object->cend());
18883 o->write_character(
'\"');
18885 o->write_characters(
"\":", 2);
18888 o->write_character(
'}');
18896 if (val.m_data.m_value.array->empty())
18898 o->write_characters(
"[]", 2);
18904 o->write_characters(
"[\n", 2);
18907 const auto new_indent = current_indent + indent_step;
18914 for (
auto i = val.m_data.m_value.array->cbegin();
18915 i != val.m_data.m_value.array->cend() - 1; ++i)
18919 o->write_characters(
",\n", 2);
18925 dump(val.m_data.m_value.array->back(),
true,
ensure_ascii, indent_step, new_indent);
18927 o->write_character(
'\n');
18928 o->write_characters(
indent_string.c_str(), current_indent);
18929 o->write_character(
']');
18933 o->write_character(
'[');
18936 for (
auto i = val.m_data.m_value.array->cbegin();
18937 i != val.m_data.m_value.array->cend() - 1; ++i)
18940 o->write_character(
',');
18945 dump(val.m_data.m_value.array->back(),
false,
ensure_ascii, indent_step, current_indent);
18947 o->write_character(
']');
18955 o->write_character(
'\"');
18956 dump_escaped(*val.m_data.m_value.string,
ensure_ascii);
18957 o->write_character(
'\"');
18965 o->write_characters(
"{\n", 2);
18968 const auto new_indent = current_indent + indent_step;
18976 o->write_characters(
"\"bytes\": [", 10);
18978 if (!val.m_data.m_value.binary->empty())
18980 for (
auto i = val.m_data.m_value.binary->cbegin();
18981 i != val.m_data.m_value.binary->cend() - 1; ++i)
18984 o->write_characters(
", ", 2);
18986 dump_integer(val.m_data.m_value.binary->back());
18989 o->write_characters(
"],\n", 3);
18992 o->write_characters(
"\"subtype\": ", 11);
18993 if (val.m_data.m_value.binary->has_subtype())
18995 dump_integer(val.m_data.m_value.binary->subtype());
18999 o->write_characters(
"null", 4);
19001 o->write_character(
'\n');
19002 o->write_characters(
indent_string.c_str(), current_indent);
19003 o->write_character(
'}');
19007 o->write_characters(
"{\"bytes\":[", 10);
19009 if (!val.m_data.m_value.binary->empty())
19011 for (
auto i = val.m_data.m_value.binary->cbegin();
19012 i != val.m_data.m_value.binary->cend() - 1; ++i)
19015 o->write_character(
',');
19017 dump_integer(val.m_data.m_value.binary->back());
19020 o->write_characters(
"],\"subtype\":", 12);
19021 if (val.m_data.m_value.binary->has_subtype())
19023 dump_integer(val.m_data.m_value.binary->subtype());
19024 o->write_character(
'}');
19028 o->write_characters(
"null}", 5);
19036 if (val.m_data.m_value.boolean)
19038 o->write_characters(
"true", 4);
19042 o->write_characters(
"false", 5);
19049 dump_integer(val.m_data.m_value.number_integer);
19055 dump_integer(val.m_data.m_value.number_unsigned);
19061 dump_float(val.m_data.m_value.number_float);
19067 o->write_characters(
"<discarded>", 11);
19073 o->write_characters(
"null", 4);
19099 std::uint32_t codepoint{};
19107 for (std::size_t i = 0; i < s.size(); ++i)
19109 const auto byte =
static_cast<std::uint8_t
>(s[i]);
19111 switch (decode(
state, codepoint,
byte))
19170 if ((codepoint <= 0x1F) || (
ensure_ascii && (codepoint >= 0x7F)))
19172 if (codepoint <= 0xFFFF)
19176 static_cast<std::uint16_t
>(codepoint)));
19182 static_cast<void>((std::snprintf)(
string_buffer.data() +
bytes, 13,
"\\u%04x\\u%04x",
19183 static_cast<std::uint16_t
>(0xD7C0u + (codepoint >> 10u)),
19184 static_cast<std::uint16_t
>(0xDC00u + (codepoint & 0x3FFu))));
19328 o->write_characters(
"\\ufffd", 6);
19332 o->write_characters(
"\xEF\xBF\xBD", 3);
19352 unsigned int count_digits(number_unsigned_t x)
noexcept
19354 unsigned int n_digits = 1;
19363 return n_digits + 1;
19367 return n_digits + 2;
19371 return n_digits + 3;
19383 static std::string hex_bytes(std::uint8_t
byte)
19385 std::string result =
"FF";
19386 constexpr const char* nibble_to_hex =
"0123456789ABCDEF";
19387 result[0] = nibble_to_hex[
byte / 16];
19388 result[1] = nibble_to_hex[
byte % 16];
19393 template <typename NumberType, enable_if_t<std::is_signed<NumberType>::value,
int> = 0>
19394 bool is_negative_number(NumberType x)
19399 template < typename NumberType, enable_if_t <std::is_unsigned<NumberType>::value,
int > = 0 >
19400 bool is_negative_number(NumberType )
19415 std::is_integral<NumberType>::value ||
19416 std::is_same<NumberType, number_unsigned_t>::value ||
19417 std::is_same<NumberType, number_integer_t>::value ||
19418 std::is_same<NumberType, binary_char_t>::value,
19420 void dump_integer(NumberType x)
19422 static constexpr std::array<std::array<char, 2>, 100> digits_to_99
19425 {{
'0',
'0'}}, {{
'0',
'1'}}, {{
'0',
'2'}}, {{
'0',
'3'}}, {{
'0',
'4'}}, {{
'0',
'5'}}, {{
'0',
'6'}}, {{
'0',
'7'}}, {{
'0',
'8'}}, {{
'0',
'9'}},
19426 {{
'1',
'0'}}, {{
'1',
'1'}}, {{
'1',
'2'}}, {{
'1',
'3'}}, {{
'1',
'4'}}, {{
'1',
'5'}}, {{
'1',
'6'}}, {{
'1',
'7'}}, {{
'1',
'8'}}, {{
'1',
'9'}},
19427 {{
'2',
'0'}}, {{
'2',
'1'}}, {{
'2',
'2'}}, {{
'2',
'3'}}, {{
'2',
'4'}}, {{
'2',
'5'}}, {{
'2',
'6'}}, {{
'2',
'7'}}, {{
'2',
'8'}}, {{
'2',
'9'}},
19428 {{
'3',
'0'}}, {{
'3',
'1'}}, {{
'3',
'2'}}, {{
'3',
'3'}}, {{
'3',
'4'}}, {{
'3',
'5'}}, {{
'3',
'6'}}, {{
'3',
'7'}}, {{
'3',
'8'}}, {{
'3',
'9'}},
19429 {{
'4',
'0'}}, {{
'4',
'1'}}, {{
'4',
'2'}}, {{
'4',
'3'}}, {{
'4',
'4'}}, {{
'4',
'5'}}, {{
'4',
'6'}}, {{
'4',
'7'}}, {{
'4',
'8'}}, {{
'4',
'9'}},
19430 {{
'5',
'0'}}, {{
'5',
'1'}}, {{
'5',
'2'}}, {{
'5',
'3'}}, {{
'5',
'4'}}, {{
'5',
'5'}}, {{
'5',
'6'}}, {{
'5',
'7'}}, {{
'5',
'8'}}, {{
'5',
'9'}},
19431 {{
'6',
'0'}}, {{
'6',
'1'}}, {{
'6',
'2'}}, {{
'6',
'3'}}, {{
'6',
'4'}}, {{
'6',
'5'}}, {{
'6',
'6'}}, {{
'6',
'7'}}, {{
'6',
'8'}}, {{
'6',
'9'}},
19432 {{
'7',
'0'}}, {{
'7',
'1'}}, {{
'7',
'2'}}, {{
'7',
'3'}}, {{
'7',
'4'}}, {{
'7',
'5'}}, {{
'7',
'6'}}, {{
'7',
'7'}}, {{
'7',
'8'}}, {{
'7',
'9'}},
19433 {{
'8',
'0'}}, {{
'8',
'1'}}, {{
'8',
'2'}}, {{
'8',
'3'}}, {{
'8',
'4'}}, {{
'8',
'5'}}, {{
'8',
'6'}}, {{
'8',
'7'}}, {{
'8',
'8'}}, {{
'8',
'9'}},
19434 {{
'9',
'0'}}, {{
'9',
'1'}}, {{
'9',
'2'}}, {{
'9',
'3'}}, {{
'9',
'4'}}, {{
'9',
'5'}}, {{
'9',
'6'}}, {{
'9',
'7'}}, {{
'9',
'8'}}, {{
'9',
'9'}},
19441 o->write_character(
'0');
19446 auto buffer_ptr = number_buffer.begin();
19448 number_unsigned_t abs_value;
19450 unsigned int n_chars{};
19452 if (is_negative_number(x))
19455 abs_value = remove_sign(
static_cast<number_integer_t
>(x));
19458 n_chars = 1 + count_digits(abs_value);
19462 abs_value =
static_cast<number_unsigned_t
>(x);
19463 n_chars = count_digits(abs_value);
19471 buffer_ptr += n_chars;
19475 while (abs_value >= 100)
19477 const auto digits_index =
static_cast<unsigned>((abs_value % 100));
19479 *(--buffer_ptr) = digits_to_99[digits_index][1];
19480 *(--buffer_ptr) = digits_to_99[digits_index][0];
19483 if (abs_value >= 10)
19485 const auto digits_index =
static_cast<unsigned>(abs_value);
19486 *(--buffer_ptr) = digits_to_99[digits_index][1];
19487 *(--buffer_ptr) = digits_to_99[digits_index][0];
19491 *(--buffer_ptr) =
static_cast<char>(
'0' + abs_value);
19494 o->write_characters(number_buffer.data(), n_chars);
19505 void dump_float(number_float_t x)
19508 if (!std::isfinite(x))
19510 o->write_characters(
"null", 4);
19519 static constexpr bool is_ieee_single_or_double
19520 = (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) ||
19521 (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);
19523 dump_float(x, std::integral_constant<bool, is_ieee_single_or_double>());
19526 void dump_float(number_float_t x, std::true_type )
19528 auto* begin = number_buffer.data();
19529 auto* end = ::nlohmann::detail::to_chars(begin, begin + number_buffer.size(), x);
19531 o->write_characters(begin,
static_cast<size_t>(end - begin));
19534 void dump_float(number_float_t x, std::false_type )
19537 static constexpr auto d = std::numeric_limits<number_float_t>::max_digits10;
19541 std::ptrdiff_t len = (std::snprintf)(number_buffer.data(), number_buffer.size(),
"%.*g", d, x);
19546 JSON_ASSERT(
static_cast<std::size_t
>(len) < number_buffer.size());
19549 if (thousands_sep !=
'\0')
19552 const auto end = std::remove(number_buffer.begin(), number_buffer.begin() + len, thousands_sep);
19553 std::fill(end, number_buffer.end(),
'\0');
19554 JSON_ASSERT((end - number_buffer.begin()) <= len);
19555 len = (end - number_buffer.begin());
19559 if (decimal_point !=
'\0' && decimal_point !=
'.')
19562 const auto dec_pos = std::find(number_buffer.begin(), number_buffer.end(), decimal_point);
19563 if (dec_pos != number_buffer.end())
19569 o->write_characters(number_buffer.data(),
static_cast<std::size_t
>(len));
19572 const bool value_is_int_like =
19573 std::none_of(number_buffer.begin(), number_buffer.begin() + len + 1,
19576 return c ==
'.' || c ==
'e';
19579 if (value_is_int_like)
19581 o->write_characters(
".0", 2);
19606 static std::uint8_t decode(std::uint8_t& state, std::uint32_t& codep,
const std::uint8_t
byte)
noexcept
19608 static const std::array<std::uint8_t, 400> utf8d =
19611 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,
19612 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,
19613 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,
19614 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,
19615 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,
19616 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,
19617 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,
19618 0xA, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x4, 0x3, 0x3,
19619 0xB, 0x6, 0x6, 0x6, 0x5, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8,
19620 0x0, 0x1, 0x2, 0x3, 0x5, 0x8, 0x7, 0x1, 0x1, 0x1, 0x4, 0x6, 0x1, 0x1, 0x1, 0x1,
19621 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,
19622 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,
19623 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,
19624 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
19629 const std::uint8_t type = utf8d[byte];
19631 codep = (state != UTF8_ACCEPT)
19632 ? (
byte & 0x3fu) | (codep << 6u)
19633 : (0xFFu >> type) & (byte);
19635 const std::size_t index = 256u + (
static_cast<size_t>(state) * 16u) +
static_cast<size_t>(type);
19637 state = utf8d[index];
19646 number_unsigned_t remove_sign(number_unsigned_t x)
19661 number_unsigned_t remove_sign(number_integer_t x)
noexcept
19663 JSON_ASSERT(x < 0 && x < (std::numeric_limits<number_integer_t>::max)());
19664 return static_cast<number_unsigned_t
>(-(x + 1)) + 1;
19669 output_adapter_t<char> o =
nullptr;
19711#include <functional>
19712#include <initializer_list>
19715#include <stdexcept>
19716#include <type_traits>
19729template <
class Key,
class T,
class IgnoredLess = std::less<Key>,
19730 class Allocator = std::allocator<std::pair<const Key, T>>>
19735 using Container = std::vector<std::pair<const Key, T>, Allocator>;
19740#ifdef JSON_HAS_CPP_14
19750 template <
class It>
19753 ordered_map(std::initializer_list<value_type> init,
const Allocator& alloc = Allocator() )
19758 for (
auto it = this->begin(); it != this->end(); ++it)
19762 return {it,
false};
19765 Container::emplace_back(key, std::forward<T>(t));
19766 return {std::prev(this->end()),
true};
19771 std::pair<iterator, bool>
emplace(KeyType && key, T && t)
19773 for (
auto it = this->begin(); it != this->end(); ++it)
19777 return {it,
false};
19780 Container::emplace_back(std::forward<KeyType>(key), std::forward<T>(t));
19781 return {std::prev(this->end()),
true};
19786 return emplace(key, T{}).first->second;
19793 return emplace(std::forward<KeyType>(key), T{}).first->second;
19805 return at(std::forward<KeyType>(key));
19810 for (
auto it = this->begin(); it != this->end(); ++it)
19818 JSON_THROW(std::out_of_range(
"key not found"));
19825 for (
auto it = this->begin(); it != this->end(); ++it)
19833 JSON_THROW(std::out_of_range(
"key not found"));
19838 for (
auto it = this->begin(); it != this->end(); ++it)
19846 JSON_THROW(std::out_of_range(
"key not found"));
19851 const T &
at(KeyType && key)
const
19853 for (
auto it = this->begin(); it != this->end(); ++it)
19861 JSON_THROW(std::out_of_range(
"key not found"));
19866 for (
auto it = this->begin(); it != this->end(); ++it)
19871 for (
auto next = it; ++next != this->end(); ++it)
19876 Container::pop_back();
19887 for (
auto it = this->begin(); it != this->end(); ++it)
19892 for (
auto next = it; ++next != this->end(); ++it)
19897 Container::pop_back();
19906 return erase(pos, std::next(pos));
19916 const auto elements_affected = std::distance(first, last);
19917 const auto offset = std::distance(Container::begin(), first);
19939 for (
auto it = first; std::next(it, elements_affected) != Container::end(); ++it)
19942 new (&*it)
value_type{std::move(*std::next(it, elements_affected))};
19950 Container::resize(this->size() -
static_cast<size_type>(elements_affected));
19959 return Container::begin() + offset;
19964 for (
auto it = this->begin(); it != this->end(); ++it)
19978 for (
auto it = this->begin(); it != this->end(); ++it)
19990 for (
auto it = this->begin(); it != this->end(); ++it)
19997 return Container::end();
20004 for (
auto it = this->begin(); it != this->end(); ++it)
20011 return Container::end();
20016 for (
auto it = this->begin(); it != this->end(); ++it)
20023 return Container::end();
20028 return emplace(value.first, std::move(value.second));
20033 for (
auto it = this->begin(); it != this->end(); ++it)
20037 return {it,
false};
20040 Container::push_back(value);
20041 return {--this->end(),
true};
20044 template<
typename InputIt>
20045 using require_input_iter =
typename std::enable_if<std::is_convertible<typename std::iterator_traits<InputIt>::iterator_category,
20046 std::input_iterator_tag>::value>::type;
20048 template<
typename InputIt,
typename = require_input_iter<InputIt>>
20051 for (
auto it = first; it != last; ++it)
20064#if defined(JSON_HAS_CPP_17)
20065 #if JSON_HAS_STATIC_RTTI
20068 #include <string_view>
20098 :
public ::nlohmann::detail::json_base_class<CustomBaseClass>
20104 friend class ::nlohmann::json_pointer;
20108 template<
typename BasicJsonType,
typename InputType>
20109 friend class ::nlohmann::detail::parser;
20110 friend ::nlohmann::detail::serializer<basic_json>;
20111 template<
typename BasicJsonType>
20112 friend class ::nlohmann::detail::iter_impl;
20113 template<
typename BasicJsonType,
typename CharType>
20114 friend class ::nlohmann::detail::binary_writer;
20115 template<
typename BasicJsonType,
typename InputType,
typename SAX>
20116 friend class ::nlohmann::detail::binary_reader;
20117 template<
typename BasicJsonType,
typename InputAdapterType>
20118 friend class ::nlohmann::detail::json_sax_dom_parser;
20119 template<
typename BasicJsonType,
typename InputAdapterType>
20120 friend class ::nlohmann::detail::json_sax_dom_callback_parser;
20121 friend class ::nlohmann::detail::exception;
20129 using lexer = ::nlohmann::detail::lexer_base<basic_json>;
20131 template<
typename InputAdapterType>
20132 static ::nlohmann::detail::parser<basic_json, InputAdapterType>
parser(
20133 InputAdapterType adapter,
20135 const bool allow_exceptions =
true,
20136 const bool ignore_comments =
false
20139 return ::nlohmann::detail::parser<basic_json, InputAdapterType>(std::move(adapter),
20140 std::move(cb), allow_exceptions, ignore_comments);
20145 template<
typename BasicJsonType>
20147 template<
typename BasicJsonType>
20149 template<
typename Iterator>
20153 template<
typename CharType>
20156 template<
typename InputType>
20158 template<
typename CharType>
using binary_writer = ::nlohmann::detail::binary_writer<basic_json, CharType>;
20161 using serializer = ::nlohmann::detail::serializer<basic_json>;
20167 template<
typename T,
typename SFINAE>
20225 using pointer =
typename std::allocator_traits<allocator_type>::pointer;
20227 using const_pointer =
typename std::allocator_traits<allocator_type>::const_pointer;
20254 result[
"copyright"] =
"(C) 2013-2023 Niels Lohmann";
20255 result[
"name"] =
"JSON for Modern C++";
20256 result[
"url"] =
"https://github.com/nlohmann/json";
20257 result[
"version"][
"string"] =
20266 result[
"platform"] =
"win32";
20267#elif defined __linux__
20268 result[
"platform"] =
"linux";
20269#elif defined __APPLE__
20270 result[
"platform"] =
"apple";
20271#elif defined __unix__
20272 result[
"platform"] =
"unix";
20274 result[
"platform"] =
"unknown";
20277#if defined(__ICC) || defined(__INTEL_COMPILER)
20278 result[
"compiler"] = {{
"family",
"icc"}, {
"version", __INTEL_COMPILER}};
20279#elif defined(__clang__)
20280 result[
"compiler"] = {{
"family",
"clang"}, {
"version", __clang_version__}};
20281#elif defined(__GNUC__) || defined(__GNUG__)
20282 result[
"compiler"] = {{
"family",
"gcc"}, {
"version",
detail::concat(
20283 std::to_string(__GNUC__),
'.',
20284 std::to_string(__GNUC_MINOR__),
'.',
20285 std::to_string(__GNUC_PATCHLEVEL__))
20288#elif defined(__HP_cc) || defined(__HP_aCC)
20289 result[
"compiler"] =
"hp"
20290#elif defined(__IBMCPP__)
20291 result[
"compiler"] = {{
"family",
"ilecpp"}, {
"version", __IBMCPP__}};
20292#elif defined(_MSC_VER)
20293 result[
"compiler"] = {{
"family",
"msvc"}, {
"version", _MSC_VER}};
20294#elif defined(__PGI)
20295 result[
"compiler"] = {{
"family",
"pgcpp"}, {
"version", __PGI}};
20296#elif defined(__SUNPRO_CC)
20297 result[
"compiler"] = {{
"family",
"sunpro"}, {
"version", __SUNPRO_CC}};
20299 result[
"compiler"] = {{
"family",
"unknown"}, {
"version",
"unknown"}};
20302#if defined(_MSVC_LANG)
20303 result[
"compiler"][
"c++"] = std::to_string(_MSVC_LANG);
20304#elif defined(__cplusplus)
20305 result[
"compiler"][
"c++"] = std::to_string(__cplusplus);
20307 result[
"compiler"][
"c++"] =
"unknown";
20325#if defined(JSON_HAS_CPP_14)
20328 using default_object_comparator_t = std::less<>;
20338 AllocatorType<std::pair<
const StringType,
20343 using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
20367 using binary_t = nlohmann::byte_container_with_subtype<BinaryType>;
20378 template<
typename T,
typename... Args>
20382 AllocatorType<T> alloc;
20383 using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;
20385 auto deleter = [&](T * obj)
20387 AllocatorTraits::deallocate(alloc, obj, 1);
20389 std::unique_ptr<T,
decltype(deleter)> obj(AllocatorTraits::allocate(alloc, 1), deleter);
20390 AllocatorTraits::construct(alloc, obj.get(), std::forward<Args>(args)...);
20392 return obj.release();
20459 case value_t::object:
20465 case value_t::array:
20471 case value_t::string:
20477 case value_t::binary:
20483 case value_t::boolean:
20485 boolean =
static_cast<boolean_t>(
false);
20489 case value_t::number_integer:
20495 case value_t::number_unsigned:
20501 case value_t::number_float:
20507 case value_t::null:
20513 case value_t::discarded:
20559 (t == value_t::object &&
object ==
nullptr) ||
20560 (t == value_t::array &&
array ==
nullptr) ||
20561 (t == value_t::string &&
string ==
nullptr) ||
20562 (t == value_t::binary &&
binary ==
nullptr)
20568 if (t == value_t::array || t == value_t::object)
20571 std::vector<basic_json> stack;
20574 if (t == value_t::array)
20576 stack.reserve(
array->size());
20577 std::move(
array->begin(),
array->end(), std::back_inserter(stack));
20581 stack.reserve(
object->size());
20582 for (
auto&& it : *
object)
20584 stack.push_back(std::move(it.second));
20588 while (!stack.empty())
20591 basic_json current_item(std::move(stack.back()));
20598 std::move(current_item.
m_data.m_value.array->begin(), current_item.
m_data.m_value.array->end(), std::back_inserter(stack));
20600 current_item.
m_data.m_value.array->clear();
20604 for (
auto&& it : *current_item.
m_data.m_value.object)
20606 stack.push_back(std::move(it.second));
20609 current_item.
m_data.m_value.object->clear();
20619 case value_t::object:
20621 AllocatorType<object_t> alloc;
20622 std::allocator_traits<
decltype(alloc)>
::destroy(alloc,
object);
20623 std::allocator_traits<
decltype(alloc)>::deallocate(alloc,
object, 1);
20627 case value_t::array:
20629 AllocatorType<array_t> alloc;
20631 std::allocator_traits<
decltype(alloc)>::deallocate(alloc,
array, 1);
20635 case value_t::string:
20637 AllocatorType<string_t> alloc;
20638 std::allocator_traits<
decltype(alloc)>
::destroy(alloc,
string);
20639 std::allocator_traits<
decltype(alloc)>::deallocate(alloc,
string, 1);
20643 case value_t::binary:
20645 AllocatorType<binary_t> alloc;
20647 std::allocator_traits<
decltype(alloc)>::deallocate(alloc,
binary, 1);
20651 case value_t::null:
20652 case value_t::boolean:
20653 case value_t::number_integer:
20654 case value_t::number_unsigned:
20655 case value_t::number_float:
20656 case value_t::discarded:
20691#if JSON_DIAGNOSTICS
20697 return j.m_parent ==
this;
20702 static_cast<void>(check_parents);
20707#if JSON_DIAGNOSTICS
20710 case value_t::array:
20712 for (
auto& element : *
m_data.m_value.array)
20714 element.m_parent =
this;
20719 case value_t::object:
20721 for (
auto& element : *
m_data.m_value.object)
20723 element.second.m_parent =
this;
20728 case value_t::null:
20729 case value_t::string:
20730 case value_t::boolean:
20731 case value_t::number_integer:
20732 case value_t::number_unsigned:
20733 case value_t::number_float:
20734 case value_t::binary:
20735 case value_t::discarded:
20744#if JSON_DIAGNOSTICS
20745 for (
typename iterator::difference_type i = 0; i < count_set_parents; ++i)
20747 (it + i)->m_parent =
this;
20750 static_cast<void>(count_set_parents);
20757#if JSON_DIAGNOSTICS
20772#ifdef JSON_HEDLEY_MSVC_VERSION
20773#pragma warning(push )
20774#pragma warning(disable : 4127)
20781#ifdef JSON_HEDLEY_MSVC_VERSION
20782#pragma warning( pop )
20787 static_cast<void>(j);
20788 static_cast<void>(old_capacity);
20833 template <
typename CompatibleType,
20838 JSONSerializer<U>::to_json(std::declval<basic_json_t&>(),
20839 std::forward<CompatibleType>(val))))
20841 JSONSerializer<U>::to_json(*
this, std::forward<CompatibleType>(val));
20848 template <
typename BasicJsonType,
20852#if JSON_DIAGNOSTIC_POSITIONS
20853 : start_position(val.start_pos()),
20854 end_position(val.end_pos())
20857 using other_boolean_t =
typename BasicJsonType::boolean_t;
20858 using other_number_float_t =
typename BasicJsonType::number_float_t;
20859 using other_number_integer_t =
typename BasicJsonType::number_integer_t;
20860 using other_number_unsigned_t =
typename BasicJsonType::number_unsigned_t;
20861 using other_string_t =
typename BasicJsonType::string_t;
20862 using other_object_t =
typename BasicJsonType::object_t;
20863 using other_array_t =
typename BasicJsonType::array_t;
20864 using other_binary_t =
typename BasicJsonType::binary_t;
20866 switch (val.type())
20868 case value_t::boolean:
20871 case value_t::number_float:
20874 case value_t::number_integer:
20877 case value_t::number_unsigned:
20880 case value_t::string:
20883 case value_t::object:
20886 case value_t::array:
20889 case value_t::binary:
20892 case value_t::null:
20895 case value_t::discarded:
20896 m_data.m_type = value_t::discarded;
20910 bool type_deduction =
true,
20911 value_t manual_type = value_t::array)
20915 bool is_an_object = std::all_of(init.begin(), init.end(),
20921 return element_ref->is_array() && element_ref->size() == 2 && (*element_ref)[static_cast<size_type>(0)].is_string();
20925 if (!type_deduction)
20928 if (manual_type == value_t::array)
20930 is_an_object =
false;
20943 m_data.m_type = value_t::object;
20944 m_data.m_value = value_t::object;
20946 for (
auto& element_ref : init)
20949 m_data.m_value.object->emplace(
20950 std::move(*((*element.m_data.m_value.array)[0].m_data.m_value.string)),
20951 std::move((*element.m_data.m_value.array)[1]));
20957 m_data.m_type = value_t::array;
20971 res.m_data.m_type = value_t::binary;
20972 res.m_data.m_value = init;
20979 static basic_json binary(
const typename binary_t::container_type& init,
typename binary_t::subtype_type subtype)
20982 res.m_data.m_type = value_t::binary;
20983 res.m_data.m_value =
binary_t(init, subtype);
20993 res.m_data.m_type = value_t::binary;
20994 res.m_data.m_value = std::move(init);
21001 static basic_json binary(
typename binary_t::container_type&& init,
typename binary_t::subtype_type subtype)
21004 res.m_data.m_type = value_t::binary;
21005 res.m_data.m_value =
binary_t(std::move(init), subtype);
21014 return basic_json(init,
false, value_t::array);
21022 return basic_json(init,
false, value_t::object);
21036 template <
class InputIT,
typename std::enable_if <
21037 std::is_same<InputIT, typename basic_json_t::iterator>::value ||
21038 std::is_same<InputIT, typename basic_json_t::const_iterator>::value,
int >::type = 0 >
21051 m_data.m_type = first.m_object->m_data.m_type;
21056 case value_t::boolean:
21057 case value_t::number_float:
21058 case value_t::number_integer:
21059 case value_t::number_unsigned:
21060 case value_t::string:
21063 || !last.m_it.primitive_iterator.is_end()))
21070 case value_t::null:
21071 case value_t::object:
21072 case value_t::array:
21073 case value_t::binary:
21074 case value_t::discarded:
21081 case value_t::number_integer:
21083 m_data.m_value.number_integer = first.m_object->m_data.m_value.number_integer;
21087 case value_t::number_unsigned:
21089 m_data.m_value.number_unsigned = first.m_object->m_data.m_value.number_unsigned;
21093 case value_t::number_float:
21095 m_data.m_value.number_float = first.m_object->m_data.m_value.number_float;
21099 case value_t::boolean:
21101 m_data.m_value.boolean = first.m_object->m_data.m_value.boolean;
21105 case value_t::string:
21107 m_data.m_value = *first.m_object->m_data.m_value.string;
21111 case value_t::object:
21114 last.m_it.object_iterator);
21118 case value_t::array:
21121 last.m_it.array_iterator);
21125 case value_t::binary:
21127 m_data.m_value = *first.m_object->m_data.m_value.binary;
21131 case value_t::null:
21132 case value_t::discarded:
21145 template<
typename JsonRef,
21147 std::is_same<typename JsonRef::value_type, basic_json>>::value,
int> = 0 >
21155 , start_position(other.start_position)
21156 , end_position(other.end_position)
21165 case value_t::object:
21167 m_data.m_value = *other.m_data.m_value.object;
21171 case value_t::array:
21173 m_data.m_value = *other.m_data.m_value.array;
21177 case value_t::string:
21179 m_data.m_value = *other.m_data.m_value.string;
21183 case value_t::boolean:
21185 m_data.m_value = other.m_data.m_value.boolean;
21189 case value_t::number_integer:
21191 m_data.m_value = other.m_data.m_value.number_integer;
21195 case value_t::number_unsigned:
21197 m_data.m_value = other.m_data.m_value.number_unsigned;
21201 case value_t::number_float:
21203 m_data.m_value = other.m_data.m_value.number_float;
21207 case value_t::binary:
21209 m_data.m_value = *other.m_data.m_value.binary;
21213 case value_t::null:
21214 case value_t::discarded:
21220 assert_invariant();
21227 m_data(std::move(other.m_data))
21228#if JSON_DIAGNOSTIC_POSITIONS
21229 , start_position(other.start_position)
21230 , end_position(other.end_position)
21234 other.assert_invariant(
false);
21237 other.m_data.m_type = value_t::null;
21238 other.m_data.m_value = {};
21240#if JSON_DIAGNOSTIC_POSITIONS
21241 other.start_position = std::string::npos;
21242 other.end_position = std::string::npos;
21252 std::is_nothrow_move_constructible<value_t>::value&&
21253 std::is_nothrow_move_assignable<value_t>::value&&
21254 std::is_nothrow_move_constructible<json_value>::value&&
21255 std::is_nothrow_move_assignable<json_value>::value&&
21256 std::is_nothrow_move_assignable<json_base_class_t>::value
21260 other.assert_invariant();
21266#if JSON_DIAGNOSTIC_POSITIONS
21267 swap(start_position, other.start_position);
21268 swap(end_position, other.end_position);
21271 json_base_class_t::operator=(std::move(other));
21299 const char indent_char =
' ',
21300 const bool ensure_ascii =
false,
21308 s.dump(*
this,
true, ensure_ascii,
static_cast<unsigned int>(indent));
21312 s.dump(*
this,
false, ensure_ascii, 0);
21343 return m_data.m_type == value_t::null;
21350 return m_data.m_type == value_t::boolean;
21364 return m_data.m_type == value_t::number_integer ||
m_data.m_type == value_t::number_unsigned;
21371 return m_data.m_type == value_t::number_unsigned;
21378 return m_data.m_type == value_t::number_float;
21385 return m_data.m_type == value_t::object;
21392 return m_data.m_type == value_t::array;
21399 return m_data.m_type == value_t::string;
21406 return m_data.m_type == value_t::binary;
21413 return m_data.m_type == value_t::discarded;
21435 return m_data.m_value.boolean;
21492 return m_data.m_type == value_t::number_integer ? &
m_data.m_value.number_integer :
nullptr;
21498 return m_data.m_type == value_t::number_integer ? &
m_data.m_value.number_integer :
nullptr;
21548 template<
typename ReferenceType,
typename ThisType>
21569 template<
typename PointerType,
typename std::enable_if<
21570 std::is_pointer<PointerType>::value,
int>::type = 0>
21574 return get_impl_ptr(
static_cast<PointerType
>(
nullptr));
21579 template <
typename PointerType,
typename std::enable_if <
21580 std::is_pointer<PointerType>::value&&
21581 std::is_const<typename std::remove_pointer<PointerType>::type>::value,
int >::type = 0 >
21585 return get_impl_ptr(
static_cast<PointerType
>(
nullptr));
21627 template <
typename ValueType,
21633 JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), std::declval<ValueType&>())))
21635 auto ret = ValueType();
21636 JSONSerializer<ValueType>::from_json(*
this, ret);
21670 template <
typename ValueType,
21675 JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>())))
21677 return JSONSerializer<ValueType>::from_json(*
this);
21695 template <
typename BasicJsonType,
21718 template<
typename BasicJsonType,
21720 std::is_same<BasicJsonType, basic_json_t>::value,
21731 template<
typename PointerType,
21733 std::is_pointer<PointerType>::value,
21766 template <
typename ValueTypeCV,
typename ValueType = detail::uncvref_t<ValueTypeCV>>
21767#if defined(JSON_HAS_CPP_14)
21777 static_assert(!std::is_reference<ValueTypeCV>::value,
21778 "get() cannot be used with reference types, you might want to use get_ref()");
21779 return get_impl<ValueType>(detail::priority_tag<4> {});
21809 template<
typename PointerType,
typename std::enable_if<
21810 std::is_pointer<PointerType>::value,
int>::type = 0>
21819 template <
typename ValueType,
21824 ValueType &
get_to(ValueType& v)
const noexcept(
noexcept(
21825 JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), v)))
21827 JSONSerializer<ValueType>::from_json(*
this, v);
21833 template<
typename ValueType,
21844 typename T, std::size_t N,
21845 typename Array = T (&)[N],
21849 noexcept(
noexcept(JSONSerializer<Array>::from_json(
21850 std::declval<const basic_json_t&>(), v)))
21852 JSONSerializer<Array>::from_json(*
this, v);
21858 template<
typename ReferenceType,
typename std::enable_if<
21859 std::is_reference<ReferenceType>::value,
int>::type = 0>
21868 template <
typename ReferenceType,
typename std::enable_if <
21869 std::is_reference<ReferenceType>::value&&
21870 std::is_const<typename std::remove_reference<ReferenceType>::type>::value,
int >::type = 0 >
21906 template <
typename ValueType,
typename std::enable_if <
21914#if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER <= 1914))
21917#if defined(JSON_HAS_CPP_17) && JSON_HAS_STATIC_RTTI
21921 >::value,
int >::type = 0 >
21994 return m_data.m_value.array->at(idx);
22018 auto it =
m_data.m_value.object->find(
key);
22019 if (it ==
m_data.m_value.object->end())
22038 auto it =
m_data.m_value.object->find(std::forward<KeyType>(
key));
22039 if (it ==
m_data.m_value.object->end())
22056 auto it =
m_data.m_value.object->find(
key);
22057 if (it ==
m_data.m_value.object->end())
22076 auto it =
m_data.m_value.object->find(std::forward<KeyType>(
key));
22077 if (it ==
m_data.m_value.object->end())
22091 m_data.m_type = value_t::array;
22100 if (idx >=
m_data.m_value.array->size())
22102#if JSON_DIAGNOSTICS
22104 const auto old_size =
m_data.m_value.array->size();
22105 const auto old_capacity =
m_data.m_value.array->capacity();
22107 m_data.m_value.array->resize(idx + 1);
22109#if JSON_DIAGNOSTICS
22118 set_parents(
begin() +
static_cast<typename iterator::difference_type
>(old_size),
static_cast<typename iterator::difference_type
>(idx + 1 - old_size));
22124 return m_data.m_value.array->operator[](idx);
22137 return m_data.m_value.array->operator[](idx);
22150 m_data.m_type = value_t::object;
22158 auto result =
m_data.m_value.object->emplace(std::move(
key),
nullptr);
22172 auto it =
m_data.m_value.object->find(
key);
22182 template<
typename T>
22188 template<
typename T>
22203 m_data.m_type = value_t::object;
22211 auto result =
m_data.m_value.object->emplace(std::forward<KeyType>(
key),
nullptr);
22227 auto it =
m_data.m_value.object->find(std::forward<KeyType>(
key));
22236 template<
typename KeyType>
22240 template<
typename ValueType>
22243 string_t,
typename std::decay<ValueType>::type >;
22251 && !std::is_same<value_t, detail::uncvref_t<ValueType>>
::value,
int > = 0 >
22252 ValueType
value(
const typename object_t::key_type&
key,
const ValueType& default_value)
const
22264 return default_value;
22272 template < class ValueType, class ReturnType = typename value_return_type<ValueType>::type,
22276 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value,
int > = 0 >
22277 ReturnType
value(
const typename object_t::key_type&
key, ValueType && default_value)
const
22289 return std::forward<ValueType>(default_value);
22300 && is_comparable_with_object_key<KeyType>::value
22302 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value,
int > = 0 >
22303 ValueType
value(KeyType &&
key,
const ValueType& default_value)
const
22309 const auto it =
find(std::forward<KeyType>(
key));
22315 return default_value;
22323 template < class ValueType, class KeyType, class ReturnType = typename value_return_type<ValueType>::type,
22327 && is_comparable_with_object_key<KeyType>::value
22329 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value,
int > = 0 >
22330 ReturnType
value(KeyType &&
key, ValueType && default_value)
const
22336 const auto it =
find(std::forward<KeyType>(
key));
22342 return std::forward<ValueType>(default_value);
22352 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value,
int > = 0 >
22365 return default_value;
22374 template < class ValueType, class ReturnType = typename value_return_type<ValueType>::type,
22377 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value,
int > = 0 >
22390 return std::forward<ValueType>(default_value);
22400 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value,
int > = 0 >
22402 ValueType
value(const ::nlohmann::
json_pointer<BasicJsonType>& ptr, const ValueType& default_value)
const
22404 return value(ptr.convert(), default_value);
22407 template < class ValueType, class BasicJsonType, class ReturnType = typename value_return_type<ValueType>::type,
22411 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value,
int > = 0 >
22415 return value(ptr.convert(), std::forward<ValueType>(default_value));
22453 std::is_same<IteratorType, typename basic_json_t::iterator>::value ||
22454 std::is_same<IteratorType, typename basic_json_t::const_iterator>::value,
int > = 0 >
22463 IteratorType result =
end();
22467 case value_t::boolean:
22468 case value_t::number_float:
22469 case value_t::number_integer:
22470 case value_t::number_unsigned:
22471 case value_t::string:
22472 case value_t::binary:
22481 AllocatorType<string_t> alloc;
22482 std::allocator_traits<
decltype(alloc)>
::destroy(alloc,
m_data.m_value.string);
22483 std::allocator_traits<
decltype(alloc)>::deallocate(alloc,
m_data.m_value.string, 1);
22484 m_data.m_value.string =
nullptr;
22488 AllocatorType<binary_t> alloc;
22489 std::allocator_traits<
decltype(alloc)>
::destroy(alloc,
m_data.m_value.binary);
22490 std::allocator_traits<
decltype(alloc)>::deallocate(alloc,
m_data.m_value.binary, 1);
22491 m_data.m_value.binary =
nullptr;
22494 m_data.m_type = value_t::null;
22499 case value_t::object:
22501 result.m_it.object_iterator =
m_data.m_value.object->erase(pos.m_it.object_iterator);
22505 case value_t::array:
22507 result.m_it.array_iterator =
m_data.m_value.array->erase(pos.m_it.array_iterator);
22511 case value_t::null:
22512 case value_t::discarded:
22523 std::is_same<IteratorType, typename basic_json_t::iterator>::value ||
22524 std::is_same<IteratorType, typename basic_json_t::const_iterator>::value,
int > = 0 >
22525 IteratorType
erase(IteratorType first, IteratorType last)
22533 IteratorType result =
end();
22537 case value_t::boolean:
22538 case value_t::number_float:
22539 case value_t::number_integer:
22540 case value_t::number_unsigned:
22541 case value_t::string:
22542 case value_t::binary:
22545 || !last.m_it.primitive_iterator.is_end()))
22552 AllocatorType<string_t> alloc;
22553 std::allocator_traits<
decltype(alloc)>
::destroy(alloc,
m_data.m_value.string);
22554 std::allocator_traits<
decltype(alloc)>::deallocate(alloc,
m_data.m_value.string, 1);
22555 m_data.m_value.string =
nullptr;
22559 AllocatorType<binary_t> alloc;
22560 std::allocator_traits<
decltype(alloc)>
::destroy(alloc,
m_data.m_value.binary);
22561 std::allocator_traits<
decltype(alloc)>::deallocate(alloc,
m_data.m_value.binary, 1);
22562 m_data.m_value.binary =
nullptr;
22565 m_data.m_type = value_t::null;
22570 case value_t::object:
22572 result.m_it.object_iterator =
m_data.m_value.object->erase(first.m_it.object_iterator,
22573 last.m_it.object_iterator);
22577 case value_t::array:
22579 result.m_it.array_iterator =
m_data.m_value.array->erase(first.m_it.array_iterator,
22580 last.m_it.array_iterator);
22584 case value_t::null:
22585 case value_t::discarded:
22604 return m_data.m_value.object->erase(std::forward<KeyType>(
key));
22617 const auto it =
m_data.m_value.object->find(std::forward<KeyType>(
key));
22618 if (it !=
m_data.m_value.object->end())
22620 m_data.m_value.object->erase(it);
22679 auto result =
end();
22683 result.m_it.object_iterator =
m_data.m_value.object->find(
key);
22693 auto result =
cend();
22697 result.m_it.object_iterator =
m_data.m_value.object->find(
key);
22709 auto result =
end();
22713 result.m_it.object_iterator =
m_data.m_value.object->find(std::forward<KeyType>(
key));
22725 auto result =
cend();
22729 result.m_it.object_iterator =
m_data.m_value.object->find(std::forward<KeyType>(
key));
22776 template<typename BasicJsonType, detail::enable_if_t<detail::is_basic_json<BasicJsonType>::value,
int> = 0>
22780 return ptr.contains(
this);
22797 result.set_begin();
22813 result.set_begin();
22893 return ref.items();
22904 return ref.items();
22936 case value_t::null:
22942 case value_t::array:
22945 return m_data.m_value.array->empty();
22948 case value_t::object:
22951 return m_data.m_value.object->empty();
22954 case value_t::string:
22955 case value_t::boolean:
22956 case value_t::number_integer:
22957 case value_t::number_unsigned:
22958 case value_t::number_float:
22959 case value_t::binary:
22960 case value_t::discarded:
22975 case value_t::null:
22981 case value_t::array:
22984 return m_data.m_value.array->size();
22987 case value_t::object:
22990 return m_data.m_value.object->size();
22993 case value_t::string:
22994 case value_t::boolean:
22995 case value_t::number_integer:
22996 case value_t::number_unsigned:
22997 case value_t::number_float:
22998 case value_t::binary:
22999 case value_t::discarded:
23014 case value_t::array:
23017 return m_data.m_value.array->max_size();
23020 case value_t::object:
23023 return m_data.m_value.object->max_size();
23026 case value_t::null:
23027 case value_t::string:
23028 case value_t::boolean:
23029 case value_t::number_integer:
23030 case value_t::number_unsigned:
23031 case value_t::number_float:
23032 case value_t::binary:
23033 case value_t::discarded:
23057 case value_t::number_integer:
23059 m_data.m_value.number_integer = 0;
23063 case value_t::number_unsigned:
23065 m_data.m_value.number_unsigned = 0;
23069 case value_t::number_float:
23071 m_data.m_value.number_float = 0.0;
23075 case value_t::boolean:
23077 m_data.m_value.boolean =
false;
23081 case value_t::string:
23083 m_data.m_value.string->clear();
23087 case value_t::binary:
23089 m_data.m_value.binary->clear();
23093 case value_t::array:
23095 m_data.m_value.array->clear();
23099 case value_t::object:
23101 m_data.m_value.object->clear();
23105 case value_t::null:
23106 case value_t::discarded:
23125 m_data.m_type = value_t::array;
23126 m_data.m_value = value_t::array;
23131 const auto old_capacity =
m_data.m_value.array->capacity();
23132 m_data.m_value.array->push_back(std::move(val));
23158 m_data.m_type = value_t::array;
23159 m_data.m_value = value_t::array;
23164 const auto old_capacity =
m_data.m_value.array->capacity();
23165 m_data.m_value.array->push_back(val);
23190 m_data.m_type = value_t::object;
23191 m_data.m_value = value_t::object;
23196 auto res =
m_data.m_value.object->insert(val);
23212 if (
is_object() && init.size() == 2 && (*init.begin())->is_string())
23215 push_back(
typename object_t::value_type(
23216 std::move(
key.get_ref<
string_t&>()), (init.begin() + 1)->moved_or_copied()));
23234 template<
class... Args>
23246 m_data.m_type = value_t::array;
23247 m_data.m_value = value_t::array;
23252 const auto old_capacity =
m_data.m_value.array->capacity();
23253 m_data.m_value.array->emplace_back(std::forward<Args>(args)...);
23259 template<
class... Args>
23271 m_data.m_type = value_t::object;
23272 m_data.m_value = value_t::object;
23277 auto res =
m_data.m_value.object->emplace(std::forward<Args>(args)...);
23282 it.m_it.object_iterator = res.first;
23285 return {it, res.second};
23291 template<
typename... Args>
23297 auto insert_pos = std::distance(
m_data.m_value.array->begin(), pos.m_it.array_iterator);
23298 m_data.m_value.array->insert(pos.m_it.array_iterator, std::forward<Args>(args)...);
23299 result.m_it.array_iterator =
m_data.m_value.array->begin() + insert_pos;
23333 return insert(pos, val);
23384 return insert_iterator(pos, first.m_it.array_iterator, last.m_it.array_iterator);
23429 m_data.m_value.object->insert(first.m_it.object_iterator, last.m_it.object_iterator);
23447 m_data.m_type = value_t::object;
23469 for (
auto it = first; it != last; ++it)
23471 if (merge_objects && it.value().is_object())
23473 auto it2 =
m_data.m_value.object->find(it.key());
23474 if (it2 !=
m_data.m_value.object->end())
23476 it2->second.update(it.value(),
true);
23480 m_data.m_value.object->operator[](it.key()) = it.value();
23481#if JSON_DIAGNOSTICS
23482 m_data.m_value.object->operator[](it.key()).m_parent =
this;
23490 std::is_nothrow_move_constructible<value_t>::value&&
23491 std::is_nothrow_move_assignable<value_t>::value&&
23492 std::is_nothrow_move_constructible<json_value>::value&&
23493 std::is_nothrow_move_assignable<json_value>::value
23500 other.set_parents();
23507 std::is_nothrow_move_constructible<value_t>::value&&
23508 std::is_nothrow_move_assignable<value_t>::value&&
23509 std::is_nothrow_move_constructible<json_value>::value&&
23510 std::is_nothrow_move_assignable<json_value>::value
23582 void swap(
typename binary_t::container_type& other)
23607#define JSON_IMPLEMENT_OPERATOR(op, null_result, unordered_result, default_result) \
23608 const auto lhs_type = lhs.type(); \
23609 const auto rhs_type = rhs.type(); \
23611 if (lhs_type == rhs_type) \
23613 switch (lhs_type) \
23615 case value_t::array: \
23616 return (*lhs.m_data.m_value.array) op (*rhs.m_data.m_value.array); \
23618 case value_t::object: \
23619 return (*lhs.m_data.m_value.object) op (*rhs.m_data.m_value.object); \
23621 case value_t::null: \
23622 return (null_result); \
23624 case value_t::string: \
23625 return (*lhs.m_data.m_value.string) op (*rhs.m_data.m_value.string); \
23627 case value_t::boolean: \
23628 return (lhs.m_data.m_value.boolean) op (rhs.m_data.m_value.boolean); \
23630 case value_t::number_integer: \
23631 return (lhs.m_data.m_value.number_integer) op (rhs.m_data.m_value.number_integer); \
23633 case value_t::number_unsigned: \
23634 return (lhs.m_data.m_value.number_unsigned) op (rhs.m_data.m_value.number_unsigned); \
23636 case value_t::number_float: \
23637 return (lhs.m_data.m_value.number_float) op (rhs.m_data.m_value.number_float); \
23639 case value_t::binary: \
23640 return (*lhs.m_data.m_value.binary) op (*rhs.m_data.m_value.binary); \
23642 case value_t::discarded: \
23644 return (unordered_result); \
23647 else if (lhs_type == value_t::number_integer && rhs_type == value_t::number_float) \
23649 return static_cast<number_float_t>(lhs.m_data.m_value.number_integer) op rhs.m_data.m_value.number_float; \
23651 else if (lhs_type == value_t::number_float && rhs_type == value_t::number_integer) \
23653 return lhs.m_data.m_value.number_float op static_cast<number_float_t>(rhs.m_data.m_value.number_integer); \
23655 else if (lhs_type == value_t::number_unsigned && rhs_type == value_t::number_float) \
23657 return static_cast<number_float_t>(lhs.m_data.m_value.number_unsigned) op rhs.m_data.m_value.number_float; \
23659 else if (lhs_type == value_t::number_float && rhs_type == value_t::number_unsigned) \
23661 return lhs.m_data.m_value.number_float op static_cast<number_float_t>(rhs.m_data.m_value.number_unsigned); \
23663 else if (lhs_type == value_t::number_unsigned && rhs_type == value_t::number_integer) \
23665 return static_cast<number_integer_t>(lhs.m_data.m_value.number_unsigned) op rhs.m_data.m_value.number_integer; \
23667 else if (lhs_type == value_t::number_integer && rhs_type == value_t::number_unsigned) \
23669 return lhs.m_data.m_value.number_integer op static_cast<number_integer_t>(rhs.m_data.m_value.number_unsigned); \
23671 else if(compares_unordered(lhs, rhs))\
23673 return (unordered_result);\
23676 return (default_result);
23687 || (
rhs.is_number_float() && std::isnan(
rhs.m_data.m_value.number_float) && lhs.
is_number()))
23691#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
23700 bool compares_unordered(const_reference rhs,
bool inverse =
false) const noexcept
23702 return compares_unordered(*
this, rhs, inverse);
23706#if JSON_HAS_THREE_WAY_COMPARISON
23709 bool operator==(const_reference rhs)
const noexcept
23712#pragma GCC diagnostic push
23713#pragma GCC diagnostic ignored "-Wfloat-equal"
23715 const_reference lhs = *
this;
23718#pragma GCC diagnostic pop
23724 template<
typename ScalarType>
23725 requires std::is_scalar_v<ScalarType>
23726 bool operator==(ScalarType rhs)
const noexcept
23728 return *
this == basic_json(rhs);
23733 bool operator!=(const_reference rhs)
const noexcept
23735 if (compares_unordered(rhs,
true))
23744 std::partial_ordering operator<=>(const_reference rhs)
const noexcept
23746 const_reference lhs = *
this;
23750 std::partial_ordering::equivalent,
23751 std::partial_ordering::unordered,
23752 lhs_type <=> rhs_type)
23757 template<
typename ScalarType>
23758 requires std::is_scalar_v<ScalarType>
23759 std::partial_ordering operator<=>(ScalarType rhs)
const noexcept
23761 return *this <=> basic_json(rhs);
23764#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
23771 bool operator<=(const_reference rhs)
const noexcept
23773 if (compares_unordered(rhs,
true))
23777 return !(rhs < *
this);
23782 template<
typename ScalarType>
23783 requires std::is_scalar_v<ScalarType>
23784 bool operator<=(ScalarType rhs)
const noexcept
23786 return *
this <= basic_json(rhs);
23792 bool operator>=(const_reference rhs)
const noexcept
23794 if (compares_unordered(rhs,
true))
23798 return !(*
this < rhs);
23803 template<
typename ScalarType>
23804 requires std::is_scalar_v<ScalarType>
23805 bool operator>=(ScalarType rhs)
const noexcept
23807 return *
this >= basic_json(rhs);
23813 friend bool operator==(const_reference lhs, const_reference rhs)
noexcept
23816#pragma GCC diagnostic push
23817#pragma GCC diagnostic ignored "-Wfloat-equal"
23821#pragma GCC diagnostic pop
23827 template<
typename ScalarType,
typename std::enable_if<
23828 std::is_scalar<ScalarType>::value,
int>::type = 0>
23829 friend bool operator==(const_reference lhs, ScalarType rhs)
noexcept
23831 return lhs == basic_json(rhs);
23836 template<
typename ScalarType,
typename std::enable_if<
23837 std::is_scalar<ScalarType>::value,
int>::type = 0>
23838 friend bool operator==(ScalarType lhs, const_reference rhs)
noexcept
23840 return basic_json(lhs) == rhs;
23845 friend bool operator!=(const_reference lhs, const_reference rhs)
noexcept
23847 if (compares_unordered(lhs, rhs,
true))
23851 return !(lhs == rhs);
23856 template<
typename ScalarType,
typename std::enable_if<
23857 std::is_scalar<ScalarType>::value,
int>::type = 0>
23858 friend bool operator!=(const_reference lhs, ScalarType rhs)
noexcept
23860 return lhs != basic_json(rhs);
23865 template<
typename ScalarType,
typename std::enable_if<
23866 std::is_scalar<ScalarType>::value,
int>::type = 0>
23867 friend bool operator!=(ScalarType lhs, const_reference rhs)
noexcept
23869 return basic_json(lhs) != rhs;
23874 friend bool operator<(const_reference lhs, const_reference rhs)
noexcept
23884 template<
typename ScalarType,
typename std::enable_if<
23885 std::is_scalar<ScalarType>::value,
int>::type = 0>
23886 friend bool operator<(const_reference lhs, ScalarType rhs)
noexcept
23888 return lhs < basic_json(rhs);
23893 template<
typename ScalarType,
typename std::enable_if<
23894 std::is_scalar<ScalarType>::value,
int>::type = 0>
23895 friend bool operator<(ScalarType lhs, const_reference rhs)
noexcept
23897 return basic_json(lhs) < rhs;
23902 friend bool operator<=(const_reference lhs, const_reference rhs)
noexcept
23904 if (compares_unordered(lhs, rhs,
true))
23908 return !(rhs < lhs);
23913 template<
typename ScalarType,
typename std::enable_if<
23914 std::is_scalar<ScalarType>::value,
int>::type = 0>
23915 friend bool operator<=(const_reference lhs, ScalarType rhs)
noexcept
23917 return lhs <= basic_json(rhs);
23922 template<
typename ScalarType,
typename std::enable_if<
23923 std::is_scalar<ScalarType>::value,
int>::type = 0>
23924 friend bool operator<=(ScalarType lhs, const_reference rhs)
noexcept
23926 return basic_json(lhs) <= rhs;
23931 friend bool operator>(const_reference lhs, const_reference rhs)
noexcept
23934 if (compares_unordered(lhs, rhs))
23938 return !(lhs <= rhs);
23943 template<
typename ScalarType,
typename std::enable_if<
23944 std::is_scalar<ScalarType>::value,
int>::type = 0>
23945 friend bool operator>(const_reference lhs, ScalarType rhs)
noexcept
23947 return lhs > basic_json(rhs);
23952 template<
typename ScalarType,
typename std::enable_if<
23953 std::is_scalar<ScalarType>::value,
int>::type = 0>
23954 friend bool operator>(ScalarType lhs, const_reference rhs)
noexcept
23956 return basic_json(lhs) > rhs;
23961 friend bool operator>=(const_reference lhs, const_reference rhs)
noexcept
23963 if (compares_unordered(lhs, rhs,
true))
23967 return !(lhs < rhs);
23972 template<
typename ScalarType,
typename std::enable_if<
23973 std::is_scalar<ScalarType>::value,
int>::type = 0>
23974 friend bool operator>=(const_reference lhs, ScalarType rhs)
noexcept
23976 return lhs >= basic_json(rhs);
23981 template<
typename ScalarType,
typename std::enable_if<
23982 std::is_scalar<ScalarType>::value,
int>::type = 0>
23983 friend bool operator>=(ScalarType lhs, const_reference rhs)
noexcept
23985 return basic_json(lhs) >= rhs;
23989#undef JSON_IMPLEMENT_OPERATOR
24002 friend std::ostream& operator<<(std::ostream& o,
const basic_json& j)
24005 const bool pretty_print = o.width() > 0;
24006 const auto indentation = pretty_print ? o.width() : 0;
24012 serializer s(detail::output_adapter<char>(o), o.fill());
24013 s.dump(j, pretty_print,
false,
static_cast<unsigned int>(indentation));
24024 friend std::ostream& operator>>(
const basic_json& j, std::ostream& o)
24040 template<
typename InputType>
24042 static basic_json parse(InputType&& i,
24043 parser_callback_t cb =
nullptr,
24044 const bool allow_exceptions =
true,
24045 const bool ignore_comments =
false)
24048 parser(
detail::input_adapter(std::forward<InputType>(i)), std::move(cb), allow_exceptions, ignore_comments).parse(
true, result);
24054 template<
typename IteratorType>
24056 static basic_json parse(IteratorType first,
24058 parser_callback_t cb =
nullptr,
24059 const bool allow_exceptions =
true,
24060 const bool ignore_comments =
false)
24063 parser(
detail::input_adapter(std::move(first), std::move(last)), std::move(cb), allow_exceptions, ignore_comments).parse(
true, result);
24069 static basic_json parse(detail::span_input_adapter&& i,
24070 parser_callback_t cb =
nullptr,
24071 const bool allow_exceptions =
true,
24072 const bool ignore_comments =
false)
24075 parser(i.get(), std::move(cb), allow_exceptions, ignore_comments).parse(
true, result);
24081 template<
typename InputType>
24082 static bool accept(InputType&& i,
24083 const bool ignore_comments =
false)
24085 return parser(
detail::input_adapter(std::forward<InputType>(i)),
nullptr,
false, ignore_comments).accept(
true);
24090 template<
typename IteratorType>
24091 static bool accept(IteratorType first, IteratorType last,
24092 const bool ignore_comments =
false)
24094 return parser(
detail::input_adapter(std::move(first), std::move(last)),
nullptr,
false, ignore_comments).accept(
true);
24099 static bool accept(detail::span_input_adapter&& i,
24100 const bool ignore_comments =
false)
24102 return parser(i.get(),
nullptr,
false, ignore_comments).accept(
true);
24107 template <
typename InputType,
typename SAX>
24111 const
bool strict = true,
24112 const
bool ignore_comments = false)
24115 return format == input_format_t::json
24116 ?
parser(std::move(ia),
nullptr,
true, ignore_comments).sax_parse(sax, strict)
24122 template<
class IteratorType,
class SAX>
24124 static
bool sax_parse(IteratorType first, IteratorType last, SAX* sax,
24126 const
bool strict = true,
24127 const
bool ignore_comments = false)
24130 return format == input_format_t::json
24131 ?
parser(std::move(ia),
nullptr,
true, ignore_comments).sax_parse(sax, strict)
24140 template <
typename SAX>
24145 const
bool strict = true,
24146 const
bool ignore_comments = false)
24149 return format == input_format_t::json
24151 ?
parser(std::move(ia),
nullptr,
true, ignore_comments).sax_parse(sax, strict)
24189 case value_t::null:
24191 case value_t::object:
24193 case value_t::array:
24195 case value_t::string:
24197 case value_t::boolean:
24199 case value_t::binary:
24201 case value_t::discarded:
24202 return "discarded";
24203 case value_t::number_integer:
24204 case value_t::number_unsigned:
24205 case value_t::number_float:
24219 value_t m_type = value_t::null;
24249#if JSON_DIAGNOSTICS
24254#if JSON_DIAGNOSTIC_POSITIONS
24256 std::size_t start_position = std::string::npos;
24258 std::size_t end_position = std::string::npos;
24260 constexpr std::size_t start_pos() const noexcept
24262 return start_position;
24265 constexpr std::size_t end_pos() const noexcept
24267 return end_position;
24283 std::vector<std::uint8_t> result;
24306 std::vector<std::uint8_t> result;
24328 const bool use_size =
false,
24329 const bool use_type =
false)
24331 std::vector<std::uint8_t> result;
24332 to_ubjson(j, result, use_size, use_type);
24339 const bool use_size =
false,
const bool use_type =
false)
24347 const bool use_size =
false,
const bool use_type =
false)
24355 const bool use_size =
false,
24356 const bool use_type =
false,
24359 std::vector<std::uint8_t> result;
24360 to_bjdata(j, result, use_size, use_type, version);
24367 const bool use_size =
false,
const bool use_type =
false,
24376 const bool use_size =
false,
const bool use_type =
false,
24386 std::vector<std::uint8_t> result;
24407 template<
typename InputType>
24410 const bool strict =
true,
24411 const bool allow_exceptions =
true,
24417 const bool res =
binary_reader<decltype(ia)>(std::move(ia), input_format_t::cbor).sax_parse(input_format_t::cbor, &sdp, strict, tag_handler);
24418 return res ? result :
basic_json(value_t::discarded);
24423 template<
typename IteratorType>
24426 const bool strict =
true,
24427 const bool allow_exceptions =
true,
24433 const bool res =
binary_reader<decltype(ia)>(std::move(ia), input_format_t::cbor).sax_parse(input_format_t::cbor, &sdp, strict, tag_handler);
24434 return res ? result :
basic_json(value_t::discarded);
24437 template<
typename T>
24441 const
bool strict = true,
24442 const
bool allow_exceptions = true,
24445 return from_cbor(ptr, ptr + len, strict, allow_exceptions, tag_handler);
24451 const
bool strict = true,
24452 const
bool allow_exceptions = true,
24459 const bool res =
binary_reader<decltype(ia)>(std::move(ia), input_format_t::cbor).sax_parse(input_format_t::cbor, &sdp, strict, tag_handler);
24460 return res ? result :
basic_json(value_t::discarded);
24465 template<
typename InputType>
24468 const bool strict =
true,
24469 const bool allow_exceptions =
true)
24474 const bool res =
binary_reader<decltype(ia)>(std::move(ia), input_format_t::msgpack).sax_parse(input_format_t::msgpack, &sdp, strict);
24475 return res ? result :
basic_json(value_t::discarded);
24480 template<
typename IteratorType>
24483 const bool strict =
true,
24484 const bool allow_exceptions =
true)
24489 const bool res =
binary_reader<decltype(ia)>(std::move(ia), input_format_t::msgpack).sax_parse(input_format_t::msgpack, &sdp, strict);
24490 return res ? result :
basic_json(value_t::discarded);
24493 template<
typename T>
24497 const
bool strict = true,
24498 const
bool allow_exceptions = true)
24500 return from_msgpack(ptr, ptr + len, strict, allow_exceptions);
24506 const
bool strict = true,
24507 const
bool allow_exceptions = true)
24513 const bool res =
binary_reader<decltype(ia)>(std::move(ia), input_format_t::msgpack).sax_parse(input_format_t::msgpack, &sdp, strict);
24514 return res ? result :
basic_json(value_t::discarded);
24519 template<
typename InputType>
24522 const bool strict =
true,
24523 const bool allow_exceptions =
true)
24528 const bool res =
binary_reader<decltype(ia)>(std::move(ia), input_format_t::ubjson).sax_parse(input_format_t::ubjson, &sdp, strict);
24529 return res ? result :
basic_json(value_t::discarded);
24534 template<
typename IteratorType>
24537 const bool strict =
true,
24538 const bool allow_exceptions =
true)
24543 const bool res =
binary_reader<decltype(ia)>(std::move(ia), input_format_t::ubjson).sax_parse(input_format_t::ubjson, &sdp, strict);
24544 return res ? result :
basic_json(value_t::discarded);
24547 template<
typename T>
24551 const
bool strict = true,
24552 const
bool allow_exceptions = true)
24554 return from_ubjson(ptr, ptr + len, strict, allow_exceptions);
24560 const
bool strict = true,
24561 const
bool allow_exceptions = true)
24567 const bool res =
binary_reader<decltype(ia)>(std::move(ia), input_format_t::ubjson).sax_parse(input_format_t::ubjson, &sdp, strict);
24568 return res ? result :
basic_json(value_t::discarded);
24573 template<
typename InputType>
24576 const bool strict =
true,
24577 const bool allow_exceptions =
true)
24582 const bool res =
binary_reader<decltype(ia)>(std::move(ia), input_format_t::bjdata).sax_parse(input_format_t::bjdata, &sdp, strict);
24583 return res ? result :
basic_json(value_t::discarded);
24588 template<
typename IteratorType>
24591 const bool strict =
true,
24592 const bool allow_exceptions =
true)
24597 const bool res =
binary_reader<decltype(ia)>(std::move(ia), input_format_t::bjdata).sax_parse(input_format_t::bjdata, &sdp, strict);
24598 return res ? result :
basic_json(value_t::discarded);
24603 template<
typename InputType>
24606 const bool strict =
true,
24607 const bool allow_exceptions =
true)
24613 return res ? result :
basic_json(value_t::discarded);
24618 template<
typename IteratorType>
24621 const bool strict =
true,
24622 const bool allow_exceptions =
true)
24628 return res ? result :
basic_json(value_t::discarded);
24631 template<
typename T>
24635 const
bool strict = true,
24636 const
bool allow_exceptions = true)
24638 return from_bson(ptr, ptr + len, strict, allow_exceptions);
24644 const
bool strict = true,
24645 const
bool allow_exceptions = true)
24652 return res ? result :
basic_json(value_t::discarded);
24670 template<typename BasicJsonType, detail::enable_if_t<detail::is_basic_json<BasicJsonType>::value,
int> = 0>
24674 return ptr.get_unchecked(
this);
24684 template<typename BasicJsonType, detail::enable_if_t<detail::is_basic_json<BasicJsonType>::value,
int> = 0>
24688 return ptr.get_unchecked(
this);
24698 template<typename BasicJsonType, detail::enable_if_t<detail::is_basic_json<BasicJsonType>::value,
int> = 0>
24702 return ptr.get_checked(
this);
24712 template<typename BasicJsonType, detail::enable_if_t<detail::is_basic_json<BasicJsonType>::value,
int> = 0>
24716 return ptr.get_checked(
this);
24750 enum class patch_operations {add, remove, replace, move, copy, test, invalid};
24752 const auto get_op = [](
const string_t& op)
24756 return patch_operations::add;
24758 if (op ==
"remove")
24760 return patch_operations::remove;
24762 if (op ==
"replace")
24764 return patch_operations::replace;
24768 return patch_operations::move;
24772 return patch_operations::copy;
24776 return patch_operations::test;
24779 return patch_operations::invalid;
24794 if (top_pointer != ptr)
24796 result.
at(top_pointer);
24800 const auto last_path = ptr.
back();
24805 switch (parent.
m_data.m_type)
24807 case value_t::null:
24808 case value_t::object:
24811 parent[last_path] = val;
24815 case value_t::array:
24817 if (last_path ==
"-")
24824 const auto idx = json_pointer::template array_index<basic_json_t>(last_path);
24838 case value_t::string:
24839 case value_t::boolean:
24840 case value_t::number_integer:
24841 case value_t::number_unsigned:
24842 case value_t::number_float:
24843 case value_t::binary:
24844 case value_t::discarded:
24851 const auto operation_remove = [
this, & result](
json_pointer & ptr)
24854 const auto last_path = ptr.
back();
24862 auto it = parent.
find(last_path);
24875 parent.
erase(json_pointer::template array_index<basic_json_t>(last_path));
24886 for (
const auto& val : json_patch)
24889 const auto get_value = [&val](
const string_t& op,
24894 auto it = val.m_data.m_value.object->find(member);
24897 const auto error_msg = (op ==
"op") ?
"operation" :
detail::concat(
"operation '", op,
'\'');
24924 const auto op = get_value(
"op",
"op",
true).template
get<string_t>();
24925 const auto path = get_value(op,
"path",
true).template
get<string_t>();
24928 switch (get_op(op))
24930 case patch_operations::add:
24932 operation_add(ptr, get_value(
"add",
"value",
false));
24936 case patch_operations::remove:
24938 operation_remove(ptr);
24942 case patch_operations::replace:
24945 result.
at(ptr) = get_value(
"replace",
"value",
false);
24949 case patch_operations::move:
24951 const auto from_path = get_value(
"move",
"from",
true).template
get<string_t>();
24961 operation_remove(from_ptr);
24962 operation_add(ptr, v);
24966 case patch_operations::copy:
24968 const auto from_path = get_value(
"copy",
"from",
true).template
get<string_t>();
24977 operation_add(ptr, v);
24981 case patch_operations::test:
24983 bool success =
false;
24988 success = (result.
at(ptr) == get_value(
"test",
"value",
false));
25004 case patch_operations::invalid:
25034 if (source == target)
25039 if (source.
type() != target.
type())
25044 {
"op",
"replace"}, {
"path", path}, {
"value", target}
25049 switch (source.
type())
25051 case value_t::array:
25055 while (i < source.
size() && i < target.
size())
25059 result.
insert(result.
end(), temp_diff.begin(), temp_diff.end());
25068 while (i < source.
size())
25072 result.
insert(result.
begin() + end_index,
object(
25075 {
"path", detail::concat<string_t>(path,
'/', detail::to_string<string_t>(i))}
25081 while (i < target.
size())
25087 {
"value", target[i]}
25095 case value_t::object:
25098 for (
auto it = source.
cbegin(); it != source.
cend(); ++it)
25103 if (target.
find(it.key()) != target.
end())
25106 auto temp_diff =
diff(it.value(), target[it.key()], path_key);
25107 result.
insert(result.
end(), temp_diff.begin(), temp_diff.end());
25114 {
"op",
"remove"}, {
"path", path_key}
25120 for (
auto it = target.
cbegin(); it != target.
cend(); ++it)
25122 if (source.
find(it.key()) == source.
end())
25128 {
"op",
"add"}, {
"path", path_key},
25129 {
"value", it.value()}
25137 case value_t::null:
25138 case value_t::string:
25139 case value_t::boolean:
25140 case value_t::number_integer:
25141 case value_t::number_unsigned:
25142 case value_t::number_float:
25143 case value_t::binary:
25144 case value_t::discarded:
25150 {
"op",
"replace"}, {
"path", path}, {
"value", target}
25177 for (
auto it = apply_patch.
begin(); it != apply_patch.
end(); ++it)
25179 if (it.value().is_null())
25185 operator[](it.key()).merge_patch(it.value());
25191 *
this = apply_patch;
25214#if !defined(JSON_HEDLEY_GCC_VERSION) || JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0)
25215 inline nlohmann::json
operator ""_json(
const char* s, std::size_t n)
25217 inline nlohmann::json
operator "" _json(
const char* s, std::size_t n)
25220 return nlohmann::json::parse(s, s + n);
25226#if !defined(JSON_HEDLEY_GCC_VERSION) || JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0)
25227 inline nlohmann::json::json_pointer
operator ""_json_pointer(
const char* s, std::size_t n)
25229 inline nlohmann::json::json_pointer
operator "" _json_pointer(
const char* s, std::size_t n)
25232 return nlohmann::json::json_pointer(std::string(s, n));
25251 std::size_t
operator()(
const nlohmann::NLOHMANN_BASIC_JSON_TPL& j)
const
25253 return nlohmann::detail::hash(j);
25259struct less< ::nlohmann::detail::value_t>
25266 ::nlohmann::detail::value_t rhs)
const noexcept
25268#if JSON_HAS_THREE_WAY_COMPARISON
25269 return std::is_lt(lhs <=> rhs);
25271 return ::nlohmann::detail::operator<(lhs, rhs);
25277#ifndef JSON_HAS_CPP_20
25282inline void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL& j1, nlohmann::NLOHMANN_BASIC_JSON_TPL& j2)
noexcept(
25283 is_nothrow_move_constructible<nlohmann::NLOHMANN_BASIC_JSON_TPL>::value&&
25284 is_nothrow_move_assignable<nlohmann::NLOHMANN_BASIC_JSON_TPL>::value)
25293#if JSON_USE_GLOBAL_UDLS
25294 #if !defined(JSON_HEDLEY_GCC_VERSION) || JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0)
25295 using nlohmann::literals::json_literals::operator
""_json;
25296 using nlohmann::literals::json_literals::operator
""_json_pointer;
25298 using nlohmann::literals::json_literals::operator
"" _json;
25299 using nlohmann::literals::json_literals::operator
"" _json_pointer;
25315#if defined(__clang__)
25316 #pragma clang diagnostic pop
25321#undef JSON_INTERNAL_CATCH
25323#undef JSON_PRIVATE_UNLESS_TESTED
25324#undef NLOHMANN_BASIC_JSON_TPL_DECLARATION
25325#undef NLOHMANN_BASIC_JSON_TPL
25326#undef JSON_EXPLICIT
25327#undef NLOHMANN_CAN_CALL_STD_FUNC_IMPL
25328#undef JSON_INLINE_VARIABLE
25329#undef JSON_NO_UNIQUE_ADDRESS
25330#undef JSON_DISABLE_ENUM_SERIALIZATION
25331#undef JSON_USE_GLOBAL_UDLS
25333#ifndef JSON_TEST_KEEP_MACROS
25336 #undef JSON_HAS_CPP_11
25337 #undef JSON_HAS_CPP_14
25338 #undef JSON_HAS_CPP_17
25339 #undef JSON_HAS_CPP_20
25340 #undef JSON_HAS_FILESYSTEM
25341 #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM
25342 #undef JSON_HAS_THREE_WAY_COMPARISON
25343 #undef JSON_HAS_RANGES
25344 #undef JSON_HAS_STATIC_RTTI
25345 #undef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
25359#undef JSON_HEDLEY_ALWAYS_INLINE
25360#undef JSON_HEDLEY_ARM_VERSION
25361#undef JSON_HEDLEY_ARM_VERSION_CHECK
25362#undef JSON_HEDLEY_ARRAY_PARAM
25363#undef JSON_HEDLEY_ASSUME
25364#undef JSON_HEDLEY_BEGIN_C_DECLS
25365#undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE
25366#undef JSON_HEDLEY_CLANG_HAS_BUILTIN
25367#undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE
25368#undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE
25369#undef JSON_HEDLEY_CLANG_HAS_EXTENSION
25370#undef JSON_HEDLEY_CLANG_HAS_FEATURE
25371#undef JSON_HEDLEY_CLANG_HAS_WARNING
25372#undef JSON_HEDLEY_COMPCERT_VERSION
25373#undef JSON_HEDLEY_COMPCERT_VERSION_CHECK
25374#undef JSON_HEDLEY_CONCAT
25375#undef JSON_HEDLEY_CONCAT3
25376#undef JSON_HEDLEY_CONCAT3_EX
25377#undef JSON_HEDLEY_CONCAT_EX
25378#undef JSON_HEDLEY_CONST
25379#undef JSON_HEDLEY_CONSTEXPR
25380#undef JSON_HEDLEY_CONST_CAST
25381#undef JSON_HEDLEY_CPP_CAST
25382#undef JSON_HEDLEY_CRAY_VERSION
25383#undef JSON_HEDLEY_CRAY_VERSION_CHECK
25384#undef JSON_HEDLEY_C_DECL
25385#undef JSON_HEDLEY_DEPRECATED
25386#undef JSON_HEDLEY_DEPRECATED_FOR
25387#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
25388#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_
25389#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
25390#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES
25391#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
25392#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION
25393#undef JSON_HEDLEY_DIAGNOSTIC_POP
25394#undef JSON_HEDLEY_DIAGNOSTIC_PUSH
25395#undef JSON_HEDLEY_DMC_VERSION
25396#undef JSON_HEDLEY_DMC_VERSION_CHECK
25397#undef JSON_HEDLEY_EMPTY_BASES
25398#undef JSON_HEDLEY_EMSCRIPTEN_VERSION
25399#undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK
25400#undef JSON_HEDLEY_END_C_DECLS
25401#undef JSON_HEDLEY_FLAGS
25402#undef JSON_HEDLEY_FLAGS_CAST
25403#undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE
25404#undef JSON_HEDLEY_GCC_HAS_BUILTIN
25405#undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE
25406#undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE
25407#undef JSON_HEDLEY_GCC_HAS_EXTENSION
25408#undef JSON_HEDLEY_GCC_HAS_FEATURE
25409#undef JSON_HEDLEY_GCC_HAS_WARNING
25410#undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK
25411#undef JSON_HEDLEY_GCC_VERSION
25412#undef JSON_HEDLEY_GCC_VERSION_CHECK
25413#undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE
25414#undef JSON_HEDLEY_GNUC_HAS_BUILTIN
25415#undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE
25416#undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE
25417#undef JSON_HEDLEY_GNUC_HAS_EXTENSION
25418#undef JSON_HEDLEY_GNUC_HAS_FEATURE
25419#undef JSON_HEDLEY_GNUC_HAS_WARNING
25420#undef JSON_HEDLEY_GNUC_VERSION
25421#undef JSON_HEDLEY_GNUC_VERSION_CHECK
25422#undef JSON_HEDLEY_HAS_ATTRIBUTE
25423#undef JSON_HEDLEY_HAS_BUILTIN
25424#undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE
25425#undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS
25426#undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE
25427#undef JSON_HEDLEY_HAS_EXTENSION
25428#undef JSON_HEDLEY_HAS_FEATURE
25429#undef JSON_HEDLEY_HAS_WARNING
25430#undef JSON_HEDLEY_IAR_VERSION
25431#undef JSON_HEDLEY_IAR_VERSION_CHECK
25432#undef JSON_HEDLEY_IBM_VERSION
25433#undef JSON_HEDLEY_IBM_VERSION_CHECK
25434#undef JSON_HEDLEY_IMPORT
25435#undef JSON_HEDLEY_INLINE
25436#undef JSON_HEDLEY_INTEL_CL_VERSION
25437#undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK
25438#undef JSON_HEDLEY_INTEL_VERSION
25439#undef JSON_HEDLEY_INTEL_VERSION_CHECK
25440#undef JSON_HEDLEY_IS_CONSTANT
25441#undef JSON_HEDLEY_IS_CONSTEXPR_
25442#undef JSON_HEDLEY_LIKELY
25443#undef JSON_HEDLEY_MALLOC
25444#undef JSON_HEDLEY_MCST_LCC_VERSION
25445#undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK
25446#undef JSON_HEDLEY_MESSAGE
25447#undef JSON_HEDLEY_MSVC_VERSION
25448#undef JSON_HEDLEY_MSVC_VERSION_CHECK
25449#undef JSON_HEDLEY_NEVER_INLINE
25450#undef JSON_HEDLEY_NON_NULL
25451#undef JSON_HEDLEY_NO_ESCAPE
25452#undef JSON_HEDLEY_NO_RETURN
25453#undef JSON_HEDLEY_NO_THROW
25454#undef JSON_HEDLEY_NULL
25455#undef JSON_HEDLEY_PELLES_VERSION
25456#undef JSON_HEDLEY_PELLES_VERSION_CHECK
25457#undef JSON_HEDLEY_PGI_VERSION
25458#undef JSON_HEDLEY_PGI_VERSION_CHECK
25459#undef JSON_HEDLEY_PREDICT
25460#undef JSON_HEDLEY_PRINTF_FORMAT
25461#undef JSON_HEDLEY_PRIVATE
25462#undef JSON_HEDLEY_PUBLIC
25463#undef JSON_HEDLEY_PURE
25464#undef JSON_HEDLEY_REINTERPRET_CAST
25465#undef JSON_HEDLEY_REQUIRE
25466#undef JSON_HEDLEY_REQUIRE_CONSTEXPR
25467#undef JSON_HEDLEY_REQUIRE_MSG
25468#undef JSON_HEDLEY_RESTRICT
25469#undef JSON_HEDLEY_RETURNS_NON_NULL
25470#undef JSON_HEDLEY_SENTINEL
25471#undef JSON_HEDLEY_STATIC_ASSERT
25472#undef JSON_HEDLEY_STATIC_CAST
25473#undef JSON_HEDLEY_STRINGIFY
25474#undef JSON_HEDLEY_STRINGIFY_EX
25475#undef JSON_HEDLEY_SUNPRO_VERSION
25476#undef JSON_HEDLEY_SUNPRO_VERSION_CHECK
25477#undef JSON_HEDLEY_TINYC_VERSION
25478#undef JSON_HEDLEY_TINYC_VERSION_CHECK
25479#undef JSON_HEDLEY_TI_ARMCL_VERSION
25480#undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK
25481#undef JSON_HEDLEY_TI_CL2000_VERSION
25482#undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK
25483#undef JSON_HEDLEY_TI_CL430_VERSION
25484#undef JSON_HEDLEY_TI_CL430_VERSION_CHECK
25485#undef JSON_HEDLEY_TI_CL6X_VERSION
25486#undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK
25487#undef JSON_HEDLEY_TI_CL7X_VERSION
25488#undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK
25489#undef JSON_HEDLEY_TI_CLPRU_VERSION
25490#undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK
25491#undef JSON_HEDLEY_TI_VERSION
25492#undef JSON_HEDLEY_TI_VERSION_CHECK
25493#undef JSON_HEDLEY_UNAVAILABLE
25494#undef JSON_HEDLEY_UNLIKELY
25495#undef JSON_HEDLEY_UNPREDICTABLE
25496#undef JSON_HEDLEY_UNREACHABLE
25497#undef JSON_HEDLEY_UNREACHABLE_RETURN
25498#undef JSON_HEDLEY_VERSION
25499#undef JSON_HEDLEY_VERSION_DECODE_MAJOR
25500#undef JSON_HEDLEY_VERSION_DECODE_MINOR
25501#undef JSON_HEDLEY_VERSION_DECODE_REVISION
25502#undef JSON_HEDLEY_VERSION_ENCODE
25503#undef JSON_HEDLEY_WARNING
25504#undef JSON_HEDLEY_WARN_UNUSED_RESULT
25505#undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG
25506#undef JSON_HEDLEY_FALL_THROUGH
namespace for Niels Lohmann
Definition json.hpp:20099
constexpr bool is_string() const noexcept
Definition json.hpp:21397
number_integer_t * get_impl_ptr(number_integer_t *) noexcept
get a pointer to the value (integer number)
Definition json.hpp:21490
size_type erase(const typename object_t::key_type &key)
remove element from a JSON object given a key
Definition json.hpp:22630
detail::cbor_tag_handler_t cbor_tag_handler_t
Definition json.hpp:20172
reference operator[](KeyType &&key)
access specified object element
Definition json.hpp:22198
json_value(object_t &&value)
constructor for rvalue objects
Definition json.hpp:20536
size_type size() const noexcept
Definition json.hpp:22971
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:24425
json_value(typename binary_t::container_type &&value)
constructor for rvalue binary arrays
Definition json.hpp:20548
number_unsigned_t number_unsigned
Definition json.hpp:20440
auto get() const noexcept(noexcept(std::declval< const basic_json_t & >().template get_impl< ValueType >(detail::priority_tag< 4 > {}))) -> decltype(std::declval< const basic_json_t & >().template get_impl< ValueType >(detail::priority_tag< 4 > {}))
Definition json.hpp:21770
::nlohmann::detail::iteration_proxy< Iterator > iteration_proxy
Definition json.hpp:20150
const_iterator end() const noexcept
returns an iterator to one past the last element
Definition json.hpp:22828
reference back()
access the last element
Definition json.hpp:22434
basic_json value_type
Definition json.hpp:20209
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 from compatible types
Definition json.hpp:20837
detail::parse_error parse_error
Definition json.hpp:20191
number_float_t number_float
Definition json.hpp:20442
reverse_iterator rbegin() noexcept
returns an iterator to the reverse-beginning
Definition json.hpp:22844
detail::input_format_t input_format_t
Definition json.hpp:20178
basic_json patch(const basic_json &json_patch) const
applies a JSON patch to a copy of the current object
Definition json.hpp:25017
json_value(const array_t &value)
constructor for arrays
Definition json.hpp:20539
array_t * get_impl_ptr(array_t *) noexcept
get a pointer to the value (array)
Definition json.hpp:21454
JSON_HEDLEY_RETURNS_NON_NULL const char * type_name() const noexcept
Definition json.hpp:24185
const_reference front() const
access the first element
Definition json.hpp:22427
constexpr bool is_array() const noexcept
return whether value is an array
Definition json.hpp:21390
number_float_t * get_impl_ptr(number_float_t *) noexcept
get a pointer to the value (floating-point number)
Definition json.hpp:21514
std::conditional< detail::is_c_string_uncvref< ValueType >::value, string_t, typename std::decay< ValueType >::type > value_return_type
Definition json.hpp:22241
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 &&//NOLINT(cppcoreguidelines-noexcept-swap, performance-noexcept-swap) std::is_nothrow_move_assignable< json_value >::value)
Definition json.hpp:23489
ReturnType value(const json_pointer &ptr, ValueType &&default_value) const
access specified object element via JSON Pointer with default value
Definition json.hpp:22378
size_type count(KeyType &&key) const
returns the number of occurrences of a key in a JSON object
Definition json.hpp:22747
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:21496
iter_impl< const basic_json > const_iterator
Definition json.hpp:20232
constexpr bool is_number_integer() const noexcept
Definition json.hpp:21362
json_reverse_iterator< typename basic_json::const_iterator > const_reverse_iterator
Definition json.hpp:20236
data(size_type cnt, const basic_json &val)
Definition json.hpp:24229
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:24620
::nlohmann::detail::json_base_class< void > json_base_class_t
Definition json.hpp:20125
basic_json get_impl(detail::priority_tag< 3 >) const
get special-case overload
Definition json.hpp:21722
reference operator[](const json_pointer &ptr)
access specified element via JSON Pointer
Definition json.hpp:24665
typename std::allocator_traits< allocator_type >::const_pointer const_pointer
Definition json.hpp:20227
static JSON_HEDLEY_RETURNS_NON_NULL T * create(Args &&... args)
helper for exception-safe object creation
Definition json.hpp:20380
std::size_t size_type
Definition json.hpp:20219
detail::type_error type_error
Definition json.hpp:20193
constexpr bool is_structured() const noexcept
Definition json.hpp:21334
json_value(boolean_t v) noexcept
constructor for booleans
Definition json.hpp:20447
const_reference operator[](KeyType &&key) const
access specified object element
Definition json.hpp:22222
detail::error_handler_t error_handler_t
Definition json.hpp:20170
boolean_t get_impl(boolean_t *) const
get a boolean (explicit)
Definition json.hpp:21431
const value_type & const_reference
Definition json.hpp:20214
detail::invalid_iterator invalid_iterator
Definition json.hpp:20192
void swap(binary_t &other)
exchanges the values
Definition json.hpp:23566
ReferenceType get_ref()
Definition json.hpp:21860
size_type max_size() const noexcept
returns the maximum possible number of elements
Definition json.hpp:23010
void update(const_reference j, bool merge_objects=false)
updates a JSON object from another object, overwriting existing keys
Definition json.hpp:23435
::nlohmann::detail::iter_impl< BasicJsonType > iter_impl
Definition json.hpp:20148
ReferenceType get_ref() const
get a reference value (implicit)
Definition json.hpp:21871
constexpr bool is_discarded() const noexcept
return whether value is discarded
Definition json.hpp:21411
JSON_PRIVATE_UNLESS_TESTED const_reference rhs
Definition json.hpp:23684
reference operator+=(initializer_list_t init)
add an object to an object
Definition json.hpp:23226
::nlohmann::detail::output_adapter_t< CharType > output_adapter_t
Definition json.hpp:20154
void push_back(basic_json &&val)
add an object to an array
Definition json.hpp:23114
const_reference operator[](const typename object_t::key_type &key) const
access specified object element
Definition json.hpp:22167
iteration_proxy< const_iterator > items() const noexcept
helper to access iterator member functions in range-based for
Definition json.hpp:22916
json_value(number_integer_t v) noexcept
constructor for numbers (integer)
Definition json.hpp:20449
static ReferenceType get_ref_impl(ThisType &obj)
helper function to implement get_ref()
Definition json.hpp:21549
::nlohmann::detail::json_reverse_iterator< Base > json_reverse_iterator
Definition json.hpp:20151
const_reference back() const
access the last element
Definition json.hpp:22443
IteratorType erase(IteratorType first, IteratorType last)
remove elements given an iterator range
Definition json.hpp:22525
reference operator+=(const basic_json &val)
add an object to an array
Definition json.hpp:23171
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 &&//NOLINT(cppcoreguidelines-noexcept-swap, performance-noexcept-swap) std::is_nothrow_move_assignable< json_value >::value)
exchanges the values
Definition json.hpp:23506
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:24521
constexpr const string_t * get_impl_ptr(const string_t *) const noexcept
get a pointer to the value (string)
Definition json.hpp:21472
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json binary(const typename binary_t::container_type &init, typename binary_t::subtype_type subtype)
explicitly create a binary array (with subtype)
Definition json.hpp:20979
iterator insert(const_iterator pos, size_type cnt, const basic_json &val)
inserts copies of element into array
Definition json.hpp:23338
object_t * get_impl_ptr(object_t *) noexcept
get a pointer to the value (object)
Definition json.hpp:21442
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:24605
static allocator_type get_allocator()
returns the allocator associated with the container
Definition json.hpp:20242
nlohmann::byte_container_with_subtype< std::vector< std::uint8_t > > binary_t
Definition json.hpp:20367
reference at(KeyType &&key)
access specified object element with bounds checking
Definition json.hpp:22030
iterator end() noexcept
Definition json.hpp:22819
constexpr bool is_number_unsigned() const noexcept
return whether value is an unsigned integer number
Definition json.hpp:21369
json_value(array_t &&value)
constructor for rvalue arrays
Definition json.hpp:20542
void update(const_iterator first, const_iterator last, bool merge_objects=false)
updates a JSON object from another object, overwriting existing keys
Definition json.hpp:23442
static std::vector< std::uint8_t > to_bson(const basic_json &j)
create a BSON serialization of a given JSON value
Definition json.hpp:24384
detail::exception exception
Definition json.hpp:20190
const_reverse_iterator rbegin() const noexcept
returns an iterator to the reverse-beginning
Definition json.hpp:22851
data m_data
Definition json.hpp:24247
void push_back(initializer_list_t init)
add an object to an object
Definition json.hpp:23210
detail::parser_callback_t< basic_json > parser_callback_t
Definition json.hpp:20804
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json object(initializer_list_t init={})
Definition json.hpp:21020
ValueType & get_to(ValueType &v) const
Definition json.hpp:21837
static void to_msgpack(const basic_json &j, detail::output_adapter< char > o)
create a MessagePack serialization of a given JSON value
Definition json.hpp:24320
iterator begin() noexcept
Definition json.hpp:22794
array_t * array
Definition json.hpp:20430
detail::parse_event_t parse_event_t
Definition json.hpp:20800
JSON_PRIVATE_UNLESS_TESTED const_reference bool inverse
Definition json.hpp:23684
void assert_invariant(bool check_parents=true) const noexcept
checks the class invariants
Definition json.hpp:20684
ReturnType value(const typename object_t::key_type &key, ValueType &&default_value) const
access specified object element with default value
Definition json.hpp:22277
void destroy(value_t t)
Definition json.hpp:20556
ValueType get_impl(detail::priority_tag< 0 >) const noexcept(noexcept(JSONSerializer< ValueType >::from_json(std::declval< const basic_json_t & >(), std::declval< ValueType & >())))
get a value (explicit)
Definition json.hpp:21632
json_value(string_t &&value)
constructor for rvalue strings
Definition json.hpp:20530
const_iterator cend() const noexcept
Definition json.hpp:22835
constexpr const binary_t * get_impl_ptr(const binary_t *) const noexcept
get a pointer to the value (binary)
Definition json.hpp:21532
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json from_bjdata(InputType &&i, const bool strict=true, const bool allow_exceptions=true)
create a JSON value from an input in BJData format
Definition json.hpp:24575
const_reference at(const json_pointer &ptr) const
access specified element via JSON Pointer
Definition json.hpp:24707
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json binary(typename binary_t::container_type &&init)
explicitly create a binary array
Definition json.hpp:20990
basic_json(std::nullptr_t=nullptr) noexcept
create a null object
Definition json.hpp:20825
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:24409
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:21508
constexpr const boolean_t * get_impl_ptr(const boolean_t *) const noexcept
get a pointer to the value (boolean)
Definition json.hpp:21484
basic_json flatten() const
return flattened JSON value
Definition json.hpp:24721
constexpr const array_t * get_impl_ptr(const array_t *) const noexcept
get a pointer to the value (array)
Definition json.hpp:21460
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:24536
json_value(number_unsigned_t v) noexcept
constructor for numbers (unsigned)
Definition json.hpp:20451
size_type erase(KeyType &&key)
remove element from a JSON object given a key
Definition json.hpp:22641
std::vector< basic_json, std::allocator< basic_json > > array_t
Definition json.hpp:20343
::nlohmann::detail::primitive_iterator_t primitive_iterator_t
Definition json.hpp:20144
json_value(const string_t &value)
constructor for strings
Definition json.hpp:20527
nlohmann::ordered_map< std::string, basic_json, default_object_comparator_t, std::allocator< std::pair< const std::string, basic_json > > > object_t
Definition json.hpp:20335
const binary_t & get_binary() const
get a binary value
Definition json.hpp:21942
iterator insert(const_iterator pos, const_iterator first, const_iterator last)
inserts range of elements into array
Definition json.hpp:23358
void patch_inplace(const basic_json &json_patch)
applies a JSON patch in-place without copying the object
Definition json.hpp:24746
ReturnType value(KeyType &&key, ValueType &&default_value) const
access specified object element via JSON Pointer with default value
Definition json.hpp:22330
const_reference operator[](const json_pointer &ptr) const
access specified element via JSON Pointer
Definition json.hpp:24679
json_value(number_float_t v) noexcept
constructor for numbers (floating-point)
Definition json.hpp:20453
value_type & reference
Definition json.hpp:20212
std::initializer_list< detail::json_ref< basic_json > > initializer_list_t
Definition json.hpp:20176
bool contains(KeyType &&key) const
check the existence of an element in a JSON object
Definition json.hpp:22764
static void to_cbor(const basic_json &j, detail::output_adapter< std::uint8_t > o)
create a CBOR serialization of a given JSON value
Definition json.hpp:24290
::nlohmann::detail::binary_reader< basic_json, InputType > binary_reader
Definition json.hpp:20157
static void to_bson(const basic_json &j, detail::output_adapter< char > o)
create a BSON serialization of a given JSON value
Definition json.hpp:24400
iterator find(const typename object_t::key_type &key)
Definition json.hpp:22677
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:20968
BasicJsonType get_impl(detail::priority_tag< 2 >) const
get special-case overload
Definition json.hpp:21699
static std::vector< std::uint8_t > to_bjdata(const basic_json &j, const bool use_size=false, const bool use_type=false, const bjdata_version_t version=bjdata_version_t::draft2)
create a BJData serialization of a given JSON value
Definition json.hpp:24354
const_reference at(KeyType &&key) const
access specified object element with bounds checking
Definition json.hpp:22068
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json meta()
returns version information on the library
Definition json.hpp:20250
basic_json(size_type cnt, const basic_json &val)
construct an array with count copies of given value
Definition json.hpp:21027
const_iterator find(const typename object_t::key_type &key) const
find an element in a JSON object
Definition json.hpp:22691
static std::vector< std::uint8_t > to_cbor(const basic_json &j)
create a CBOR serialization of a given JSON value
Definition json.hpp:24281
IteratorType erase(IteratorType pos)
remove element given an iterator
Definition json.hpp:22455
iterator insert(const_iterator pos, const basic_json &val)
inserts element into array
Definition json.hpp:23311
double number_float_t
Definition json.hpp:20363
ValueType value(const typename object_t::key_type &key, const ValueType &default_value) const
Definition json.hpp:22252
string_t * string
Definition json.hpp:20432
std::allocator< basic_json > allocator_type
Definition json.hpp:20222
typename std::allocator_traits< allocator_type >::pointer pointer
Definition json.hpp:20225
reference set_parent(reference j, std::size_t old_capacity=detail::unknown_size())
Definition json.hpp:20755
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:21298
void merge_patch(const basic_json &apply_patch)
applies a JSON Merge Patch
Definition json.hpp:25169
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:21824
static void to_bjdata(const basic_json &j, detail::output_adapter< std::uint8_t > o, const bool use_size=false, const bool use_type=false, const bjdata_version_t version=bjdata_version_t::draft2)
create a BJData serialization of a given JSON value
Definition json.hpp:24366
reference operator[](T *key)
Definition json.hpp:22183
reference at(size_type idx)
access specified array element with bounds checking
Definition json.hpp:21964
iterator find(KeyType &&key)
find an element in a JSON object
Definition json.hpp:22707
binary_t * binary
Definition json.hpp:20434
constexpr bool is_number_float() const noexcept
Definition json.hpp:21376
reverse_iterator rend() noexcept
returns an iterator to the reverse-end
Definition json.hpp:22858
static std::vector< std::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:24327
reference at(const json_pointer &ptr)
access specified element via JSON Pointer
Definition json.hpp:24693
bool boolean_t
Definition json.hpp:20351
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json diff(const basic_json &source, const basic_json &target, const string_t &path="")
creates a diff as a JSON patch
Definition json.hpp:25027
::nlohmann::detail::internal_iterator< BasicJsonType > internal_iterator
Definition json.hpp:20146
void set_parents()
Definition json.hpp:20705
detail::value_t value_t
Definition json.hpp:20164
size_type erase_internal(KeyType &&key)
Definition json.hpp:22596
std::less< std::string > default_object_comparator_t
Definition json.hpp:20330
reference operator+=(const typename object_t::value_type &val)
add an object to an object
Definition json.hpp:23202
const_iterator cbegin() const noexcept
Definition json.hpp:22810
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:21520
reference operator[](typename object_t::key_type key)
access specified object element
Definition json.hpp:22145
string_t * get_impl_ptr(string_t *) noexcept
get a pointer to the value (string)
Definition json.hpp:21466
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:21582
~basic_json() noexcept
destructor
Definition json.hpp:21280
detail::is_comparable< object_comparator_t, const typename object_t::key_type &, KeyType > is_comparable_with_object_key
Definition json.hpp:22237
detail::out_of_range out_of_range
Definition json.hpp:20194
json_value(binary_t &&value)
constructor for rvalue binary arrays (internal type)
Definition json.hpp:20554
const_reverse_iterator crend() const noexcept
Definition json.hpp:22879
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:20909
json_value(const object_t &value)
constructor for objects
Definition json.hpp:20533
void swap(typename binary_t::container_type &other)
exchanges the values
Definition json.hpp:23582
binary_t & get_binary()
get a binary value
Definition json.hpp:21930
const_iterator begin() const noexcept
returns an iterator to the first element
Definition json.hpp:22803
constexpr bool is_number() const noexcept
Definition json.hpp:21355
number_unsigned_t * get_impl_ptr(number_unsigned_t *) noexcept
get a pointer to the value (unsigned number)
Definition json.hpp:21502
void insert(const_iterator first, const_iterator last)
inserts range of elements into object
Definition json.hpp:23409
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:24467
auto get() noexcept -> decltype(std::declval< basic_json_t & >().template get_ptr< PointerType >())
get a pointer value (explicit)
Definition json.hpp:21811
const_reference operator[](T *key) const
Definition json.hpp:22189
data(const value_t v)
Definition json.hpp:24224
reference operator[](size_type idx)
access specified array element
Definition json.hpp:22086
basic_json(const JsonRef &ref)
Definition json.hpp:21148
adl_serializer< T, SFINAE > json_serializer
Definition json.hpp:20168
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 &&std::is_nothrow_move_assignable< json_base_class_t >::value)
copy assignment
Definition json.hpp:21251
static iteration_proxy< iterator > iterator_wrapper(reference ref) noexcept
Definition json.hpp:22891
static void to_ubjson(const basic_json &j, detail::output_adapter< char > o, const bool use_size=false, const bool use_type=false)
create a UBJSON serialization of a given JSON value
Definition json.hpp:24346
Array get_to(T(&v)[N]) const noexcept(noexcept(JSONSerializer< Array >::from_json(std::declval< const basic_json_t & >(), v)))
Definition json.hpp:21848
std::int64_t number_integer_t
Definition json.hpp:20355
auto get_ptr() noexcept -> decltype(std::declval< basic_json_t & >().get_impl_ptr(std::declval< PointerType >()))
Definition json.hpp:21571
const_reference at(const typename object_t::key_type &key) const
access specified object element with bounds checking
Definition json.hpp:22048
binary_t * get_impl_ptr(binary_t *) noexcept
get a pointer to the value (binary)
Definition json.hpp:21526
constexpr bool is_binary() const noexcept
Definition json.hpp:21404
void swap(object_t &other)
exchanges the values
Definition json.hpp:23534
iterator set_parents(iterator it, typename iterator::difference_type count_set_parents)
Definition json.hpp:20742
constexpr auto get_impl(detail::priority_tag< 4 >) const noexcept -> decltype(std::declval< const basic_json_t & >().template get_ptr< PointerType >())
get a pointer value (explicit)
Definition json.hpp:21735
basic_json unflatten() const
unflatten a previously flattened JSON value
Definition json.hpp:24730
iterator insert(const_iterator pos, initializer_list_t ilist)
inserts elements from initializer list into array
Definition json.hpp:23389
static void to_bjdata(const basic_json &j, detail::output_adapter< char > o, const bool use_size=false, const bool use_type=false, const bjdata_version_t version=bjdata_version_t::draft2)
create a BJData serialization of a given JSON value
Definition json.hpp:24375
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json binary(typename binary_t::container_type &&init, typename binary_t::subtype_type subtype)
explicitly create a binary array (with subtype)
Definition json.hpp:21001
iteration_proxy< iterator > items() noexcept
helper to access iterator member functions in range-based for
Definition json.hpp:22909
bool empty() const noexcept
checks whether the container is empty.
Definition json.hpp:22932
void swap(array_t &other)
exchanges the values
Definition json.hpp:23518
void erase(const size_type idx)
remove element from a JSON array given an index
Definition json.hpp:22648
reference operator+=(basic_json &&val)
add an object to an array
Definition json.hpp:23139
bool contains(const json_pointer &ptr) const
check the existence of an element in a JSON object given a JSON pointer
Definition json.hpp:22771
ValueType get_impl(detail::priority_tag< 1 >) const noexcept(noexcept(JSONSerializer< ValueType >::from_json(std::declval< const basic_json_t & >())))
get a value (explicit); special case
Definition json.hpp:21674
constexpr value_t type() const noexcept
Definition json.hpp:21320
reference emplace_back(Args &&... args)
add an object to an array
Definition json.hpp:23235
ValueType value(const json_pointer &ptr, const ValueType &default_value) const
access specified object element via JSON Pointer with default value
Definition json.hpp:22353
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json array(initializer_list_t init={})
explicitly create an array from an initializer list
Definition json.hpp:21012
detail::bjdata_version_t bjdata_version_t
Definition json.hpp:20174
std::string string_t
Definition json.hpp:20347
friend class ::nlohmann::detail::parser
Definition json.hpp:20109
void push_back(const basic_json &val)
add an object to an array
Definition json.hpp:23147
ValueType value(KeyType &&key, const ValueType &default_value) const
access specified object element with default value
Definition json.hpp:22303
reference at(const typename object_t::key_type &key)
access specified object element with bounds checking
Definition json.hpp:22010
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json from_bjdata(IteratorType first, IteratorType last, const bool strict=true, const bool allow_exceptions=true)
create a JSON value from an input in BJData format
Definition json.hpp:24590
json_value m_value
Definition json.hpp:24222
number_integer_t number_integer
Definition json.hpp:20438
const_reverse_iterator crbegin() const noexcept
Definition json.hpp:22872
json_sax< basic_json > json_sax_t
Definition json.hpp:20180
constexpr bool is_boolean() const noexcept
Definition json.hpp:21348
size_type count(const typename object_t::key_type &key) const
returns the number of occurrences of a key in a JSON object
Definition json.hpp:22737
reference front()
access the first element
Definition json.hpp:22420
constexpr bool is_primitive() const noexcept
return whether type is primitive
Definition json.hpp:21327
constexpr bool is_null() const noexcept
Definition json.hpp:21341
void clear() noexcept
clears the contents
Definition json.hpp:23053
constexpr const object_t * get_impl_ptr(const object_t *) const noexcept
get a pointer to the value (object)
Definition json.hpp:21448
json_value(value_t t)
constructor for empty values of a given type
Definition json.hpp:20455
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:20132
static void to_ubjson(const basic_json &j, detail::output_adapter< std::uint8_t > o, const bool use_size=false, const bool use_type=false)
create a UBJSON serialization of a given JSON value
Definition json.hpp:24338
detail::other_error other_error
Definition json.hpp:20195
JSON_PRIVATE_UNLESS_TESTED const_reference bool static SAX bool sax_parse(InputType &&i, SAX *sax, input_format_t format=input_format_t::json, const bool strict=true, const bool ignore_comments=false)
Definition json.hpp:24109
basic_json(basic_json &&other) noexcept
move constructor
Definition json.hpp:21225
iter_impl< basic_json > iterator
Definition json.hpp:20230
basic_json(const value_t v)
create an empty value with a given type
Definition json.hpp:20817
const_reference operator[](size_type idx) const
access specified array element
Definition json.hpp:22132
std::ptrdiff_t difference_type
Definition json.hpp:20217
iterator insert(const_iterator pos, basic_json &&val)
inserts element into array
Definition json.hpp:23331
const_reverse_iterator rend() const noexcept
returns an iterator to the reverse-end
Definition json.hpp:22865
std::uint64_t number_unsigned_t
Definition json.hpp:20359
friend std::istream & operator>>(std::istream &i, basic_json &j)
Definition json.hpp:24170
static std::vector< std::uint8_t > to_msgpack(const basic_json &j)
create a MessagePack serialization of a given JSON value
Definition json.hpp:24304
void swap(string_t &other)
exchanges the values
Definition json.hpp:23550
basic_json(const BasicJsonType &val)
create a JSON value from an existing one
Definition json.hpp:20851
NLOHMANN_BASIC_JSON_TPL basic_json_t
Definition json.hpp:20124
boolean_t * get_impl_ptr(boolean_t *) noexcept
get a pointer to the value (boolean)
Definition json.hpp:21478
::nlohmann::detail::binary_writer< basic_json, CharType > binary_writer
Definition json.hpp:20158
json_reverse_iterator< typename basic_json::iterator > reverse_iterator
Definition json.hpp:20234
json_value(const binary_t &value)
constructor for binary arrays (internal type)
Definition json.hpp:20551
const_reference at(size_type idx) const
access specified array element with bounds checking
Definition json.hpp:21987
detail::actual_object_comparator_t< basic_json > object_comparator_t
Definition json.hpp:20371
basic_json(const basic_json &other)
copy constructor
Definition json.hpp:21152
void push_back(const typename object_t::value_type &val)
add an object to an object
Definition json.hpp:23179
std::pair< iterator, bool > emplace(Args &&... args)
add an object to an object if key does not exist
Definition json.hpp:23260
static void to_cbor(const basic_json &j, detail::output_adapter< char > o)
create a CBOR serialization of a given JSON value
Definition json.hpp:24297
constexpr bool is_object() const noexcept
return whether value is an object
Definition json.hpp:21383
static void to_msgpack(const basic_json &j, detail::output_adapter< std::uint8_t > o)
create a MessagePack serialization of a given JSON value
Definition json.hpp:24313
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:24482
iterator insert_iterator(const_iterator pos, Args &&... args)
Definition json.hpp:23292
basic_json(InputIT first, InputIT last)
construct a JSON container given an iterator range
Definition json.hpp:21039
bool contains(const typename object_t::key_type &key) const
check the existence of an element in a JSON object
Definition json.hpp:22755
static void to_bson(const basic_json &j, detail::output_adapter< std::uint8_t > o)
create a BSON serialization of a given JSON value
Definition json.hpp:24393
const_iterator find(KeyType &&key) const
find an element in a JSON object
Definition json.hpp:22723
boolean_t boolean
Definition json.hpp:20436
json_value(const typename binary_t::container_type &value)
constructor for binary arrays
Definition json.hpp:20545
::nlohmann::json_pointer< std::string > json_pointer
Definition json.hpp:20166
bool operator!=(const byte_container_with_subtype &rhs) const
Definition json.hpp:6219
byte_container_with_subtype() noexcept(noexcept(container_type()))
Definition json.hpp:6185
std::uint64_t subtype_type
Definition json.hpp:6182
bool operator==(const byte_container_with_subtype &rhs) const
Definition json.hpp:6213
BinaryType container_type
Definition json.hpp:6181
byte_container_with_subtype(container_type &&b, subtype_type subtype_) noexcept(noexcept(container_type(std::move(b))))
Definition json.hpp:6207
byte_container_with_subtype(container_type &&b) noexcept(noexcept(container_type(std::move(b))))
Definition json.hpp:6195
constexpr subtype_type subtype() const noexcept
return the binary subtype
Definition json.hpp:6234
byte_container_with_subtype(const container_type &b, subtype_type subtype_) noexcept(noexcept(container_type(b)))
Definition json.hpp:6200
constexpr bool has_subtype() const noexcept
return whether the value has a subtype
Definition json.hpp:6241
byte_container_with_subtype(const container_type &b) noexcept(noexcept(container_type(b)))
Definition json.hpp:6190
subtype_type m_subtype
Definition json.hpp:6255
void set_subtype(subtype_type subtype_) noexcept
sets the binary subtype
Definition json.hpp:6226
bool m_has_subtype
Definition json.hpp:6256
void clear_subtype() noexcept
clears the binary subtype
Definition json.hpp:6248
deserialization of CBOR, MessagePack, and UBJSON values
Definition json.hpp:9831
json_sax_t * sax
the SAX parser
Definition json.hpp:12787
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:12649
bool get_ubjson_size_type(std::pair< std::size_t, char_int_type > &result, bool inside_ndarray=false)
determine the type and size for a container
Definition json.hpp:12001
binary_reader(const binary_reader &)=delete
bool parse_bson_array()
Reads an array from the BSON input and passes it to the SAX-parser.
Definition json.hpp:10159
typename BasicJsonType::string_t string_t
Definition json.hpp:9835
std::size_t chars_read
the number of characters read
Definition json.hpp:12778
std::pair< char_int_type, string_t > bjd_type
Definition json.hpp:12814
bool parse_bson_element_list(const bool is_array)
Read a BSON element list (as specified in the BSON-spec)
Definition json.hpp:10121
typename InputAdapterType::char_type char_type
Definition json.hpp:9838
bool parse_msgpack_internal()
Definition json.hpp:10965
std::string get_token_string() const
Definition json.hpp:12719
const bool is_little_endian
whether we can assume little endianness
Definition json.hpp:12781
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition json.hpp:9833
bool get_msgpack_string(string_t &result)
reads a MessagePack string
Definition json.hpp:11346
std::string exception_message(const input_format_t format, const std::string &detail, const std::string &context) const
Definition json.hpp:12732
InputAdapterType ia
input adapter
Definition json.hpp:12772
bool get_ubjson_high_precision_number()
Definition json.hpp:12459
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:12682
binary_reader(binary_reader &&)=default
static void byte_swap(NumberType &number)
Definition json.hpp:12582
char_int_type get_ignore_noop()
Definition json.hpp:12570
bool get_ubjson_value(const char_int_type prefix)
Definition json.hpp:12068
bool get_ubjson_ndarray_size(std::vector< size_t > &dim)
Definition json.hpp:11713
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:10035
bool get_msgpack_object(const std::size_t len)
Definition json.hpp:11562
typename char_traits< char_type >::int_type char_int_type
Definition json.hpp:9839
binary_reader(InputAdapterType &&adapter, const input_format_t format=input_format_t::json) noexcept
create a binary reader
Definition json.hpp:9847
typename BasicJsonType::binary_t binary_t
Definition json.hpp:9836
bool parse_bson_internal()
Reads in a BSON-object and passes it to the SAX-parser.
Definition json.hpp:9931
binary_reader & operator=(const binary_reader &)=delete
bool get_cbor_object(const std::size_t len, const cbor_tag_handler_t tag_handler)
Definition json.hpp:10909
bool get_cbor_binary(binary_t &result)
reads a CBOR byte array
Definition json.hpp:10776
bool get_number(const input_format_t format, NumberType &result)
Definition json.hpp:12619
typename BasicJsonType::number_integer_t number_integer_t
Definition json.hpp:9832
bool unexpect_eof(const input_format_t format, const char *context) const
Definition json.hpp:12706
bool get_ubjson_array()
Definition json.hpp:12261
bool get_bson_cstr(string_t &result)
Parses a C-style string from the BSON input.
Definition json.hpp:9956
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:9868
bool get_cbor_array(const std::size_t len, const cbor_tag_handler_t tag_handler)
Definition json.hpp:10871
char_int_type current
the current character
Definition json.hpp:12775
bool get_msgpack_array(const std::size_t len)
Definition json.hpp:11540
char_int_type get()
get next character from the input
Definition json.hpp:12538
typename BasicJsonType::number_float_t number_float_t
Definition json.hpp:9834
bool get_msgpack_binary(binary_t &result)
reads a MessagePack byte array
Definition json.hpp:11429
bool parse_ubjson_internal(const bool get_char=true)
Definition json.hpp:11599
SAX json_sax_t
Definition json.hpp:9837
bool get_ubjson_size_value(std::size_t &result, bool &is_ndarray, char_int_type prefix=0)
Definition json.hpp:11778
bool parse_cbor_internal(const bool get_char, const cbor_tag_handler_t tag_handler)
Definition json.hpp:10189
bool get_ubjson_object()
Definition json.hpp:12376
const decltype(JSON_BINARY_READER_MAKE_BJD_TYPES_MAP_) bjd_types_map
Definition json.hpp:12816
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:9986
bool get_ubjson_string(string_t &result, const bool get_char=true)
reads a UBJSON string
Definition json.hpp:11618
bool get_to(T &dest, const input_format_t format, const char *context)
get_to read into a primitive type
Definition json.hpp:12553
static JSON_INLINE_VARIABLE constexpr std::size_t npos
Definition json.hpp:12769
bool get_cbor_string(string_t &result)
reads a CBOR string
Definition json.hpp:10680
const input_format_t input_format
input format
Definition json.hpp:12784
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:10008
binary_reader & operator=(binary_reader &&)=default
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:16885
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:16722
void write_bson(const BasicJsonType &j)
Definition json.hpp:15792
typename BasicJsonType::binary_t binary_t
Definition json.hpp:15774
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:16782
typename BasicJsonType::string_t string_t
Definition json.hpp:15773
static constexpr CharType to_char_type(std::uint8_t x) noexcept
Definition json.hpp:17532
static constexpr std::size_t calc_bson_unsigned_size(const std::uint64_t value) noexcept
Definition json.hpp:16800
void write_ubjson(const BasicJsonType &j, const bool use_count, const bool use_type, const bool add_prefix=true, const bool use_bjdata=false, const bjdata_version_t bjdata_version=bjdata_version_t::draft2)
Definition json.hpp:16472
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:16866
static CharType to_char_type(std::uint8_t x) noexcept
Definition json.hpp:17539
static constexpr CharType get_cbor_float_prefix(double)
Definition json.hpp:17031
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:16750
binary_writer(output_adapter_t< CharType > adapter)
create a binary writer
Definition json.hpp:15783
static constexpr CharType get_ubjson_float_prefix(double)
Definition json.hpp:17346
void write_number_with_ubjson_prefix(const NumberType n, const bool add_prefix, const bool use_bjdata)
Definition json.hpp:17057
static constexpr CharType get_msgpack_float_prefix(double)
Definition json.hpp:17045
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:16948
static constexpr CharType to_char_type(InputCharType x) noexcept
Definition json.hpp:17561
void write_bson_object(const typename BasicJsonType::object_t &value)
Definition json.hpp:17010
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:16732
static std::size_t calc_bson_string_size(const string_t &value)
Definition json.hpp:16742
void write_number(const NumberType n, const bool OutputIsLittleEndian=false)
Definition json.hpp:17482
static std::size_t calc_bson_entry_header_size(const string_t &name, const BasicJsonType &j)
Definition json.hpp:16695
void write_bson_null(const string_t &name)
Writes a BSON element with key name and null value.
Definition json.hpp:16764
typename BasicJsonType::number_float_t number_float_t
Definition json.hpp:15775
CharType ubjson_prefix(const BasicJsonType &j, const bool use_bjdata) const noexcept
determine the type prefix of container values
Definition json.hpp:17240
void write_bson_unsigned(const string_t &name, const BasicJsonType &j)
Writes a BSON element with key name and unsigned value.
Definition json.hpp:16810
static constexpr CharType get_ubjson_float_prefix(float)
Definition json.hpp:17341
static std::size_t calc_bson_binary_size(const typename BasicJsonType::binary_t &value)
Definition json.hpp:16858
bool write_bjdata_ndarray(const typename BasicJsonType::object_t &value, const bool use_count, const bool use_type, const bjdata_version_t bjdata_version)
Definition json.hpp:17354
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:16900
void write_msgpack(const BasicJsonType &j)
Definition json.hpp:16145
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:16995
void write_compact_float(const number_float_t n, detail::input_format_t format)
Definition json.hpp:17498
output_adapter_t< CharType > oa
the output
Definition json.hpp:17571
void write_cbor(const BasicJsonType &j)
Definition json.hpp:15821
static constexpr CharType get_cbor_float_prefix(float)
Definition json.hpp:17026
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:16710
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:16833
static constexpr CharType get_msgpack_float_prefix(float)
Definition json.hpp:17040
const bool is_little_endian
whether we can assume little endianness
Definition json.hpp:17568
static std::size_t calc_bson_array_size(const typename BasicJsonType::array_t &value)
Definition json.hpp:16843
static std::size_t calc_bson_integer_size(const std::int64_t value)
Definition json.hpp:16772
general exception of the basic_json class
Definition json.hpp:4506
static std::string get_byte_positions(const BasicJsonType *leaf_element)
Definition json.hpp:4611
exception(int id_, const char *what_arg)
Definition json.hpp:4519
const int id
the id of the exception
Definition json.hpp:4515
static std::string diagnostics(std::nullptr_t)
Definition json.hpp:4526
std::runtime_error m
an exception object as storage for error messages
Definition json.hpp:4598
static std::string name(const std::string &ename, int id_)
Definition json.hpp:4521
const char * what() const noexcept override
returns the explanatory string
Definition json.hpp:4509
static std::string diagnostics(const BasicJsonType *leaf_element)
Definition json.hpp:4532
exception indicating errors with iterators
Definition json.hpp:4675
static invalid_iterator create(int id_, const std::string &what_arg, BasicJsonContext context)
Definition json.hpp:4678
invalid_iterator(int id_, const char *what_arg)
Definition json.hpp:4686
iter_impl operator+(difference_type i) const
add to iterator
Definition json.hpp:14174
iter_impl & operator=(const iter_impl< typename std::remove_const< BasicJsonType >::type > &other) noexcept
converting assignment
Definition json.hpp:13728
bool operator>=(const iter_impl &other) const
comparison: greater than or equal
Definition json.hpp:14119
iter_impl(const iter_impl< typename std::remove_const< BasicJsonType >::type > &other) noexcept
converting constructor
Definition json.hpp:13718
bool operator<(const iter_impl &other) const
comparison: smaller
Definition json.hpp:14061
bool operator<=(const iter_impl &other) const
comparison: less than or equal
Definition json.hpp:14101
iter_impl & operator-=(difference_type i)
subtract from iterator
Definition json.hpp:14165
iter_impl & operator--()
pre-decrement (–it)
Definition json.hpp:13971
const object_t::key_type & key() const
return the key of an object iterator
Definition json.hpp:14274
bool operator==(const IterImpl &other) const
comparison: equal
Definition json.hpp:14012
iter_impl operator++(int) &
post-increment (it++)
Definition json.hpp:13909
iter_impl & operator+=(difference_type i)
add to iterator
Definition json.hpp:14128
reference operator[](difference_type n) const
access to successor
Definition json.hpp:14236
typename std::conditional< std::is_const< BasicJsonType >::value, typename BasicJsonType::const_pointer, typename BasicJsonType::pointer >::type pointer
Definition json.hpp:13623
typename BasicJsonType::difference_type difference_type
Definition json.hpp:13621
pointer operator->() const
dereference the iterator
Definition json.hpp:13867
friend other_iter_impl
Definition json.hpp:13595
internal_iterator< typename std::remove_const< BasicJsonType >::type > m_it
Definition json.hpp:14299
difference_type operator-(const iter_impl &other) const
return difference
Definition json.hpp:14207
iter_impl(iter_impl &&) noexcept=default
std::bidirectional_iterator_tag iterator_category
Definition json.hpp:13616
friend iter_impl operator+(difference_type i, const iter_impl &it)
addition of distance and iterator
Definition json.hpp:14185
reference value() const
Definition json.hpp:14290
bool operator>(const iter_impl &other) const
comparison: greater than
Definition json.hpp:14110
typename BasicJsonType::array_t array_t
Definition json.hpp:13601
typename BasicJsonType::object_t object_t
Definition json.hpp:13600
iter_impl & operator++()
pre-increment (++it)
Definition json.hpp:13920
typename BasicJsonType::value_type value_type
Definition json.hpp:13619
reference operator*() const
return a reference to the value pointed to by the iterator
Definition json.hpp:13823
iter_impl operator-(difference_type i) const
subtract from iterator
Definition json.hpp:14196
typename std::conditional< std::is_const< BasicJsonType >::value, typename BasicJsonType::const_reference, typename BasicJsonType::reference >::type reference
Definition json.hpp:13627
iter_impl< typename std::conditional< std::is_const< BasicJsonType >::value, typename std::remove_const< BasicJsonType >::type, const BasicJsonType >::type > other_iter_impl
the iterator with BasicJsonType of different const-ness
Definition json.hpp:13593
friend BasicJsonType
Definition json.hpp:13596
iter_impl & operator=(const iter_impl< const BasicJsonType > &other) noexcept
converting assignment
Definition json.hpp:13703
bool operator!=(const IterImpl &other) const
comparison: not equal
Definition json.hpp:14052
iter_impl operator--(int) &
post-decrement (it–)
Definition json.hpp:13960
iter_impl(const iter_impl< const BasicJsonType > &other) noexcept
const copy constructor
Definition json.hpp:13693
void set_end() noexcept
set the iterator past the last value
Definition json.hpp:13784
iteration_proxy_value operator++(int) &
Definition json.hpp:5508
iteration_proxy_value(iteration_proxy_value const &)=default
bool operator==(const iteration_proxy_value &o) const
equality operator (needed for InputIterator)
Definition json.hpp:5517
bool operator!=(const iteration_proxy_value &o) const
inequality operator (needed for range-based for)
Definition json.hpp:5523
std::ptrdiff_t difference_type
Definition json.hpp:5454
value_type & reference
Definition json.hpp:5457
string_type empty_str
an empty string (to return a reference for primitive values)
Definition json.hpp:5471
iteration_proxy_value(IteratorType it, std::size_t array_index_=0) noexcept(std::is_nothrow_move_constructible< IteratorType >::value &&std::is_nothrow_default_constructible< string_type >::value)
Definition json.hpp:5475
iteration_proxy_value & operator++()
increment operator (needed for range-based for)
Definition json.hpp:5500
iteration_proxy_value()=default
std::forward_iterator_tag iterator_category
Definition json.hpp:5458
iteration_proxy_value value_type
Definition json.hpp:5455
std::size_t array_index_last
last stringified array index
Definition json.hpp:5467
std::size_t array_index
an index for arrays (used to create key names)
Definition json.hpp:5465
iteration_proxy_value(iteration_proxy_value &&) noexcept(std::is_nothrow_move_constructible< IteratorType >::value &&std::is_nothrow_move_constructible< string_type >::value)=default
IteratorType::reference value() const
return value of the iterator
Definition json.hpp:5565
value_type * pointer
Definition json.hpp:5456
const string_type & key() const
return key of the iterator
Definition json.hpp:5529
iteration_proxy_value & operator=(iteration_proxy_value const &)=default
string_type array_index_str
a string representation of the array index
Definition json.hpp:5469
typename std::remove_cv< typename std::remove_reference< decltype(std::declval< IteratorType >().key()) >::type >::type string_type
Definition json.hpp:5459
IteratorType anchor
the iterator
Definition json.hpp:5463
proxy class for the items() function
Definition json.hpp:5573
IteratorType::pointer container
the container to iterate
Definition json.hpp:5576
iteration_proxy_value< IteratorType > end() const noexcept
return iterator end (needed for range-based for)
Definition json.hpp:5598
iteration_proxy(iteration_proxy const &)=default
iteration_proxy()=default
iteration_proxy(iteration_proxy &&) noexcept=default
iteration_proxy_value< IteratorType > begin() const noexcept
return iterator begin (needed for range-based for)
Definition json.hpp:5592
iteration_proxy(typename IteratorType::reference cont) noexcept
construct iteration proxy from a container
Definition json.hpp:5582
iteration_proxy & operator=(iteration_proxy const &)=default
Definition json.hpp:15504
value_type owned_value
Definition json.hpp:15554
json_ref(json_ref &&) noexcept=default
json_ref(const value_type &value)
Definition json.hpp:15512
json_ref(value_type &&value)
Definition json.hpp:15508
value_type const & operator*() const
Definition json.hpp:15543
value_type const * operator->() const
Definition json.hpp:15548
json_ref(std::initializer_list< json_ref > init)
Definition json.hpp:15516
json_ref(Args &&... args)
Definition json.hpp:15523
value_type moved_or_copied() const
Definition json.hpp:15534
BasicJsonType value_type
Definition json.hpp:15506
value_type const * value_ref
Definition json.hpp:15555
json_reverse_iterator operator++(int) &
post-increment (it++)
Definition json.hpp:14369
json_reverse_iterator operator--(int) &
post-decrement (it–)
Definition json.hpp:14381
json_reverse_iterator & operator++()
pre-increment (++it)
Definition json.hpp:14375
std::ptrdiff_t difference_type
Definition json.hpp:14355
json_reverse_iterator & operator+=(difference_type i)
add to iterator
Definition json.hpp:14393
reference operator[](difference_type n) const
access to successor
Definition json.hpp:14417
auto key() const -> decltype(std::declval< Base >().key())
return the key of an object iterator
Definition json.hpp:14423
difference_type operator-(const json_reverse_iterator &other) const
return difference
Definition json.hpp:14411
typename Base::reference reference
the reference type for the pointed-to element
Definition json.hpp:14359
reference value() const
return the value of an iterator
Definition json.hpp:14430
json_reverse_iterator(const base_iterator &it) noexcept
create reverse iterator from base class
Definition json.hpp:14366
json_reverse_iterator & operator--()
pre-decrement (–it)
Definition json.hpp:14387
std::reverse_iterator< Base > base_iterator
shortcut to the reverse iterator adapter
Definition json.hpp:14357
json_reverse_iterator operator-(difference_type i) const
subtract from iterator
Definition json.hpp:14405
json_reverse_iterator(const typename base_iterator::iterator_type &it) noexcept
create reverse iterator from iterator
Definition json.hpp:14362
json_reverse_iterator operator+(difference_type i) const
add to iterator
Definition json.hpp:14399
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition json.hpp:9549
bool end_object()
Definition json.hpp:9599
bool binary(binary_t &)
Definition json.hpp:9584
bool number_integer(number_integer_t)
Definition json.hpp:9564
bool start_array(std::size_t=detail::unknown_size())
Definition json.hpp:9604
bool boolean(bool)
Definition json.hpp:9559
bool null()
Definition json.hpp:9554
bool end_array()
Definition json.hpp:9609
bool number_unsigned(number_unsigned_t)
Definition json.hpp:9569
bool start_object(std::size_t=detail::unknown_size())
Definition json.hpp:9589
bool string(string_t &)
Definition json.hpp:9579
typename BasicJsonType::binary_t binary_t
Definition json.hpp:9552
bool number_float(number_float_t, const string_t &)
Definition json.hpp:9574
bool parse_error(std::size_t, const std::string &, const detail::exception &)
Definition json.hpp:9614
bool key(string_t &)
Definition json.hpp:9594
typename BasicJsonType::number_integer_t number_integer_t
Definition json.hpp:9548
typename BasicJsonType::number_float_t number_float_t
Definition json.hpp:9550
typename BasicJsonType::string_t string_t
Definition json.hpp:9551
bool start_array(std::size_t len)
Definition json.hpp:9277
typename BasicJsonType::parser_callback_t parser_callback_t
Definition json.hpp:9116
bool null()
Definition json.hpp:9136
std::vector< BasicJsonType * > ref_stack
stack to model hierarchy of values
Definition json.hpp:9525
typename BasicJsonType::parse_event_t parse_event_t
Definition json.hpp:9117
json_sax_dom_callback_parser & operator=(json_sax_dom_callback_parser &&)=default
bool number_integer(number_integer_t val)
Definition json.hpp:9148
bool parse_error(std::size_t, const std::string &, const Exception &ex)
Definition json.hpp:9356
typename BasicJsonType::number_float_t number_float_t
Definition json.hpp:9113
BasicJsonType discarded
a discarded value for the callback
Definition json.hpp:9539
json_sax_dom_callback_parser & operator=(const json_sax_dom_callback_parser &)=delete
lexer< BasicJsonType, InputAdapterType > lexer_t
Definition json.hpp:9118
bool end_object()
Definition json.hpp:9227
const parser_callback_t callback
callback function
Definition json.hpp:9535
bool number_unsigned(number_unsigned_t val)
Definition json.hpp:9154
BasicJsonType * object_element
helper to hold the reference for the next object element
Definition json.hpp:9531
bool number_float(number_float_t val, const string_t &)
Definition json.hpp:9160
const bool allow_exceptions
whether to throw exceptions in case of errors
Definition json.hpp:9537
constexpr bool is_errored() const
Definition json.hpp:9368
json_sax_dom_callback_parser(BasicJsonType &r, parser_callback_t cb, const bool allow_exceptions_=true, lexer_t *lexer_=nullptr)
Definition json.hpp:9120
bool binary(binary_t &val)
Definition json.hpp:9172
std::vector< bool > key_keep_stack
stack to manage which object keys to keep
Definition json.hpp:9529
typename BasicJsonType::string_t string_t
Definition json.hpp:9114
bool boolean(bool val)
Definition json.hpp:9142
bool key(string_t &val)
Definition json.hpp:9210
bool string(string_t &val)
Definition json.hpp:9166
json_sax_dom_callback_parser(json_sax_dom_callback_parser &&)=default
BasicJsonType & root
the parsed JSON value
Definition json.hpp:9523
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition json.hpp:9112
typename BasicJsonType::number_integer_t number_integer_t
Definition json.hpp:9111
typename BasicJsonType::binary_t binary_t
Definition json.hpp:9115
bool errored
whether a syntax error occurred
Definition json.hpp:9533
lexer_t * m_lexer_ref
the lexer reference to obtain the current position
Definition json.hpp:9541
~json_sax_dom_callback_parser()=default
bool end_array()
Definition json.hpp:9309
bool start_object(std::size_t len)
Definition json.hpp:9178
std::pair< bool, BasicJsonType * > handle_value(Value &&v, const bool skip_callback=false)
Definition json.hpp:9455
json_sax_dom_callback_parser(const json_sax_dom_callback_parser &)=delete
std::vector< bool > keep_stack
stack to manage which values to keep
Definition json.hpp:9527
SAX implementation to create a JSON value from SAX events.
Definition json.hpp:8803
lexer_t * m_lexer_ref
the lexer reference to obtain the current position
Definition json.hpp:9104
bool number_float(number_float_t val, const string_t &)
Definition json.hpp:8852
std::vector< BasicJsonType * > ref_stack
stack to model hierarchy of values
Definition json.hpp:9096
bool number_unsigned(number_unsigned_t val)
Definition json.hpp:8846
json_sax_dom_parser(const json_sax_dom_parser &)=delete
json_sax_dom_parser & operator=(const json_sax_dom_parser &)=delete
bool binary(binary_t &val)
Definition json.hpp:8864
BasicJsonType * object_element
helper to hold the reference for the next object element
Definition json.hpp:9098
typename BasicJsonType::binary_t binary_t
Definition json.hpp:8809
json_sax_dom_parser(BasicJsonType &r, const bool allow_exceptions_=true, lexer_t *lexer_=nullptr)
Definition json.hpp:8817
bool start_object(std::size_t len)
Definition json.hpp:8870
typename BasicJsonType::number_integer_t number_integer_t
Definition json.hpp:8805
bool key(string_t &val)
Definition json.hpp:8893
bool end_object()
Definition json.hpp:8903
typename BasicJsonType::string_t string_t
Definition json.hpp:8808
~json_sax_dom_parser()=default
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition json.hpp:8806
bool parse_error(std::size_t, const std::string &, const Exception &ex)
Definition json.hpp:8961
lexer< BasicJsonType, InputAdapterType > lexer_t
Definition json.hpp:8810
bool boolean(bool val)
Definition json.hpp:8834
const bool allow_exceptions
whether to throw exceptions in case of errors
Definition json.hpp:9102
bool start_array(std::size_t len)
Definition json.hpp:8921
typename BasicJsonType::number_float_t number_float_t
Definition json.hpp:8807
JSON_HEDLEY_RETURNS_NON_NULL BasicJsonType * handle_value(Value &&v)
Definition json.hpp:9056
BasicJsonType & root
the parsed JSON value
Definition json.hpp:9094
bool end_array()
Definition json.hpp:8942
json_sax_dom_parser(json_sax_dom_parser &&)=default
bool errored
whether a syntax error occurred
Definition json.hpp:9100
constexpr bool is_errored() const
Definition json.hpp:8973
bool null()
Definition json.hpp:8828
bool string(string_t &val)
Definition json.hpp:8858
json_sax_dom_parser & operator=(json_sax_dom_parser &&)=default
bool number_integer(number_integer_t val)
Definition json.hpp:8840
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:7070
token_type
token types for the parser
Definition json.hpp:7047
@ value_float
an floating point number – use get_number_float() for actual value
Definition json.hpp:7055
@ begin_array
the character for array begin [
Definition json.hpp:7056
@ value_string
a string – use get_string() for actual value
Definition json.hpp:7052
@ end_array
the character for array end ]
Definition json.hpp:7058
@ uninitialized
indicating the scanner is uninitialized
Definition json.hpp:7048
@ parse_error
indicating a parse error
Definition json.hpp:7062
@ value_integer
a signed integer – use get_number_integer() for actual value
Definition json.hpp:7054
@ value_separator
the value separator ,
Definition json.hpp:7061
@ end_object
the character for object end }
Definition json.hpp:7059
@ literal_true
the true literal
Definition json.hpp:7049
@ begin_object
the character for object begin {
Definition json.hpp:7057
@ value_unsigned
an unsigned integer – use get_number_unsigned() for actual value
Definition json.hpp:7053
@ literal_null
the null literal
Definition json.hpp:7051
@ end_of_input
indicating the end of the input buffer
Definition json.hpp:7063
@ name_separator
the name separator :
Definition json.hpp:7060
@ literal_or_value
a literal or the begin of a value (only for diagnostics)
Definition json.hpp:7064
@ literal_false
the false literal
Definition json.hpp:7050
lexical analysis
Definition json.hpp:7120
void reset() noexcept
reset token_buffer; current character is beginning of token
Definition json.hpp:8330
bool skip_bom()
skip the UTF-8 byte order mark
Definition json.hpp:8502
string_t token_buffer
buffer for variable-length tokens (numbers, strings)
Definition json.hpp:8633
int get_codepoint()
get codepoint from 4 hex characters following \u
Definition json.hpp:7177
token_type scan_string()
scan a string literal
Definition json.hpp:7262
number_integer_t value_integer
Definition json.hpp:8639
void skip_whitespace()
Definition json.hpp:8516
const bool ignore_comments
whether comments should be ignored (true) or signaled as errors (false)
Definition json.hpp:8618
lexer(InputAdapterType &&adapter, bool ignore_comments_=false) noexcept
Definition json.hpp:7131
char_int_type current
the current character
Definition json.hpp:8621
JSON_HEDLEY_RETURNS_NON_NULL constexpr const char * get_error_message() const noexcept
return syntax error message
Definition json.hpp:8489
std::string get_token_string() const
Definition json.hpp:8464
typename BasicJsonType::number_float_t number_float_t
Definition json.hpp:7123
constexpr number_integer_t get_number_integer() const noexcept
return integer value
Definition json.hpp:8423
typename BasicJsonType::string_t string_t
Definition json.hpp:7124
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition json.hpp:7122
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:7225
char_int_type get()
Definition json.hpp:8348
constexpr position_t get_position() const noexcept
return position of last read token
Definition json.hpp:8456
static void strtof(float &f, const char *str, char **endptr) noexcept
Definition json.hpp:7920
const char_int_type decimal_point_char
the decimal point
Definition json.hpp:8644
number_unsigned_t value_unsigned
Definition json.hpp:8640
typename BasicJsonType::number_integer_t number_integer_t
Definition json.hpp:7121
token_type scan()
Definition json.hpp:8525
constexpr number_unsigned_t get_number_unsigned() const noexcept
return unsigned integer value
Definition json.hpp:8429
typename char_traits< char_type >::int_type char_int_type
Definition json.hpp:7126
bool scan_comment()
scan a comment
Definition json.hpp:7852
typename lexer_base< BasicJsonType >::token_type token_type
Definition json.hpp:7129
const char * error_message
a description of occurred lexer errors
Definition json.hpp:8636
lexer & operator=(lexer &&)=default
bool next_unget
whether the next get() call should just return current
Definition json.hpp:8624
lexer(const lexer &)=delete
std::size_t decimal_point_position
the position of the decimal point in the input
Definition json.hpp:8646
typename InputAdapterType::char_type char_type
Definition json.hpp:7125
InputAdapterType ia
input adapter
Definition json.hpp:8615
lexer & operator=(lexer &)=delete
token_type scan_number()
scan a number literal
Definition json.hpp:7977
number_float_t value_float
Definition json.hpp:8641
string_t & get_string()
return current string value (implicitly resets the token; useful only once)
Definition json.hpp:8441
token_type scan_literal(const char_type *literal_text, const std::size_t length, token_type return_type)
Definition json.hpp:8310
std::vector< char_type > token_string
raw input token string (for error messages)
Definition json.hpp:8630
void add(char_int_type c)
add a character to token_buffer
Definition json.hpp:8412
position_t position
the start position of the current token
Definition json.hpp:8627
void unget()
unget current character (read it again on next get)
Definition json.hpp:8385
constexpr number_float_t get_number_float() const noexcept
return floating-point value
Definition json.hpp:8435
static JSON_HEDLEY_PURE char get_decimal_point() noexcept
return the locale-dependent decimal point
Definition json.hpp:7151
exception indicating other library errors
Definition json.hpp:4727
other_error(int id_, const char *what_arg)
Definition json.hpp:4738
static other_error create(int id_, const std::string &what_arg, BasicJsonContext context)
Definition json.hpp:4730
exception indicating access out of the defined range
Definition json.hpp:4710
out_of_range(int id_, const char *what_arg)
Definition json.hpp:4721
static out_of_range create(int id_, const std::string &what_arg, BasicJsonContext context)
Definition json.hpp:4713
Definition json.hpp:15723
output_adapter(StringType &s)
Definition json.hpp:15734
output_adapter_t< CharType > oa
Definition json.hpp:15743
output_adapter(std::basic_ostream< CharType > &s)
Definition json.hpp:15730
output_adapter(std::vector< CharType, AllocatorType > &vec)
Definition json.hpp:15726
output adapter for output streams
Definition json.hpp:15675
void write_characters(const CharType *s, std::size_t length) override
Definition json.hpp:15687
output_stream_adapter(std::basic_ostream< CharType > &s) noexcept
Definition json.hpp:15677
void write_character(CharType c) override
Definition json.hpp:15681
std::basic_ostream< CharType > & stream
Definition json.hpp:15693
output adapter for basic_string
Definition json.hpp:15700
void write_character(CharType c) override
Definition json.hpp:15706
output_string_adapter(StringType &s) noexcept
Definition json.hpp:15702
StringType & str
Definition json.hpp:15718
void write_characters(const CharType *s, std::size_t length) override
Definition json.hpp:15712
output adapter for byte vectors
Definition json.hpp:15650
std::vector< CharType, AllocatorType > & v
Definition json.hpp:15668
output_vector_adapter(std::vector< CharType, AllocatorType > &vec) noexcept
Definition json.hpp:15652
void write_characters(const CharType *s, std::size_t length) override
Definition json.hpp:15662
void write_character(CharType c) override
Definition json.hpp:15656
exception indicating a parse error
Definition json.hpp:4622
static parse_error create(int id_, const position_t &pos, const std::string &what_arg, BasicJsonContext context)
create a parse error exception
Definition json.hpp:4634
static std::string position_string(const position_t &pos)
Definition json.hpp:4665
static parse_error create(int id_, std::size_t byte_, const std::string &what_arg, BasicJsonContext context)
Definition json.hpp:4642
const std::size_t byte
byte index of the parse error
Definition json.hpp:4659
parse_error(int id_, std::size_t byte_, const char *what_arg)
Definition json.hpp:4662
std::string exception_message(const token_type expected, const std::string &context)
Definition json.hpp:13321
const bool allow_exceptions
whether to throw exceptions in case of errors
Definition json.hpp:13358
bool sax_parse_internal(SAX *sax)
Definition json.hpp:13023
typename lexer_t::token_type token_type
Definition json.hpp:12910
void parse(const bool strict, BasicJsonType &result)
public parser interface
Definition json.hpp:12936
token_type last_token
the type of the last read token
Definition json.hpp:13354
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition json.hpp:12906
typename BasicJsonType::number_integer_t number_integer_t
Definition json.hpp:12905
typename BasicJsonType::string_t string_t
Definition json.hpp:12908
lexer_t m_lexer
the lexer
Definition json.hpp:13356
lexer< BasicJsonType, InputAdapterType > lexer_t
Definition json.hpp:12909
bool accept(const bool strict=true)
public accept interface
Definition json.hpp:12996
typename BasicJsonType::number_float_t number_float_t
Definition json.hpp:12907
const parser_callback_t< BasicJsonType > callback
callback function
Definition json.hpp:13352
parser(InputAdapterType &&adapter, 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:12914
bool sax_parse(SAX *sax, const bool strict=true)
Definition json.hpp:13004
token_type get_token()
get next token from lexer
Definition json.hpp:13316
Definition json.hpp:13408
primitive_iterator_t & operator++() noexcept
Definition json.hpp:13470
primitive_iterator_t & operator-=(difference_type n) noexcept
Definition json.hpp:13502
static constexpr difference_type end_value
Definition json.hpp:13412
constexpr bool is_begin() const noexcept
return whether the iterator can be dereferenced
Definition json.hpp:13437
primitive_iterator_t & operator--() noexcept
Definition json.hpp:13483
static constexpr difference_type begin_value
Definition json.hpp:13411
void set_end() noexcept
set iterator to a defined past the end
Definition json.hpp:13431
friend constexpr bool operator<(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
Definition json.hpp:13453
constexpr bool is_end() const noexcept
return whether the iterator is at end
Definition json.hpp:13443
primitive_iterator_t operator++(int) &noexcept
Definition json.hpp:13476
primitive_iterator_t & operator+=(difference_type n) noexcept
Definition json.hpp:13496
friend constexpr bool operator==(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
Definition json.hpp:13448
constexpr difference_type get_value() const noexcept
Definition json.hpp:13419
friend constexpr difference_type operator-(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
Definition json.hpp:13465
primitive_iterator_t operator+(difference_type n) noexcept
Definition json.hpp:13458
void set_begin() noexcept
set iterator to a defined beginning
Definition json.hpp:13425
primitive_iterator_t operator--(int) &noexcept
Definition json.hpp:13489
std::ptrdiff_t difference_type
Definition json.hpp:13410
typename BasicJsonType::binary_t::value_type binary_char_t
Definition json.hpp:18763
std::array< char, 512 > string_buffer
string buffer
Definition json.hpp:19682
std::uint8_t state
Definition json.hpp:19100
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition json.hpp:18762
std::size_t bytes_after_last_accept
Definition json.hpp:19104
serializer(output_adapter_t< char > s, const char ichar, error_handler_t error_handler_=error_handler_t::strict)
Definition json.hpp:18773
JSON_PRIVATE_UNLESS_TESTED const bool ensure_ascii
Definition json.hpp:19098
std::size_t undumped_chars
Definition json.hpp:19105
const char thousands_sep
the locale's thousand separator character
Definition json.hpp:19677
static constexpr std::uint8_t UTF8_REJECT
Definition json.hpp:18765
const char decimal_point
the locale's decimal point character
Definition json.hpp:19679
serializer & operator=(const serializer &)=delete
const error_handler_t error_handler
error_handler how to react on decoding errors
Definition json.hpp:19690
string_t indent_string
the indentation string
Definition json.hpp:19687
const std::lconv * loc
the locale
Definition json.hpp:19675
typename BasicJsonType::number_integer_t number_integer_t
Definition json.hpp:18761
typename BasicJsonType::number_float_t number_float_t
Definition json.hpp:18760
serializer & operator=(serializer &&)=delete
typename BasicJsonType::string_t string_t
Definition json.hpp:18759
std::array< char, 64 > number_buffer
a (hopefully) large enough character buffer
Definition json.hpp:19672
const char indent_char
the indentation character
Definition json.hpp:19685
std::size_t bytes
Definition json.hpp:19101
static constexpr std::uint8_t UTF8_ACCEPT
Definition json.hpp:18764
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:18813
serializer(const serializer &)=delete
serializer(serializer &&)=delete
exception indicating executing a member function with a wrong type
Definition json.hpp:4693
static type_error create(int id_, const std::string &what_arg, BasicJsonContext context)
Definition json.hpp:4696
type_error(int id_, const char *what_arg)
Definition json.hpp:4704
JSON Pointer defines a string syntax for identifying a specific value within a JSON document.
Definition json.hpp:14525
BasicJsonType & get_checked(BasicJsonType *ptr) const
Definition json.hpp:14911
json_pointer< string_t > convert() const &
Definition json.hpp:15324
friend json_pointer operator/(const json_pointer &lhs, string_t token)
create a new JSON pointer by appending the unescaped token at the end of the JSON pointer
Definition json.hpp:14620
static BasicJsonType::size_type array_index(const string_t &s)
Definition json.hpp:14703
typename string_t_helper< RefStringType >::type string_t
Definition json.hpp:14547
friend json_pointer operator/(const json_pointer &lhs, 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:14627
json_pointer result
Definition json.hpp:14748
result reference_tokens
Definition json.hpp:14749
json_pointer(const string_t &s="")
create JSON pointer
Definition json.hpp:14551
static std::vector< string_t > split(const string_t &reference_string)
split the string input to reference tokens
Definition json.hpp:15155
bool empty() const noexcept
return whether pointer points to the root document
Definition json.hpp:14686
BasicJsonType & get_and_create(BasicJsonType &j) const
create and return a reference to the pointed to value
Definition json.hpp:14763
void pop_back()
remove last reference token
Definition json.hpp:14648
string_t to_string() const
return a string representation of the JSON pointer
Definition json.hpp:14557
json_pointer & operator/=(std::size_t array_idx)
append an array index at the end of this JSON pointer
Definition json.hpp:14605
void push_back(string_t &&token)
append an unescaped token at the end of the reference pointer
Definition json.hpp:14679
json_pointer< string_t > convert() &&
Definition json.hpp:15331
static void flatten(const string_t &reference_string, const BasicJsonType &value, BasicJsonType &result)
Definition json.hpp:15224
json_pointer & operator/=(const json_pointer &ptr)
append another JSON pointer at the end of this JSON pointer
Definition json.hpp:14587
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:14612
BasicJsonType & get_unchecked(BasicJsonType *ptr) const
return a reference to the pointed to value
Definition json.hpp:14843
json_pointer parent_pointer() const
returns the parent of this JSON pointer
Definition json.hpp:14634
static BasicJsonType unflatten(const BasicJsonType &value)
Definition json.hpp:15296
json_pointer & operator/=(string_t token)
append an unescaped reference token at the end of this JSON pointer
Definition json.hpp:14597
friend class json_pointer
Definition json.hpp:14531
const string_t & back() const
return last reference token
Definition json.hpp:14660
friend std::ostream & operator<<(std::ostream &o, const json_pointer &ptr)
write string representation of the JSON pointer to stream
Definition json.hpp:14578
const BasicJsonType & get_unchecked(const BasicJsonType *ptr) const
return a const reference to the pointed to value
Definition json.hpp:14969
friend class basic_json
Definition json.hpp:14528
void push_back(const string_t &token)
append an unescaped token at the end of the reference pointer
Definition json.hpp:14672
const BasicJsonType & get_checked(const BasicJsonType *ptr) const
Definition json.hpp:15018
bool contains(const BasicJsonType *ptr) const
Definition json.hpp:15067
decltype( get< N >(std::declval< ::nlohmann::detail::iteration_proxy_value< IteratorType > >())) type
Definition json.hpp:5644
nlohmann::json json
For better readability and development process using json is declared here at the top of the implemen...
Definition files.cpp:37
#define NLOHMANN_BASIC_JSON_TPL_DECLARATION
Definition json.hpp:2614
#define JSON_HEDLEY_CONST
Definition json.hpp:1832
#define JSON_HEDLEY_DIAGNOSTIC_PUSH
Definition json.hpp:1116
#define JSON_INLINE_VARIABLE
Definition json.hpp:2513
#define JSON_HEDLEY_WARN_UNUSED_RESULT
Definition json.hpp:1462
#define JSON_PRIVATE_UNLESS_TESTED
Definition json.hpp:2573
#define NLOHMANN_JSON_VERSION_PATCH
Definition json.hpp:70
#define JSON_HEDLEY_LIKELY(expr)
Definition json.hpp:1727
bool operator==(const json_pointer< RefStringTypeLhs > &lhs, const json_pointer< RefStringTypeRhs > &rhs) noexcept
Definition json.hpp:15420
#define JSON_HEDLEY_NON_NULL(...)
Definition json.hpp:1620
#define JSON_INTERNAL_CATCH(exception)
Definition json.hpp:2540
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:25201
#define JSON_HEDLEY_RETURNS_NON_NULL
Definition json.hpp:2061
#define JSON_CATCH(exception)
Definition json.hpp:2539
#define JSON_ASSERT(x)
Definition json.hpp:2566
#define JSON_THROW(exception)
Definition json.hpp:2537
#define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
Definition json.hpp:81
#define NLOHMANN_JSON_VERSION_MAJOR
Definition json.hpp:68
bool operator<(const json_pointer< RefStringTypeLhs > &lhs, const json_pointer< RefStringTypeRhs > &rhs) noexcept
Definition json.hpp:15470
#define NLOHMANN_BASIC_JSON_TPL
Definition json.hpp:2624
#define JSON_HEDLEY_UNLIKELY(expr)
Definition json.hpp:1728
#define JSON_BINARY_READER_MAKE_BJD_TYPES_MAP_
Definition json.hpp:12793
#define JSON_TRY
Definition json.hpp:2538
#define NLOHMANN_JSON_NAMESPACE_END
Definition json.hpp:155
#define JSON_NO_UNIQUE_ADDRESS
Definition json.hpp:2519
basic_json< nlohmann::ordered_map > ordered_json
specialization that maintains the insertion order of object keys
Definition json.hpp:3553
#define NLOHMANN_JSON_VERSION_MINOR
Definition json.hpp:69
#define NLOHMANN_CAN_CALL_STD_FUNC_IMPL(std_name)
Definition json.hpp:2908
bool operator!=(const json_pointer< RefStringTypeLhs > &lhs, const json_pointer< RefStringTypeRhs > &rhs) noexcept
Definition json.hpp:15445
#define NLOHMANN_JSON_NAMESPACE_BEGIN
Definition json.hpp:145
#define JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_
Definition json.hpp:12790
#define JSON_HEDLEY_DIAGNOSTIC_POP
Definition json.hpp:1117
#define JSON_EXPLICIT
Definition json.hpp:2945
#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement)
Definition json.hpp:1410
#define JSON_HEDLEY_PURE
Definition json.hpp:1801
#define JSON_IMPLEMENT_OPERATOR(op, null_result, unordered_result, default_result)
Definition json.hpp:23607
#define JSON_DIAGNOSTIC_POSITIONS
Definition json.hpp:77
implements the Grisu2 algorithm for binary to decimal floating-point conversion.
Definition json.hpp:17650
int find_largest_pow10(const std::uint32_t n, std::uint32_t &pow10)
Definition json.hpp:18097
cached_power get_cached_power_for_binary_exponent(int e)
Definition json.hpp:17933
Target reinterpret_bits(const Source source)
Definition json.hpp:17653
boundaries compute_boundaries(FloatType value)
Definition json.hpp:17794
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:18151
constexpr int kAlpha
Definition json.hpp:17916
void grisu2(char *buf, int &len, int &decimal_exponent, diyfp m_minus, diyfp v, diyfp m_plus)
Definition json.hpp:18433
constexpr int kGamma
Definition json.hpp:17917
void grisu2_digit_gen(char *buffer, int &length, int &decimal_exponent, diyfp M_minus, diyfp w, diyfp M_plus)
Definition json.hpp:18192
JSON_HEDLEY_RETURNS_NON_NULL char * append_exponent(char *buf, int e)
appends a decimal representation of e to buf
Definition json.hpp:18533
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:18585
constexpr bool is_transparent()
Definition json.hpp:4316
constexpr bool is_c_string()
Definition json.hpp:4288
detail namespace with internal helper functions
Definition json.hpp:263
make_integer_sequence< size_t, N > make_index_sequence
Definition json.hpp:3313
decltype(std::declval< StringType & >().append(std::declval< Arg && >())) string_can_append
Definition json.hpp:4391
std::integral_constant< bool,(std::is_signed< OfType >::value &&(sizeof(T)< sizeof(OfType)))||(same_sign< OfType, T >::value &&sizeof(OfType)==sizeof(T)) > never_out_of_range
Definition json.hpp:4198
input_format_t
the supported input formats
Definition json.hpp:6469
@ bson
Definition json.hpp:6469
@ bjdata
Definition json.hpp:6469
@ ubjson
Definition json.hpp:6469
@ json
Definition json.hpp:6469
@ cbor
Definition json.hpp:6469
@ msgpack
Definition json.hpp:6469
typename detector< nonesuch, void, Op, Args... >::type detected_t
Definition json.hpp:314
void to_json_tuple_impl(BasicJsonType &j, const Tuple &t, index_sequence< Idx... >)
Definition json.hpp:6061
static void unescape(StringType &s)
string unescaping as described in RFC 6901 (Sect. 4)
Definition json.hpp:3127
decltype(T::to_json(std::declval< Args >()...)) to_json_function
Definition json.hpp:3639
detector< Default, void, Op, Args... > detected_or
Definition json.hpp:317
decltype(std::declval< T & >().binary(std::declval< Binary & >())) binary_function_t
Definition json.hpp:9677
typename std::conditional< is_usable_as_key_type< typename BasicJsonType::object_comparator_t, typename BasicJsonType::object_t::key_type, KeyTypeCVRef, RequireTransparentComparator, ExcludeObjectKeyType >::value &&!is_json_iterator_of< BasicJsonType, KeyType >::value, std::true_type, std::false_type >::type is_usable_as_basic_json_key_type
Definition json.hpp:4132
is_detected< string_can_append_data, StringType, Arg > detect_string_can_append_data
Definition json.hpp:4412
decltype(std::declval< T & >().end_object()) end_object_function_t
Definition json.hpp:9689
OutStringType concat(Args &&... args)
Definition json.hpp:4471
typename T::value_type value_type_t
Definition json.hpp:3624
constexpr std::array< T, sizeof...(Args)> make_array(Args &&... args)
Definition json.hpp:3344
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:18670
decltype(std::declval< T & >().boolean(std::declval< bool >())) boolean_function_t
Definition json.hpp:9657
std::is_same< Expected, detected_t< Op, Args... > > is_detected_exact
Definition json.hpp:323
is_detected< string_can_append, StringType, Arg > detect_string_can_append
Definition json.hpp:4394
typename std::enable_if< B, T >::type enable_if_t
Definition json.hpp:3217
parse_event_t
Definition json.hpp:12878
@ value
the parser finished reading a JSON value
Definition json.hpp:12890
@ key
the parser read a key of a value in an object
Definition json.hpp:12888
@ array_end
the parser read ] and finished processing a JSON array
Definition json.hpp:12886
@ array_start
the parser read [ and started to process a JSON array
Definition json.hpp:12884
@ object_start
the parser read { and started to process a JSON object
Definition json.hpp:12880
@ object_end
the parser read } and finished processing a JSON object
Definition json.hpp:12882
std::integral_constant< bool, all_signed< Types... >::value||all_unsigned< Types... >::value > same_sign
Definition json.hpp:4194
typename detector< nonesuch, void, Op, Args... >::value_t is_detected
Definition json.hpp:308
typename std::conditional< is_comparable< Comparator, ObjectKeyType, KeyTypeCVRef >::value &&!(ExcludeObjectKeyType &&std::is_same< KeyType, ObjectKeyType >::value) &&(!RequireTransparentComparator||is_detected< detect_is_transparent, Comparator >::value) &&!is_json_pointer< KeyType >::value, std::true_type, std::false_type >::type is_usable_as_key_type
Definition json.hpp:4114
typename T::pointer pointer_t
Definition json.hpp:3630
std::pair< A1, A2 > from_json_tuple_impl(BasicJsonType &&j, identity_tag< std::pair< A1, A2 > >, priority_tag< 0 >)
Definition json.hpp:5238
void from_json_array_impl(const BasicJsonType &j, typename BasicJsonType::array_t &arr, priority_tag< 3 >)
Definition json.hpp:5043
typename utility_internal::Gen< T, N >::type make_integer_sequence
Definition json.hpp:3305
conjunction< std::is_integral< Types >... > all_integral
Definition json.hpp:4184
std::shared_ptr< output_adapter_protocol< CharType > > output_adapter_t
a type to simplify interfaces
Definition json.hpp:15645
typename detected_or< Default, Op, Args... >::type detected_or_t
Definition json.hpp:320
decltype(std::declval< T & >().key(std::declval< String & >())) key_function_t
Definition json.hpp:9685
decltype(std::declval< T & >().null()) null_function_t
Definition json.hpp:9654
void int_to_string(StringType &target, std::size_t value)
Definition json.hpp:5426
T conditional_static_cast(U value)
Definition json.hpp:4172
typename T::difference_type difference_type_t
Definition json.hpp:3627
conjunction< std::is_unsigned< Types >... > all_unsigned
Definition json.hpp:4190
constexpr T static_const< T >::value
Definition json.hpp:3340
decltype(std::declval< T & >().start_object(std::declval< std::size_t >())) start_object_function_t
Definition json.hpp:9681
decltype(std::declval< T & >().number_float( std::declval< Float >(), std::declval< const String & >())) number_float_function_t
Definition json.hpp:9669
void replace_substring(StringType &s, const StringType &f, const StringType &t)
replace all occurrences of a substring by another string
Definition json.hpp:3093
decltype(std::declval< T & >().start_array(std::declval< std::size_t >())) start_array_function_t
Definition json.hpp:9692
is_detected< string_can_append_iter, StringType, Arg > detect_string_can_append_iter
Definition json.hpp:4406
auto get(const nlohmann::detail::iteration_proxy_value< IteratorType > &i) -> decltype(i.key())
Definition json.hpp:5608
typename std::conditional< is_detected< detect_erase_with_key_type, typename BasicJsonType::object_t, KeyType >::value, std::true_type, std::false_type >::type has_erase_with_key_type
Definition json.hpp:4145
typename actual_object_comparator< BasicJsonType >::type actual_object_comparator_t
Definition json.hpp:3718
decltype(std::declval< ObjectType & >().erase(std::declval< KeyType >())) detect_erase_with_key_type
Definition json.hpp:4141
decltype(input_adapter(std::declval< const char * >(), std::declval< const char * >())) contiguous_bytes_input_adapter
Definition json.hpp:6923
cbor_tag_handler_t
how to treat CBOR tags
Definition json.hpp:9804
@ ignore
ignore tags
Definition json.hpp:9806
@ store
store tags as binary type
Definition json.hpp:9807
@ error
throw a parse_error exception in case of a tag
Definition json.hpp:9805
value_type_t< iterator_traits< iterator_t< T > > > range_value_t
Definition json.hpp:3869
make_index_sequence< sizeof...(Ts)> index_sequence_for
Definition json.hpp:3321
void concat_into(OutStringType &)
Definition json.hpp:4387
constexpr bool value_in_range_of(T val)
Definition json.hpp:4272
value_t
the JSON type enumeration
Definition json.hpp:2995
@ null
null value
Definition json.hpp:2996
@ number_integer
number value (signed integer)
Definition json.hpp:3001
@ boolean
boolean value
Definition json.hpp:3000
@ discarded
discarded by the parser callback function
Definition json.hpp:3005
@ binary
binary array (ordered collection of bytes)
Definition json.hpp:3004
@ object
object (unordered set of name/value pairs)
Definition json.hpp:2997
@ string
string value
Definition json.hpp:2999
@ number_float
number value (floating-point)
Definition json.hpp:3003
@ number_unsigned
number value (unsigned integer)
Definition json.hpp:3002
@ array
array (ordered collection of values)
Definition json.hpp:2998
decltype(T::from_json(std::declval< Args >()...)) from_json_function
Definition json.hpp:3642
conjunction< std::is_signed< Types >... > all_signed
Definition json.hpp:4187
constexpr std::size_t unknown_size()
Definition json.hpp:8783
std::array< T, sizeof...(Idx)> from_json_inplace_array_impl(BasicJsonType &&j, identity_tag< std::array< T, sizeof...(Idx)> >, index_sequence< Idx... >)
Definition json.hpp:5126
static bool little_endianness(int num=1) noexcept
determine system byte order
Definition json.hpp:9817
StringType to_string(std::size_t value)
Definition json.hpp:5434
std::size_t hash(const BasicJsonType &j)
hash a JSON value
Definition json.hpp:6310
decltype(std::declval< T & >().number_integer(std::declval< Integer >())) number_integer_function_t
Definition json.hpp:9661
typename make_void< Ts... >::type void_t
Definition json.hpp:269
std::size_t combine(std::size_t seed, std::size_t h) noexcept
Definition json.hpp:6292
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:9699
bool operator<(const value_t lhs, const value_t rhs) noexcept
comparison operator for JSON types
Definition json.hpp:3024
iterator_input_adapter_factory< IteratorType >::adapter_type input_adapter(IteratorType first, IteratorType last)
Definition json.hpp:6859
enable_if_t< is_range< R >::value, result_of_begin< decltype(std::declval< R & >())> > iterator_t
Definition json.hpp:3866
typename T::iterator_category iterator_category_t
Definition json.hpp:3636
typename std::conditional< std::is_same< T, void >::value, json_default_base, T >::type json_base_class
Definition json.hpp:14475
is_c_string< uncvref_t< T > > is_c_string_uncvref
Definition json.hpp:4306
error_handler_t
how to treat decoding errors
Definition json.hpp:18750
@ strict
throw a type_error exception in case of invalid UTF-8
Definition json.hpp:18751
@ ignore
ignore invalid UTF-8 sequences
Definition json.hpp:18753
@ replace
replace invalid UTF-8 sequences with U+FFFD
Definition json.hpp:18752
std::size_t concat_length()
Definition json.hpp:4356
std::integral_constant< bool, Value > bool_constant
Definition json.hpp:4278
decltype(input_adapter(std::declval< std::string >())) string_input_adapter_type
Definition json.hpp:6899
typename std::remove_cv< typename std::remove_reference< T >::type >::type uncvref_t
Definition json.hpp:3203
void from_json(const BasicJsonType &j, typename std::nullptr_t &n)
Definition json.hpp:4820
typename T::key_compare detect_key_compare
Definition json.hpp:3702
void to_json(BasicJsonType &j, T b) noexcept
Definition json.hpp:5922
void get_arithmetic_value(const BasicJsonType &j, ArithmeticType &val)
Definition json.hpp:4852
integer_sequence< size_t, Ints... > index_sequence
Definition json.hpp:3259
std::is_convertible< detected_t< Op, Args... >, To > is_detected_convertible
Definition json.hpp:326
is_specialization_of<::nlohmann::json_pointer, uncvref_t< T > > is_json_pointer
Definition json.hpp:4095
decltype(std::declval< StringType & >().append(std::declval< const Arg & >().begin(), std::declval< const Arg & >().end())) string_can_append_iter
Definition json.hpp:4403
decltype(std::declval< T & >().end_array()) end_array_function_t
Definition json.hpp:9696
std::tuple< Args... > from_json_tuple_impl_base(BasicJsonType &&j, index_sequence< Idx... >)
Definition json.hpp:5226
decltype(std::declval< StringType & >().append(std::declval< const Arg & >().data(), std::declval< const Arg & >().size())) string_can_append_data
Definition json.hpp:4409
typename T::key_type key_type_t
Definition json.hpp:3621
typename T::reference reference_t
Definition json.hpp:3633
typename T::is_transparent detect_is_transparent
Definition json.hpp:4108
bjdata_version_t
how to encode BJData
Definition json.hpp:15758
@ draft3
Definition json.hpp:15760
@ draft2
Definition json.hpp:15759
is_detected< string_can_append_op, StringType, Arg > detect_string_can_append_op
Definition json.hpp:4400
typename T::mapped_type mapped_type_t
Definition json.hpp:3618
decltype(std::declval< StringType & >()+=std::declval< Arg && >()) string_can_append_op
Definition json.hpp:4397
StringType escape(StringType s)
string escaping as described in RFC 6901 (Sect. 4)
Definition json.hpp:3112
decltype(std::declval< T & >().string(std::declval< String & >())) string_function_t
Definition json.hpp:9673
decltype(std::declval< T >().template get< U >()) get_template_function
Definition json.hpp:3645
decltype(std::declval< T & >().number_unsigned(std::declval< Unsigned >())) number_unsigned_function_t
Definition json.hpp:9665
std::function< bool(int, parse_event_t, BasicJsonType &)> parser_callback_t
Definition json.hpp:12894
Definition json.hpp:25209
Definition json.hpp:25207
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:25282
namespace for Niels Lohmann
Definition json.hpp:6121
static auto to_json(BasicJsonType &j, TargetType &&val) noexcept(noexcept(::nlohmann::to_json(j, std::forward< TargetType >(val)))) -> decltype(::nlohmann::to_json(j, std::forward< TargetType >(val)), void())
convert any value type to a JSON value
Definition json.hpp:6145
static auto from_json(BasicJsonType &&j) noexcept(noexcept(::nlohmann::from_json(std::forward< BasicJsonType >(j), detail::identity_tag< TargetType > {}))) -> decltype(::nlohmann::from_json(std::forward< BasicJsonType >(j), detail::identity_tag< TargetType > {}))
convert a JSON value to any value type
Definition json.hpp:6135
static auto from_json(BasicJsonType &&j, TargetType &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:6125
typename BasicJsonType::object_t object_t
Definition json.hpp:3711
typename BasicJsonType::default_object_comparator_t object_comparator_t
Definition json.hpp:3712
typename std::conditional< has_key_compare< object_t >::value, typename object_t::key_compare, object_comparator_t >::type type
Definition json.hpp:3713
signed char char_type
Definition json.hpp:3757
static constexpr int_type eof() noexcept
Definition json.hpp:3771
uint64_t int_type
Definition json.hpp:3758
static char_type to_char_type(int_type i) noexcept
Definition json.hpp:3766
static int_type to_int_type(char_type c) noexcept
Definition json.hpp:3761
static char_type to_char_type(int_type i) noexcept
Definition json.hpp:3742
static constexpr int_type eof() noexcept
Definition json.hpp:3747
unsigned char char_type
Definition json.hpp:3733
uint64_t int_type
Definition json.hpp:3734
static int_type to_int_type(char_type c) noexcept
Definition json.hpp:3737
std::true_type value_t
Definition json.hpp:303
Op< Args... > type
Definition json.hpp:304
std::false_type value_t
Definition json.hpp:296
Default type
Definition json.hpp:297
Definition json.hpp:17781
diyfp w
Definition json.hpp:17782
diyfp minus
Definition json.hpp:17783
diyfp plus
Definition json.hpp:17784
Definition json.hpp:17920
std::uint64_t f
Definition json.hpp:17921
int e
Definition json.hpp:17922
int k
Definition json.hpp:17923
Definition json.hpp:17663
static diyfp mul(const diyfp &x, const diyfp &y) noexcept
returns x * y
Definition json.hpp:17687
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:17769
static diyfp normalize(diyfp x) noexcept
normalize x such that the significand is >= 2^(q-1)
Definition json.hpp:17752
static diyfp sub(const diyfp &x, const diyfp &y) noexcept
returns x - y
Definition json.hpp:17675
constexpr diyfp(std::uint64_t f_, int e_) noexcept
Definition json.hpp:17669
static constexpr int kPrecision
Definition json.hpp:17664
std::uint64_t f
Definition json.hpp:17666
int e
Definition json.hpp:17667
static void construct(BasicJsonType &j, const std::vector< bool > &arr)
Definition json.hpp:5831
static void construct(BasicJsonType &j, typename BasicJsonType::array_t &&arr)
Definition json.hpp:5806
static void construct(BasicJsonType &j, const typename BasicJsonType::array_t &arr)
Definition json.hpp:5796
static void construct(BasicJsonType &j, const CompatibleArrayType &arr)
Definition json.hpp:5818
static void construct(BasicJsonType &j, const std::valarray< T > &arr)
Definition json.hpp:5847
static void construct(BasicJsonType &j, const typename BasicJsonType::binary_t &b)
Definition json.hpp:5735
static void construct(BasicJsonType &j, typename BasicJsonType::binary_t &&b)
Definition json.hpp:5744
static void construct(BasicJsonType &j, typename BasicJsonType::boolean_t b) noexcept
Definition json.hpp:5689
static void construct(BasicJsonType &j, typename BasicJsonType::number_float_t val) noexcept
Definition json.hpp:5757
static void construct(BasicJsonType &j, typename BasicJsonType::number_integer_t val) noexcept
Definition json.hpp:5783
static void construct(BasicJsonType &j, typename BasicJsonType::number_unsigned_t val) noexcept
Definition json.hpp:5770
static void construct(BasicJsonType &j, const typename BasicJsonType::object_t &obj)
Definition json.hpp:5866
static void construct(BasicJsonType &j, const CompatibleObjectType &obj)
Definition json.hpp:5887
static void construct(BasicJsonType &j, typename BasicJsonType::object_t &&obj)
Definition json.hpp:5876
static void construct(BasicJsonType &j, typename BasicJsonType::string_t &&s)
Definition json.hpp:5711
static void construct(BasicJsonType &j, const CompatibleStringType &str)
Definition json.hpp:5722
static void construct(BasicJsonType &j, const typename BasicJsonType::string_t &s)
Definition json.hpp:5702
auto operator()(const BasicJsonType &j, T &&val) const noexcept(noexcept(from_json(j, std::forward< T >(val)))) -> decltype(from_json(j, std::forward< T >(val)))
Definition json.hpp:5329
typename BasicJsonType::template json_serializer< T, void > serializer
Definition json.hpp:3664
static constexpr bool value
Definition json.hpp:3666
typename BasicJsonType::template json_serializer< T, void > serializer
Definition json.hpp:3679
static constexpr bool value
Definition json.hpp:3681
static constexpr bool value
Definition json.hpp:3696
typename BasicJsonType::template json_serializer< T, void > serializer
Definition json.hpp:3694
T value_type
Definition json.hpp:3246
static constexpr std::size_t size() noexcept
Definition json.hpp:3247
an iterator value
Definition json.hpp:13524
BasicJsonType::array_t::iterator array_iterator
iterator for JSON arrays
Definition json.hpp:13528
primitive_iterator_t primitive_iterator
generic iterator for all other types
Definition json.hpp:13530
BasicJsonType::object_t::iterator object_iterator
iterator for JSON objects
Definition json.hpp:13526
static constexpr bool value
Definition json.hpp:3975
static constexpr auto value
Definition json.hpp:4043
std::numeric_limits< RealIntegerType > RealLimits
Definition json.hpp:4040
std::numeric_limits< CompatibleNumberIntegerType > CompatibleLimits
Definition json.hpp:4041
typename BasicJsonType::object_t object_t
Definition json.hpp:3891
static constexpr bool value
Definition json.hpp:3894
static constexpr auto value
Definition json.hpp:3941
static constexpr bool value
Definition json.hpp:4063
detail::is_constructible_array_type_impl< BasicJsonType, ConstructibleArrayType, enable_if_t< !std::is_same< ConstructibleArrayType, typename BasicJsonType::value_type >::value &&!is_compatible_string_type< BasicJsonType, ConstructibleArrayType >::value &&is_default_constructible< ConstructibleArrayType >::value &&(std::is_move_assignable< ConstructibleArrayType >::value||std::is_copy_assignable< ConstructibleArrayType >::value)&&is_detected< iterator_t, ConstructibleArrayType >::value &&is_iterator_traits< iterator_traits< detected_t< iterator_t, ConstructibleArrayType > > >::value &&is_detected< range_value_t, ConstructibleArrayType >::value &&!std::is_same< ConstructibleArrayType, detected_t< range_value_t, ConstructibleArrayType > >::value &&is_complete_type< detected_t< range_value_t, ConstructibleArrayType > >::value > >::value_type range_value_t< ConstructibleArrayType > value_type
Definition json.hpp:4012
detail::is_constructible_array_type_impl< BasicJsonType, ConstructibleArrayType, enable_if_t< !std::is_same< ConstructibleArrayType, typename BasicJsonType::value_type >::value &&!is_compatible_string_type< BasicJsonType, ConstructibleArrayType >::value &&is_default_constructible< ConstructibleArrayType >::value &&(std::is_move_assignable< ConstructibleArrayType >::value||std::is_copy_assignable< ConstructibleArrayType >::value)&&is_detected< iterator_t, ConstructibleArrayType >::value &&is_iterator_traits< iterator_traits< detected_t< iterator_t, ConstructibleArrayType > > >::value &&is_detected< range_value_t, ConstructibleArrayType >::value &&!std::is_same< ConstructibleArrayType, detected_t< range_value_t, ConstructibleArrayType > >::value &&is_complete_type< detected_t< range_value_t, ConstructibleArrayType > >::value > >::value static constexpr bool value
Definition json.hpp:4014
typename BasicJsonType::object_t object_t
Definition json.hpp:3915
static constexpr bool value
Definition json.hpp:3917
ConstructibleStringType laundered_type
Definition json.hpp:3952
static constexpr auto value
Definition json.hpp:3955
static constexpr bool value
Definition json.hpp:3658
typename std::iterator_traits< T >::value_type value_type
Definition json.hpp:6836
static constexpr auto value
Definition json.hpp:3838
iterator_traits< T > traits
Definition json.hpp:3835
char x[2]
Definition json.hpp:4161
static one test(decltype(&C::capacity))
char one
Definition json.hpp:4157
@ value
Definition json.hpp:4167
detected_t< result_of_end, t_ref > sentinel
Definition json.hpp:3853
detected_t< result_of_begin, t_ref > iterator
Definition json.hpp:3852
typename std::add_lvalue_reference< T >::type t_ref
Definition json.hpp:3850
static constexpr bool value
Definition json.hpp:3862
static constexpr auto is_iterator_begin
Definition json.hpp:3858
typename BasicJsonType::number_integer_t number_integer_t
Definition json.hpp:9741
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition json.hpp:9742
typename BasicJsonType::binary_t binary_t
Definition json.hpp:9745
typename BasicJsonType::exception exception_t
Definition json.hpp:9746
typename BasicJsonType::string_t string_t
Definition json.hpp:9744
typename BasicJsonType::number_float_t number_float_t
Definition json.hpp:9743
typename BasicJsonType::binary_t binary_t
Definition json.hpp:9714
typename BasicJsonType::exception exception_t
Definition json.hpp:9715
typename BasicJsonType::number_float_t number_float_t
Definition json.hpp:9712
typename BasicJsonType::string_t string_t
Definition json.hpp:9713
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition json.hpp:9711
static constexpr bool value
Definition json.hpp:9718
typename BasicJsonType::number_integer_t number_integer_t
Definition json.hpp:9710
T value_type
Definition json.hpp:3426
T * pointer
Definition json.hpp:3428
ptrdiff_t difference_type
Definition json.hpp:3427
T & reference
Definition json.hpp:3429
std::random_access_iterator_tag iterator_category
Definition json.hpp:3425
typename It::iterator_category iterator_category
Definition json.hpp:3406
typename It::difference_type difference_type
Definition json.hpp:3402
typename It::value_type value_type
Definition json.hpp:3403
typename It::reference reference
Definition json.hpp:3405
typename It::pointer pointer
Definition json.hpp:3404
Default base class of the basic_json class.
Definition json.hpp:14472
void type
Definition json.hpp:267
nonesuch(nonesuch const &&)=delete
void operator=(nonesuch &&)=delete
void operator=(nonesuch const &)=delete
nonesuch(nonesuch const &)=delete
abstract output adapter interface
Definition json.hpp:15631
output_adapter_protocol(const output_adapter_protocol &)=default
virtual ~output_adapter_protocol()=default
virtual void write_character(CharType c)=0
output_adapter_protocol(output_adapter_protocol &&) noexcept=default
output_adapter_protocol()=default
virtual void write_characters(const CharType *s, std::size_t length)=0
struct to capture the start position of the current token
Definition json.hpp:3158
std::size_t chars_read_current_line
the number of characters read in the current line
Definition json.hpp:3162
std::size_t lines_read
the number of lines read
Definition json.hpp:3164
std::size_t chars_read_total
the total number of characters read
Definition json.hpp:3160
static JSON_INLINE_VARIABLE constexpr T value
Definition json.hpp:3335
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:6090
integer_sequence< T, Ints...,(Ints+SeqSize)... > type
Definition json.hpp:3271
integer_sequence< T, Ints...,(Ints+SeqSize)..., 2 *SeqSize > type
Definition json.hpp:3277
integer_sequence< T > type
Definition json.hpp:3292
typename Extend< typename Gen< T, N/2 >::type, N/2, N % 2 >::type type
Definition json.hpp:3285
static constexpr bool test(T val)
Definition json.hpp:4256
static constexpr bool test(T)
Definition json.hpp:4265
static constexpr bool test(T val)
Definition json.hpp:4210
static constexpr bool test(T val)
Definition json.hpp:4230
static constexpr bool test(T val)
Definition json.hpp:4220
static constexpr bool test(T val)
Definition json.hpp:4240
StringType type
Definition json.hpp:14542
Definition json.hpp:14535
T type
Definition json.hpp:14536
SAX interface.
Definition json.hpp:8668
virtual bool binary(binary_t &val)=0
a binary value was read
virtual bool number_float(number_float_t val, const string_t &s)=0
a floating-point number was read
virtual bool number_unsigned(number_unsigned_t val)=0
an unsigned integer number was read
virtual bool key(string_t &val)=0
an object key was read
virtual bool string(string_t &val)=0
a string value was read
virtual bool number_integer(number_integer_t val)=0
an integer number was read
virtual bool start_object(std::size_t elements)=0
the beginning of an object was read
typename BasicJsonType::number_integer_t number_integer_t
Definition json.hpp:8669
typename BasicJsonType::string_t string_t
Definition json.hpp:8672
virtual bool end_array()=0
the end of an array was read
json_sax(const json_sax &)=default
virtual bool boolean(bool val)=0
a boolean value was read
virtual bool end_object()=0
the end of an object was read
typename BasicJsonType::number_float_t number_float_t
Definition json.hpp:8671
virtual bool null()=0
a null value was read
typename BasicJsonType::number_unsigned_t number_unsigned_t
Definition json.hpp:8670
json_sax(json_sax &&) noexcept=default
typename BasicJsonType::binary_t binary_t
Definition json.hpp:8673
virtual bool parse_error(std::size_t position, const std::string &last_token, const detail::exception &ex)=0
a parse error occurred
virtual bool start_array(std::size_t elements)=0
the beginning of an array was read
a minimal map-like container that preserves insertion order
Definition json.hpp:19732
std::vector< std::pair< const Key, T >, Allocator > Container
Definition json.hpp:19735
std::pair< iterator, bool > insert(value_type &&value)
Definition json.hpp:20026
typename Container::value_type value_type
Definition json.hpp:19739
std::equal_to< Key > key_compare
Definition json.hpp:19743
iterator erase(iterator pos)
Definition json.hpp:19904
T mapped_type
Definition json.hpp:19734
ordered_map(const Allocator &alloc) noexcept(noexcept(Container(alloc)))
Definition json.hpp:19749
T & operator[](KeyType &&key)
Definition json.hpp:19791
typename Container::iterator iterator
Definition json.hpp:19736
const T & at(KeyType &&key) const
Definition json.hpp:19851
T & at(KeyType &&key)
Definition json.hpp:19823
const T & operator[](KeyType &&key) const
Definition json.hpp:19803
iterator find(const key_type &key)
Definition json.hpp:19988
iterator erase(iterator first, iterator last)
Definition json.hpp:19909
const T & at(const key_type &key) const
Definition json.hpp:19836
const_iterator find(const key_type &key) const
Definition json.hpp:20014
T & operator[](const key_type &key)
Definition json.hpp:19784
size_type erase(KeyType &&key)
Definition json.hpp:19885
typename Container::size_type size_type
Definition json.hpp:19738
ordered_map() noexcept(noexcept(Container()))
Definition json.hpp:19748
void insert(InputIt first, InputIt last)
Definition json.hpp:20049
size_type count(const key_type &key) const
Definition json.hpp:19962
std::pair< iterator, bool > emplace(KeyType &&key, T &&t)
Definition json.hpp:19771
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:20045
size_type erase(const key_type &key)
Definition json.hpp:19864
ordered_map(std::initializer_list< value_type > init, const Allocator &alloc=Allocator())
Definition json.hpp:19753
std::pair< iterator, bool > insert(const value_type &value)
Definition json.hpp:20031
size_type count(KeyType &&key) const
Definition json.hpp:19976
Key key_type
Definition json.hpp:19733
ordered_map(It first, It last, const Allocator &alloc=Allocator())
Definition json.hpp:19751
const T & operator[](const key_type &key) const
Definition json.hpp:19796
JSON_NO_UNIQUE_ADDRESS key_compare m_compare
Definition json.hpp:20058
iterator find(KeyType &&key)
Definition json.hpp:20002
T & at(const key_type &key)
Definition json.hpp:19808
typename Container::const_iterator const_iterator
Definition json.hpp:19737
std::pair< iterator, bool > emplace(const key_type &key, T &&t)
Definition json.hpp:19756
std::size_t operator()(const nlohmann::NLOHMANN_BASIC_JSON_TPL &j) const
Definition json.hpp:25251
bool operator()(::nlohmann::detail::value_t lhs, ::nlohmann::detail::value_t rhs) const noexcept
compare two value_t enum values
Definition json.hpp:25265