30 #ifndef INCLUDE_NLOHMANN_JSON_HPP_ 31 #define INCLUDE_NLOHMANN_JSON_HPP_ 33 #define NLOHMANN_JSON_VERSION_MAJOR 3 34 #define NLOHMANN_JSON_VERSION_MINOR 9 35 #define NLOHMANN_JSON_VERSION_PATCH 1 40 #include <initializer_list> 59 #include <forward_list> 64 #include <type_traits> 65 #include <unordered_map> 96 constexpr
operator size_t()
const 122 #if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 14) 123 #if defined(JSON_HEDLEY_VERSION) 124 #undef JSON_HEDLEY_VERSION 126 #define JSON_HEDLEY_VERSION 14 128 #if defined(JSON_HEDLEY_STRINGIFY_EX) 129 #undef JSON_HEDLEY_STRINGIFY_EX 131 #define JSON_HEDLEY_STRINGIFY_EX(x) #x 133 #if defined(JSON_HEDLEY_STRINGIFY) 134 #undef JSON_HEDLEY_STRINGIFY 136 #define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x) 138 #if defined(JSON_HEDLEY_CONCAT_EX) 139 #undef JSON_HEDLEY_CONCAT_EX 141 #define JSON_HEDLEY_CONCAT_EX(a,b) a##b 143 #if defined(JSON_HEDLEY_CONCAT) 144 #undef JSON_HEDLEY_CONCAT 146 #define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b) 148 #if defined(JSON_HEDLEY_CONCAT3_EX) 149 #undef JSON_HEDLEY_CONCAT3_EX 151 #define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c 153 #if defined(JSON_HEDLEY_CONCAT3) 154 #undef JSON_HEDLEY_CONCAT3 156 #define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c) 158 #if defined(JSON_HEDLEY_VERSION_ENCODE) 159 #undef JSON_HEDLEY_VERSION_ENCODE 161 #define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision)) 163 #if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR) 164 #undef JSON_HEDLEY_VERSION_DECODE_MAJOR 166 #define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000) 168 #if defined(JSON_HEDLEY_VERSION_DECODE_MINOR) 169 #undef JSON_HEDLEY_VERSION_DECODE_MINOR 171 #define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000) 173 #if defined(JSON_HEDLEY_VERSION_DECODE_REVISION) 174 #undef JSON_HEDLEY_VERSION_DECODE_REVISION 176 #define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000) 178 #if defined(JSON_HEDLEY_GNUC_VERSION) 179 #undef JSON_HEDLEY_GNUC_VERSION 181 #if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) 182 #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) 183 #elif defined(__GNUC__) 184 #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) 187 #if defined(JSON_HEDLEY_GNUC_VERSION_CHECK) 188 #undef JSON_HEDLEY_GNUC_VERSION_CHECK 190 #if defined(JSON_HEDLEY_GNUC_VERSION) 191 #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 193 #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0) 196 #if defined(JSON_HEDLEY_MSVC_VERSION) 197 #undef JSON_HEDLEY_MSVC_VERSION 199 #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL) 200 #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100) 201 #elif defined(_MSC_FULL_VER) && !defined(__ICL) 202 #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10) 203 #elif defined(_MSC_VER) && !defined(__ICL) 204 #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) 207 #if defined(JSON_HEDLEY_MSVC_VERSION_CHECK) 208 #undef JSON_HEDLEY_MSVC_VERSION_CHECK 210 #if !defined(JSON_HEDLEY_MSVC_VERSION) 211 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0) 212 #elif defined(_MSC_VER) && (_MSC_VER >= 1400) 213 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) 214 #elif defined(_MSC_VER) && (_MSC_VER >= 1200) 215 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) 217 #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor))) 220 #if defined(JSON_HEDLEY_INTEL_VERSION) 221 #undef JSON_HEDLEY_INTEL_VERSION 223 #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL) 224 #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE) 225 #elif defined(__INTEL_COMPILER) && !defined(__ICL) 226 #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) 229 #if defined(JSON_HEDLEY_INTEL_VERSION_CHECK) 230 #undef JSON_HEDLEY_INTEL_VERSION_CHECK 232 #if defined(JSON_HEDLEY_INTEL_VERSION) 233 #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 235 #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0) 238 #if defined(JSON_HEDLEY_INTEL_CL_VERSION) 239 #undef JSON_HEDLEY_INTEL_CL_VERSION 241 #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL) 242 #define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0) 245 #if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK) 246 #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK 248 #if defined(JSON_HEDLEY_INTEL_CL_VERSION) 249 #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 251 #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0) 254 #if defined(JSON_HEDLEY_PGI_VERSION) 255 #undef JSON_HEDLEY_PGI_VERSION 257 #if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__) 258 #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) 261 #if defined(JSON_HEDLEY_PGI_VERSION_CHECK) 262 #undef JSON_HEDLEY_PGI_VERSION_CHECK 264 #if defined(JSON_HEDLEY_PGI_VERSION) 265 #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 267 #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0) 270 #if defined(JSON_HEDLEY_SUNPRO_VERSION) 271 #undef JSON_HEDLEY_SUNPRO_VERSION 273 #if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) 274 #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) 275 #elif defined(__SUNPRO_C) 276 #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf) 277 #elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) 278 #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) 279 #elif defined(__SUNPRO_CC) 280 #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf) 283 #if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK) 284 #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK 286 #if defined(JSON_HEDLEY_SUNPRO_VERSION) 287 #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 289 #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0) 292 #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) 293 #undef JSON_HEDLEY_EMSCRIPTEN_VERSION 295 #if defined(__EMSCRIPTEN__) 296 #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__) 299 #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK) 300 #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK 302 #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) 303 #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 305 #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0) 308 #if defined(JSON_HEDLEY_ARM_VERSION) 309 #undef JSON_HEDLEY_ARM_VERSION 311 #if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) 312 #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100) 313 #elif defined(__CC_ARM) && defined(__ARMCC_VERSION) 314 #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100) 317 #if defined(JSON_HEDLEY_ARM_VERSION_CHECK) 318 #undef JSON_HEDLEY_ARM_VERSION_CHECK 320 #if defined(JSON_HEDLEY_ARM_VERSION) 321 #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 323 #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0) 326 #if defined(JSON_HEDLEY_IBM_VERSION) 327 #undef JSON_HEDLEY_IBM_VERSION 329 #if defined(__ibmxl__) 330 #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__) 331 #elif defined(__xlC__) && defined(__xlC_ver__) 332 #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff) 333 #elif defined(__xlC__) 334 #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) 337 #if defined(JSON_HEDLEY_IBM_VERSION_CHECK) 338 #undef JSON_HEDLEY_IBM_VERSION_CHECK 340 #if defined(JSON_HEDLEY_IBM_VERSION) 341 #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 343 #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0) 346 #if defined(JSON_HEDLEY_TI_VERSION) 347 #undef JSON_HEDLEY_TI_VERSION 350 defined(__TI_COMPILER_VERSION__) && \ 352 defined(__TMS470__) || defined(__TI_ARM__) || \ 353 defined(__MSP430__) || \ 354 defined(__TMS320C2000__) \ 356 #if (__TI_COMPILER_VERSION__ >= 16000000) 357 #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) 361 #if defined(JSON_HEDLEY_TI_VERSION_CHECK) 362 #undef JSON_HEDLEY_TI_VERSION_CHECK 364 #if defined(JSON_HEDLEY_TI_VERSION) 365 #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 367 #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0) 370 #if defined(JSON_HEDLEY_TI_CL2000_VERSION) 371 #undef JSON_HEDLEY_TI_CL2000_VERSION 373 #if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__) 374 #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) 377 #if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK) 378 #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK 380 #if defined(JSON_HEDLEY_TI_CL2000_VERSION) 381 #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 383 #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0) 386 #if defined(JSON_HEDLEY_TI_CL430_VERSION) 387 #undef JSON_HEDLEY_TI_CL430_VERSION 389 #if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) 390 #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) 393 #if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK) 394 #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK 396 #if defined(JSON_HEDLEY_TI_CL430_VERSION) 397 #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 399 #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0) 402 #if defined(JSON_HEDLEY_TI_ARMCL_VERSION) 403 #undef JSON_HEDLEY_TI_ARMCL_VERSION 405 #if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__)) 406 #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) 409 #if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK) 410 #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK 412 #if defined(JSON_HEDLEY_TI_ARMCL_VERSION) 413 #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 415 #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0) 418 #if defined(JSON_HEDLEY_TI_CL6X_VERSION) 419 #undef JSON_HEDLEY_TI_CL6X_VERSION 421 #if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__) 422 #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) 425 #if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK) 426 #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK 428 #if defined(JSON_HEDLEY_TI_CL6X_VERSION) 429 #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 431 #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0) 434 #if defined(JSON_HEDLEY_TI_CL7X_VERSION) 435 #undef JSON_HEDLEY_TI_CL7X_VERSION 437 #if defined(__TI_COMPILER_VERSION__) && defined(__C7000__) 438 #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) 441 #if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK) 442 #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK 444 #if defined(JSON_HEDLEY_TI_CL7X_VERSION) 445 #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 447 #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0) 450 #if defined(JSON_HEDLEY_TI_CLPRU_VERSION) 451 #undef JSON_HEDLEY_TI_CLPRU_VERSION 453 #if defined(__TI_COMPILER_VERSION__) && defined(__PRU__) 454 #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) 457 #if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK) 458 #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK 460 #if defined(JSON_HEDLEY_TI_CLPRU_VERSION) 461 #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 463 #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0) 466 #if defined(JSON_HEDLEY_CRAY_VERSION) 467 #undef JSON_HEDLEY_CRAY_VERSION 470 #if defined(_RELEASE_PATCHLEVEL) 471 #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL) 473 #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) 477 #if defined(JSON_HEDLEY_CRAY_VERSION_CHECK) 478 #undef JSON_HEDLEY_CRAY_VERSION_CHECK 480 #if defined(JSON_HEDLEY_CRAY_VERSION) 481 #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 483 #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0) 486 #if defined(JSON_HEDLEY_IAR_VERSION) 487 #undef JSON_HEDLEY_IAR_VERSION 489 #if defined(__IAR_SYSTEMS_ICC__) 491 #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000)) 493 #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(VER / 100, __VER__ % 100, 0) 497 #if defined(JSON_HEDLEY_IAR_VERSION_CHECK) 498 #undef JSON_HEDLEY_IAR_VERSION_CHECK 500 #if defined(JSON_HEDLEY_IAR_VERSION) 501 #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 503 #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0) 506 #if defined(JSON_HEDLEY_TINYC_VERSION) 507 #undef JSON_HEDLEY_TINYC_VERSION 509 #if defined(__TINYC__) 510 #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100) 513 #if defined(JSON_HEDLEY_TINYC_VERSION_CHECK) 514 #undef JSON_HEDLEY_TINYC_VERSION_CHECK 516 #if defined(JSON_HEDLEY_TINYC_VERSION) 517 #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 519 #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0) 522 #if defined(JSON_HEDLEY_DMC_VERSION) 523 #undef JSON_HEDLEY_DMC_VERSION 526 #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf) 529 #if defined(JSON_HEDLEY_DMC_VERSION_CHECK) 530 #undef JSON_HEDLEY_DMC_VERSION_CHECK 532 #if defined(JSON_HEDLEY_DMC_VERSION) 533 #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 535 #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0) 538 #if defined(JSON_HEDLEY_COMPCERT_VERSION) 539 #undef JSON_HEDLEY_COMPCERT_VERSION 541 #if defined(__COMPCERT_VERSION__) 542 #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100) 545 #if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK) 546 #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK 548 #if defined(JSON_HEDLEY_COMPCERT_VERSION) 549 #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 551 #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0) 554 #if defined(JSON_HEDLEY_PELLES_VERSION) 555 #undef JSON_HEDLEY_PELLES_VERSION 557 #if defined(__POCC__) 558 #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) 561 #if defined(JSON_HEDLEY_PELLES_VERSION_CHECK) 562 #undef JSON_HEDLEY_PELLES_VERSION_CHECK 564 #if defined(JSON_HEDLEY_PELLES_VERSION) 565 #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 567 #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0) 570 #if defined(JSON_HEDLEY_GCC_VERSION) 571 #undef JSON_HEDLEY_GCC_VERSION 574 defined(JSON_HEDLEY_GNUC_VERSION) && \ 575 !defined(__clang__) && \ 576 !defined(JSON_HEDLEY_INTEL_VERSION) && \ 577 !defined(JSON_HEDLEY_PGI_VERSION) && \ 578 !defined(JSON_HEDLEY_ARM_VERSION) && \ 579 !defined(JSON_HEDLEY_TI_VERSION) && \ 580 !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \ 581 !defined(JSON_HEDLEY_TI_CL430_VERSION) && \ 582 !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \ 583 !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \ 584 !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \ 585 !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \ 586 !defined(__COMPCERT__) 587 #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION 590 #if defined(JSON_HEDLEY_GCC_VERSION_CHECK) 591 #undef JSON_HEDLEY_GCC_VERSION_CHECK 593 #if defined(JSON_HEDLEY_GCC_VERSION) 594 #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) 596 #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0) 599 #if defined(JSON_HEDLEY_HAS_ATTRIBUTE) 600 #undef JSON_HEDLEY_HAS_ATTRIBUTE 602 #if defined(__has_attribute) 603 #define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) 605 #define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0) 608 #if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE) 609 #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE 611 #if defined(__has_attribute) 612 #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) __has_attribute(attribute) 614 #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) 617 #if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE) 618 #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE 620 #if defined(__has_attribute) 621 #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) __has_attribute(attribute) 623 #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) 626 #if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE) 627 #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE 630 defined(__has_cpp_attribute) && \ 631 defined(__cplusplus) && \ 632 (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) 633 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute) 635 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0) 638 #if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS) 639 #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS 641 #if !defined(__cplusplus) || !defined(__has_cpp_attribute) 642 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) 644 !defined(JSON_HEDLEY_PGI_VERSION) && \ 645 !defined(JSON_HEDLEY_IAR_VERSION) && \ 646 (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \ 647 (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0)) 648 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) 650 #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) 653 #if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE) 654 #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE 656 #if defined(__has_cpp_attribute) && defined(__cplusplus) 657 #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) 659 #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) 662 #if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE) 663 #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE 665 #if defined(__has_cpp_attribute) && defined(__cplusplus) 666 #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) 668 #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) 671 #if defined(JSON_HEDLEY_HAS_BUILTIN) 672 #undef JSON_HEDLEY_HAS_BUILTIN 674 #if defined(__has_builtin) 675 #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin) 677 #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0) 680 #if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN) 681 #undef JSON_HEDLEY_GNUC_HAS_BUILTIN 683 #if defined(__has_builtin) 684 #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) 686 #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) 689 #if defined(JSON_HEDLEY_GCC_HAS_BUILTIN) 690 #undef JSON_HEDLEY_GCC_HAS_BUILTIN 692 #if defined(__has_builtin) 693 #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) 695 #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) 698 #if defined(JSON_HEDLEY_HAS_FEATURE) 699 #undef JSON_HEDLEY_HAS_FEATURE 701 #if defined(__has_feature) 702 #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature) 704 #define JSON_HEDLEY_HAS_FEATURE(feature) (0) 707 #if defined(JSON_HEDLEY_GNUC_HAS_FEATURE) 708 #undef JSON_HEDLEY_GNUC_HAS_FEATURE 710 #if defined(__has_feature) 711 #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) 713 #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) 716 #if defined(JSON_HEDLEY_GCC_HAS_FEATURE) 717 #undef JSON_HEDLEY_GCC_HAS_FEATURE 719 #if defined(__has_feature) 720 #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) 722 #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) 725 #if defined(JSON_HEDLEY_HAS_EXTENSION) 726 #undef JSON_HEDLEY_HAS_EXTENSION 728 #if defined(__has_extension) 729 #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension) 731 #define JSON_HEDLEY_HAS_EXTENSION(extension) (0) 734 #if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION) 735 #undef JSON_HEDLEY_GNUC_HAS_EXTENSION 737 #if defined(__has_extension) 738 #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) 740 #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) 743 #if defined(JSON_HEDLEY_GCC_HAS_EXTENSION) 744 #undef JSON_HEDLEY_GCC_HAS_EXTENSION 746 #if defined(__has_extension) 747 #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) 749 #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) 752 #if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE) 753 #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE 755 #if defined(__has_declspec_attribute) 756 #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute) 758 #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0) 761 #if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE) 762 #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE 764 #if defined(__has_declspec_attribute) 765 #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) 767 #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) 770 #if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) 771 #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE 773 #if defined(__has_declspec_attribute) 774 #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) 776 #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) 779 #if defined(JSON_HEDLEY_HAS_WARNING) 780 #undef JSON_HEDLEY_HAS_WARNING 782 #if defined(__has_warning) 783 #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning) 785 #define JSON_HEDLEY_HAS_WARNING(warning) (0) 788 #if defined(JSON_HEDLEY_GNUC_HAS_WARNING) 789 #undef JSON_HEDLEY_GNUC_HAS_WARNING 791 #if defined(__has_warning) 792 #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) 794 #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) 797 #if defined(JSON_HEDLEY_GCC_HAS_WARNING) 798 #undef JSON_HEDLEY_GCC_HAS_WARNING 800 #if defined(__has_warning) 801 #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) 803 #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) 807 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ 808 defined(__clang__) || \ 809 JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ 810 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 811 JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ 812 JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ 813 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 814 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 815 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ 816 JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ 817 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ 818 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \ 819 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 820 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ 821 JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \ 822 JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \ 823 JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \ 824 (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR)) 825 #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value) 826 #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) 827 #define JSON_HEDLEY_PRAGMA(value) __pragma(value) 829 #define JSON_HEDLEY_PRAGMA(value) 832 #if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH) 833 #undef JSON_HEDLEY_DIAGNOSTIC_PUSH 835 #if defined(JSON_HEDLEY_DIAGNOSTIC_POP) 836 #undef JSON_HEDLEY_DIAGNOSTIC_POP 838 #if defined(__clang__) 839 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") 840 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") 841 #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) 842 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") 843 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") 844 #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) 845 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") 846 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") 848 JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ 849 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 850 #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push)) 851 #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop)) 852 #elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) 853 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push") 854 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop") 856 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 857 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 858 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \ 859 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ 860 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 861 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 862 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push") 863 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop") 864 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) 865 #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") 866 #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") 868 #define JSON_HEDLEY_DIAGNOSTIC_PUSH 869 #define JSON_HEDLEY_DIAGNOSTIC_POP 874 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) 875 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ 877 #if defined(__cplusplus) 878 # if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat") 879 # if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions") 880 # if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions") 881 # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ 882 JSON_HEDLEY_DIAGNOSTIC_PUSH \ 883 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ 884 _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ 885 _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \ 887 JSON_HEDLEY_DIAGNOSTIC_POP 889 # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ 890 JSON_HEDLEY_DIAGNOSTIC_PUSH \ 891 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ 892 _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ 894 JSON_HEDLEY_DIAGNOSTIC_POP 897 # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ 898 JSON_HEDLEY_DIAGNOSTIC_PUSH \ 899 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ 901 JSON_HEDLEY_DIAGNOSTIC_POP 905 #if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) 906 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x 909 #if defined(JSON_HEDLEY_CONST_CAST) 910 #undef JSON_HEDLEY_CONST_CAST 912 #if defined(__cplusplus) 913 # define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast<T>(expr)) 915 JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ 916 JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ 917 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) 918 # define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ 919 JSON_HEDLEY_DIAGNOSTIC_PUSH \ 920 JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ 922 JSON_HEDLEY_DIAGNOSTIC_POP \ 925 # define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr)) 928 #if defined(JSON_HEDLEY_REINTERPRET_CAST) 929 #undef JSON_HEDLEY_REINTERPRET_CAST 931 #if defined(__cplusplus) 932 #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast<T>(expr)) 934 #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr)) 937 #if defined(JSON_HEDLEY_STATIC_CAST) 938 #undef JSON_HEDLEY_STATIC_CAST 940 #if defined(__cplusplus) 941 #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast<T>(expr)) 943 #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) 946 #if defined(JSON_HEDLEY_CPP_CAST) 947 #undef JSON_HEDLEY_CPP_CAST 949 #if defined(__cplusplus) 950 # if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast") 951 # define JSON_HEDLEY_CPP_CAST(T, expr) \ 952 JSON_HEDLEY_DIAGNOSTIC_PUSH \ 953 _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \ 955 JSON_HEDLEY_DIAGNOSTIC_POP 956 # elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0) 957 # define JSON_HEDLEY_CPP_CAST(T, expr) \ 958 JSON_HEDLEY_DIAGNOSTIC_PUSH \ 959 _Pragma("diag_suppress=Pe137") \ 960 JSON_HEDLEY_DIAGNOSTIC_POP 962 # define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr)) 965 # define JSON_HEDLEY_CPP_CAST(T, expr) (expr) 968 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) 969 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED 971 #if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") 972 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") 973 #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) 974 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") 975 #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 976 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786)) 977 #elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) 978 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445") 979 #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) 980 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") 981 #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) 982 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") 983 #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) 984 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) 986 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 987 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 988 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 989 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 990 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 991 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 992 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 993 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 994 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 995 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 996 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 997 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") 998 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) 999 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") 1000 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) 1001 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") 1002 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) 1003 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") 1004 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) 1005 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") 1007 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED 1010 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) 1011 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS 1013 #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") 1014 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") 1015 #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) 1016 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") 1017 #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1018 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161)) 1019 #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) 1020 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") 1021 #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) 1022 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") 1023 #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) 1024 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068)) 1026 JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \ 1027 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ 1028 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1029 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) 1030 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") 1031 #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) 1032 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") 1033 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) 1034 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161") 1036 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS 1039 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES) 1040 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES 1042 #if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes") 1043 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"") 1044 #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) 1045 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") 1046 #elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) 1047 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)") 1048 #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1049 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292)) 1050 #elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0) 1051 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030)) 1052 #elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) 1053 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098") 1054 #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) 1055 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") 1056 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus) 1057 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)") 1059 JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ 1060 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ 1061 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) 1062 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173") 1063 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) 1064 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097") 1066 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES 1069 #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL) 1070 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL 1072 #if JSON_HEDLEY_HAS_WARNING("-Wcast-qual") 1073 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"") 1074 #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) 1075 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)") 1076 #elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) 1077 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") 1079 #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL 1082 #if defined(JSON_HEDLEY_DEPRECATED) 1083 #undef JSON_HEDLEY_DEPRECATED 1085 #if defined(JSON_HEDLEY_DEPRECATED_FOR) 1086 #undef JSON_HEDLEY_DEPRECATED_FOR 1089 JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ 1090 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1091 #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) 1092 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) 1094 JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) || \ 1095 JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ 1096 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1097 JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ 1098 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \ 1099 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ 1100 JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ 1101 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \ 1102 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ 1103 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1104 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) 1105 #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since))) 1106 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) 1107 #elif defined(__cplusplus) && (__cplusplus >= 201402L) 1108 #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]]) 1109 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]]) 1111 JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \ 1112 JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ 1113 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1114 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1115 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1116 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1117 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1118 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1119 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1120 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1121 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1122 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1123 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1124 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 1125 #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) 1126 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__)) 1128 JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ 1129 JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \ 1130 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1131 #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated) 1132 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated) 1133 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) 1134 #define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated") 1135 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated") 1137 #define JSON_HEDLEY_DEPRECATED(since) 1138 #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) 1141 #if defined(JSON_HEDLEY_UNAVAILABLE) 1142 #undef JSON_HEDLEY_UNAVAILABLE 1145 JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \ 1146 JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \ 1147 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) 1148 #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since))) 1150 #define JSON_HEDLEY_UNAVAILABLE(available_since) 1153 #if defined(JSON_HEDLEY_WARN_UNUSED_RESULT) 1154 #undef JSON_HEDLEY_WARN_UNUSED_RESULT 1156 #if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG) 1157 #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG 1160 JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ 1161 JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ 1162 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1163 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1164 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1165 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1166 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1167 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1168 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1169 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1170 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1171 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1172 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1173 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ 1174 (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ 1175 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) 1176 #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) 1177 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__)) 1178 #elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L) 1179 #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) 1180 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]]) 1181 #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) 1182 #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) 1183 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) 1184 #elif defined(_Check_return_) 1185 #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_ 1186 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_ 1188 #define JSON_HEDLEY_WARN_UNUSED_RESULT 1189 #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) 1192 #if defined(JSON_HEDLEY_SENTINEL) 1193 #undef JSON_HEDLEY_SENTINEL 1196 JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \ 1197 JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ 1198 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1199 JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) 1200 #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position))) 1202 #define JSON_HEDLEY_SENTINEL(position) 1205 #if defined(JSON_HEDLEY_NO_RETURN) 1206 #undef JSON_HEDLEY_NO_RETURN 1208 #if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) 1209 #define JSON_HEDLEY_NO_RETURN __noreturn 1210 #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) 1211 #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) 1212 #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L 1213 #define JSON_HEDLEY_NO_RETURN _Noreturn 1214 #elif defined(__cplusplus) && (__cplusplus >= 201103L) 1215 #define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]]) 1217 JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \ 1218 JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \ 1219 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ 1220 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1221 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ 1222 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1223 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1224 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1225 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1226 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1227 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1228 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1229 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1230 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1231 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1232 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 1233 #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) 1234 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) 1235 #define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return") 1237 JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ 1238 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1239 #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) 1240 #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) 1241 #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;") 1242 #elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) 1243 #define JSON_HEDLEY_NO_RETURN __attribute((noreturn)) 1244 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) 1245 #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) 1247 #define JSON_HEDLEY_NO_RETURN 1250 #if defined(JSON_HEDLEY_NO_ESCAPE) 1251 #undef JSON_HEDLEY_NO_ESCAPE 1253 #if JSON_HEDLEY_HAS_ATTRIBUTE(noescape) 1254 #define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__)) 1256 #define JSON_HEDLEY_NO_ESCAPE 1259 #if defined(JSON_HEDLEY_UNREACHABLE) 1260 #undef JSON_HEDLEY_UNREACHABLE 1262 #if defined(JSON_HEDLEY_UNREACHABLE_RETURN) 1263 #undef JSON_HEDLEY_UNREACHABLE_RETURN 1265 #if defined(JSON_HEDLEY_ASSUME) 1266 #undef JSON_HEDLEY_ASSUME 1269 JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ 1270 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1271 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1272 #define JSON_HEDLEY_ASSUME(expr) __assume(expr) 1273 #elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume) 1274 #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr) 1276 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ 1277 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) 1278 #if defined(__cplusplus) 1279 #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr) 1281 #define JSON_HEDLEY_ASSUME(expr) _nassert(expr) 1285 (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \ 1286 JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ 1287 JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \ 1288 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1289 JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) 1290 #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable() 1291 #elif defined(JSON_HEDLEY_ASSUME) 1292 #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) 1294 #if !defined(JSON_HEDLEY_ASSUME) 1295 #if defined(JSON_HEDLEY_UNREACHABLE) 1296 #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1))) 1298 #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr) 1301 #if defined(JSON_HEDLEY_UNREACHABLE) 1303 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ 1304 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) 1305 #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value)) 1307 #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE() 1310 #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value) 1312 #if !defined(JSON_HEDLEY_UNREACHABLE) 1313 #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) 1317 #if JSON_HEDLEY_HAS_WARNING("-Wpedantic") 1318 #pragma clang diagnostic ignored "-Wpedantic" 1320 #if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus) 1321 #pragma clang diagnostic ignored "-Wc++98-compat-pedantic" 1323 #if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0) 1324 #if defined(__clang__) 1325 #pragma clang diagnostic ignored "-Wvariadic-macros" 1326 #elif defined(JSON_HEDLEY_GCC_VERSION) 1327 #pragma GCC diagnostic ignored "-Wvariadic-macros" 1330 #if defined(JSON_HEDLEY_NON_NULL) 1331 #undef JSON_HEDLEY_NON_NULL 1334 JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \ 1335 JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ 1336 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1337 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) 1338 #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__))) 1340 #define JSON_HEDLEY_NON_NULL(...) 1344 #if defined(JSON_HEDLEY_PRINTF_FORMAT) 1345 #undef JSON_HEDLEY_PRINTF_FORMAT 1347 #if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO) 1348 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check))) 1349 #elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO) 1350 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check))) 1352 JSON_HEDLEY_HAS_ATTRIBUTE(format) || \ 1353 JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ 1354 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1355 JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ 1356 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ 1357 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1358 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1359 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1360 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1361 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1362 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1363 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1364 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1365 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1366 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1367 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 1368 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) 1369 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0) 1370 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check)) 1372 #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) 1375 #if defined(JSON_HEDLEY_CONSTEXPR) 1376 #undef JSON_HEDLEY_CONSTEXPR 1378 #if defined(__cplusplus) 1379 #if __cplusplus >= 201103L 1380 #define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr) 1383 #if !defined(JSON_HEDLEY_CONSTEXPR) 1384 #define JSON_HEDLEY_CONSTEXPR 1387 #if defined(JSON_HEDLEY_PREDICT) 1388 #undef JSON_HEDLEY_PREDICT 1390 #if defined(JSON_HEDLEY_LIKELY) 1391 #undef JSON_HEDLEY_LIKELY 1393 #if defined(JSON_HEDLEY_UNLIKELY) 1394 #undef JSON_HEDLEY_UNLIKELY 1396 #if defined(JSON_HEDLEY_UNPREDICTABLE) 1397 #undef JSON_HEDLEY_UNPREDICTABLE 1399 #if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable) 1400 #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr)) 1403 (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \ 1404 JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) 1405 # define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability)) 1406 # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability)) 1407 # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability)) 1408 # define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 ) 1409 # define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 ) 1411 (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ 1412 JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ 1413 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1414 (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ 1415 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1416 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ 1417 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1418 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ 1419 JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ 1420 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ 1421 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ 1422 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1423 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ 1424 JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \ 1425 JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) 1426 # define JSON_HEDLEY_PREDICT(expr, expected, probability) \ 1427 (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))) 1428 # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ 1430 double hedley_probability_ = (probability); \ 1431 ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ 1433 # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ 1435 double hedley_probability_ = (probability); \ 1436 ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ 1438 # define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) 1439 # define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) 1441 # define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)) 1442 # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr)) 1443 # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) 1444 # define JSON_HEDLEY_LIKELY(expr) (!!(expr)) 1445 # define JSON_HEDLEY_UNLIKELY(expr) (!!(expr)) 1447 #if !defined(JSON_HEDLEY_UNPREDICTABLE) 1448 #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5) 1451 #if defined(JSON_HEDLEY_MALLOC) 1452 #undef JSON_HEDLEY_MALLOC 1455 JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \ 1456 JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ 1457 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1458 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ 1459 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1460 JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ 1461 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1462 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1463 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1464 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1465 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1466 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1467 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1468 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1469 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1470 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1471 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 1472 #define JSON_HEDLEY_MALLOC __attribute__((__malloc__)) 1473 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) 1474 #define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory") 1476 JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ 1477 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1478 #define JSON_HEDLEY_MALLOC __declspec(restrict) 1480 #define JSON_HEDLEY_MALLOC 1483 #if defined(JSON_HEDLEY_PURE) 1484 #undef JSON_HEDLEY_PURE 1487 JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \ 1488 JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ 1489 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1490 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ 1491 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1492 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ 1493 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1494 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1495 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1496 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1497 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1498 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1499 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1500 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1501 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1502 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1503 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ 1504 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) 1505 # define JSON_HEDLEY_PURE __attribute__((__pure__)) 1506 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) 1507 # define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data") 1508 #elif defined(__cplusplus) && \ 1510 JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ 1511 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \ 1512 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \ 1514 # define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;") 1516 # define JSON_HEDLEY_PURE 1519 #if defined(JSON_HEDLEY_CONST) 1520 #undef JSON_HEDLEY_CONST 1523 JSON_HEDLEY_HAS_ATTRIBUTE(const) || \ 1524 JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \ 1525 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1526 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ 1527 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1528 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ 1529 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1530 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1531 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1532 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1533 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1534 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1535 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1536 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1537 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1538 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1539 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ 1540 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) 1541 #define JSON_HEDLEY_CONST __attribute__((__const__)) 1543 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) 1544 #define JSON_HEDLEY_CONST _Pragma("no_side_effect") 1546 #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE 1549 #if defined(JSON_HEDLEY_RESTRICT) 1550 #undef JSON_HEDLEY_RESTRICT 1552 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) 1553 #define JSON_HEDLEY_RESTRICT restrict 1555 JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ 1556 JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ 1557 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1558 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ 1559 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1560 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ 1561 JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ 1562 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1563 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \ 1564 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ 1565 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1566 (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \ 1567 JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ 1569 #define JSON_HEDLEY_RESTRICT __restrict 1570 #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus) 1571 #define JSON_HEDLEY_RESTRICT _Restrict 1573 #define JSON_HEDLEY_RESTRICT 1576 #if defined(JSON_HEDLEY_INLINE) 1577 #undef JSON_HEDLEY_INLINE 1580 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ 1581 (defined(__cplusplus) && (__cplusplus >= 199711L)) 1582 #define JSON_HEDLEY_INLINE inline 1584 defined(JSON_HEDLEY_GCC_VERSION) || \ 1585 JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0) 1586 #define JSON_HEDLEY_INLINE __inline__ 1588 JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ 1589 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ 1590 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1591 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \ 1592 JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ 1593 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ 1594 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ 1595 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1596 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 1597 #define JSON_HEDLEY_INLINE __inline 1599 #define JSON_HEDLEY_INLINE 1602 #if defined(JSON_HEDLEY_ALWAYS_INLINE) 1603 #undef JSON_HEDLEY_ALWAYS_INLINE 1606 JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \ 1607 JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ 1608 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1609 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ 1610 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1611 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ 1612 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1613 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1614 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1615 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1616 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1617 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1618 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1619 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1620 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1621 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1622 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 1623 # define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE 1625 JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ 1626 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1627 # define JSON_HEDLEY_ALWAYS_INLINE __forceinline 1628 #elif defined(__cplusplus) && \ 1630 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1631 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1632 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1633 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ 1634 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1635 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \ 1637 # define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") 1638 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) 1639 # define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") 1641 # define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE 1644 #if defined(JSON_HEDLEY_NEVER_INLINE) 1645 #undef JSON_HEDLEY_NEVER_INLINE 1648 JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \ 1649 JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ 1650 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1651 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ 1652 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1653 JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ 1654 JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1655 (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1656 JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1657 (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1658 JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1659 (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1660 JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1661 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1662 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1663 JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1664 JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 1665 #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__)) 1667 JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ 1668 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1669 #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) 1670 #elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0) 1671 #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline") 1672 #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) 1673 #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;") 1674 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) 1675 #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never") 1676 #elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) 1677 #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline)) 1678 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) 1679 #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) 1681 #define JSON_HEDLEY_NEVER_INLINE 1684 #if defined(JSON_HEDLEY_PRIVATE) 1685 #undef JSON_HEDLEY_PRIVATE 1687 #if defined(JSON_HEDLEY_PUBLIC) 1688 #undef JSON_HEDLEY_PUBLIC 1690 #if defined(JSON_HEDLEY_IMPORT) 1691 #undef JSON_HEDLEY_IMPORT 1693 #if defined(_WIN32) || defined(__CYGWIN__) 1694 # define JSON_HEDLEY_PRIVATE 1695 # define JSON_HEDLEY_PUBLIC __declspec(dllexport) 1696 # define JSON_HEDLEY_IMPORT __declspec(dllimport) 1699 JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \ 1700 JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ 1701 JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ 1702 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1703 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1704 JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ 1706 defined(__TI_EABI__) && \ 1708 (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1709 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \ 1712 # define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) 1713 # define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default"))) 1715 # define JSON_HEDLEY_PRIVATE 1716 # define JSON_HEDLEY_PUBLIC 1718 # define JSON_HEDLEY_IMPORT extern 1721 #if defined(JSON_HEDLEY_NO_THROW) 1722 #undef JSON_HEDLEY_NO_THROW 1725 JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \ 1726 JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ 1727 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) 1728 #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__)) 1730 JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \ 1731 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ 1732 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) 1733 #define JSON_HEDLEY_NO_THROW __declspec(nothrow) 1735 #define JSON_HEDLEY_NO_THROW 1738 #if defined(JSON_HEDLEY_FALL_THROUGH) 1739 #undef JSON_HEDLEY_FALL_THROUGH 1742 JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \ 1743 JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) 1744 #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) 1745 #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough) 1746 #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) 1747 #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough) 1748 #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]]) 1749 #elif defined(__fallthrough) 1750 #define JSON_HEDLEY_FALL_THROUGH __fallthrough 1752 #define JSON_HEDLEY_FALL_THROUGH 1755 #if defined(JSON_HEDLEY_RETURNS_NON_NULL) 1756 #undef JSON_HEDLEY_RETURNS_NON_NULL 1759 JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \ 1760 JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) 1761 #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__)) 1762 #elif defined(_Ret_notnull_) 1763 #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_ 1765 #define JSON_HEDLEY_RETURNS_NON_NULL 1768 #if defined(JSON_HEDLEY_ARRAY_PARAM) 1769 #undef JSON_HEDLEY_ARRAY_PARAM 1772 defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ 1773 !defined(__STDC_NO_VLA__) && \ 1774 !defined(__cplusplus) && \ 1775 !defined(JSON_HEDLEY_PGI_VERSION) && \ 1776 !defined(JSON_HEDLEY_TINYC_VERSION) 1777 #define JSON_HEDLEY_ARRAY_PARAM(name) (name) 1779 #define JSON_HEDLEY_ARRAY_PARAM(name) 1782 #if defined(JSON_HEDLEY_IS_CONSTANT) 1783 #undef JSON_HEDLEY_IS_CONSTANT 1785 #if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR) 1786 #undef JSON_HEDLEY_REQUIRE_CONSTEXPR 1790 #if defined(JSON_HEDLEY_IS_CONSTEXPR_) 1791 #undef JSON_HEDLEY_IS_CONSTEXPR_ 1794 JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \ 1795 JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ 1796 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1797 JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \ 1798 JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1799 JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ 1800 JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ 1801 (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \ 1802 JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) 1803 #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr) 1805 #if !defined(__cplusplus) 1807 JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \ 1808 JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ 1809 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1810 JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ 1811 JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ 1812 JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ 1813 JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24) 1814 #if defined(__INTPTR_TYPE__) 1815 #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*) 1818 #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*) 1822 defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ 1823 !defined(JSON_HEDLEY_SUNPRO_VERSION) && \ 1824 !defined(JSON_HEDLEY_PGI_VERSION) && \ 1825 !defined(JSON_HEDLEY_IAR_VERSION)) || \ 1826 JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) || \ 1827 JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ 1828 JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \ 1829 JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ 1830 JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0) 1831 #if defined(__INTPTR_TYPE__) 1832 #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0) 1835 #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0) 1838 defined(JSON_HEDLEY_GCC_VERSION) || \ 1839 defined(JSON_HEDLEY_INTEL_VERSION) || \ 1840 defined(JSON_HEDLEY_TINYC_VERSION) || \ 1841 defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \ 1842 JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \ 1843 defined(JSON_HEDLEY_TI_CL2000_VERSION) || \ 1844 defined(JSON_HEDLEY_TI_CL6X_VERSION) || \ 1845 defined(JSON_HEDLEY_TI_CL7X_VERSION) || \ 1846 defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \ 1848 # define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \ 1852 ((void*) ((expr) * 0L) ) : \ 1853 ((struct { char v[sizeof(void) * 2]; } *) 1) \ 1859 #if defined(JSON_HEDLEY_IS_CONSTEXPR_) 1860 #if !defined(JSON_HEDLEY_IS_CONSTANT) 1861 #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr) 1863 #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1)) 1865 #if !defined(JSON_HEDLEY_IS_CONSTANT) 1866 #define JSON_HEDLEY_IS_CONSTANT(expr) (0) 1868 #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr) 1871 #if defined(JSON_HEDLEY_BEGIN_C_DECLS) 1872 #undef JSON_HEDLEY_BEGIN_C_DECLS 1874 #if defined(JSON_HEDLEY_END_C_DECLS) 1875 #undef JSON_HEDLEY_END_C_DECLS 1877 #if defined(JSON_HEDLEY_C_DECL) 1878 #undef JSON_HEDLEY_C_DECL 1880 #if defined(__cplusplus) 1881 #define JSON_HEDLEY_BEGIN_C_DECLS extern "C" { 1882 #define JSON_HEDLEY_END_C_DECLS } 1883 #define JSON_HEDLEY_C_DECL extern "C" 1885 #define JSON_HEDLEY_BEGIN_C_DECLS 1886 #define JSON_HEDLEY_END_C_DECLS 1887 #define JSON_HEDLEY_C_DECL 1890 #if defined(JSON_HEDLEY_STATIC_ASSERT) 1891 #undef JSON_HEDLEY_STATIC_ASSERT 1894 !defined(__cplusplus) && ( \ 1895 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ 1896 (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ 1897 JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \ 1898 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1899 defined(_Static_assert) \ 1901 # define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message) 1903 (defined(__cplusplus) && (__cplusplus >= 201103L)) || \ 1904 JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \ 1905 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1906 # define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message)) 1908 # define JSON_HEDLEY_STATIC_ASSERT(expr, message) 1911 #if defined(JSON_HEDLEY_NULL) 1912 #undef JSON_HEDLEY_NULL 1914 #if defined(__cplusplus) 1915 #if __cplusplus >= 201103L 1916 #define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr) 1918 #define JSON_HEDLEY_NULL NULL 1920 #define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0) 1923 #define JSON_HEDLEY_NULL NULL 1925 #define JSON_HEDLEY_NULL ((void*) 0) 1928 #if defined(JSON_HEDLEY_MESSAGE) 1929 #undef JSON_HEDLEY_MESSAGE 1931 #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") 1932 # define JSON_HEDLEY_MESSAGE(msg) \ 1933 JSON_HEDLEY_DIAGNOSTIC_PUSH \ 1934 JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ 1935 JSON_HEDLEY_PRAGMA(message msg) \ 1936 JSON_HEDLEY_DIAGNOSTIC_POP 1938 JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \ 1939 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) 1940 # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg) 1941 #elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) 1942 # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg) 1943 #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) 1944 # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) 1945 #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0) 1946 # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) 1948 # define JSON_HEDLEY_MESSAGE(msg) 1951 #if defined(JSON_HEDLEY_WARNING) 1952 #undef JSON_HEDLEY_WARNING 1954 #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") 1955 # define JSON_HEDLEY_WARNING(msg) \ 1956 JSON_HEDLEY_DIAGNOSTIC_PUSH \ 1957 JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ 1958 JSON_HEDLEY_PRAGMA(clang warning msg) \ 1959 JSON_HEDLEY_DIAGNOSTIC_POP 1961 JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \ 1962 JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ 1963 JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) 1964 # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg) 1966 JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ 1967 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1968 # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg)) 1970 # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg) 1973 #if defined(JSON_HEDLEY_REQUIRE) 1974 #undef JSON_HEDLEY_REQUIRE 1976 #if defined(JSON_HEDLEY_REQUIRE_MSG) 1977 #undef JSON_HEDLEY_REQUIRE_MSG 1979 #if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if) 1980 # if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat") 1981 # define JSON_HEDLEY_REQUIRE(expr) \ 1982 JSON_HEDLEY_DIAGNOSTIC_PUSH \ 1983 _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ 1984 __attribute__((diagnose_if(!(expr), #expr, "error"))) \ 1985 JSON_HEDLEY_DIAGNOSTIC_POP 1986 # define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \ 1987 JSON_HEDLEY_DIAGNOSTIC_PUSH \ 1988 _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ 1989 __attribute__((diagnose_if(!(expr), msg, "error"))) \ 1990 JSON_HEDLEY_DIAGNOSTIC_POP 1992 # define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error"))) 1993 # define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error"))) 1996 # define JSON_HEDLEY_REQUIRE(expr) 1997 # define JSON_HEDLEY_REQUIRE_MSG(expr,msg) 2000 #if defined(JSON_HEDLEY_FLAGS) 2001 #undef JSON_HEDLEY_FLAGS 2003 #if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) 2004 #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__)) 2006 #define JSON_HEDLEY_FLAGS 2009 #if defined(JSON_HEDLEY_FLAGS_CAST) 2010 #undef JSON_HEDLEY_FLAGS_CAST 2012 #if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0) 2013 # define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \ 2014 JSON_HEDLEY_DIAGNOSTIC_PUSH \ 2015 _Pragma("warning(disable:188)") \ 2017 JSON_HEDLEY_DIAGNOSTIC_POP \ 2020 # define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr) 2023 #if defined(JSON_HEDLEY_EMPTY_BASES) 2024 #undef JSON_HEDLEY_EMPTY_BASES 2027 (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \ 2028 JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 2029 #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases) 2031 #define JSON_HEDLEY_EMPTY_BASES 2036 #if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) 2037 #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK 2039 #if defined(__clang__) 2040 #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0) 2042 #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) 2045 #if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE) 2046 #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE 2048 #define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) 2050 #if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) 2051 #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE 2053 #define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) 2055 #if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN) 2056 #undef JSON_HEDLEY_CLANG_HAS_BUILTIN 2058 #define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin) 2060 #if defined(JSON_HEDLEY_CLANG_HAS_FEATURE) 2061 #undef JSON_HEDLEY_CLANG_HAS_FEATURE 2063 #define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature) 2065 #if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION) 2066 #undef JSON_HEDLEY_CLANG_HAS_EXTENSION 2068 #define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension) 2070 #if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) 2071 #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE 2073 #define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) 2075 #if defined(JSON_HEDLEY_CLANG_HAS_WARNING) 2076 #undef JSON_HEDLEY_CLANG_HAS_WARNING 2078 #define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning) 2087 #if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) 2088 #if defined(__clang__) 2089 #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 2090 #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" 2092 #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) 2093 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 2094 #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" 2100 #if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) 2101 #define JSON_HAS_CPP_20 2102 #define JSON_HAS_CPP_17 2103 #define JSON_HAS_CPP_14 2104 #elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 2105 #define JSON_HAS_CPP_17 2106 #define JSON_HAS_CPP_14 2107 #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) 2108 #define JSON_HAS_CPP_14 2112 #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) 2113 #pragma GCC diagnostic push 2114 #pragma GCC diagnostic ignored "-Wfloat-equal" 2118 #if defined(__clang__) 2119 #pragma GCC diagnostic push 2120 #pragma GCC diagnostic ignored "-Wdocumentation" 2124 #if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) 2125 #define JSON_THROW(exception) throw exception 2126 #define JSON_TRY try 2127 #define JSON_CATCH(exception) catch(exception) 2128 #define JSON_INTERNAL_CATCH(exception) catch(exception) 2131 #define JSON_THROW(exception) std::abort() 2132 #define JSON_TRY if(true) 2133 #define JSON_CATCH(exception) if(false) 2134 #define JSON_INTERNAL_CATCH(exception) if(false) 2138 #if defined(JSON_THROW_USER) 2140 #define JSON_THROW JSON_THROW_USER 2142 #if defined(JSON_TRY_USER) 2144 #define JSON_TRY JSON_TRY_USER 2146 #if defined(JSON_CATCH_USER) 2148 #define JSON_CATCH JSON_CATCH_USER 2149 #undef JSON_INTERNAL_CATCH 2150 #define JSON_INTERNAL_CATCH JSON_CATCH_USER 2152 #if defined(JSON_INTERNAL_CATCH_USER) 2153 #undef JSON_INTERNAL_CATCH 2154 #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER 2158 #if !defined(JSON_ASSERT) 2160 #define JSON_ASSERT(x) assert(x) 2164 #if defined(JSON_TESTS_PRIVATE) 2165 #define JSON_PRIVATE_UNLESS_TESTED public 2167 #define JSON_PRIVATE_UNLESS_TESTED private 2175 #define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ 2176 template<typename BasicJsonType> \ 2177 inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \ 2179 static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \ 2180 static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \ 2181 auto it = std::find_if(std::begin(m), std::end(m), \ 2182 [e](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \ 2184 return ej_pair.first == e; \ 2186 j = ((it != std::end(m)) ? it : std::begin(m))->second; \ 2188 template<typename BasicJsonType> \ 2189 inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \ 2191 static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \ 2192 static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \ 2193 auto it = std::find_if(std::begin(m), std::end(m), \ 2194 [&j](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \ 2196 return ej_pair.second == j; \ 2198 e = ((it != std::end(m)) ? it : std::begin(m))->first; \ 2204 #define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ 2205 template<template<typename, typename, typename...> class ObjectType, \ 2206 template<typename, typename...> class ArrayType, \ 2207 class StringType, class BooleanType, class NumberIntegerType, \ 2208 class NumberUnsignedType, class NumberFloatType, \ 2209 template<typename> class AllocatorType, \ 2210 template<typename, typename = void> class JSONSerializer, \ 2213 #define NLOHMANN_BASIC_JSON_TPL \ 2214 basic_json<ObjectType, ArrayType, StringType, BooleanType, \ 2215 NumberIntegerType, NumberUnsignedType, NumberFloatType, \ 2216 AllocatorType, JSONSerializer, BinaryType> 2220 #define NLOHMANN_JSON_EXPAND( x ) x 2221 #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 2222 #define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \ 2223 NLOHMANN_JSON_PASTE64, \ 2224 NLOHMANN_JSON_PASTE63, \ 2225 NLOHMANN_JSON_PASTE62, \ 2226 NLOHMANN_JSON_PASTE61, \ 2227 NLOHMANN_JSON_PASTE60, \ 2228 NLOHMANN_JSON_PASTE59, \ 2229 NLOHMANN_JSON_PASTE58, \ 2230 NLOHMANN_JSON_PASTE57, \ 2231 NLOHMANN_JSON_PASTE56, \ 2232 NLOHMANN_JSON_PASTE55, \ 2233 NLOHMANN_JSON_PASTE54, \ 2234 NLOHMANN_JSON_PASTE53, \ 2235 NLOHMANN_JSON_PASTE52, \ 2236 NLOHMANN_JSON_PASTE51, \ 2237 NLOHMANN_JSON_PASTE50, \ 2238 NLOHMANN_JSON_PASTE49, \ 2239 NLOHMANN_JSON_PASTE48, \ 2240 NLOHMANN_JSON_PASTE47, \ 2241 NLOHMANN_JSON_PASTE46, \ 2242 NLOHMANN_JSON_PASTE45, \ 2243 NLOHMANN_JSON_PASTE44, \ 2244 NLOHMANN_JSON_PASTE43, \ 2245 NLOHMANN_JSON_PASTE42, \ 2246 NLOHMANN_JSON_PASTE41, \ 2247 NLOHMANN_JSON_PASTE40, \ 2248 NLOHMANN_JSON_PASTE39, \ 2249 NLOHMANN_JSON_PASTE38, \ 2250 NLOHMANN_JSON_PASTE37, \ 2251 NLOHMANN_JSON_PASTE36, \ 2252 NLOHMANN_JSON_PASTE35, \ 2253 NLOHMANN_JSON_PASTE34, \ 2254 NLOHMANN_JSON_PASTE33, \ 2255 NLOHMANN_JSON_PASTE32, \ 2256 NLOHMANN_JSON_PASTE31, \ 2257 NLOHMANN_JSON_PASTE30, \ 2258 NLOHMANN_JSON_PASTE29, \ 2259 NLOHMANN_JSON_PASTE28, \ 2260 NLOHMANN_JSON_PASTE27, \ 2261 NLOHMANN_JSON_PASTE26, \ 2262 NLOHMANN_JSON_PASTE25, \ 2263 NLOHMANN_JSON_PASTE24, \ 2264 NLOHMANN_JSON_PASTE23, \ 2265 NLOHMANN_JSON_PASTE22, \ 2266 NLOHMANN_JSON_PASTE21, \ 2267 NLOHMANN_JSON_PASTE20, \ 2268 NLOHMANN_JSON_PASTE19, \ 2269 NLOHMANN_JSON_PASTE18, \ 2270 NLOHMANN_JSON_PASTE17, \ 2271 NLOHMANN_JSON_PASTE16, \ 2272 NLOHMANN_JSON_PASTE15, \ 2273 NLOHMANN_JSON_PASTE14, \ 2274 NLOHMANN_JSON_PASTE13, \ 2275 NLOHMANN_JSON_PASTE12, \ 2276 NLOHMANN_JSON_PASTE11, \ 2277 NLOHMANN_JSON_PASTE10, \ 2278 NLOHMANN_JSON_PASTE9, \ 2279 NLOHMANN_JSON_PASTE8, \ 2280 NLOHMANN_JSON_PASTE7, \ 2281 NLOHMANN_JSON_PASTE6, \ 2282 NLOHMANN_JSON_PASTE5, \ 2283 NLOHMANN_JSON_PASTE4, \ 2284 NLOHMANN_JSON_PASTE3, \ 2285 NLOHMANN_JSON_PASTE2, \ 2286 NLOHMANN_JSON_PASTE1)(__VA_ARGS__)) 2287 #define NLOHMANN_JSON_PASTE2(func, v1) func(v1) 2288 #define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2) 2289 #define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3) 2290 #define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4) 2291 #define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5) 2292 #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) 2293 #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) 2294 #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) 2295 #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) 2296 #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) 2297 #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) 2298 #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) 2299 #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) 2300 #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) 2301 #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) 2302 #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) 2303 #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) 2304 #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) 2305 #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) 2306 #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) 2307 #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) 2308 #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) 2309 #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) 2310 #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) 2311 #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) 2312 #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) 2313 #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) 2314 #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) 2315 #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) 2316 #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) 2317 #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) 2318 #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) 2319 #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) 2320 #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) 2321 #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) 2322 #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) 2323 #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) 2324 #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) 2325 #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) 2326 #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) 2327 #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) 2328 #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) 2329 #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) 2330 #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) 2331 #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) 2332 #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) 2333 #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) 2334 #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) 2335 #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) 2336 #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) 2337 #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) 2338 #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) 2339 #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) 2340 #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) 2341 #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) 2342 #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) 2343 #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) 2344 #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) 2345 #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) 2346 #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) 2347 #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) 2348 #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) 2349 #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) 2351 #define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1; 2352 #define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1); 2359 #define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \ 2360 friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ 2361 friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } 2368 #define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \ 2369 inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ 2370 inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } 2372 #ifndef JSON_USE_IMPLICIT_CONVERSIONS 2373 #define JSON_USE_IMPLICIT_CONVERSIONS 1 2376 #if JSON_USE_IMPLICIT_CONVERSIONS 2377 #define JSON_EXPLICIT 2379 #define JSON_EXPLICIT explicit 2424 const char*
what() const noexcept
override 2434 exception(
int id_, const
char* what_arg) :
id(id_), m(what_arg) {}
2438 return "[json.exception." + ename +
"." + std::to_string(id_) +
"] ";
2443 std::runtime_error
m;
2506 position_string(pos) +
": " + what_arg;
2513 (byte_ != 0 ? (
" at byte " + std::to_string(byte_)) :
"") +
2531 :
exception(id_, what_arg), byte(byte_) {}
2535 return " at line " + std::to_string(pos.
lines_read + 1) +
2738 #include <type_traits> 2745 template<
bool B,
typename T =
void>
2748 template<
typename T>
2753 template<std::size_t... Ints>
2758 static constexpr std::size_t
size() noexcept
2760 return sizeof...(Ints);
2764 template<
class Sequence1,
class Sequence2>
2767 template<std::size_t... I1, std::size_t... I2>
2771 template<std::
size_t N>
2774 typename make_index_sequence < N - N / 2 >::type > {};
2779 template<
typename... Ts>
2787 template<
typename T>
2793 template<
typename T>
2802 #include <type_traits> 2832 template<
typename It,
typename =
void>
2835 template<
typename It>
2850 template<
typename T,
typename =
void>
2855 template<
typename T>
2861 template<
typename T>
2880 #include <type_traits> 2896 void operator=(
nonesuch const&) =
delete;
2897 void operator=(
nonesuch&&) =
delete;
2900 template<
class Default,
2902 template<
class...>
class Op,
2910 template<
class Default,
template<
class...>
class Op,
class... Args>
2917 template<
template<
class...>
class Op,
class... Args>
2920 template<
template<
class...>
class Op,
class... Args>
2923 template<
class Default,
template<
class...>
class Op,
class... Args>
2926 template<
class Default,
template<
class...>
class Op,
class... Args>
2929 template<
class Expected,
template<
class...>
class Op,
class... Args>
2932 template<
class To,
template<
class...>
class Op,
class... Args>
2939 #ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ 2940 #define INCLUDE_NLOHMANN_JSON_FWD_HPP_ 2962 template<
typename T =
void,
typename SFINAE =
void>
2965 template<
template<
typename U,
typename V,
typename... Args>
class ObjectType =
2967 template<
typename U,
typename... Args>
class ArrayType = std::vector,
2969 class NumberIntegerType = std::int64_t,
2970 class NumberUnsignedType = std::uint64_t,
2971 class NumberFloatType = double,
2972 template<
typename U>
class AllocatorType = std::allocator,
2973 template<
typename T,
typename SFINAE =
void>
class JSONSerializer =
2975 class BinaryType = std::vector<std::uint8_t>>
2989 template<
typename BasicJsonType>
3002 template<
class Key,
class T,
class IgnoredLess,
class Allocator>
3016 #endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ 3059 template<
typename T>
3066 template<
typename T>
3069 template<
typename T>
3072 template<
typename T>
3075 template<
typename T>
3078 template<
typename T>
3081 template<
typename T>
3084 template<
typename T>
3087 template<
typename T>
3090 template<
typename T,
typename... Args>
3093 template<
typename T,
typename... Args>
3096 template<
typename T,
typename U>
3100 template<
typename BasicJsonType,
typename T,
typename =
void>
3107 template <
typename BasicJsonType,
typename T>
3113 template<
typename BasicJsonType,
typename T>
3117 using serializer =
typename BasicJsonType::template json_serializer<T, void>;
3121 const BasicJsonType&, T&>
::value;
3126 template<
typename BasicJsonType,
typename T,
typename =
void>
3129 template<
typename BasicJsonType,
typename T>
3132 using serializer =
typename BasicJsonType::template json_serializer<T, void>;
3141 template<
typename BasicJsonType,
typename T,
typename =
void>
3144 template<
typename BasicJsonType,
typename T>
3147 using serializer =
typename BasicJsonType::template json_serializer<T, void>;
3159 template<
typename T,
typename =
void>
3162 template<
typename T>
3179 template<
typename T,
typename =
void>
3182 template<
typename T>
3185 template<
typename BasicJsonType,
typename CompatibleObjectType,
3189 template<
typename BasicJsonType,
typename CompatibleObjectType>
3191 BasicJsonType, CompatibleObjectType,
3200 std::is_constructible<
typename object_t::key_type,
3201 typename CompatibleObjectType::key_type>
::value &&
3202 std::is_constructible<
typename object_t::mapped_type,
3203 typename CompatibleObjectType::mapped_type>
::value;
3206 template<
typename BasicJsonType,
typename CompatibleObjectType>
3210 template<
typename BasicJsonType,
typename ConstructibleObjectType,
3214 template<
typename BasicJsonType,
typename ConstructibleObjectType>
3216 BasicJsonType, ConstructibleObjectType,
3226 (std::is_constructible<
typename ConstructibleObjectType::key_type,
3227 typename object_t::key_type>::value &&
3229 typename object_t::mapped_type,
3230 typename ConstructibleObjectType::mapped_type >::value)) ||
3232 typename ConstructibleObjectType::mapped_type>::value ||
3235 typename ConstructibleObjectType::mapped_type >::value);
3238 template<
typename BasicJsonType,
typename ConstructibleObjectType>
3241 ConstructibleObjectType> {};
3243 template<
typename BasicJsonType,
typename CompatibleStringType,
3247 template<
typename BasicJsonType,
typename CompatibleStringType>
3249 BasicJsonType, CompatibleStringType,
3253 static constexpr
auto value =
3257 template<
typename BasicJsonType,
typename ConstructibleStringType>
3261 template<
typename BasicJsonType,
typename ConstructibleStringType,
3265 template<
typename BasicJsonType,
typename ConstructibleStringType>
3267 BasicJsonType, ConstructibleStringType,
3271 static constexpr
auto value =
3272 std::is_constructible<ConstructibleStringType,
3273 typename BasicJsonType::string_t>
::value;
3276 template<
typename BasicJsonType,
typename ConstructibleStringType>
3280 template<
typename BasicJsonType,
typename CompatibleArrayType,
typename =
void>
3283 template<
typename BasicJsonType,
typename CompatibleArrayType>
3285 BasicJsonType, CompatibleArrayType,
3292 iterator_traits<CompatibleArrayType >>
::value >>
3294 static constexpr
bool value =
3295 std::is_constructible<BasicJsonType,
3296 typename CompatibleArrayType::value_type>
::value;
3299 template<
typename BasicJsonType,
typename CompatibleArrayType>
3303 template<
typename BasicJsonType,
typename ConstructibleArrayType,
typename =
void>
3306 template<
typename BasicJsonType,
typename ConstructibleArrayType>
3308 BasicJsonType, ConstructibleArrayType,
3310 typename BasicJsonType::value_type>
::value >>
3311 : std::true_type {};
3313 template<
typename BasicJsonType,
typename ConstructibleArrayType>
3315 BasicJsonType, ConstructibleArrayType,
3316 enable_if_t < !std::is_same<ConstructibleArrayType,
3317 typename BasicJsonType::value_type>
::value&&
3318 std::is_default_constructible<ConstructibleArrayType>
::value&&
3319 (std::is_move_assignable<ConstructibleArrayType>::value ||
3320 std::is_copy_assignable<ConstructibleArrayType>::value)&&
3324 detected_t<value_type_t, ConstructibleArrayType >>
::value >>
3326 static constexpr
bool value =
3334 (std::is_same<
typename ConstructibleArrayType::value_type,
3335 typename BasicJsonType::array_t::value_type>
::value ||
3337 typename ConstructibleArrayType::value_type>
::value ||
3339 BasicJsonType,
typename ConstructibleArrayType::value_type >
::value);
3342 template<
typename BasicJsonType,
typename ConstructibleArrayType>
3346 template<
typename RealIntegerType,
typename CompatibleNumberIntegerType,
3350 template<
typename RealIntegerType,
typename CompatibleNumberIntegerType>
3352 RealIntegerType, CompatibleNumberIntegerType,
3353 enable_if_t < std::is_integral<RealIntegerType>::value&&
3354 std::is_integral<CompatibleNumberIntegerType>::value&&
3355 !std::is_same<bool, CompatibleNumberIntegerType>::value >>
3361 static constexpr
auto value =
3362 std::is_constructible<RealIntegerType,
3363 CompatibleNumberIntegerType>::value &&
3368 template<
typename RealIntegerType,
typename CompatibleNumberIntegerType>
3371 CompatibleNumberIntegerType> {};
3373 template<
typename BasicJsonType,
typename CompatibleType,
typename =
void>
3376 template<
typename BasicJsonType,
typename CompatibleType>
3378 BasicJsonType, CompatibleType,
3381 static constexpr
bool value =
3385 template<
typename BasicJsonType,
typename CompatibleType>
3392 template<
class B1,
class... Bn>
3394 : std::conditional<bool(B1::value), conjunction<Bn...>, B1>
::type {};
3396 template<
typename T1,
typename T2>
3399 template<
typename T1,
typename... Args>
3473 static constexpr std::array<std::uint8_t, 9> order = {{
3480 const auto l_index =
static_cast<std::size_t
>(lhs);
3481 const auto r_index =
static_cast<std::size_t
>(rhs);
3482 return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index];
3492 template<
typename BasicJsonType>
3493 void from_json(
const BasicJsonType& j,
typename std::nullptr_t& n)
3503 template <
typename BasicJsonType,
typename ArithmeticType,
3509 switch (static_cast<value_t>(j))
3513 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>());
3518 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>());
3523 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>());
3532 template<
typename BasicJsonType>
3533 void from_json(
const BasicJsonType& j,
typename BasicJsonType::boolean_t& b)
3539 b = *j.template get_ptr<const typename BasicJsonType::boolean_t*>();
3542 template<
typename BasicJsonType>
3543 void from_json(
const BasicJsonType& j,
typename BasicJsonType::string_t& s)
3549 s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
3553 typename BasicJsonType,
typename ConstructibleStringType,
3556 !std::is_same<
typename BasicJsonType::string_t,
3557 ConstructibleStringType>
::value,
3559 void from_json(
const BasicJsonType& j, ConstructibleStringType& s)
3566 s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
3569 template<
typename BasicJsonType>
3570 void from_json(
const BasicJsonType& j,
typename BasicJsonType::number_float_t& val)
3575 template<
typename BasicJsonType>
3576 void from_json(
const BasicJsonType& j,
typename BasicJsonType::number_unsigned_t& val)
3581 template<
typename BasicJsonType>
3582 void from_json(
const BasicJsonType& j,
typename BasicJsonType::number_integer_t& val)
3587 template<
typename BasicJsonType,
typename EnumType,
3593 e =
static_cast<EnumType
>(val);
3597 template<
typename BasicJsonType,
typename T,
typename Allocator,
3599 void from_json(
const BasicJsonType& j, std::forward_list<T, Allocator>& l)
3606 std::transform(j.rbegin(), j.rend(),
3607 std::front_inserter(l), [](
const BasicJsonType & i)
3609 return i.template get<T>();
3614 template<
typename BasicJsonType,
typename T,
3615 enable_if_t<is_getable<BasicJsonType, T>::value,
int> = 0>
3623 std::transform(j.begin(), j.end(), std::begin(l),
3624 [](
const BasicJsonType & elem)
3626 return elem.template get<T>();
3630 template<
typename BasicJsonType,
typename T, std::
size_t N>
3632 -> decltype(j.template get<T>(),
void())
3634 for (std::size_t i = 0; i < N; ++i)
3636 arr[i] = j.at(i).template get<T>();
3640 template<
typename BasicJsonType>
3643 arr = *j.template get_ptr<const typename BasicJsonType::array_t*>();
3646 template<
typename BasicJsonType,
typename T, std::
size_t N>
3649 -> decltype(j.template get<T>(),
void())
3651 for (std::size_t i = 0; i < N; ++i)
3653 arr[i] = j.at(i).template get<T>();
3657 template<
typename BasicJsonType,
typename ConstructibleArrayType>
3660 arr.reserve(std::declval<typename ConstructibleArrayType::size_type>()),
3661 j.template get<typename ConstructibleArrayType::value_type>(),
3666 ConstructibleArrayType
ret;
3667 ret.reserve(j.size());
3668 std::transform(j.begin(), j.end(),
3669 std::inserter(ret, end(ret)), [](
const BasicJsonType & i)
3673 return i.template get<typename ConstructibleArrayType::value_type>();
3678 template<
typename BasicJsonType,
typename ConstructibleArrayType>
3684 ConstructibleArrayType
ret;
3686 j.begin(), j.end(), std::inserter(ret, end(ret)),
3687 [](
const BasicJsonType & i)
3691 return i.template get<typename ConstructibleArrayType::value_type>();
3696 template <
typename BasicJsonType,
typename ConstructibleArrayType,
3704 auto from_json(
const BasicJsonType& j, ConstructibleArrayType& arr)
3706 j.template get<typename ConstructibleArrayType::value_type>(),
3718 template<
typename BasicJsonType>
3719 void from_json(
const BasicJsonType& j,
typename BasicJsonType::binary_t& bin)
3726 bin = *j.template get_ptr<const typename BasicJsonType::binary_t*>();
3729 template<
typename BasicJsonType,
typename ConstructibleObjectType,
3731 void from_json(
const BasicJsonType& j, ConstructibleObjectType& obj)
3738 ConstructibleObjectType
ret;
3739 auto inner_object = j.template get_ptr<const typename BasicJsonType::object_t*>();
3740 using value_type =
typename ConstructibleObjectType::value_type;
3742 inner_object->begin(), inner_object->end(),
3743 std::inserter(ret, ret.begin()),
3744 [](
typename BasicJsonType::object_t::value_type
const & p)
3746 return value_type(p.first, p.second.template get<typename ConstructibleObjectType::mapped_type>());
3755 template <
typename BasicJsonType,
typename ArithmeticType,
3765 switch (static_cast<value_t>(j))
3769 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>());
3774 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>());
3779 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>());
3784 val =
static_cast<ArithmeticType
>(*j.template get_ptr<const typename BasicJsonType::boolean_t*>());
3793 template<
typename BasicJsonType,
typename A1,
typename A2>
3794 void from_json(
const BasicJsonType& j, std::pair<A1, A2>& p)
3796 p = {j.at(0).template get<A1>(), j.at(1).template get<A2>()};
3799 template<
typename BasicJsonType,
typename Tuple, std::size_t... Idx>
3805 template<
typename BasicJsonType,
typename... Args>
3806 void from_json(
const BasicJsonType& j, std::tuple<Args...>& t)
3811 template <
typename BasicJsonType,
typename Key,
typename Value,
typename Compare,
typename Allocator,
3813 typename BasicJsonType::string_t, Key >::value >>
3814 void from_json(
const BasicJsonType& j, std::map<Key, Value, Compare, Allocator>& m)
3821 for (
const auto& p : j)
3827 m.emplace(p.at(0).template get<Key>(), p.at(1).template get<Value>());
3831 template <
typename BasicJsonType,
typename Key,
typename Value,
typename Hash,
typename KeyEqual,
typename Allocator,
3833 typename BasicJsonType::string_t, Key >::value >>
3834 void from_json(
const BasicJsonType& j, std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>& m)
3841 for (
const auto& p : j)
3847 m.emplace(p.at(0).template get<Key>(), p.at(1).template get<Value>());
3853 template<
typename BasicJsonType,
typename T>
3875 #include <algorithm> 3879 #include <type_traits> 3901 template<
typename string_type>
3905 using std::to_string;
3916 using string_type =
typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().
key() ) >::type >::type;
3922 std::size_t array_index = 0;
3924 mutable std::size_t array_index_last = 0;
3951 return anchor == o.
anchor;
3957 return anchor != o.
anchor;
3965 switch (anchor.m_object->type())
3970 if (array_index != array_index_last)
3973 array_index_last = array_index;
3975 return array_index_str;
3980 return anchor.key();
3991 return anchor.value();
4005 : container(cont) {}
4022 template<std::
size_t N,
typename IteratorType, enable_if_t<N == 0,
int> = 0>
4030 template<std::
size_t N,
typename IteratorType, enable_if_t<N == 1,
int> = 0>
4044 #if defined(__clang__) 4046 #pragma clang diagnostic push 4047 #pragma clang diagnostic ignored "-Wmismatched-tags" 4049 template<
typename IteratorType>
4051 :
public std::integral_constant<std::size_t, 2> {};
4053 template<std::
size_t N,
typename IteratorType>
4057 using type = decltype(
4058 get<N>(std::declval <
4061 #if defined(__clang__) 4062 #pragma clang diagnostic pop 4086 template<
typename BasicJsonType>
4087 static void construct(BasicJsonType& j,
typename BasicJsonType::boolean_t b) noexcept
4091 j.assert_invariant();
4098 template<
typename BasicJsonType>
4099 static void construct(BasicJsonType& j,
const typename BasicJsonType::string_t& s)
4103 j.assert_invariant();
4106 template<
typename BasicJsonType>
4107 static void construct(BasicJsonType& j,
typename BasicJsonType::string_t&& s)
4111 j.assert_invariant();
4114 template <
typename BasicJsonType,
typename CompatibleStringType,
4117 static void construct(BasicJsonType& j,
const CompatibleStringType& str)
4120 j.m_value.string = j.template create<typename BasicJsonType::string_t>(str);
4121 j.assert_invariant();
4128 template<
typename BasicJsonType>
4129 static void construct(BasicJsonType& j,
const typename BasicJsonType::binary_t& b)
4132 typename BasicJsonType::binary_t
value{b};
4134 j.assert_invariant();
4137 template<
typename BasicJsonType>
4138 static void construct(BasicJsonType& j,
typename BasicJsonType::binary_t&& b)
4143 j.assert_invariant();
4150 template<
typename BasicJsonType>
4151 static void construct(BasicJsonType& j,
typename BasicJsonType::number_float_t val) noexcept
4155 j.assert_invariant();
4162 template<
typename BasicJsonType>
4163 static void construct(BasicJsonType& j,
typename BasicJsonType::number_unsigned_t val) noexcept
4167 j.assert_invariant();
4174 template<
typename BasicJsonType>
4175 static void construct(BasicJsonType& j,
typename BasicJsonType::number_integer_t val) noexcept
4179 j.assert_invariant();
4186 template<
typename BasicJsonType>
4187 static void construct(BasicJsonType& j,
const typename BasicJsonType::array_t& arr)
4191 j.assert_invariant();
4194 template<
typename BasicJsonType>
4195 static void construct(BasicJsonType& j,
typename BasicJsonType::array_t&& arr)
4199 j.assert_invariant();
4202 template <
typename BasicJsonType,
typename CompatibleArrayType,
4205 static void construct(BasicJsonType& j,
const CompatibleArrayType& arr)
4210 j.m_value.array = j.template create<typename BasicJsonType::array_t>(begin(arr), end(arr));
4211 j.assert_invariant();
4214 template<
typename BasicJsonType>
4215 static void construct(BasicJsonType& j,
const std::vector<bool>& arr)
4219 j.m_value.array->reserve(arr.size());
4220 for (
const bool x : arr)
4222 j.m_value.array->push_back(x);
4224 j.assert_invariant();
4227 template<
typename BasicJsonType,
typename T,
4229 static void construct(BasicJsonType& j,
const std::valarray<T>& arr)
4233 j.m_value.array->resize(arr.size());
4236 std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin());
4238 j.assert_invariant();
4245 template<
typename BasicJsonType>
4246 static void construct(BasicJsonType& j,
const typename BasicJsonType::object_t& obj)
4250 j.assert_invariant();
4253 template<
typename BasicJsonType>
4254 static void construct(BasicJsonType& j,
typename BasicJsonType::object_t&& obj)
4258 j.assert_invariant();
4261 template <
typename BasicJsonType,
typename CompatibleObjectType,
4263 static void construct(BasicJsonType& j,
const CompatibleObjectType& obj)
4269 j.m_value.object = j.template create<typename BasicJsonType::object_t>(begin(obj), end(obj));
4270 j.assert_invariant();
4278 template<
typename BasicJsonType,
typename T,
4285 template<
typename BasicJsonType,
typename CompatibleString,
4287 void to_json(BasicJsonType& j,
const CompatibleString& s)
4292 template<
typename BasicJsonType>
4293 void to_json(BasicJsonType& j,
typename BasicJsonType::string_t&& s)
4298 template<
typename BasicJsonType,
typename FloatType,
4300 void to_json(BasicJsonType& j, FloatType val) noexcept
4305 template<
typename BasicJsonType,
typename CompatibleNumberUnsignedType,
4307 void to_json(BasicJsonType& j, CompatibleNumberUnsignedType val) noexcept
4312 template<
typename BasicJsonType,
typename CompatibleNumberIntegerType,
4314 void to_json(BasicJsonType& j, CompatibleNumberIntegerType val) noexcept
4319 template<
typename BasicJsonType,
typename EnumType,
4320 enable_if_t<std::is_enum<EnumType>::value,
int> = 0>
4321 void to_json(BasicJsonType& j, EnumType e) noexcept
4327 template<
typename BasicJsonType>
4328 void to_json(BasicJsonType& j,
const std::vector<bool>& e)
4333 template <
typename BasicJsonType,
typename CompatibleArrayType,
4335 CompatibleArrayType>::value&&
4341 void to_json(BasicJsonType& j,
const CompatibleArrayType& arr)
4346 template<
typename BasicJsonType>
4347 void to_json(BasicJsonType& j,
const typename BasicJsonType::binary_t& bin)
4352 template<
typename BasicJsonType,
typename T,
4354 void to_json(BasicJsonType& j,
const std::valarray<T>& arr)
4359 template<
typename BasicJsonType>
4360 void to_json(BasicJsonType& j,
typename BasicJsonType::array_t&& arr)
4365 template <
typename BasicJsonType,
typename CompatibleObjectType,
4367 void to_json(BasicJsonType& j,
const CompatibleObjectType& obj)
4372 template<
typename BasicJsonType>
4373 void to_json(BasicJsonType& j,
typename BasicJsonType::object_t&& obj)
4379 typename BasicJsonType,
typename T, std::size_t N,
4380 enable_if_t < !std::is_constructible<
typename BasicJsonType::string_t,
4389 void to_json(BasicJsonType& j,
const std::pair<T1, T2>& p)
4391 j = { p.first, p.second };
4395 template<
typename BasicJsonType,
typename T,
4399 j = { {b.key(), b.value()} };
4402 template<
typename BasicJsonType,
typename Tuple, std::size_t... Idx>
4405 j = { std::get<Idx>(t)... };
4409 void to_json(BasicJsonType& j,
const T& t)
4416 template<
typename BasicJsonType,
typename T>
4418 -> decltype(
to_json(j,
std::forward<T>(val)),
void())
4420 return to_json(j, std::forward<T>(val));
4436 template<
typename,
typename>
4448 template<
typename BasicJsonType,
typename ValueType>
4449 static auto from_json(BasicJsonType&& j, ValueType& val) noexcept(
4465 template<
typename BasicJsonType,
typename ValueType>
4466 static auto to_json(BasicJsonType& j, ValueType&& val) noexcept(
4499 template<
typename BinaryType>
4520 , m_subtype(subtype)
4521 , m_has_subtype(true)
4526 , m_subtype(subtype)
4527 , m_has_subtype(true)
4532 return std::tie(static_cast<const BinaryType&>(*
this), m_subtype, m_has_subtype) ==
4538 return !(rhs == *
this);
4561 m_subtype = subtype;
4562 m_has_subtype =
true;
4609 return m_has_subtype;
4634 m_has_subtype =
false;
4638 std::uint8_t m_subtype = 0;
4639 bool m_has_subtype =
false;
4654 #include <functional> 4662 inline std::size_t
combine(std::size_t seed, std::size_t h) noexcept
4664 seed ^= h + 0x9e3779b9 + (seed << 6U) + (seed >> 2U);
4679 template<
typename BasicJsonType>
4680 std::size_t
hash(
const BasicJsonType& j)
4682 using string_t =
typename BasicJsonType::string_t;
4683 using number_integer_t =
typename BasicJsonType::number_integer_t;
4684 using number_unsigned_t =
typename BasicJsonType::number_unsigned_t;
4685 using number_float_t =
typename BasicJsonType::number_float_t;
4687 const auto type =
static_cast<std::size_t
>(j.type());
4690 case BasicJsonType::value_t::null:
4691 case BasicJsonType::value_t::discarded:
4698 auto seed =
combine(type, j.size());
4699 for (
const auto& element : j.items())
4701 const auto h = std::hash<string_t> {}(element.key());
4708 case BasicJsonType::value_t::array:
4710 auto seed =
combine(type, j.size());
4711 for (
const auto& element : j)
4718 case BasicJsonType::value_t::string:
4720 const auto h = std::hash<string_t> {}(j.template get_ref<const string_t&>());
4726 const auto h = std::hash<bool> {}(j.template get<bool>());
4730 case BasicJsonType::value_t::number_integer:
4732 const auto h = std::hash<number_integer_t> {}(j.template get<number_integer_t>());
4736 case BasicJsonType::value_t::number_unsigned:
4738 const auto h = std::hash<number_unsigned_t> {}(j.template get<number_unsigned_t>());
4742 case BasicJsonType::value_t::number_float:
4744 const auto h = std::hash<number_float_t> {}(j.template get<number_float_t>());
4748 case BasicJsonType::value_t::binary:
4750 auto seed =
combine(type, j.get_binary().size());
4751 const auto h = std::hash<bool> {}(j.get_binary().has_subtype());
4753 seed =
combine(seed, j.get_binary().subtype());
4754 for (
const auto byte : j.get_binary())
4756 seed =
combine(seed, std::hash<std::uint8_t> {}(byte));
4773 #include <algorithm> 4799 #include <type_traits> 4840 return std::fgetc(m_file);
4869 is->clear(is->rdstate() & std::ios::eofbit);
4874 : is(&i), sb(i.rdbuf())
4893 auto res = sb->sbumpc();
4897 is->clear(is->rdstate() | std::ios::eofbit);
4904 std::istream* is =
nullptr;
4905 std::streambuf* sb =
nullptr;
4910 template<
typename IteratorType>
4914 using char_type =
typename std::iterator_traits<IteratorType>::value_type;
4923 auto result = std::char_traits<char_type>::to_int_type(*current);
4924 std::advance(current, 1);
4929 return std::char_traits<char_type>::eof();
4937 template<
typename BaseInputAdapter,
size_t T>
4942 return current == end;
4948 template<
typename BaseInputAdapter,
size_t T>
4951 template<
typename BaseInputAdapter>
4956 std::array<std::char_traits<char>::int_type, 4>& utf8_bytes,
4957 size_t& utf8_bytes_index,
4958 size_t& utf8_bytes_filled)
4960 utf8_bytes_index = 0;
4964 utf8_bytes[0] = std::char_traits<char>::eof();
4965 utf8_bytes_filled = 1;
4970 const auto wc = input.get_character();
4975 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(wc);
4976 utf8_bytes_filled = 1;
4978 else if (wc <= 0x7FF)
4980 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xC0u | ((
static_cast<unsigned int>(wc) >> 6u) & 0x1Fu));
4981 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
4982 utf8_bytes_filled = 2;
4984 else if (wc <= 0xFFFF)
4986 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xE0u | ((
static_cast<unsigned int>(wc) >> 12u) & 0x0Fu));
4987 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((
static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));
4988 utf8_bytes[2] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
4989 utf8_bytes_filled = 3;
4991 else if (wc <= 0x10FFFF)
4993 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xF0u | ((
static_cast<unsigned int>(wc) >> 18u) & 0x07u));
4994 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((
static_cast<unsigned int>(wc) >> 12u) & 0x3Fu));
4995 utf8_bytes[2] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((
static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));
4996 utf8_bytes[3] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
4997 utf8_bytes_filled = 4;
5002 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(wc);
5003 utf8_bytes_filled = 1;
5009 template<
typename BaseInputAdapter>
5014 std::array<std::char_traits<char>::int_type, 4>& utf8_bytes,
5015 size_t& utf8_bytes_index,
5016 size_t& utf8_bytes_filled)
5018 utf8_bytes_index = 0;
5022 utf8_bytes[0] = std::char_traits<char>::eof();
5023 utf8_bytes_filled = 1;
5028 const auto wc = input.get_character();
5033 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(wc);
5034 utf8_bytes_filled = 1;
5036 else if (wc <= 0x7FF)
5038 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xC0u | ((
static_cast<unsigned int>(wc) >> 6u)));
5039 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
5040 utf8_bytes_filled = 2;
5042 else if (0xD800 > wc || wc >= 0xE000)
5044 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xE0u | ((
static_cast<unsigned int>(wc) >> 12u)));
5045 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((
static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));
5046 utf8_bytes[2] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (
static_cast<unsigned int>(wc) & 0x3Fu));
5047 utf8_bytes_filled = 3;
5053 const auto wc2 =
static_cast<unsigned int>(input.get_character());
5054 const auto charcode = 0x10000u + (((
static_cast<unsigned int>(wc) & 0x3FFu) << 10u) | (wc2 & 0x3FFu));
5055 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(0xF0u | (charcode >> 18u));
5056 utf8_bytes[1] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((charcode >> 12u) & 0x3Fu));
5057 utf8_bytes[2] =
static_cast<std::char_traits<char>::int_type
>(0x80u | ((charcode >> 6u) & 0x3Fu));
5058 utf8_bytes[3] =
static_cast<std::char_traits<char>::int_type
>(0x80u | (charcode & 0x3Fu));
5059 utf8_bytes_filled = 4;
5063 utf8_bytes[0] =
static_cast<std::char_traits<char>::int_type
>(wc);
5064 utf8_bytes_filled = 1;
5072 template<
typename BaseInputAdapter,
typename W
ideCharType>
5079 : base_adapter(base) {}
5084 if (utf8_bytes_index == utf8_bytes_filled)
5086 fill_buffer<sizeof(WideCharType)>();
5094 JSON_ASSERT(utf8_bytes_index < utf8_bytes_filled);
5095 return utf8_bytes[utf8_bytes_index++];
5108 std::array<std::char_traits<char>::int_type, 4> utf8_bytes = {{0, 0, 0, 0}};
5111 std::size_t utf8_bytes_index = 0;
5113 std::size_t utf8_bytes_filled = 0;
5117 template<
typename IteratorType,
typename Enable =
void>
5121 using char_type =
typename std::iterator_traits<iterator_type>::value_type;
5130 template<
typename T>
5140 template<
typename IteratorType>
5144 using char_type =
typename std::iterator_traits<iterator_type>::value_type;
5155 template<
typename IteratorType>
5163 template<
typename ContainerType>
5192 template <
typename CharT,
5193 typename std::enable_if <
5201 auto length = std::strlen(reinterpret_cast<const char*>(b));
5202 const auto*
ptr =
reinterpret_cast<const char*
>(b);
5206 template<
typename T, std::
size_t N>
5218 template <
typename CharT,
5219 typename std::enable_if <
5225 : ia(reinterpret_cast<const char*>(b), reinterpret_cast<const char*>(b) + l) {}
5227 template<
class IteratorType,
5228 typename std::enable_if<
5229 std::is_same<typename iterator_traits<IteratorType>::iterator_category, std::random_access_iterator_tag>
::value,
5269 template<
typename BasicJsonType>
5282 virtual bool null() = 0;
5289 virtual bool boolean(
bool val) = 0;
5335 virtual bool start_object(std::size_t elements) = 0;
5349 virtual bool end_object() = 0;
5357 virtual bool start_array(std::size_t elements) = 0;
5363 virtual bool end_array() = 0;
5372 virtual bool parse_error(std::size_t position,
5395 template<
typename BasicJsonType>
5411 : root(r), allow_exceptions(allow_exceptions_)
5423 handle_value(
nullptr);
5470 "excessive object size: " + std::to_string(len)));
5479 object_element = &(ref_stack.back()->m_value.object->operator[](val));
5485 ref_stack.pop_back();
5491 ref_stack.push_back(handle_value(BasicJsonType::value_t::array));
5496 "excessive array size: " + std::to_string(len)));
5504 ref_stack.pop_back();
5508 template<
class Exception>
5510 const Exception& ex)
5513 static_cast<void>(ex);
5514 if (allow_exceptions)
5533 template<
typename Value>
5537 if (ref_stack.empty())
5539 root = BasicJsonType(std::forward<Value>(v));
5543 JSON_ASSERT(ref_stack.back()->is_array() || ref_stack.back()->is_object());
5545 if (ref_stack.back()->is_array())
5547 ref_stack.back()->m_value.array->emplace_back(std::forward<Value>(v));
5548 return &(ref_stack.back()->m_value.array->back());
5553 *object_element = BasicJsonType(std::forward<Value>(v));
5554 return object_element;
5560 std::vector<BasicJsonType*> ref_stack {};
5562 BasicJsonType* object_element =
nullptr;
5564 bool errored =
false;
5566 const bool allow_exceptions =
true;
5569 template<
typename BasicJsonType>
5583 const bool allow_exceptions_ =
true)
5584 : root(r), callback(cb), allow_exceptions(allow_exceptions_)
5586 keep_stack.push_back(
true);
5598 handle_value(
nullptr);
5642 keep_stack.push_back(keep);
5645 ref_stack.push_back(val.second);
5648 if (ref_stack.back() &&
JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) && len > ref_stack.back()->max_size()))
5658 BasicJsonType k = BasicJsonType(val);
5661 const bool keep = callback(static_cast<int>(ref_stack.size()),
parse_event_t::key, k);
5662 key_keep_stack.push_back(keep);
5665 if (keep && ref_stack.back())
5667 object_element = &(ref_stack.back()->m_value.object->operator[](val) =
discarded);
5675 if (ref_stack.back() && !callback(static_cast<int>(ref_stack.size()) - 1,
parse_event_t::object_end, *ref_stack.back()))
5683 ref_stack.pop_back();
5684 keep_stack.pop_back();
5686 if (!ref_stack.empty() && ref_stack.back() && ref_stack.back()->is_structured())
5689 for (
auto it = ref_stack.back()->begin(); it != ref_stack.back()->end(); ++it)
5691 if (it->is_discarded())
5693 ref_stack.back()->erase(it);
5705 keep_stack.push_back(keep);
5707 auto val = handle_value(BasicJsonType::value_t::array,
true);
5708 ref_stack.push_back(val.second);
5711 if (ref_stack.back() &&
JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) && len > ref_stack.back()->max_size()))
5723 if (ref_stack.back())
5735 ref_stack.pop_back();
5736 keep_stack.pop_back();
5739 if (!keep && !ref_stack.empty() && ref_stack.back()->is_array())
5741 ref_stack.back()->m_value.array->pop_back();
5747 template<
class Exception>
5749 const Exception& ex)
5752 static_cast<void>(ex);
5753 if (allow_exceptions)
5781 template<
typename Value>
5782 std::pair<bool, BasicJsonType*>
handle_value(Value&& v,
const bool skip_callback =
false)
5788 if (!keep_stack.back())
5790 return {
false,
nullptr};
5794 auto value = BasicJsonType(std::forward<Value>(v));
5802 return {
false,
nullptr};
5805 if (ref_stack.empty())
5808 return {
true, &root};
5813 if (!ref_stack.back())
5815 return {
false,
nullptr};
5819 JSON_ASSERT(ref_stack.back()->is_array() || ref_stack.back()->is_object());
5822 if (ref_stack.back()->is_array())
5825 return {
true, &(ref_stack.back()->m_value.array->back())};
5832 const bool store_element = key_keep_stack.back();
5833 key_keep_stack.pop_back();
5837 return {
false,
nullptr};
5842 return {
true, object_element};
5848 std::vector<BasicJsonType*> ref_stack {};
5850 std::vector<bool> keep_stack {};
5852 std::vector<bool> key_keep_stack {};
5854 BasicJsonType* object_element =
nullptr;
5856 bool errored =
false;
5860 const bool allow_exceptions =
true;
5862 BasicJsonType
discarded = BasicJsonType::value_t::discarded;
5865 template<
typename BasicJsonType>
5952 #include <initializer_list> 5972 template<
typename BasicJsonType>
6005 case token_type::uninitialized:
6006 return "<uninitialized>";
6007 case token_type::literal_true:
6008 return "true literal";
6009 case token_type::literal_false:
6010 return "false literal";
6011 case token_type::literal_null:
6012 return "null literal";
6013 case token_type::value_string:
6014 return "string literal";
6015 case token_type::value_unsigned:
6016 case token_type::value_integer:
6017 case token_type::value_float:
6018 return "number literal";
6019 case token_type::begin_array:
6021 case token_type::begin_object:
6023 case token_type::end_array:
6025 case token_type::end_object:
6027 case token_type::name_separator:
6029 case token_type::value_separator:
6031 case token_type::parse_error:
6032 return "<parse error>";
6033 case token_type::end_of_input:
6034 return "end of input";
6035 case token_type::literal_or_value:
6036 return "'[', '{', or a literal";
6039 return "unknown token";
6049 template<
typename BasicJsonType,
typename InputAdapterType>
6062 explicit lexer(InputAdapterType&& adapter,
bool ignore_comments_ =
false)
6064 , ignore_comments(ignore_comments_)
6065 , decimal_point_char(static_cast<
char_int_type>(get_decimal_point()))
6084 const auto* loc = localeconv();
6086 return (loc->decimal_point ==
nullptr) ?
'.' : *(loc->decimal_point);
6114 const auto factors = { 12u, 8u, 4u, 0u };
6115 for (
const auto factor : factors)
6119 if (current >=
'0' && current <=
'9')
6121 codepoint +=
static_cast<int>((
static_cast<unsigned int>(current) - 0x30u) << factor);
6123 else if (current >=
'A' && current <=
'F')
6125 codepoint +=
static_cast<int>((
static_cast<unsigned int>(current) - 0x37u) << factor);
6127 else if (current >=
'a' && current <=
'f')
6129 codepoint +=
static_cast<int>((
static_cast<unsigned int>(current) - 0x57u) << factor);
6137 JSON_ASSERT(0x0000 <= codepoint && codepoint <= 0xFFFF);
6158 JSON_ASSERT(ranges.size() == 2 || ranges.size() == 4 || ranges.size() == 6);
6161 for (
auto range = ranges.begin(); range != ranges.end(); ++range)
6170 error_message =
"invalid string: ill-formed UTF-8 byte";
6207 case std::char_traits<char_type>::eof():
6209 error_message =
"invalid string: missing closing quote";
6210 return token_type::parse_error;
6216 return token_type::value_string;
6260 const int codepoint1 = get_codepoint();
6265 error_message =
"invalid string: '\\u' must be followed by 4 hex digits";
6266 return token_type::parse_error;
6270 if (0xD800 <= codepoint1 && codepoint1 <= 0xDBFF)
6275 const int codepoint2 = get_codepoint();
6279 error_message =
"invalid string: '\\u' must be followed by 4 hex digits";
6280 return token_type::parse_error;
6287 codepoint =
static_cast<int>(
6289 (
static_cast<unsigned int>(codepoint1) << 10u)
6291 +
static_cast<unsigned int>(codepoint2)
6299 error_message =
"invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF";
6300 return token_type::parse_error;
6305 error_message =
"invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF";
6306 return token_type::parse_error;
6313 error_message =
"invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF";
6314 return token_type::parse_error;
6319 JSON_ASSERT(0x00 <= codepoint && codepoint <= 0x10FFFF);
6322 if (codepoint < 0x80)
6325 add(static_cast<char_int_type>(codepoint));
6327 else if (codepoint <= 0x7FF)
6330 add(static_cast<char_int_type>(0xC0u | (static_cast<unsigned int>(codepoint) >> 6u)));
6331 add(static_cast<char_int_type>(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu)));
6333 else if (codepoint <= 0xFFFF)
6336 add(static_cast<char_int_type>(0xE0u | (static_cast<unsigned int>(codepoint) >> 12u)));
6337 add(static_cast<char_int_type>(0x80u | ((static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu)));
6338 add(static_cast<char_int_type>(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu)));
6343 add(static_cast<char_int_type>(0xF0u | (static_cast<unsigned int>(codepoint) >> 18u)));
6344 add(static_cast<char_int_type>(0x80u | ((static_cast<unsigned int>(codepoint) >> 12u) & 0x3Fu)));
6345 add(static_cast<char_int_type>(0x80u | ((static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu)));
6346 add(static_cast<char_int_type>(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu)));
6354 error_message =
"invalid string: forbidden character after backslash";
6355 return token_type::parse_error;
6364 error_message =
"invalid string: control character U+0000 (NUL) must be escaped to \\u0000";
6365 return token_type::parse_error;
6370 error_message =
"invalid string: control character U+0001 (SOH) must be escaped to \\u0001";
6371 return token_type::parse_error;
6376 error_message =
"invalid string: control character U+0002 (STX) must be escaped to \\u0002";
6377 return token_type::parse_error;
6382 error_message =
"invalid string: control character U+0003 (ETX) must be escaped to \\u0003";
6383 return token_type::parse_error;
6388 error_message =
"invalid string: control character U+0004 (EOT) must be escaped to \\u0004";
6389 return token_type::parse_error;
6394 error_message =
"invalid string: control character U+0005 (ENQ) must be escaped to \\u0005";
6395 return token_type::parse_error;
6400 error_message =
"invalid string: control character U+0006 (ACK) must be escaped to \\u0006";
6401 return token_type::parse_error;
6406 error_message =
"invalid string: control character U+0007 (BEL) must be escaped to \\u0007";
6407 return token_type::parse_error;
6412 error_message =
"invalid string: control character U+0008 (BS) must be escaped to \\u0008 or \\b";
6413 return token_type::parse_error;
6418 error_message =
"invalid string: control character U+0009 (HT) must be escaped to \\u0009 or \\t";
6419 return token_type::parse_error;
6424 error_message =
"invalid string: control character U+000A (LF) must be escaped to \\u000A or \\n";
6425 return token_type::parse_error;
6430 error_message =
"invalid string: control character U+000B (VT) must be escaped to \\u000B";
6431 return token_type::parse_error;
6436 error_message =
"invalid string: control character U+000C (FF) must be escaped to \\u000C or \\f";
6437 return token_type::parse_error;
6442 error_message =
"invalid string: control character U+000D (CR) must be escaped to \\u000D or \\r";
6443 return token_type::parse_error;
6448 error_message =
"invalid string: control character U+000E (SO) must be escaped to \\u000E";
6449 return token_type::parse_error;
6454 error_message =
"invalid string: control character U+000F (SI) must be escaped to \\u000F";
6455 return token_type::parse_error;
6460 error_message =
"invalid string: control character U+0010 (DLE) must be escaped to \\u0010";
6461 return token_type::parse_error;
6466 error_message =
"invalid string: control character U+0011 (DC1) must be escaped to \\u0011";
6467 return token_type::parse_error;
6472 error_message =
"invalid string: control character U+0012 (DC2) must be escaped to \\u0012";
6473 return token_type::parse_error;
6478 error_message =
"invalid string: control character U+0013 (DC3) must be escaped to \\u0013";
6479 return token_type::parse_error;
6484 error_message =
"invalid string: control character U+0014 (DC4) must be escaped to \\u0014";
6485 return token_type::parse_error;
6490 error_message =
"invalid string: control character U+0015 (NAK) must be escaped to \\u0015";
6491 return token_type::parse_error;
6496 error_message =
"invalid string: control character U+0016 (SYN) must be escaped to \\u0016";
6497 return token_type::parse_error;
6502 error_message =
"invalid string: control character U+0017 (ETB) must be escaped to \\u0017";
6503 return token_type::parse_error;
6508 error_message =
"invalid string: control character U+0018 (CAN) must be escaped to \\u0018";
6509 return token_type::parse_error;
6514 error_message =
"invalid string: control character U+0019 (EM) must be escaped to \\u0019";
6515 return token_type::parse_error;
6520 error_message =
"invalid string: control character U+001A (SUB) must be escaped to \\u001A";
6521 return token_type::parse_error;
6526 error_message =
"invalid string: control character U+001B (ESC) must be escaped to \\u001B";
6527 return token_type::parse_error;
6532 error_message =
"invalid string: control character U+001C (FS) must be escaped to \\u001C";
6533 return token_type::parse_error;
6538 error_message =
"invalid string: control character U+001D (GS) must be escaped to \\u001D";
6539 return token_type::parse_error;
6544 error_message =
"invalid string: control character U+001E (RS) must be escaped to \\u001E";
6545 return token_type::parse_error;
6550 error_message =
"invalid string: control character U+001F (US) must be escaped to \\u001F";
6551 return token_type::parse_error;
6688 return token_type::parse_error;
6698 return token_type::parse_error;
6722 return token_type::parse_error;
6732 return token_type::parse_error;
6742 return token_type::parse_error;
6754 return token_type::parse_error;
6764 return token_type::parse_error;
6772 error_message =
"invalid string: ill-formed UTF-8 byte";
6773 return token_type::parse_error;
6796 case std::char_traits<char_type>::eof():
6813 case std::char_traits<char_type>::eof():
6816 error_message =
"invalid comment; missing closing '*/'";
6844 error_message =
"invalid comment; expecting '/' or '*' after '/'";
6851 static
void strtof(
float& f, const
char* str,
char** endptr) noexcept
6853 f = std::strtof(str, endptr);
6857 static
void strtof(
double& f, const
char* str,
char** endptr) noexcept
6859 f = std::strtod(str, endptr);
6863 static
void strtof(
long double& f, const
char* str,
char** endptr) noexcept
6865 f = std::strtold(str, endptr);
6915 token_type number_type = token_type::value_unsigned;
6923 goto scan_number_minus;
6929 goto scan_number_zero;
6943 goto scan_number_any1;
6953 number_type = token_type::value_integer;
6959 goto scan_number_zero;
6973 goto scan_number_any1;
6978 error_message =
"invalid number; expected digit after '-'";
6979 return token_type::parse_error;
6989 add(decimal_point_char);
6990 goto scan_number_decimal1;
6997 goto scan_number_exponent;
7001 goto scan_number_done;
7020 goto scan_number_any1;
7025 add(decimal_point_char);
7026 goto scan_number_decimal1;
7033 goto scan_number_exponent;
7037 goto scan_number_done;
7040 scan_number_decimal1:
7042 number_type = token_type::value_float;
7057 goto scan_number_decimal2;
7062 error_message =
"invalid number; expected digit after '.'";
7063 return token_type::parse_error;
7067 scan_number_decimal2:
7083 goto scan_number_decimal2;
7090 goto scan_number_exponent;
7094 goto scan_number_done;
7097 scan_number_exponent:
7099 number_type = token_type::value_float;
7106 goto scan_number_sign;
7121 goto scan_number_any2;
7127 "invalid number; expected '+', '-', or digit after exponent";
7128 return token_type::parse_error;
7148 goto scan_number_any2;
7153 error_message =
"invalid number; expected digit after exponent sign";
7154 return token_type::parse_error;
7174 goto scan_number_any2;
7178 goto scan_number_done;
7186 char* endptr =
nullptr;
7190 if (number_type == token_type::value_unsigned)
7192 const auto x = std::strtoull(token_buffer.data(), &endptr, 10);
7195 JSON_ASSERT(endptr == token_buffer.data() + token_buffer.size());
7200 if (value_unsigned == x)
7202 return token_type::value_unsigned;
7206 else if (number_type == token_type::value_integer)
7208 const auto x = std::strtoll(token_buffer.data(), &endptr, 10);
7211 JSON_ASSERT(endptr == token_buffer.data() + token_buffer.size());
7216 if (value_integer == x)
7218 return token_type::value_integer;
7225 strtof(value_float, token_buffer.data(), &endptr);
7228 JSON_ASSERT(endptr == token_buffer.data() + token_buffer.size());
7230 return token_type::value_float;
7242 JSON_ASSERT(std::char_traits<char_type>::to_char_type(current) == literal_text[0]);
7243 for (std::size_t i = 1; i < length; ++i)
7247 error_message =
"invalid literal";
7248 return token_type::parse_error;
7261 token_buffer.clear();
7262 token_string.clear();
7263 token_string.push_back(std::char_traits<char_type>::to_char_type(current));
7278 ++position.chars_read_total;
7279 ++position.chars_read_current_line;
7288 current = ia.get_character();
7293 token_string.push_back(std::char_traits<char_type>::to_char_type(current));
7296 if (current ==
'\n')
7298 ++position.lines_read;
7299 position.chars_read_current_line = 0;
7317 --position.chars_read_total;
7320 if (position.chars_read_current_line == 0)
7322 if (position.lines_read > 0)
7324 --position.lines_read;
7329 --position.chars_read_current_line;
7335 token_string.pop_back();
7342 token_buffer.push_back(static_cast<typename string_t::value_type>(c));
7353 return value_integer;
7359 return value_unsigned;
7371 return token_buffer;
7391 for (
const auto c : token_string)
7393 if (static_cast<unsigned char>(
c) <=
'\x1F')
7396 std::array<char, 9> cs{{}};
7397 (std::snprintf)(cs.data(), cs.size(),
"<U+%.4X>",
static_cast<unsigned char>(
c));
7398 result += cs.data();
7403 result.push_back(static_cast<std::string::value_type>(
c));
7414 return error_message;
7430 return get() == 0xBB &&
get() == 0xBF;
7445 while (current ==
' ' || current ==
'\t' || current ==
'\n' || current ==
'\r');
7451 if (position.chars_read_total == 0 && !skip_bom())
7453 error_message =
"invalid BOM; must be 0xEF 0xBB 0xBF if given";
7454 return token_type::parse_error;
7461 while (ignore_comments && current ==
'/')
7463 if (!scan_comment())
7465 return token_type::parse_error;
7476 return token_type::begin_array;
7478 return token_type::end_array;
7480 return token_type::begin_object;
7482 return token_type::end_object;
7484 return token_type::name_separator;
7486 return token_type::value_separator;
7491 std::array<char_type, 4> true_literal = {{
't',
'r',
'u',
'e'}};
7492 return scan_literal(true_literal.data(), true_literal.size(), token_type::literal_true);
7496 std::array<char_type, 5> false_literal = {{
'f',
'a',
'l',
's',
'e'}};
7497 return scan_literal(false_literal.data(), false_literal.size(), token_type::literal_false);
7501 std::array<char_type, 4> null_literal = {{
'n',
'u',
'l',
'l'}};
7502 return scan_literal(null_literal.data(), null_literal.size(), token_type::literal_null);
7507 return scan_string();
7521 return scan_number();
7526 case std::char_traits<char_type>::eof():
7527 return token_type::end_of_input;
7531 error_message =
"invalid literal";
7532 return token_type::parse_error;
7541 const bool ignore_comments =
false;
7547 bool next_unget =
false;
7553 std::vector<char_type> token_string {};
7559 const char* error_message =
"";
7590 template<
typename T>
7593 template<
typename T>
7595 decltype(std::declval<T&>().
boolean(std::declval<bool>()));
7597 template<
typename T,
typename Integer>
7601 template<
typename T,
typename Un
signed>
7605 template<
typename T,
typename Float,
typename String>
7607 std::declval<Float>(), std::declval<const String&>()));
7609 template<
typename T,
typename String>
7611 decltype(std::declval<T&>().
string(std::declval<String&>()));
7613 template<
typename T,
typename Binary>
7615 decltype(std::declval<T&>().
binary(std::declval<Binary&>()));
7617 template<
typename T>
7619 decltype(std::declval<T&>().start_object(std::declval<std::size_t>()));
7621 template<
typename T,
typename String>
7623 decltype(std::declval<T&>().
key(std::declval<String&>()));
7625 template<
typename T>
7628 template<
typename T>
7630 decltype(std::declval<T&>().start_array(std::declval<std::size_t>()));
7632 template<
typename T>
7635 template<
typename T,
typename Exception>
7637 std::declval<std::size_t>(), std::declval<const std::string&>(),
7638 std::declval<const Exception&>()));
7640 template<
typename SAX,
typename BasicJsonType>
7645 "BasicJsonType must be of type basic_json<...>");
7671 template<
typename SAX,
typename BasicJsonType>
7676 "BasicJsonType must be of type basic_json<...>");
7687 "Missing/invalid function: bool null()");
7689 "Missing/invalid function: bool boolean(bool)");
7691 "Missing/invalid function: bool boolean(bool)");
7695 "Missing/invalid function: bool number_integer(number_integer_t)");
7699 "Missing/invalid function: bool number_unsigned(number_unsigned_t)");
7702 "Missing/invalid function: bool number_float(number_float_t, const string_t&)");
7705 "Missing/invalid function: bool string(string_t&)");
7708 "Missing/invalid function: bool binary(binary_t&)");
7710 "Missing/invalid function: bool start_object(std::size_t)");
7712 "Missing/invalid function: bool key(string_t&)");
7714 "Missing/invalid function: bool end_object()");
7716 "Missing/invalid function: bool start_array(std::size_t)");
7718 "Missing/invalid function: bool end_array()");
7721 "Missing/invalid function: bool parse_error(std::size_t, const " 7722 "std::string&, const exception&)");
7751 return *
reinterpret_cast<char*
>(&num) == 1;
7762 template<
typename BasicJsonType,
typename InputAdapterType,
typename SAX = json_sax_dom_parser<BasicJsonType>>
7803 const
bool strict = true,
7812 result = parse_bson_internal();
7816 result = parse_cbor_internal(
true, tag_handler);
7820 result = parse_msgpack_internal();
7824 result = parse_ubjson_internal();
7845 return sax->parse_error(chars_read, get_token_string(),
7846 parse_error::create(110, chars_read, exception_message(format,
"expected end of input; last byte: 0x" + get_token_string(),
"value")));
7864 std::int32_t document_size{};
7877 return sax->end_object();
7889 auto out = std::back_inserter(result);
7897 if (current == 0x00)
7901 *out++ =
static_cast<typename string_t::value_type
>(current);
7916 template<
typename NumberType>
7921 auto last_token = get_token_string();
7922 return sax->parse_error(chars_read, last_token,
parse_error::create(112, chars_read, exception_message(
input_format_t::bson,
"string length must be at least 1, is " + std::to_string(len),
"string")));
7925 return get_string(
input_format_t::bson, len - static_cast<NumberType>(1), result) &&
get() != std::char_traits<char_type>::eof();
7937 template<
typename NumberType>
7942 auto last_token = get_token_string();
7943 return sax->parse_error(chars_read, last_token,
parse_error::create(112, chars_read, exception_message(
input_format_t::bson,
"byte array length cannot be negative, is " + std::to_string(len),
"binary")));
7947 std::uint8_t subtype{};
7949 result.set_subtype(subtype);
7951 return get_binary(input_format_t::bson, len, result);
7965 const std::size_t element_type_parse_position)
7967 switch (element_type)
7972 return get_number<double, true>(
input_format_t::bson, number) && sax->number_float(static_cast<number_float_t>(number),
"");
7984 return parse_bson_internal();
7989 return parse_bson_array();
8001 return sax->boolean(
get() != 0);
8011 std::int32_t
value{};
8017 std::int64_t
value{};
8023 std::array<char, 3> cr{{}};
8024 (std::snprintf)(cr.data(), cr.size(),
"%.2hhX",
static_cast<unsigned char>(element_type));
8046 while (
auto element_type =
get())
8053 const std::size_t element_type_parse_position = chars_read;
8059 if (!is_array && !sax->key(key))
8064 if (
JSON_HEDLEY_UNLIKELY(!parse_bson_element_internal(element_type, element_type_parse_position)))
8082 std::int32_t document_size{};
8095 return sax->end_array();
8113 switch (get_char ?
get() : current)
8116 case std::char_traits<char_type>::eof():
8144 return sax->number_unsigned(static_cast<number_unsigned_t>(current));
8148 std::uint8_t number{};
8154 std::uint16_t number{};
8160 std::uint32_t number{};
8166 std::uint64_t number{};
8195 return sax->number_integer(static_cast<std::int8_t>(0x20 - 1 - current));
8199 std::uint8_t number{};
8200 return get_number(
input_format_t::cbor, number) && sax->number_integer(static_cast<number_integer_t>(-1) - number);
8205 std::uint16_t number{};
8206 return get_number(
input_format_t::cbor, number) && sax->number_integer(static_cast<number_integer_t>(-1) - number);
8211 std::uint32_t number{};
8212 return get_number(
input_format_t::cbor, number) && sax->number_integer(static_cast<number_integer_t>(-1) - number);
8217 std::uint64_t number{};
8218 return get_number(
input_format_t::cbor, number) && sax->number_integer(static_cast<number_integer_t>(-1)
8219 - static_cast<number_integer_t>(number));
8254 return get_cbor_binary(b) && sax->binary(b);
8289 return get_cbor_string(s) && sax->string(s);
8317 return get_cbor_array(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x1Fu), tag_handler);
8327 std::uint16_t
len{};
8333 std::uint32_t
len{};
8339 std::uint64_t
len{};
8344 return get_cbor_array(std::size_t(-1), tag_handler);
8371 return get_cbor_object(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x1Fu), tag_handler);
8381 std::uint16_t
len{};
8387 std::uint32_t
len{};
8393 std::uint64_t
len{};
8398 return get_cbor_object(std::size_t(-1), tag_handler);
8420 switch (tag_handler)
8424 auto last_token = get_token_string();
8440 std::uint16_t
len{};
8446 std::uint32_t
len{};
8452 std::uint64_t
len{};
8459 return parse_cbor_internal(
true, tag_handler);
8469 return sax->boolean(
false);
8472 return sax->boolean(
true);
8479 const auto byte1_raw =
get();
8484 const auto byte2_raw =
get();
8490 const auto byte1 =
static_cast<unsigned char>(byte1_raw);
8491 const auto byte2 =
static_cast<unsigned char>(byte2_raw);
8501 const auto half =
static_cast<unsigned int>((byte1 << 8u) + byte2);
8502 const double val = [&half]
8504 const int exp = (half >> 10u) & 0x1Fu;
8505 const unsigned int mant = half & 0x3FFu;
8511 return std::ldexp(mant, -24);
8514 ? std::numeric_limits<double>::infinity()
8515 : std::numeric_limits<double>::quiet_NaN();
8517 return std::ldexp(mant + 1024, exp - 25);
8520 return sax->number_float((half & 0x8000u) != 0
8521 ? static_cast<number_float_t>(-val)
8522 : static_cast<number_float_t>(val),
"");
8528 return get_number(
input_format_t::cbor, number) && sax->number_float(static_cast<number_float_t>(number),
"");
8534 return get_number(
input_format_t::cbor, number) && sax->number_float(static_cast<number_float_t>(number),
"");
8539 auto last_token = get_token_string();
8602 std::uint16_t
len{};
8608 std::uint32_t
len{};
8614 std::uint64_t
len{};
8620 while (
get() != 0xFF)
8623 if (!get_cbor_string(chunk))
8627 result.append(chunk);
8634 auto last_token = get_token_string();
8635 return sax->parse_error(chars_read, last_token,
parse_error::create(113, chars_read, exception_message(
input_format_t::cbor,
"expected length specification (0x60-0x7B) or indefinite string type (0x7F); last byte: 0x" + last_token,
"string")));
8698 std::uint16_t
len{};
8705 std::uint32_t
len{};
8712 std::uint64_t
len{};
8719 while (
get() != 0xFF)
8722 if (!get_cbor_binary(chunk))
8726 result.insert(result.end(), chunk.begin(), chunk.end());
8733 auto last_token = get_token_string();
8734 return sax->parse_error(chars_read, last_token,
parse_error::create(113, chars_read, exception_message(
input_format_t::cbor,
"expected length specification (0x40-0x5B) or indefinite binary array type (0x5F); last byte: 0x" + last_token,
"binary")));
8753 if (len != std::size_t(-1))
8755 for (std::size_t i = 0; i <
len; ++i)
8765 while (
get() != 0xFF)
8774 return sax->end_array();
8792 if (len != std::size_t(-1))
8794 for (std::size_t i = 0; i <
len; ++i)
8811 while (
get() != 0xFF)
8826 return sax->end_object();
8841 case std::char_traits<char_type>::eof():
8973 return sax->number_unsigned(static_cast<number_unsigned_t>(current));
8992 return get_msgpack_object(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x0Fu));
9011 return get_msgpack_array(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x0Fu));
9051 return get_msgpack_string(s) && sax->string(s);
9058 return sax->boolean(
false);
9061 return sax->boolean(
true);
9076 return get_msgpack_binary(b) && sax->binary(b);
9082 return get_number(
input_format_t::msgpack, number) && sax->number_float(static_cast<number_float_t>(number),
"");
9088 return get_number(
input_format_t::msgpack, number) && sax->number_float(static_cast<number_float_t>(number),
"");
9093 std::uint8_t number{};
9099 std::uint16_t number{};
9105 std::uint32_t number{};
9111 std::uint64_t number{};
9117 std::int8_t number{};
9123 std::int16_t number{};
9129 std::int32_t number{};
9135 std::int64_t number{};
9141 std::uint16_t
len{};
9147 std::uint32_t
len{};
9153 std::uint16_t
len{};
9159 std::uint32_t
len{};
9196 return sax->number_integer(static_cast<std::int8_t>(current));
9200 auto last_token = get_token_string();
9270 std::uint16_t
len{};
9276 std::uint32_t
len{};
9282 auto last_token = get_token_string();
9283 return sax->parse_error(chars_read, last_token,
parse_error::create(113, chars_read, exception_message(
input_format_t::msgpack,
"expected length specification (0xA0-0xBF, 0xD9-0xDB); last byte: 0x" + last_token,
"string")));
9301 auto assign_and_return_true = [&
result](std::int8_t subtype)
9303 result.set_subtype(static_cast<std::uint8_t>(subtype));
9318 std::uint16_t
len{};
9325 std::uint32_t
len{};
9333 std::int8_t subtype{};
9337 assign_and_return_true(subtype);
9342 std::uint16_t
len{};
9343 std::int8_t subtype{};
9347 assign_and_return_true(subtype);
9352 std::uint32_t
len{};
9353 std::int8_t subtype{};
9357 assign_and_return_true(subtype);
9362 std::int8_t subtype{};
9365 assign_and_return_true(subtype);
9370 std::int8_t subtype{};
9373 assign_and_return_true(subtype);
9378 std::int8_t subtype{};
9381 assign_and_return_true(subtype);
9386 std::int8_t subtype{};
9389 assign_and_return_true(subtype);
9394 std::int8_t subtype{};
9397 assign_and_return_true(subtype);
9416 for (std::size_t i = 0; i <
len; ++i)
9424 return sax->end_array();
9439 for (std::size_t i = 0; i <
len; ++i)
9454 return sax->end_object();
9470 return get_ubjson_value(get_char ? get_ignore_noop() : current);
9532 auto last_token = get_token_string();
9533 return sax->parse_error(chars_read, last_token,
parse_error::create(113, chars_read, exception_message(
input_format_t::ubjson,
"expected length type specification (U, i, I, l, L); last byte: 0x" + last_token,
"string")));
9543 switch (get_ignore_noop())
9547 std::uint8_t number{};
9552 result =
static_cast<std::size_t
>(number);
9558 std::int8_t number{};
9563 result =
static_cast<std::size_t
>(number);
9569 std::int16_t number{};
9574 result =
static_cast<std::size_t
>(number);
9580 std::int32_t number{};
9585 result =
static_cast<std::size_t
>(number);
9591 std::int64_t number{};
9596 result =
static_cast<std::size_t
>(number);
9602 auto last_token = get_token_string();
9603 return sax->parse_error(chars_read, last_token,
parse_error::create(113, chars_read, exception_message(
input_format_t::ubjson,
"expected length type specification (U, i, I, l, L) after '#'; last byte: 0x" + last_token,
"size")));
9620 result.first = string_t::npos;
9627 result.second =
get();
9640 auto last_token = get_token_string();
9641 return sax->parse_error(chars_read, last_token,
parse_error::create(112, chars_read, exception_message(
input_format_t::ubjson,
"expected '#' after type information; last byte: 0x" + last_token,
"size")));
9644 return get_ubjson_size_value(result.first);
9649 return get_ubjson_size_value(result.first);
9663 case std::char_traits<char_type>::eof():
9667 return sax->boolean(
true);
9669 return sax->boolean(
false);
9676 std::uint8_t number{};
9682 std::int8_t number{};
9688 std::int16_t number{};
9694 std::int32_t number{};
9700 std::int64_t number{};
9707 return get_number(
input_format_t::ubjson, number) && sax->number_float(static_cast<number_float_t>(number),
"");
9713 return get_number(
input_format_t::ubjson, number) && sax->number_float(static_cast<number_float_t>(number),
"");
9718 return get_ubjson_high_precision_number();
9730 auto last_token = get_token_string();
9731 return sax->parse_error(chars_read, last_token,
parse_error::create(113, chars_read, exception_message(
input_format_t::ubjson,
"byte after 'C' must be in range 0x00..0x7F; last byte: 0x" + last_token,
"char")));
9733 string_t s(1, static_cast<typename string_t::value_type>(current));
9734 return sax->string(s);
9740 return get_ubjson_string(s) && sax->string(s);
9744 return get_ubjson_array();
9747 return get_ubjson_object();
9751 auto last_token = get_token_string();
9762 std::pair<std::size_t, char_int_type> size_and_type;
9768 if (size_and_type.first != string_t::npos)
9775 if (size_and_type.second != 0)
9777 if (size_and_type.second !=
'N')
9779 for (std::size_t i = 0; i < size_and_type.first; ++i)
9790 for (std::size_t i = 0; i < size_and_type.first; ++i)
9806 while (current !=
']')
9816 return sax->end_array();
9824 std::pair<std::size_t, char_int_type> size_and_type;
9831 if (size_and_type.first != string_t::npos)
9838 if (size_and_type.second != 0)
9840 for (std::size_t i = 0; i < size_and_type.first; ++i)
9855 for (std::size_t i = 0; i < size_and_type.first; ++i)
9876 while (current !=
'}')
9891 return sax->end_object();
9901 auto res = get_ubjson_size_value(size);
9908 std::vector<char> number_vector;
9909 for (std::size_t i = 0; i < size; ++i)
9916 number_vector.push_back(static_cast<char>(current));
9922 const auto result_number = number_lexer.
scan();
9923 const auto number_string = number_lexer.get_token_string();
9924 const auto result_remainder = number_lexer.scan();
9930 return sax->parse_error(chars_read, number_string,
parse_error::create(115, chars_read, exception_message(
input_format_t::ubjson,
"invalid number text: " + number_lexer.get_token_string(),
"high-precision number")));
9933 switch (result_number)
9935 case token_type::value_integer:
9936 return sax->number_integer(number_lexer.get_number_integer());
9937 case token_type::value_unsigned:
9938 return sax->number_unsigned(number_lexer.get_number_unsigned());
9939 case token_type::value_float:
9940 return sax->number_float(number_lexer.get_number_float(),
std::move(number_string));
9942 return sax->parse_error(chars_read, number_string,
parse_error::create(115, chars_read, exception_message(
input_format_t::ubjson,
"invalid number text: " + number_lexer.get_token_string(),
"high-precision number")));
9962 return current = ia.get_character();
9974 while (current ==
'N');
9992 template<
typename NumberType,
bool InputIsLittleEndian = false>
9996 std::array<std::uint8_t, sizeof(NumberType)> vec;
9997 for (std::size_t i = 0; i <
sizeof(NumberType); ++i)
10006 if (is_little_endian != InputIsLittleEndian)
10008 vec[
sizeof(NumberType) - i - 1] = static_cast<std::uint8_t>(current);
10012 vec[i] =
static_cast<std::uint8_t
>(current);
10017 std::memcpy(&result, vec.data(),
sizeof(NumberType));
10035 template<
typename NumberType>
10037 const NumberType
len,
10041 for (NumberType i = 0; i <
len; i++)
10049 result.push_back(static_cast<typename string_t::value_type>(current));
10068 template<
typename NumberType>
10070 const NumberType
len,
10074 for (NumberType i = 0; i <
len; i++)
10082 result.push_back(static_cast<std::uint8_t>(current));
10097 return sax->parse_error(chars_read,
"<end of file>",
10098 parse_error::create(110, chars_read, exception_message(format,
"unexpected end of input", context)));
10108 std::array<char, 3> cr{{}};
10109 (std::snprintf)(cr.data(), cr.size(),
"%.2hhX",
static_cast<unsigned char>(current));
10123 std::string error_msg =
"syntax error while parsing ";
10128 error_msg +=
"CBOR";
10132 error_msg +=
"MessagePack";
10136 error_msg +=
"UBJSON";
10140 error_msg +=
"BSON";
10147 return error_msg +
" " + context +
": " + detail;
10158 std::size_t chars_read = 0;
10178 #include <functional> 10222 template<
typename BasicJsonType>
10224 std::function<bool(int depth, parse_event_t event, BasicJsonType& parsed)>;
10231 template<
typename BasicJsonType,
typename InputAdapterType>
10245 const bool allow_exceptions_ =
true,
10246 const bool skip_comments =
false)
10248 , m_lexer(
std::
move(adapter), skip_comments)
10249 , allow_exceptions(allow_exceptions_)
10270 sax_parse_internal(&sdp);
10271 result.assert_invariant();
10274 if (strict && (get_token() != token_type::end_of_input))
10277 m_lexer.get_token_string(),
10279 exception_message(token_type::end_of_input,
"value")));
10291 if (result.is_discarded())
10299 sax_parse_internal(&sdp);
10300 result.assert_invariant();
10303 if (strict && (get_token() != token_type::end_of_input))
10306 m_lexer.get_token_string(),
10308 exception_message(token_type::end_of_input,
"value")));
10329 return sax_parse(&sax_acceptor,
strict);
10332 template<
typename SAX>
10337 const bool result = sax_parse_internal(sax);
10340 if (result &&
strict && (get_token() != token_type::end_of_input))
10342 return sax->parse_error(m_lexer.get_position(),
10343 m_lexer.get_token_string(),
10345 exception_message(token_type::end_of_input,
"value")));
10352 template<
typename SAX>
10358 std::vector<bool> states;
10360 bool skip_to_state_evaluation =
false;
10364 if (!skip_to_state_evaluation)
10367 switch (last_token)
10369 case token_type::begin_object:
10377 if (get_token() == token_type::end_object)
10389 return sax->parse_error(m_lexer.get_position(),
10390 m_lexer.get_token_string(),
10392 exception_message(token_type::value_string,
"object key")));
10402 return sax->parse_error(m_lexer.get_position(),
10403 m_lexer.get_token_string(),
10405 exception_message(token_type::name_separator,
"object separator")));
10409 states.push_back(
false);
10416 case token_type::begin_array:
10424 if (get_token() == token_type::end_array)
10434 states.push_back(
true);
10440 case token_type::value_float:
10442 const auto res = m_lexer.get_number_float();
10446 return sax->parse_error(m_lexer.get_position(),
10447 m_lexer.get_token_string(),
10459 case token_type::literal_false:
10468 case token_type::literal_null:
10477 case token_type::literal_true:
10486 case token_type::value_integer:
10495 case token_type::value_string:
10504 case token_type::value_unsigned:
10513 case token_type::parse_error:
10516 return sax->parse_error(m_lexer.get_position(),
10517 m_lexer.get_token_string(),
10519 exception_message(token_type::uninitialized,
"value")));
10524 return sax->parse_error(m_lexer.get_position(),
10525 m_lexer.get_token_string(),
10527 exception_message(token_type::literal_or_value,
"value")));
10533 skip_to_state_evaluation =
false;
10537 if (states.empty())
10546 if (get_token() == token_type::value_separator)
10567 skip_to_state_evaluation =
true;
10571 return sax->parse_error(m_lexer.get_position(),
10572 m_lexer.get_token_string(),
10574 exception_message(token_type::end_array,
"array")));
10579 if (get_token() == token_type::value_separator)
10584 return sax->parse_error(m_lexer.get_position(),
10585 m_lexer.get_token_string(),
10587 exception_message(token_type::value_string,
"object key")));
10598 return sax->parse_error(m_lexer.get_position(),
10599 m_lexer.get_token_string(),
10601 exception_message(token_type::name_separator,
"object separator")));
10623 skip_to_state_evaluation =
true;
10627 return sax->parse_error(m_lexer.get_position(),
10628 m_lexer.get_token_string(),
10630 exception_message(token_type::end_object,
"object")));
10638 return last_token = m_lexer.scan();
10645 if (!context.empty())
10647 error_msg +=
"while parsing " + context +
" ";
10652 if (last_token == token_type::parse_error)
10654 error_msg +=
std::string(m_lexer.get_error_message()) +
"; last read: '" +
10655 m_lexer.get_token_string() +
"'";
10659 error_msg +=
"unexpected " +
std::string(lexer_t::token_type_name(last_token));
10662 if (expected != token_type::uninitialized)
10664 error_msg +=
"; expected " +
std::string(lexer_t::token_type_name(expected));
10678 const bool allow_exceptions =
true;
10725 m_it = begin_value;
10737 return m_it == begin_value;
10743 return m_it == end_value;
10748 return lhs.m_it == rhs.m_it;
10753 return lhs.m_it < rhs.m_it;
10765 return lhs.m_it - rhs.m_it;
10823 typename BasicJsonType::object_t::iterator object_iterator {};
10825 typename BasicJsonType::array_t::iterator array_iterator {};
10835 #include <iterator> 10836 #include <type_traits> 10877 template<
typename BasicJsonType>
10889 static_assert(
is_basic_json<
typename std::remove_const<BasicJsonType>::type>::
value,
10890 "iter_impl only accepts (const) basic_json");
10907 typename BasicJsonType::const_pointer,
10908 typename BasicJsonType::pointer>::type;
10912 typename BasicJsonType::const_reference,
10928 switch (m_object->m_type)
10932 m_it.object_iterator =
typename object_t::iterator();
10938 m_it.array_iterator =
typename array_t::iterator();
10967 : m_object(other.m_object), m_it(other.m_it)
10978 m_object = other.m_object;
10989 : m_object(other.m_object), m_it(other.m_it)
11000 m_object = other.m_object;
11010 void set_begin() noexcept
11014 switch (m_object->m_type)
11018 m_it.object_iterator = m_object->m_value.object->begin();
11024 m_it.array_iterator = m_object->m_value.array->begin();
11031 m_it.primitive_iterator.set_end();
11037 m_it.primitive_iterator.set_begin();
11051 switch (m_object->m_type)
11055 m_it.object_iterator = m_object->m_value.object->end();
11061 m_it.array_iterator = m_object->m_value.array->end();
11067 m_it.primitive_iterator.set_end();
11082 switch (m_object->m_type)
11086 JSON_ASSERT(m_it.object_iterator != m_object->m_value.object->end());
11087 return m_it.object_iterator->second;
11092 JSON_ASSERT(m_it.array_iterator != m_object->m_value.array->end());
11093 return *m_it.array_iterator;
11119 switch (m_object->m_type)
11123 JSON_ASSERT(m_it.object_iterator != m_object->m_value.object->end());
11124 return &(m_it.object_iterator->second);
11129 JSON_ASSERT(m_it.array_iterator != m_object->m_value.array->end());
11130 return &*m_it.array_iterator;
11164 switch (m_object->m_type)
11168 std::advance(m_it.object_iterator, 1);
11174 std::advance(m_it.array_iterator, 1);
11180 ++m_it.primitive_iterator;
11207 switch (m_object->m_type)
11211 std::advance(m_it.object_iterator, -1);
11217 std::advance(m_it.array_iterator, -1);
11223 --m_it.primitive_iterator;
11245 switch (m_object->m_type)
11281 switch (m_object->m_type)
11300 return !other.operator < (*this);
11329 switch (m_object->m_type)
11336 std::advance(m_it.array_iterator, i);
11342 m_it.primitive_iterator += i;
11356 return operator+=(-i);
11400 switch (m_object->m_type)
11421 switch (m_object->m_type)
11427 return *std::next(m_it.array_iterator, n);
11448 const typename object_t::key_type&
key()
const 11454 return m_it.object_iterator->first;
11484 #include <iterator> 11513 template<
typename Base>
11587 auto it = --this->base();
11594 auto it = --this->base();
11595 return it.operator * ();
11606 #include <algorithm> 11623 template<
typename BasicJsonType>
11653 : reference_tokens(split(s))
11672 return std::accumulate(reference_tokens.begin(), reference_tokens.end(),
11676 return a +
"/" + escape(b);
11704 reference_tokens.insert(reference_tokens.end(),
11750 return *
this /= std::to_string(array_idx);
11859 reference_tokens.pop_back();
11883 return reference_tokens.back();
11900 reference_tokens.push_back(token);
11906 reference_tokens.push_back(
std::move(token));
11925 return reference_tokens.empty();
11941 using size_type =
typename BasicJsonType::size_type;
11947 "array index '" + s +
11948 "' must not begin with '0'"));
11957 std::size_t processed_chars = 0;
11958 unsigned long long res = 0;
11961 res = std::stoull(s, &processed_chars);
11981 return static_cast<size_type
>(res);
12012 for (
const auto& reference_token : reference_tokens)
12018 if (reference_token ==
"0")
12041 result = &
result->operator[](array_index(reference_token));
12080 for (
const auto& reference_token : reference_tokens)
12083 if (ptr->is_null())
12087 std::all_of(reference_token.begin(), reference_token.end(),
12088 [](
const unsigned char x)
12090 return std::isdigit(x);
12094 *ptr = (nums || reference_token ==
"-")
12099 switch (ptr->type())
12104 ptr = &ptr->operator[](reference_token);
12110 if (reference_token ==
"-")
12113 ptr = &ptr->operator[](ptr->m_value.array->size());
12118 ptr = &ptr->operator[](array_index(reference_token));
12139 for (
const auto& reference_token : reference_tokens)
12141 switch (ptr->type())
12146 ptr = &ptr->at(reference_token);
12156 "array index '-' (" + std::to_string(ptr->m_value.array->size()) +
12157 ") is out of range"));
12161 ptr = &ptr->at(array_index(reference_token));
12188 for (
const auto& reference_token : reference_tokens)
12190 switch (ptr->type())
12195 ptr = &ptr->operator[](reference_token);
12205 "array index '-' (" + std::to_string(ptr->m_value.array->size()) +
12206 ") is out of range"));
12210 ptr = &ptr->operator[](array_index(reference_token));
12230 for (
const auto& reference_token : reference_tokens)
12232 switch (ptr->type())
12237 ptr = &ptr->at(reference_token);
12247 "array index '-' (" + std::to_string(ptr->m_value.array->size()) +
12248 ") is out of range"));
12252 ptr = &ptr->at(array_index(reference_token));
12270 for (
const auto& reference_token : reference_tokens)
12272 switch (ptr->type())
12276 if (!ptr->contains(reference_token))
12282 ptr = &ptr->operator[](reference_token);
12293 if (
JSON_HEDLEY_UNLIKELY(reference_token.size() == 1 && !(
"0" <= reference_token && reference_token <=
"9")))
12305 for (std::size_t i = 1; i < reference_token.size(); i++)
12315 const auto idx = array_index(reference_token);
12316 if (idx >= ptr->size())
12322 ptr = &ptr->operator[](idx);
12350 std::vector<std::string>
result;
12353 if (reference_string.empty())
12362 "JSON pointer must be empty or begin with '/' - was: '" +
12363 reference_string +
"'"));
12371 std::size_t slash = reference_string.find_first_of(
'/', 1),
12378 start = (slash == std::string::npos) ? 0 : slash + 1,
12380 slash = reference_string.find_first_of(
'/', start))
12384 auto reference_token = reference_string.substr(start, slash - start);
12387 for (std::size_t pos = reference_token.find_first_of(
'~');
12388 pos != std::string::npos;
12389 pos = reference_token.find_first_of(
'~', pos + 1))
12395 (reference_token[pos + 1] !=
'0' &&
12396 reference_token[pos + 1] !=
'1')))
12403 unescape(reference_token);
12404 result.push_back(reference_token);
12427 for (
auto pos = s.find(f);
12428 pos != std::string::npos;
12429 s.replace(pos, f.size(), t),
12430 pos = s.find(f, pos + t.size()))
12438 replace_substring(s,
"~",
"~0");
12439 replace_substring(s,
"/",
"~1");
12446 replace_substring(s,
"~1",
"/");
12447 replace_substring(s,
"~0",
"~");
12459 const BasicJsonType&
value,
12462 switch (value.type())
12466 if (value.m_value.array->empty())
12469 result[reference_string] =
nullptr;
12474 for (std::size_t i = 0; i < value.m_value.array->size(); ++i)
12476 flatten(reference_string +
"/" + std::to_string(i),
12477 value.m_value.array->operator[](i), result);
12485 if (value.m_value.object->empty())
12488 result[reference_string] =
nullptr;
12493 for (
const auto& element : *value.m_value.object)
12495 flatten(reference_string +
"/" + escape(element.first), element.second, result);
12504 result[reference_string] =
value;
12520 static BasicJsonType
12531 for (
const auto& element : *value.m_value.object)
12562 return lhs.reference_tokens == rhs.reference_tokens;
12579 return !(lhs == rhs);
12590 #include <initializer_list> 12600 template<
typename BasicJsonType>
12608 , value_ref(&owned_value)
12613 : value_ref(const_cast<
value_type*>(&value))
12618 : owned_value(init)
12619 , value_ref(&owned_value)
12627 : owned_value(
std::forward<Args>(args)...)
12628 , value_ref(&owned_value)
12650 return *
static_cast<value_type const*
>(value_ref);
12655 return static_cast<value_type const*
>(value_ref);
12659 mutable value_type owned_value =
nullptr;
12660 value_type* value_ref =
nullptr;
12661 const bool is_rvalue =
true;
12675 #include <algorithm> 12690 #include <algorithm> 12693 #include <iterator> 12708 virtual void write_character(CharType
c) = 0;
12709 virtual void write_characters(
const CharType* s, std::size_t length) = 0;
12714 template<
typename CharType>
12718 template<
typename CharType>
12732 void write_characters(const CharType* s,
std::
size_t length)
override 12734 std::copy(s, s + length, std::back_inserter(v));
12738 std::vector<CharType>&
v;
12742 template<
typename CharType>
12756 void write_characters(const CharType* s,
std::
size_t length)
override 12758 stream.write(s, static_cast<std::streamsize>(length));
12766 template<
typename CharType,
typename StringType = std::basic_
string<CharType>>
12780 void write_characters(const CharType* s,
std::
size_t length)
override 12782 str.append(s, length);
12789 template<
typename CharType,
typename StringType = std::basic_
string<CharType>>
12825 template<
typename BasicJsonType,
typename CharType>
12853 write_bson_object(*j.m_value.object);
12873 oa->write_character(to_char_type(0xF6));
12879 oa->write_character(j.m_value.boolean
12880 ? to_char_type(0xF5)
12881 : to_char_type(0xF4));
12887 if (j.m_value.number_integer >= 0)
12892 if (j.m_value.number_integer <= 0x17)
12894 write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
12898 oa->write_character(to_char_type(0x18));
12899 write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
12903 oa->write_character(to_char_type(0x19));
12904 write_number(static_cast<std::uint16_t>(j.m_value.number_integer));
12908 oa->write_character(to_char_type(0x1A));
12909 write_number(static_cast<std::uint32_t>(j.m_value.number_integer));
12913 oa->write_character(to_char_type(0x1B));
12914 write_number(static_cast<std::uint64_t>(j.m_value.number_integer));
12921 const auto positive_number = -1 - j.m_value.number_integer;
12922 if (j.m_value.number_integer >= -24)
12924 write_number(static_cast<std::uint8_t>(0x20 + positive_number));
12928 oa->write_character(to_char_type(0x38));
12929 write_number(static_cast<std::uint8_t>(positive_number));
12933 oa->write_character(to_char_type(0x39));
12934 write_number(static_cast<std::uint16_t>(positive_number));
12938 oa->write_character(to_char_type(0x3A));
12939 write_number(static_cast<std::uint32_t>(positive_number));
12943 oa->write_character(to_char_type(0x3B));
12944 write_number(static_cast<std::uint64_t>(positive_number));
12952 if (j.m_value.number_unsigned <= 0x17)
12954 write_number(static_cast<std::uint8_t>(j.m_value.number_unsigned));
12958 oa->write_character(to_char_type(0x18));
12959 write_number(static_cast<std::uint8_t>(j.m_value.number_unsigned));
12963 oa->write_character(to_char_type(0x19));
12964 write_number(static_cast<std::uint16_t>(j.m_value.number_unsigned));
12968 oa->write_character(to_char_type(0x1A));
12969 write_number(static_cast<std::uint32_t>(j.m_value.number_unsigned));
12973 oa->write_character(to_char_type(0x1B));
12974 write_number(static_cast<std::uint64_t>(j.m_value.number_unsigned));
12984 oa->write_character(to_char_type(0xF9));
12985 oa->write_character(to_char_type(0x7E));
12986 oa->write_character(to_char_type(0x00));
12988 else if (std::isinf(j.m_value.number_float))
12991 oa->write_character(to_char_type(0xf9));
12992 oa->write_character(j.m_value.number_float > 0 ? to_char_type(0x7C) : to_char_type(0xFC));
12993 oa->write_character(to_char_type(0x00));
13005 const auto N = j.m_value.string->size();
13008 write_number(static_cast<std::uint8_t>(0x60 + N));
13012 oa->write_character(to_char_type(0x78));
13013 write_number(static_cast<std::uint8_t>(N));
13017 oa->write_character(to_char_type(0x79));
13018 write_number(static_cast<std::uint16_t>(N));
13022 oa->write_character(to_char_type(0x7A));
13023 write_number(static_cast<std::uint32_t>(N));
13028 oa->write_character(to_char_type(0x7B));
13029 write_number(static_cast<std::uint64_t>(N));
13034 oa->write_characters(
13035 reinterpret_cast<const CharType*>(j.m_value.string->c_str()),
13036 j.m_value.string->size());
13043 const auto N = j.m_value.array->size();
13046 write_number(static_cast<std::uint8_t>(0x80 + N));
13050 oa->write_character(to_char_type(0x98));
13051 write_number(static_cast<std::uint8_t>(N));
13055 oa->write_character(to_char_type(0x99));
13056 write_number(static_cast<std::uint16_t>(N));
13060 oa->write_character(to_char_type(0x9A));
13061 write_number(static_cast<std::uint32_t>(N));
13066 oa->write_character(to_char_type(0x9B));
13067 write_number(static_cast<std::uint64_t>(N));
13072 for (
const auto& el : *j.m_value.array)
13081 if (j.m_value.binary->has_subtype())
13083 write_number(static_cast<std::uint8_t>(0xd8));
13084 write_number(j.m_value.binary->subtype());
13088 const auto N = j.m_value.binary->size();
13091 write_number(static_cast<std::uint8_t>(0x40 + N));
13095 oa->write_character(to_char_type(0x58));
13096 write_number(static_cast<std::uint8_t>(N));
13100 oa->write_character(to_char_type(0x59));
13101 write_number(static_cast<std::uint16_t>(N));
13105 oa->write_character(to_char_type(0x5A));
13106 write_number(static_cast<std::uint32_t>(N));
13111 oa->write_character(to_char_type(0x5B));
13112 write_number(static_cast<std::uint64_t>(N));
13117 oa->write_characters(
13118 reinterpret_cast<const CharType*>(j.m_value.binary->data()),
13127 const auto N = j.m_value.object->size();
13130 write_number(static_cast<std::uint8_t>(0xA0 + N));
13134 oa->write_character(to_char_type(0xB8));
13135 write_number(static_cast<std::uint8_t>(N));
13139 oa->write_character(to_char_type(0xB9));
13140 write_number(static_cast<std::uint16_t>(N));
13144 oa->write_character(to_char_type(0xBA));
13145 write_number(static_cast<std::uint32_t>(N));
13150 oa->write_character(to_char_type(0xBB));
13151 write_number(static_cast<std::uint64_t>(N));
13156 for (
const auto& el : *j.m_value.object)
13158 write_cbor(el.first);
13159 write_cbor(el.second);
13178 oa->write_character(to_char_type(0xC0));
13184 oa->write_character(j.m_value.boolean
13185 ? to_char_type(0xC3)
13186 : to_char_type(0xC2));
13192 if (j.m_value.number_integer >= 0)
13197 if (j.m_value.number_unsigned < 128)
13200 write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
13205 oa->write_character(to_char_type(0xCC));
13206 write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
13211 oa->write_character(to_char_type(0xCD));
13212 write_number(static_cast<std::uint16_t>(j.m_value.number_integer));
13217 oa->write_character(to_char_type(0xCE));
13218 write_number(static_cast<std::uint32_t>(j.m_value.number_integer));
13223 oa->write_character(to_char_type(0xCF));
13224 write_number(static_cast<std::uint64_t>(j.m_value.number_integer));
13229 if (j.m_value.number_integer >= -32)
13232 write_number(static_cast<std::int8_t>(j.m_value.number_integer));
13238 oa->write_character(to_char_type(0xD0));
13239 write_number(static_cast<std::int8_t>(j.m_value.number_integer));
13245 oa->write_character(to_char_type(0xD1));
13246 write_number(static_cast<std::int16_t>(j.m_value.number_integer));
13252 oa->write_character(to_char_type(0xD2));
13253 write_number(static_cast<std::int32_t>(j.m_value.number_integer));
13259 oa->write_character(to_char_type(0xD3));
13260 write_number(static_cast<std::int64_t>(j.m_value.number_integer));
13268 if (j.m_value.number_unsigned < 128)
13271 write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
13276 oa->write_character(to_char_type(0xCC));
13277 write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
13282 oa->write_character(to_char_type(0xCD));
13283 write_number(static_cast<std::uint16_t>(j.m_value.number_integer));
13288 oa->write_character(to_char_type(0xCE));
13289 write_number(static_cast<std::uint32_t>(j.m_value.number_integer));
13294 oa->write_character(to_char_type(0xCF));
13295 write_number(static_cast<std::uint64_t>(j.m_value.number_integer));
13309 const auto N = j.m_value.string->size();
13313 write_number(static_cast<std::uint8_t>(0xA0 | N));
13318 oa->write_character(to_char_type(0xD9));
13319 write_number(static_cast<std::uint8_t>(N));
13324 oa->write_character(to_char_type(0xDA));
13325 write_number(static_cast<std::uint16_t>(N));
13330 oa->write_character(to_char_type(0xDB));
13331 write_number(static_cast<std::uint32_t>(N));
13335 oa->write_characters(
13336 reinterpret_cast<const CharType*>(j.m_value.string->c_str()),
13337 j.m_value.string->size());
13344 const auto N = j.m_value.array->size();
13348 write_number(static_cast<std::uint8_t>(0x90 | N));
13353 oa->write_character(to_char_type(0xDC));
13354 write_number(static_cast<std::uint16_t>(N));
13359 oa->write_character(to_char_type(0xDD));
13360 write_number(static_cast<std::uint32_t>(N));
13364 for (
const auto& el : *j.m_value.array)
13375 const bool use_ext = j.m_value.binary->has_subtype();
13378 const auto N = j.m_value.binary->size();
13381 std::uint8_t output_type{};
13388 output_type = 0xD4;
13391 output_type = 0xD5;
13394 output_type = 0xD6;
13397 output_type = 0xD7;
13400 output_type = 0xD8;
13403 output_type = 0xC7;
13411 output_type = 0xC4;
13415 oa->write_character(to_char_type(output_type));
13418 write_number(static_cast<std::uint8_t>(N));
13423 std::uint8_t output_type = use_ext
13427 oa->write_character(to_char_type(output_type));
13428 write_number(static_cast<std::uint16_t>(N));
13432 std::uint8_t output_type = use_ext
13436 oa->write_character(to_char_type(output_type));
13437 write_number(static_cast<std::uint32_t>(N));
13443 write_number(static_cast<std::int8_t>(j.m_value.binary->subtype()));
13447 oa->write_characters(
13448 reinterpret_cast<const CharType*>(j.m_value.binary->data()),
13457 const auto N = j.m_value.object->size();
13461 write_number(static_cast<std::uint8_t>(0x80 | (N & 0xF)));
13466 oa->write_character(to_char_type(0xDE));
13467 write_number(static_cast<std::uint16_t>(N));
13472 oa->write_character(to_char_type(0xDF));
13473 write_number(static_cast<std::uint32_t>(N));
13477 for (
const auto& el : *j.m_value.object)
13479 write_msgpack(el.first);
13480 write_msgpack(el.second);
13497 const bool use_type,
const bool add_prefix =
true)
13505 oa->write_character(to_char_type(
'Z'));
13514 oa->write_character(j.m_value.boolean
13515 ? to_char_type(
'T')
13516 : to_char_type(
'F'));
13523 write_number_with_ubjson_prefix(j.m_value.number_integer, add_prefix);
13529 write_number_with_ubjson_prefix(j.m_value.number_unsigned, add_prefix);
13535 write_number_with_ubjson_prefix(j.m_value.number_float, add_prefix);
13543 oa->write_character(to_char_type(
'S'));
13545 write_number_with_ubjson_prefix(j.m_value.string->size(),
true);
13546 oa->write_characters(
13547 reinterpret_cast<const CharType*>(j.m_value.string->c_str()),
13548 j.m_value.string->size());
13556 oa->write_character(to_char_type(
'['));
13559 bool prefix_required =
true;
13560 if (use_type && !j.m_value.array->empty())
13563 const CharType first_prefix = ubjson_prefix(j.front());
13564 const bool same_prefix = std::all_of(j.begin() + 1, j.end(),
13565 [
this, first_prefix](
const BasicJsonType & v)
13567 return ubjson_prefix(v) == first_prefix;
13572 prefix_required =
false;
13573 oa->write_character(to_char_type(
'$'));
13574 oa->write_character(first_prefix);
13580 oa->write_character(to_char_type(
'#'));
13581 write_number_with_ubjson_prefix(j.m_value.array->size(),
true);
13584 for (
const auto& el : *j.m_value.array)
13586 write_ubjson(el, use_count, use_type, prefix_required);
13591 oa->write_character(to_char_type(
']'));
13601 oa->write_character(to_char_type(
'['));
13604 if (use_type && !j.m_value.binary->empty())
13607 oa->write_character(to_char_type(
'$'));
13608 oa->write_character(
'U');
13613 oa->write_character(to_char_type(
'#'));
13614 write_number_with_ubjson_prefix(j.m_value.binary->size(),
true);
13619 oa->write_characters(
13620 reinterpret_cast<const CharType*>(j.m_value.binary->data()),
13621 j.m_value.binary->size());
13625 for (
size_t i = 0; i < j.m_value.binary->size(); ++i)
13627 oa->write_character(to_char_type(
'U'));
13628 oa->write_character(j.m_value.binary->data()[i]);
13634 oa->write_character(to_char_type(
']'));
13644 oa->write_character(to_char_type(
'{'));
13647 bool prefix_required =
true;
13648 if (use_type && !j.m_value.object->empty())
13651 const CharType first_prefix = ubjson_prefix(j.front());
13652 const bool same_prefix = std::all_of(j.begin(), j.end(),
13653 [
this, first_prefix](
const BasicJsonType & v)
13655 return ubjson_prefix(v) == first_prefix;
13660 prefix_required =
false;
13661 oa->write_character(to_char_type(
'$'));
13662 oa->write_character(first_prefix);
13668 oa->write_character(to_char_type(
'#'));
13669 write_number_with_ubjson_prefix(j.m_value.object->size(),
true);
13672 for (
const auto& el : *j.m_value.object)
13674 write_number_with_ubjson_prefix(el.first.size(),
true);
13675 oa->write_characters(
13676 reinterpret_cast<const CharType*>(el.first.c_str()),
13678 write_ubjson(el.second, use_count, use_type, prefix_required);
13683 oa->write_character(to_char_type(
'}'));
13705 const auto it = name.find(static_cast<typename string_t::value_type>(0));
13709 "BSON key cannot contain code point U+0000 (at byte " + std::to_string(it) +
")"));
13712 return 1ul + name.size() + 1u;
13719 const std::uint8_t element_type)
13721 oa->write_character(to_char_type(element_type));
13722 oa->write_characters(
13723 reinterpret_cast<const CharType*>(name.c_str()),
13733 write_bson_entry_header(name, 0x08);
13734 oa->write_character(value ? to_char_type(0x01) : to_char_type(0x00));
13741 const double value)
13743 write_bson_entry_header(name, 0x01);
13744 write_number<double, true>(
value);
13752 return sizeof(std::int32_t) + value.size() + 1ul;
13761 write_bson_entry_header(name, 0x02);
13763 write_number<std::int32_t, true>(
static_cast<std::int32_t
>(value.size() + 1ul));
13764 oa->write_characters(
13765 reinterpret_cast<const CharType*>(value.c_str()),
13774 write_bson_entry_header(name, 0x0A);
13783 ?
sizeof(std::int32_t)
13784 :
sizeof(std::int64_t);
13791 const std::int64_t
value)
13795 write_bson_entry_header(name, 0x10);
13796 write_number<std::int32_t, true>(
static_cast<std::int32_t
>(
value));
13800 write_bson_entry_header(name, 0x12);
13801 write_number<std::int64_t, true>(
static_cast<std::int64_t
>(
value));
13811 ?
sizeof(std::int32_t)
13812 :
sizeof(std::int64_t);
13819 const std::uint64_t
value)
13823 write_bson_entry_header(name, 0x10 );
13824 write_number<std::int32_t, true>(
static_cast<std::int32_t
>(
value));
13828 write_bson_entry_header(name, 0x12 );
13829 write_number<std::int64_t, true>(
static_cast<std::int64_t
>(
value));
13841 const typename BasicJsonType::object_t&
value)
13843 write_bson_entry_header(name, 0x03);
13844 write_bson_object(value);
13852 std::size_t array_index = 0ul;
13854 const std::size_t embedded_document_size = std::accumulate(std::begin(value), std::end(value), std::size_t(0), [&array_index](std::size_t
result,
const typename BasicJsonType::array_t::value_type & el)
13856 return result + calc_bson_element_size(std::to_string(array_index++), el);
13859 return sizeof(std::int32_t) + embedded_document_size + 1ul;
13867 return sizeof(std::int32_t) + value.size() + 1ul;
13874 const typename BasicJsonType::array_t&
value)
13876 write_bson_entry_header(name, 0x04);
13877 write_number<std::int32_t, true>(
static_cast<std::int32_t
>(calc_bson_array_size(value)));
13879 std::size_t array_index = 0ul;
13881 for (
const auto& el : value)
13883 write_bson_element(std::to_string(array_index++), el);
13886 oa->write_character(to_char_type(0x00));
13895 write_bson_entry_header(name, 0x05);
13897 write_number<std::int32_t, true>(
static_cast<std::int32_t
>(value.size()));
13898 write_number(value.has_subtype() ? value.subtype() : std::uint8_t(0x00));
13900 oa->write_characters(reinterpret_cast<const CharType*>(value.data()), value.size());
13908 const BasicJsonType& j)
13910 const auto header_size = calc_bson_entry_header_size(name);
13914 return header_size + calc_bson_object_size(*j.m_value.object);
13917 return header_size + calc_bson_array_size(*j.m_value.array);
13920 return header_size + calc_bson_binary_size(*j.m_value.binary);
13923 return header_size + 1ul;
13926 return header_size + 8ul;
13929 return header_size + calc_bson_integer_size(j.m_value.number_integer);
13932 return header_size + calc_bson_unsigned_size(j.m_value.number_unsigned);
13935 return header_size + calc_bson_string_size(*j.m_value.string);
13938 return header_size + 0ul;
13956 const BasicJsonType& j)
13961 return write_bson_object_entry(name, *j.m_value.object);
13964 return write_bson_array(name, *j.m_value.array);
13967 return write_bson_binary(name, *j.m_value.binary);
13970 return write_bson_boolean(name, j.m_value.boolean);
13973 return write_bson_double(name, j.m_value.number_float);
13976 return write_bson_integer(name, j.m_value.number_integer);
13979 return write_bson_unsigned(name, j.m_value.number_unsigned);
13982 return write_bson_string(name, *j.m_value.string);
13985 return write_bson_null(name);
14003 std::size_t document_size = std::accumulate(value.begin(), value.end(), std::size_t(0),
14004 [](
size_t result,
const typename BasicJsonType::object_t::value_type & el)
14006 return result += calc_bson_element_size(el.first, el.second);
14009 return sizeof(std::int32_t) + document_size + 1ul;
14018 write_number<std::int32_t, true>(
static_cast<std::int32_t
>(calc_bson_object_size(value)));
14020 for (
const auto& el : value)
14022 write_bson_element(el.first, el.second);
14025 oa->write_character(to_char_type(0x00));
14034 return to_char_type(0xFA);
14039 return to_char_type(0xFB);
14048 return to_char_type(0xCA);
14053 return to_char_type(0xCB);
14061 template<
typename NumberType,
typename std::enable_if<
14064 const bool add_prefix)
14068 oa->write_character(get_ubjson_float_prefix(n));
14074 template<
typename NumberType,
typename std::enable_if<
14077 const bool add_prefix)
14083 oa->write_character(to_char_type(
'i'));
14085 write_number(static_cast<std::uint8_t>(n));
14091 oa->write_character(to_char_type(
'U'));
14093 write_number(static_cast<std::uint8_t>(n));
14099 oa->write_character(to_char_type(
'I'));
14101 write_number(static_cast<std::int16_t>(n));
14107 oa->write_character(to_char_type(
'l'));
14109 write_number(static_cast<std::int32_t>(n));
14115 oa->write_character(to_char_type(
'L'));
14117 write_number(static_cast<std::int64_t>(n));
14123 oa->write_character(to_char_type(
'H'));
14126 const auto number = BasicJsonType(n).dump();
14127 write_number_with_ubjson_prefix(number.size(),
true);
14128 for (std::size_t i = 0; i < number.size(); ++i)
14130 oa->write_character(to_char_type(static_cast<std::uint8_t>(number[i])));
14136 template <
typename NumberType,
typename std::enable_if <
14138 !std::is_floating_point<NumberType>::value,
int >::type = 0 >
14140 const bool add_prefix)
14146 oa->write_character(to_char_type(
'i'));
14148 write_number(static_cast<std::int8_t>(n));
14154 oa->write_character(to_char_type(
'U'));
14156 write_number(static_cast<std::uint8_t>(n));
14162 oa->write_character(to_char_type(
'I'));
14164 write_number(static_cast<std::int16_t>(n));
14170 oa->write_character(to_char_type(
'l'));
14172 write_number(static_cast<std::int32_t>(n));
14178 oa->write_character(to_char_type(
'L'));
14180 write_number(static_cast<std::int64_t>(n));
14187 oa->write_character(to_char_type(
'H'));
14190 const auto number = BasicJsonType(n).dump();
14191 write_number_with_ubjson_prefix(number.size(),
true);
14192 for (std::size_t i = 0; i < number.size(); ++i)
14194 oa->write_character(to_char_type(static_cast<std::uint8_t>(number[i])));
14211 return j.m_value.boolean ?
'T' :
'F';
14266 return get_ubjson_float_prefix(j.m_value.number_float);
14308 template<
typename NumberType,
bool OutputIsLittleEndian = false>
14312 std::array<CharType, sizeof(NumberType)> vec;
14313 std::memcpy(vec.data(), &n,
sizeof(NumberType));
14316 if (is_little_endian != OutputIsLittleEndian)
14322 oa->write_characters(vec.data(),
sizeof(NumberType));
14327 if (static_cast<double>(n) >= static_cast<double>(std::numeric_limits<float>::lowest()) &&
14329 static_cast<double>(static_cast<float>(n)) == static_cast<double>(n))
14332 ? get_cbor_float_prefix(static_cast<float>(n))
14333 : get_msgpack_float_prefix(static_cast<float>(n)));
14334 write_number(static_cast<float>(n));
14339 ? get_cbor_float_prefix(n)
14340 : get_msgpack_float_prefix(n));
14350 template <
typename C = CharType,
14354 return *
reinterpret_cast<char*
>(&x);
14357 template <
typename C = CharType,
14361 static_assert(
sizeof(std::uint8_t) ==
sizeof(CharType),
"size of CharType must be equal to std::uint8_t");
14364 std::memcpy(&result, &x,
sizeof(x));
14368 template<
typename C = CharType,
14375 template <
typename InputCharType,
typename C = CharType,
14378 std::is_signed<char>::value &&
14401 #include <algorithm> 14410 #include <type_traits> 14421 #include <type_traits> 14450 namespace dtoa_impl
14453 template<
typename Target,
typename Source>
14456 static_assert(
sizeof(Target) ==
sizeof(Source),
"size mismatch");
14459 std::memcpy(&target, &source,
sizeof(Source));
14465 static constexpr
int kPrecision = 64;
14467 std::uint64_t f = 0;
14470 constexpr
diyfp(std::uint64_t f_,
int e_) noexcept : f(f_), e(e_) {}
14481 return {x.f - y.f, x.e};
14490 static_assert(kPrecision == 64,
"internal error");
14515 const std::uint64_t u_lo = x.f & 0xFFFFFFFFu;
14516 const std::uint64_t u_hi = x.f >> 32u;
14517 const std::uint64_t v_lo = y.f & 0xFFFFFFFFu;
14518 const std::uint64_t v_hi = y.f >> 32u;
14520 const std::uint64_t p0 = u_lo * v_lo;
14521 const std::uint64_t p1 = u_lo * v_hi;
14522 const std::uint64_t p2 = u_hi * v_lo;
14523 const std::uint64_t p3 = u_hi * v_hi;
14525 const std::uint64_t p0_hi = p0 >> 32u;
14526 const std::uint64_t p1_lo = p1 & 0xFFFFFFFFu;
14527 const std::uint64_t p1_hi = p1 >> 32u;
14528 const std::uint64_t p2_lo = p2 & 0xFFFFFFFFu;
14529 const std::uint64_t p2_hi = p2 >> 32u;
14531 std::uint64_t Q = p0_hi + p1_lo + p2_lo;
14542 Q += std::uint64_t{1} << (64u - 32u - 1u);
14544 const std::uint64_t h = p3 + p2_hi + p1_hi + (Q >> 32u);
14546 return {h, x.e + y.e + 64};
14557 while ((x.f >> 63u) == 0)
14572 const int delta = x.
e - target_exponent;
14577 return {x.f << delta, target_exponent};
14594 template<
typename FloatType>
14607 static_assert(std::numeric_limits<FloatType>::is_iec559,
14608 "internal error: dtoa_short requires an IEEE-754 floating-point implementation");
14610 constexpr
int kPrecision = std::numeric_limits<FloatType>::digits;
14611 constexpr
int kBias = std::numeric_limits<FloatType>::max_exponent - 1 + (kPrecision - 1);
14612 constexpr
int kMinExp = 1 - kBias;
14613 constexpr std::uint64_t kHiddenBit = std::uint64_t{1} << (kPrecision - 1);
14617 const std::uint64_t bits = reinterpret_bits<bits_type>(
value);
14618 const std::uint64_t E = bits >> (kPrecision - 1);
14619 const std::uint64_t F = bits & (kHiddenBit - 1);
14621 const bool is_denormal = E == 0;
14622 const diyfp v = is_denormal
14623 ?
diyfp(F, kMinExp)
14624 : diyfp(F + kHiddenBit, static_cast<int>(E) - kBias);
14647 const bool lower_boundary_is_closer = F == 0 && E > 1;
14648 const diyfp m_plus = diyfp(2 * v.
f + 1, v.
e - 1);
14649 const diyfp m_minus = lower_boundary_is_closer
14650 ? diyfp(4 * v.
f - 1, v.
e - 2)
14651 : diyfp(2 * v.
f - 1, v.
e - 1);
14657 const diyfp w_minus = diyfp::normalize_to(m_minus, w_plus.
e);
14786 constexpr
int kCachedPowersMinDecExp = -300;
14787 constexpr
int kCachedPowersDecStep = 8;
14789 static constexpr std::array<cached_power, 79> kCachedPowers =
14792 { 0xAB70FE17C79AC6CA, -1060, -300 },
14793 { 0xFF77B1FCBEBCDC4F, -1034, -292 },
14794 { 0xBE5691EF416BD60C, -1007, -284 },
14795 { 0x8DD01FAD907FFC3C, -980, -276 },
14796 { 0xD3515C2831559A83, -954, -268 },
14797 { 0x9D71AC8FADA6C9B5, -927, -260 },
14798 { 0xEA9C227723EE8BCB, -901, -252 },
14799 { 0xAECC49914078536D, -874, -244 },
14800 { 0x823C12795DB6CE57, -847, -236 },
14801 { 0xC21094364DFB5637, -821, -228 },
14802 { 0x9096EA6F3848984F, -794, -220 },
14803 { 0xD77485CB25823AC7, -768, -212 },
14804 { 0xA086CFCD97BF97F4, -741, -204 },
14805 { 0xEF340A98172AACE5, -715, -196 },
14806 { 0xB23867FB2A35B28E, -688, -188 },
14807 { 0x84C8D4DFD2C63F3B, -661, -180 },
14808 { 0xC5DD44271AD3CDBA, -635, -172 },
14809 { 0x936B9FCEBB25C996, -608, -164 },
14810 { 0xDBAC6C247D62A584, -582, -156 },
14811 { 0xA3AB66580D5FDAF6, -555, -148 },
14812 { 0xF3E2F893DEC3F126, -529, -140 },
14813 { 0xB5B5ADA8AAFF80B8, -502, -132 },
14814 { 0x87625F056C7C4A8B, -475, -124 },
14815 { 0xC9BCFF6034C13053, -449, -116 },
14816 { 0x964E858C91BA2655, -422, -108 },
14817 { 0xDFF9772470297EBD, -396, -100 },
14818 { 0xA6DFBD9FB8E5B88F, -369, -92 },
14819 { 0xF8A95FCF88747D94, -343, -84 },
14820 { 0xB94470938FA89BCF, -316, -76 },
14821 { 0x8A08F0F8BF0F156B, -289, -68 },
14822 { 0xCDB02555653131B6, -263, -60 },
14823 { 0x993FE2C6D07B7FAC, -236, -52 },
14824 { 0xE45C10C42A2B3B06, -210, -44 },
14825 { 0xAA242499697392D3, -183, -36 },
14826 { 0xFD87B5F28300CA0E, -157, -28 },
14827 { 0xBCE5086492111AEB, -130, -20 },
14828 { 0x8CBCCC096F5088CC, -103, -12 },
14829 { 0xD1B71758E219652C, -77, -4 },
14830 { 0x9C40000000000000, -50, 4 },
14831 { 0xE8D4A51000000000, -24, 12 },
14832 { 0xAD78EBC5AC620000, 3, 20 },
14833 { 0x813F3978F8940984, 30, 28 },
14834 { 0xC097CE7BC90715B3, 56, 36 },
14835 { 0x8F7E32CE7BEA5C70, 83, 44 },
14836 { 0xD5D238A4ABE98068, 109, 52 },
14837 { 0x9F4F2726179A2245, 136, 60 },
14838 { 0xED63A231D4C4FB27, 162, 68 },
14839 { 0xB0DE65388CC8ADA8, 189, 76 },
14840 { 0x83C7088E1AAB65DB, 216, 84 },
14841 { 0xC45D1DF942711D9A, 242, 92 },
14842 { 0x924D692CA61BE758, 269, 100 },
14843 { 0xDA01EE641A708DEA, 295, 108 },
14844 { 0xA26DA3999AEF774A, 322, 116 },
14845 { 0xF209787BB47D6B85, 348, 124 },
14846 { 0xB454E4A179DD1877, 375, 132 },
14847 { 0x865B86925B9BC5C2, 402, 140 },
14848 { 0xC83553C5C8965D3D, 428, 148 },
14849 { 0x952AB45CFA97A0B3, 455, 156 },
14850 { 0xDE469FBD99A05FE3, 481, 164 },
14851 { 0xA59BC234DB398C25, 508, 172 },
14852 { 0xF6C69A72A3989F5C, 534, 180 },
14853 { 0xB7DCBF5354E9BECE, 561, 188 },
14854 { 0x88FCF317F22241E2, 588, 196 },
14855 { 0xCC20CE9BD35C78A5, 614, 204 },
14856 { 0x98165AF37B2153DF, 641, 212 },
14857 { 0xE2A0B5DC971F303A, 667, 220 },
14858 { 0xA8D9D1535CE3B396, 694, 228 },
14859 { 0xFB9B7CD9A4A7443C, 720, 236 },
14860 { 0xBB764C4CA7A44410, 747, 244 },
14861 { 0x8BAB8EEFB6409C1A, 774, 252 },
14862 { 0xD01FEF10A657842C, 800, 260 },
14863 { 0x9B10A4E5E9913129, 827, 268 },
14864 { 0xE7109BFBA19C0C9D, 853, 276 },
14865 { 0xAC2820D9623BF429, 880, 284 },
14866 { 0x80444B5E7AA7CF85, 907, 292 },
14867 { 0xBF21E44003ACDD2D, 933, 300 },
14868 { 0x8E679C2F5E44FF8F, 960, 308 },
14869 { 0xD433179D9C8CB841, 986, 316 },
14870 { 0x9E19DB92B4E31BA9, 1013, 324 },
14880 const int f = kAlpha - e - 1;
14881 const int k = (f * 78913) / (1 << 18) +
static_cast<int>(f > 0);
14883 const int index = (-kCachedPowersMinDecExp + k + (kCachedPowersDecStep - 1)) / kCachedPowersDecStep;
14885 JSON_ASSERT(static_cast<std::size_t>(index) < kCachedPowers.size());
14887 const cached_power cached = kCachedPowers[
static_cast<std::size_t
>(index)];
14901 if (n >= 1000000000)
14903 pow10 = 1000000000;
14907 else if (n >= 100000000)
14912 else if (n >= 10000000)
14917 else if (n >= 1000000)
14922 else if (n >= 100000)
14927 else if (n >= 10000)
14932 else if (n >= 1000)
14955 std::uint64_t rest, std::uint64_t ten_k)
14982 && delta - rest >= ten_k
14983 && (rest + ten_k < dist || dist - rest > rest + ten_k - dist))
14998 static_assert(kAlpha >= -60,
"internal error");
14999 static_assert(kGamma <= -32,
"internal error");
15016 std::uint64_t delta = diyfp::sub(M_plus, M_minus).f;
15017 std::uint64_t dist = diyfp::sub(M_plus, w ).f;
15026 const diyfp one(std::uint64_t{1} << -M_plus.
e, M_plus.
e);
15028 auto p1 =
static_cast<std::uint32_t
>(M_plus.
f >> -one.e);
15029 std::uint64_t p2 = M_plus.
f & (one.f - 1);
15037 std::uint32_t pow10;
15065 const std::uint32_t
d = p1 / pow10;
15066 const std::uint32_t r = p1 % pow10;
15072 buffer[length++] =
static_cast<char>(
'0' +
d);
15091 const std::uint64_t rest = (std::uint64_t{p1} << -one.e) + p2;
15096 decimal_exponent += n;
15107 const std::uint64_t ten_n = std::uint64_t{pow10} << -one.e;
15108 grisu2_round(buffer, length, dist, delta, rest, ten_n);
15171 const std::uint64_t
d = p2 >> -one.e;
15172 const std::uint64_t r = p2 & (one.f - 1);
15179 buffer[length++] =
static_cast<char>(
'0' +
d);
15204 decimal_exponent -= m;
15212 const std::uint64_t ten_m = one.f;
15253 const diyfp c_minus_k(cached.
f, cached.
e);
15256 const diyfp w = diyfp::mul(v, c_minus_k);
15257 const diyfp w_minus = diyfp::mul(m_minus, c_minus_k);
15258 const diyfp w_plus = diyfp::mul(m_plus, c_minus_k);
15281 const diyfp M_minus(w_minus.
f + 1, w_minus.
e);
15282 const diyfp M_plus (w_plus.
f - 1, w_plus.
e );
15284 decimal_exponent = -cached.
k;
15294 template<
typename FloatType>
15298 static_assert(diyfp::kPrecision >= std::numeric_limits<FloatType>::digits + 3,
15299 "internal error: not enough precision");
15351 auto k =
static_cast<std::uint32_t
>(e);
15357 *buf++ =
static_cast<char>(
'0' + k);
15361 *buf++ =
static_cast<char>(
'0' + k / 10);
15363 *buf++ =
static_cast<char>(
'0' + k);
15367 *buf++ =
static_cast<char>(
'0' + k / 100);
15369 *buf++ =
static_cast<char>(
'0' + k / 10);
15371 *buf++ =
static_cast<char>(
'0' + k);
15389 int min_exp,
int max_exp)
15395 const int n = len + decimal_exponent;
15401 if (k <= n && n <= max_exp)
15406 std::memset(buf + k,
'0', static_cast<size_t>(n) - static_cast<size_t>(k));
15410 return buf + (
static_cast<size_t>(n) + 2);
15413 if (0 < n && n <= max_exp)
15420 std::memmove(buf + (static_cast<size_t>(n) + 1), buf + n, static_cast<size_t>(k) - static_cast<size_t>(n));
15422 return buf + (
static_cast<size_t>(k) + 1U);
15425 if (min_exp < n && n <= 0)
15430 std::memmove(buf + (2 + static_cast<size_t>(-n)), buf, static_cast<size_t>(k));
15433 std::memset(buf + 2,
'0', static_cast<size_t>(-n));
15434 return buf + (2U +
static_cast<size_t>(-n) + static_cast<size_t>(k));
15449 std::memmove(buf + 2, buf + 1, static_cast<size_t>(k) - 1);
15451 buf += 1 +
static_cast<size_t>(k);
15470 template<
typename FloatType>
15475 static_cast<void>(last);
15479 if (std::signbit(value))
15494 JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10);
15501 int decimal_exponent = 0;
15504 JSON_ASSERT(len <= std::numeric_limits<FloatType>::max_digits10);
15507 constexpr
int kMinExp = -4;
15512 JSON_ASSERT(last - first >= 2 + (-kMinExp - 1) + std::numeric_limits<FloatType>::max_digits10);
15513 JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10 + 6);
15550 template<
typename BasicJsonType>
15558 static constexpr std::uint8_t UTF8_ACCEPT = 0;
15559 static constexpr std::uint8_t UTF8_REJECT = 1;
15570 , loc(
std::localeconv())
15573 , indent_char(ichar)
15574 , indent_string(512, indent_char)
15575 , error_handler(error_handler_)
15608 const bool pretty_print,
15609 const bool ensure_ascii,
15610 const unsigned int indent_step,
15611 const unsigned int current_indent = 0)
15613 switch (val.m_type)
15617 if (val.m_value.object->empty())
15619 o->write_characters(
"{}", 2);
15625 o->write_characters(
"{\n", 2);
15628 const auto new_indent = current_indent + indent_step;
15631 indent_string.resize(indent_string.size() * 2,
' ');
15635 auto i = val.m_value.object->cbegin();
15636 for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i)
15638 o->write_characters(indent_string.c_str(), new_indent);
15639 o->write_character(
'\"');
15640 dump_escaped(i->first, ensure_ascii);
15641 o->write_characters(
"\": ", 3);
15642 dump(i->second,
true, ensure_ascii, indent_step, new_indent);
15643 o->write_characters(
",\n", 2);
15648 JSON_ASSERT(std::next(i) == val.m_value.object->cend());
15649 o->write_characters(indent_string.c_str(), new_indent);
15650 o->write_character(
'\"');
15651 dump_escaped(i->first, ensure_ascii);
15652 o->write_characters(
"\": ", 3);
15653 dump(i->second,
true, ensure_ascii, indent_step, new_indent);
15655 o->write_character(
'\n');
15656 o->write_characters(indent_string.c_str(), current_indent);
15657 o->write_character(
'}');
15661 o->write_character(
'{');
15664 auto i = val.m_value.object->cbegin();
15665 for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i)
15667 o->write_character(
'\"');
15668 dump_escaped(i->first, ensure_ascii);
15669 o->write_characters(
"\":", 2);
15670 dump(i->second,
false, ensure_ascii, indent_step, current_indent);
15671 o->write_character(
',');
15676 JSON_ASSERT(std::next(i) == val.m_value.object->cend());
15677 o->write_character(
'\"');
15678 dump_escaped(i->first, ensure_ascii);
15679 o->write_characters(
"\":", 2);
15680 dump(i->second,
false, ensure_ascii, indent_step, current_indent);
15682 o->write_character(
'}');
15690 if (val.m_value.array->empty())
15692 o->write_characters(
"[]", 2);
15698 o->write_characters(
"[\n", 2);
15701 const auto new_indent = current_indent + indent_step;
15704 indent_string.resize(indent_string.size() * 2,
' ');
15708 for (
auto i = val.m_value.array->cbegin();
15709 i != val.m_value.array->cend() - 1; ++i)
15711 o->write_characters(indent_string.c_str(), new_indent);
15712 dump(*i,
true, ensure_ascii, indent_step, new_indent);
15713 o->write_characters(
",\n", 2);
15718 o->write_characters(indent_string.c_str(), new_indent);
15719 dump(val.m_value.array->back(),
true, ensure_ascii, indent_step, new_indent);
15721 o->write_character(
'\n');
15722 o->write_characters(indent_string.c_str(), current_indent);
15723 o->write_character(
']');
15727 o->write_character(
'[');
15730 for (
auto i = val.m_value.array->cbegin();
15731 i != val.m_value.array->cend() - 1; ++i)
15733 dump(*i,
false, ensure_ascii, indent_step, current_indent);
15734 o->write_character(
',');
15739 dump(val.m_value.array->back(),
false, ensure_ascii, indent_step, current_indent);
15741 o->write_character(
']');
15749 o->write_character(
'\"');
15750 dump_escaped(*val.m_value.string, ensure_ascii);
15751 o->write_character(
'\"');
15759 o->write_characters(
"{\n", 2);
15762 const auto new_indent = current_indent + indent_step;
15765 indent_string.resize(indent_string.size() * 2,
' ');
15768 o->write_characters(indent_string.c_str(), new_indent);
15770 o->write_characters(
"\"bytes\": [", 10);
15772 if (!val.m_value.binary->empty())
15774 for (
auto i = val.m_value.binary->cbegin();
15775 i != val.m_value.binary->cend() - 1; ++i)
15778 o->write_characters(
", ", 2);
15780 dump_integer(val.m_value.binary->back());
15783 o->write_characters(
"],\n", 3);
15784 o->write_characters(indent_string.c_str(), new_indent);
15786 o->write_characters(
"\"subtype\": ", 11);
15787 if (val.m_value.binary->has_subtype())
15789 dump_integer(val.m_value.binary->subtype());
15793 o->write_characters(
"null", 4);
15795 o->write_character(
'\n');
15796 o->write_characters(indent_string.c_str(), current_indent);
15797 o->write_character(
'}');
15801 o->write_characters(
"{\"bytes\":[", 10);
15803 if (!val.m_value.binary->empty())
15805 for (
auto i = val.m_value.binary->cbegin();
15806 i != val.m_value.binary->cend() - 1; ++i)
15809 o->write_character(
',');
15811 dump_integer(val.m_value.binary->back());
15814 o->write_characters(
"],\"subtype\":", 12);
15815 if (val.m_value.binary->has_subtype())
15817 dump_integer(val.m_value.binary->subtype());
15818 o->write_character(
'}');
15822 o->write_characters(
"null}", 5);
15830 if (val.m_value.boolean)
15832 o->write_characters(
"true", 4);
15836 o->write_characters(
"false", 5);
15843 dump_integer(val.m_value.number_integer);
15849 dump_integer(val.m_value.number_unsigned);
15855 dump_float(val.m_value.number_float);
15861 o->write_characters(
"<discarded>", 11);
15867 o->write_characters(
"null", 4);
15891 void dump_escaped(
const string_t& s,
const bool ensure_ascii)
15898 std::size_t bytes_after_last_accept = 0;
15899 std::size_t undumped_chars = 0;
15901 for (std::size_t i = 0; i < s.size(); ++i)
15903 const auto byte =
static_cast<uint8_t
>(s[i]);
15905 switch (
decode(state, codepoint, byte))
15913 string_buffer[bytes++] =
'\\';
15914 string_buffer[bytes++] =
'b';
15920 string_buffer[bytes++] =
'\\';
15921 string_buffer[bytes++] =
't';
15927 string_buffer[bytes++] =
'\\';
15928 string_buffer[bytes++] =
'n';
15934 string_buffer[bytes++] =
'\\';
15935 string_buffer[bytes++] =
'f';
15941 string_buffer[bytes++] =
'\\';
15942 string_buffer[bytes++] =
'r';
15948 string_buffer[bytes++] =
'\\';
15949 string_buffer[bytes++] =
'\"';
15955 string_buffer[bytes++] =
'\\';
15956 string_buffer[bytes++] =
'\\';
15964 if ((codepoint <= 0x1F) || (ensure_ascii && (codepoint >= 0x7F)))
15966 if (codepoint <= 0xFFFF)
15968 (std::snprintf)(string_buffer.data() +
bytes, 7,
"\\u%04x",
15969 static_cast<std::uint16_t
>(
codepoint));
15974 (std::snprintf)(string_buffer.data() +
bytes, 13,
"\\u%04x\\u%04x",
15975 static_cast<std::uint16_t
>(0xD7C0u + (codepoint >> 10u)),
15976 static_cast<std::uint16_t
>(0xDC00u + (codepoint & 0x3FFu)));
15984 string_buffer[bytes++] = s[i];
15993 if (string_buffer.size() - bytes < 13)
15995 o->write_characters(string_buffer.data(),
bytes);
16000 bytes_after_last_accept =
bytes;
16001 undumped_chars = 0;
16007 switch (error_handler)
16012 (std::snprintf)(&sn[0], sn.size(),
"%.2X", byte);
16023 if (undumped_chars > 0)
16030 bytes = bytes_after_last_accept;
16037 string_buffer[bytes++] =
'\\';
16038 string_buffer[bytes++] =
'u';
16039 string_buffer[bytes++] =
'f';
16040 string_buffer[bytes++] =
'f';
16041 string_buffer[bytes++] =
'f';
16042 string_buffer[bytes++] =
'd';
16054 if (string_buffer.size() - bytes < 13)
16056 o->write_characters(string_buffer.data(),
bytes);
16060 bytes_after_last_accept =
bytes;
16063 undumped_chars = 0;
16066 state = UTF8_ACCEPT;
16081 string_buffer[bytes++] = s[i];
16095 o->write_characters(string_buffer.data(),
bytes);
16101 switch (error_handler)
16106 (std::snprintf)(&sn[0], sn.size(),
"%.2X",
static_cast<std::uint8_t
>(s.back()));
16113 o->write_characters(string_buffer.data(), bytes_after_last_accept);
16120 o->write_characters(string_buffer.data(), bytes_after_last_accept);
16124 o->write_characters(
"\\ufffd", 6);
16128 o->write_characters(
"\xEF\xBF\xBD", 3);
16150 unsigned int n_digits = 1;
16159 return n_digits + 1;
16163 return n_digits + 2;
16167 return n_digits + 3;
16188 void dump_integer(NumberType x)
16190 static constexpr std::array<std::array<char, 2>, 100> digits_to_99
16193 {{
'0',
'0'}}, {{
'0',
'1'}}, {{
'0',
'2'}}, {{
'0',
'3'}}, {{
'0',
'4'}}, {{
'0',
'5'}}, {{
'0',
'6'}}, {{
'0',
'7'}}, {{
'0',
'8'}}, {{
'0',
'9'}},
16194 {{
'1',
'0'}}, {{
'1',
'1'}}, {{
'1',
'2'}}, {{
'1',
'3'}}, {{
'1',
'4'}}, {{
'1',
'5'}}, {{
'1',
'6'}}, {{
'1',
'7'}}, {{
'1',
'8'}}, {{
'1',
'9'}},
16195 {{
'2',
'0'}}, {{
'2',
'1'}}, {{
'2',
'2'}}, {{
'2',
'3'}}, {{
'2',
'4'}}, {{
'2',
'5'}}, {{
'2',
'6'}}, {{
'2',
'7'}}, {{
'2',
'8'}}, {{
'2',
'9'}},
16196 {{
'3',
'0'}}, {{
'3',
'1'}}, {{
'3',
'2'}}, {{
'3',
'3'}}, {{
'3',
'4'}}, {{
'3',
'5'}}, {{
'3',
'6'}}, {{
'3',
'7'}}, {{
'3',
'8'}}, {{
'3',
'9'}},
16197 {{
'4',
'0'}}, {{
'4',
'1'}}, {{
'4',
'2'}}, {{
'4',
'3'}}, {{
'4',
'4'}}, {{
'4',
'5'}}, {{
'4',
'6'}}, {{
'4',
'7'}}, {{
'4',
'8'}}, {{
'4',
'9'}},
16198 {{
'5',
'0'}}, {{
'5',
'1'}}, {{
'5',
'2'}}, {{
'5',
'3'}}, {{
'5',
'4'}}, {{
'5',
'5'}}, {{
'5',
'6'}}, {{
'5',
'7'}}, {{
'5',
'8'}}, {{
'5',
'9'}},
16199 {{
'6',
'0'}}, {{
'6',
'1'}}, {{
'6',
'2'}}, {{
'6',
'3'}}, {{
'6',
'4'}}, {{
'6',
'5'}}, {{
'6',
'6'}}, {{
'6',
'7'}}, {{
'6',
'8'}}, {{
'6',
'9'}},
16200 {{
'7',
'0'}}, {{
'7',
'1'}}, {{
'7',
'2'}}, {{
'7',
'3'}}, {{
'7',
'4'}}, {{
'7',
'5'}}, {{
'7',
'6'}}, {{
'7',
'7'}}, {{
'7',
'8'}}, {{
'7',
'9'}},
16201 {{
'8',
'0'}}, {{
'8',
'1'}}, {{
'8',
'2'}}, {{
'8',
'3'}}, {{
'8',
'4'}}, {{
'8',
'5'}}, {{
'8',
'6'}}, {{
'8',
'7'}}, {{
'8',
'8'}}, {{
'8',
'9'}},
16202 {{
'9',
'0'}}, {{
'9',
'1'}}, {{
'9',
'2'}}, {{
'9',
'3'}}, {{
'9',
'4'}}, {{
'9',
'5'}}, {{
'9',
'6'}}, {{
'9',
'7'}}, {{
'9',
'8'}}, {{
'9',
'9'}},
16209 o->write_character(
'0');
16214 auto buffer_ptr = number_buffer.begin();
16219 unsigned int n_chars;
16224 abs_value = remove_sign(static_cast<number_integer_t>(x));
16240 buffer_ptr += n_chars;
16244 while (abs_value >= 100)
16246 const auto digits_index =
static_cast<unsigned>((abs_value % 100));
16248 *(--buffer_ptr) = digits_to_99[digits_index][1];
16249 *(--buffer_ptr) = digits_to_99[digits_index][0];
16252 if (abs_value >= 10)
16254 const auto digits_index =
static_cast<unsigned>(abs_value);
16255 *(--buffer_ptr) = digits_to_99[digits_index][1];
16256 *(--buffer_ptr) = digits_to_99[digits_index][0];
16260 *(--buffer_ptr) = static_cast<char>(
'0' + abs_value);
16263 o->write_characters(number_buffer.data(), n_chars);
16279 o->write_characters(
"null", 4);
16288 static constexpr
bool is_ieee_single_or_double
16289 = (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) ||
16290 (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);
16292 dump_float(x, std::integral_constant<bool, is_ieee_single_or_double>());
16297 char* begin = number_buffer.data();
16300 o->write_characters(begin, static_cast<size_t>(end - begin));
16306 static constexpr
auto d = std::numeric_limits<number_float_t>::max_digits10;
16309 std::ptrdiff_t
len = (std::snprintf)(number_buffer.data(), number_buffer.size(),
"%.*g",
d, x);
16314 JSON_ASSERT(static_cast<std::size_t>(len) < number_buffer.size());
16319 const auto end =
std::remove(number_buffer.begin(),
16321 std::fill(end, number_buffer.end(),
'\0');
16322 JSON_ASSERT((end - number_buffer.begin()) <= len);
16323 len = (end - number_buffer.begin());
16330 if (dec_pos != number_buffer.end())
16336 o->write_characters(number_buffer.data(),
static_cast<std::size_t
>(
len));
16339 const bool value_is_int_like =
16340 std::none_of(number_buffer.begin(), number_buffer.begin() + len + 1,
16343 return c ==
'.' ||
c ==
'e';
16346 if (value_is_int_like)
16348 o->write_characters(
".0", 2);
16373 static std::uint8_t
decode(std::uint8_t& state, std::uint32_t& codep,
const std::uint8_t byte) noexcept
16375 static const std::array<std::uint8_t, 400> utf8d =
16378 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,
16379 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,
16380 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,
16381 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,
16382 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,
16383 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,
16384 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,
16385 0xA, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x4, 0x3, 0x3,
16386 0xB, 0x6, 0x6, 0x6, 0x5, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8,
16387 0x0, 0x1, 0x2, 0x3, 0x5, 0x8, 0x7, 0x1, 0x1, 0x1, 0x4, 0x6, 0x1, 0x1, 0x1, 0x1,
16388 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,
16389 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,
16390 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,
16391 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
16395 const std::uint8_t type = utf8d[byte];
16397 codep = (state != UTF8_ACCEPT)
16398 ? (byte & 0x3fu) | (codep << 6u)
16399 : (0xFFu >> type) & (byte);
16401 std::size_t index = 256u +
static_cast<size_t>(
state) * 16u + static_cast<size_t>(type);
16403 state = utf8d[index];
16438 std::array<char, 64> number_buffer{{}};
16441 const std::lconv* loc =
nullptr;
16448 std::array<char, 512> string_buffer{{}};
16468 #include <functional> 16481 template <
class Key,
class T,
class IgnoredLess = std::less<Key>,
16482 class Allocator = std::allocator<std::pair<const Key, T>>>
16483 struct ordered_map : std::vector<std::pair<const Key, T>, Allocator>
16487 using Container = std::vector<std::pair<const Key, T>, Allocator>;
16488 using typename Container::iterator;
16489 using typename Container::const_iterator;
16490 using typename Container::size_type;
16491 using typename Container::value_type;
16496 template <
class It>
16499 ordered_map(std::initializer_list<T> init,
const Allocator& alloc = Allocator() )
16504 for (
auto it = this->begin(); it != this->end(); ++it)
16506 if (it->first == key)
16508 return {it,
false};
16511 Container::emplace_back(key, t);
16512 return {--this->end(),
true};
16517 return emplace(key, T{}).first->second;
16527 for (
auto it = this->begin(); it != this->end(); ++it)
16529 if (it->first == key)
16535 JSON_THROW(std::out_of_range(
"key not found"));
16540 for (
auto it = this->begin(); it != this->end(); ++it)
16542 if (it->first == key)
16548 JSON_THROW(std::out_of_range(
"key not found"));
16553 for (
auto it = this->begin(); it != this->end(); ++it)
16555 if (it->first == key)
16558 for (
auto next = it; ++
next != this->end(); ++it)
16563 Container::pop_back();
16575 for (
auto next = it; ++
next != this->end(); ++it)
16580 Container::pop_back();
16586 for (
auto it = this->begin(); it != this->end(); ++it)
16588 if (it->first == key)
16598 for (
auto it = this->begin(); it != this->end(); ++it)
16600 if (it->first == key)
16605 return Container::end();
16610 for (
auto it = this->begin(); it != this->end(); ++it)
16612 if (it->first == key)
16617 return Container::end();
16627 for (
auto it = this->begin(); it != this->end(); ++it)
16629 if (it->first == value.first)
16631 return {it,
false};
16634 Container::push_back(value);
16635 return {--this->end(),
true};
16739 friend ::nlohmann::json_pointer<basic_json>;
16741 template<
typename BasicJsonType,
typename InputType>
16742 friend class ::nlohmann::detail::parser;
16743 friend ::nlohmann::detail::serializer<basic_json>;
16744 template<
typename BasicJsonType>
16745 friend class ::nlohmann::detail::iter_impl;
16746 template<
typename BasicJsonType,
typename CharType>
16747 friend class ::nlohmann::detail::binary_writer;
16748 template<
typename BasicJsonType,
typename InputType,
typename SAX>
16749 friend class ::nlohmann::detail::binary_reader;
16750 template<
typename BasicJsonType>
16751 friend class ::nlohmann::detail::json_sax_dom_parser;
16752 template<
typename BasicJsonType>
16753 friend class ::nlohmann::detail::json_sax_dom_callback_parser;
16762 template<
typename InputAdapterType>
16763 static ::nlohmann::detail::parser<basic_json, InputAdapterType>
parser(
16764 InputAdapterType adapter,
16766 const bool allow_exceptions =
true,
16767 const bool ignore_comments =
false 16770 return ::nlohmann::detail::parser<basic_json, InputAdapterType>(
std::move(adapter),
16771 std::move(cb), allow_exceptions, ignore_comments);
16776 template<
typename BasicJsonType>
16778 template<
typename BasicJsonType>
16780 template<
typename Iterator>
16784 template<
typename CharType>
16787 template<
typename InputType>
16798 template<
typename T,
typename SFINAE>
16861 using pointer =
typename std::allocator_traits<allocator_type>::pointer;
16863 using const_pointer =
typename std::allocator_traits<allocator_type>::const_pointer;
16916 result[
"copyright"] =
"(C) 2013-2020 Niels Lohmann";
16917 result[
"name"] =
"JSON for Modern C++";
16918 result[
"url"] =
"https://github.com/nlohmann/json";
16919 result[
"version"][
"string"] =
16928 result[
"platform"] =
"win32";
16929 #elif defined __linux__ 16930 result[
"platform"] =
"linux";
16931 #elif defined __APPLE__ 16932 result[
"platform"] =
"apple";
16933 #elif defined __unix__ 16934 result[
"platform"] =
"unix";
16936 result[
"platform"] =
"unknown";
16939 #if defined(__ICC) || defined(__INTEL_COMPILER) 16940 result[
"compiler"] = {{
"family",
"icc"}, {
"version", __INTEL_COMPILER}};
16941 #elif defined(__clang__) 16942 result[
"compiler"] = {{
"family",
"clang"}, {
"version", __clang_version__}};
16943 #elif defined(__GNUC__) || defined(__GNUG__) 16944 result[
"compiler"] = {{
"family",
"gcc"}, {
"version", std::to_string(__GNUC__) +
"." + std::to_string(__GNUC_MINOR__) +
"." + std::to_string(__GNUC_PATCHLEVEL__)}};
16945 #elif defined(__HP_cc) || defined(__HP_aCC) 16946 result[
"compiler"] =
"hp" 16947 #elif defined(__IBMCPP__) 16948 result[
"compiler"] = {{
"family",
"ilecpp"}, {
"version", __IBMCPP__}};
16949 #elif defined(_MSC_VER) 16950 result[
"compiler"] = {{
"family",
"msvc"}, {
"version", _MSC_VER}};
16951 #elif defined(__PGI) 16952 result[
"compiler"] = {{
"family",
"pgcpp"}, {
"version", __PGI}};
16953 #elif defined(__SUNPRO_CC) 16954 result[
"compiler"] = {{
"family",
"sunpro"}, {
"version", __SUNPRO_CC}};
16956 result[
"compiler"] = {{
"family",
"unknown"}, {
"version",
"unknown"}};
16960 result[
"compiler"][
"c++"] = std::to_string(__cplusplus);
16962 result[
"compiler"][
"c++"] =
"unknown";
16977 #if defined(JSON_HAS_CPP_14) 17068 using object_t = ObjectType<StringType,
17071 AllocatorType<std::pair<
const StringType,
17118 using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
17485 template<
typename T,
typename... Args>
17489 AllocatorType<T> alloc;
17490 using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;
17492 auto deleter = [&](T *
object)
17494 AllocatorTraits::deallocate(alloc,
object, 1);
17496 std::unique_ptr<T, decltype(deleter)>
object(AllocatorTraits::allocate(alloc, 1), deleter);
17499 return object.release();
17552 json_value() =
default;
17568 object = create<object_t>();
17574 array = create<array_t>();
17580 string = create<string_t>(
"");
17586 binary = create<binary_t>();
17635 string = create<string_t>(
value);
17647 object = create<object_t>(
value);
17659 array = create<array_t>(
value);
17671 binary = create<binary_t>(
value);
17683 binary = create<binary_t>(
value);
17695 std::vector<basic_json> stack;
17700 stack.reserve(array->size());
17701 std::move(array->begin(), array->end(), std::back_inserter(stack));
17705 stack.reserve(object->size());
17706 for (
auto&& it : *
object)
17712 while (!stack.empty())
17715 basic_json current_item(
std::move(stack.back()));
17723 std::back_inserter(stack));
17725 current_item.
m_value.array->clear();
17729 for (
auto&& it : *current_item.
m_value.object)
17734 current_item.
m_value.object->clear();
17745 AllocatorType<object_t> alloc;
17746 std::allocator_traits<decltype(alloc)>::destroy(alloc,
object);
17747 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
object, 1);
17753 AllocatorType<array_t> alloc;
17754 std::allocator_traits<decltype(alloc)>::destroy(alloc,
array);
17755 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
array, 1);
17761 AllocatorType<string_t> alloc;
17762 std::allocator_traits<decltype(alloc)>::destroy(alloc,
string);
17763 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
string, 1);
17769 AllocatorType<binary_t> alloc;
17770 std::allocator_traits<decltype(alloc)>::destroy(alloc,
binary);
17771 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
binary, 1);
17914 : m_type(v), m_value(v)
17916 assert_invariant();
17940 assert_invariant();
18006 template <
typename CompatibleType,
18012 std::forward<CompatibleType>(val))))
18015 assert_invariant();
18044 template <
typename BasicJsonType,
18049 using other_boolean_t =
typename BasicJsonType::boolean_t;
18050 using other_number_float_t =
typename BasicJsonType::number_float_t;
18051 using other_number_integer_t =
typename BasicJsonType::number_integer_t;
18052 using other_number_unsigned_t =
typename BasicJsonType::number_unsigned_t;
18053 using other_string_t =
typename BasicJsonType::string_t;
18054 using other_object_t =
typename BasicJsonType::object_t;
18055 using other_array_t =
typename BasicJsonType::array_t;
18056 using other_binary_t =
typename BasicJsonType::binary_t;
18058 switch (val.type())
18093 assert_invariant();
18171 bool type_deduction =
true,
18176 bool is_an_object = std::all_of(init.begin(), init.end(),
18179 return element_ref->is_array() && element_ref->size() == 2 && (*element_ref)[0].is_string();
18183 if (!type_deduction)
18188 is_an_object =
false;
18206 auto element = element_ref.moved_or_copied();
18207 m_value.object->emplace(
18208 std::move(*((*element.m_value.array)[0].m_value.string)),
18209 std::move((*element.m_value.array)[1]));
18216 m_value.array = create<array_t>(init.begin(), init.end());
18219 assert_invariant();
18252 auto res = basic_json();
18254 res.m_value = init;
18289 auto res = basic_json();
18291 res.m_value =
binary_t(init, subtype);
18299 auto res = basic_json();
18309 auto res = basic_json();
18427 m_value.array = create<array_t>(cnt, val);
18428 assert_invariant();
18486 template <
class InputIT,
typename std::enable_if <
18501 m_type = first.m_object->m_type;
18513 || !last.m_it.primitive_iterator.is_end()))
18528 m_value.number_integer = first.m_object->m_value.number_integer;
18534 m_value.number_unsigned = first.m_object->m_value.number_unsigned;
18540 m_value.number_float = first.m_object->m_value.number_float;
18546 m_value.boolean = first.m_object->m_value.boolean;
18552 m_value = *first.m_object->m_value.string;
18558 m_value.object = create<object_t>(first.m_it.object_iterator,
18559 last.m_it.object_iterator);
18565 m_value.array = create<array_t>(first.m_it.array_iterator,
18566 last.m_it.array_iterator);
18572 m_value = *first.m_object->m_value.binary;
18581 assert_invariant();
18589 template<
typename JsonRef,
18591 std::is_same<typename JsonRef::value_type, basic_json>>
::value,
int> = 0 >
18592 basic_json(
const JsonRef& ref) : basic_json(ref.moved_or_copied()) {}
18620 : m_type(other.m_type)
18629 m_value = *other.
m_value.object;
18635 m_value = *other.
m_value.array;
18641 m_value = *other.
m_value.string;
18647 m_value = other.
m_value.boolean;
18653 m_value = other.
m_value.number_integer;
18659 m_value = other.
m_value.number_unsigned;
18665 m_value = other.
m_value.number_float;
18671 m_value = *other.
m_value.binary;
18679 assert_invariant();
18709 : m_type(
std::
move(other.m_type)),
18710 m_value(
std::
move(other.m_value))
18713 other.assert_invariant();
18717 other.m_value = {};
18719 assert_invariant();
18756 swap(m_type, other.m_type);
18757 swap(m_value, other.m_value);
18759 assert_invariant();
18780 assert_invariant();
18781 m_value.destroy(m_type);
18843 const char indent_char =
' ',
18844 const bool ensure_ascii =
false,
18852 s.dump(*
this,
true, ensure_ascii, static_cast<unsigned int>(indent));
18856 s.dump(*
this,
false, ensure_ascii, 0);
18928 return is_null() || is_string() || is_boolean() || is_number() || is_binary();
18955 return is_array() || is_object();
19029 return is_number_integer() || is_number_float();
19270 return m_value.boolean;
19279 return is_object() ? m_value.object :
nullptr;
19285 return is_object() ? m_value.object :
nullptr;
19291 return is_array() ? m_value.array :
nullptr;
19297 return is_array() ? m_value.array :
nullptr;
19303 return is_string() ? m_value.string :
nullptr;
19309 return is_string() ? m_value.string :
nullptr;
19315 return is_boolean() ? &m_value.boolean :
nullptr;
19321 return is_boolean() ? &m_value.boolean :
nullptr;
19327 return is_number_integer() ? &m_value.number_integer :
nullptr;
19333 return is_number_integer() ? &m_value.number_integer :
nullptr;
19339 return is_number_unsigned() ? &m_value.number_unsigned :
nullptr;
19345 return is_number_unsigned() ? &m_value.number_unsigned :
nullptr;
19351 return is_number_float() ? &m_value.number_float :
nullptr;
19357 return is_number_float() ? &m_value.number_float :
nullptr;
19363 return is_binary() ? m_value.binary :
nullptr;
19369 return is_binary() ? m_value.binary :
nullptr;
19383 template<
typename ReferenceType,
typename ThisType>
19419 basic_json
get()
const 19442 BasicJsonType
get()
const 19486 template <
typename ValueTypeCV,
typename ValueType = detail::uncvref_t<ValueTypeCV>,
19487 detail::enable_if_t <
19488 !detail::is_basic_json<ValueType>::value &&
19489 detail::has_from_json<basic_json_t, ValueType>::value &&
19490 !detail::has_non_default_from_json<basic_json_t, ValueType>::value,
19492 ValueType
get()
const noexcept(noexcept(
19499 "get() cannot be used with reference types, you might want to use get_ref()");
19501 "types must be DefaultConstructible when used with get()");
19539 template <
typename ValueTypeCV,
typename ValueType = detail::uncvref_t<ValueTypeCV>,
19540 detail::enable_if_t < !std::is_same<basic_json_t, ValueType>::value &&
19541 detail::has_non_default_from_json<basic_json_t, ValueType>::value,
19543 ValueType
get()
const noexcept(noexcept(
19547 "get() cannot be used with reference types, you might want to use get_ref()");
19584 template <
typename ValueType,
19589 ValueType &
get_to(ValueType& v)
const noexcept(noexcept(
19598 template<
typename ValueType,
19609 typename T, std::size_t N,
19610 typename Array = T (&)[N],
19615 std::declval<const basic_json_t&>(), v)))
19648 template<
typename PointerType,
typename std::enable_if<
19653 return get_impl_ptr(static_cast<PointerType>(
nullptr));
19660 template <
typename PointerType,
typename std::enable_if <
19661 std::is_pointer<PointerType>::value&&
19666 return get_impl_ptr(static_cast<PointerType>(
nullptr));
19696 template<
typename PointerType,
typename std::enable_if<
19697 std::is_pointer<PointerType>::value,
int>::type = 0>
19698 auto get() noexcept -> decltype(std::declval<basic_json_t&>().template get_ptr<PointerType>())
19701 return get_ptr<PointerType>();
19708 template<
typename PointerType,
typename std::enable_if<
19709 std::is_pointer<PointerType>::value,
int>::type = 0>
19710 constexpr
auto get()
const noexcept -> decltype(std::declval<const basic_json_t&>().template get_ptr<PointerType>())
19713 return get_ptr<PointerType>();
19742 template<
typename ReferenceType,
typename std::enable_if<
19747 return get_ref_impl<ReferenceType>(*this);
19754 template <
typename ReferenceType,
typename std::enable_if <
19755 std::is_reference<ReferenceType>::value&&
19760 return get_ref_impl<ReferenceType>(*this);
19792 template <
typename ValueType,
typename std::enable_if <
19794 !std::is_same<ValueType, detail::json_ref<basic_json>>::value&&
19796 !detail::is_basic_json<ValueType>::value
19797 && !std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::value
19798 #if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER <= 1914)) 19802 ,
int >::type = 0 >
19806 return get<ValueType>();
19825 return *get_ptr<binary_t*>();
19836 return *get_ptr<const binary_t*>();
19883 return m_value.array->at(idx);
19930 return m_value.array->at(idx);
19981 return m_value.object->at(key);
20032 return m_value.object->at(key);
20077 m_value.array = create<array_t>();
20078 assert_invariant();
20085 if (idx >= m_value.array->size())
20087 m_value.array->insert(m_value.array->end(),
20088 idx - m_value.array->size() + 1,
20092 return m_value.array->operator[](idx);
20122 return m_value.
array->operator[](idx);
20161 m_value.object = create<object_t>();
20162 assert_invariant();
20168 return m_value.object->operator[](
key);
20209 JSON_ASSERT(m_value.object->find(key) != m_value.object->end());
20210 return m_value.object->find(key)->second;
20243 template<
typename T>
20252 assert_invariant();
20258 return m_value.object->operator[](
key);
20294 template<
typename T>
20301 JSON_ASSERT(m_value.object->find(key) != m_value.object->end());
20302 return m_value.object->find(key)->second;
20359 template <
class ValueType,
typename std::enable_if <
20362 ValueType
value(
const typename object_t::key_type&
key,
const ValueType& default_value)
const 20368 const auto it =
find(key);
20371 return it->template get<ValueType>();
20374 return default_value;
20432 template<
class ValueType,
typename std::enable_if<
20442 return ptr.
get_checked(
this).template get<ValueType>();
20446 return default_value;
20595 template <
class IteratorType,
typename std::enable_if <
20607 IteratorType
result = end();
20625 AllocatorType<string_t> alloc;
20626 std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.string);
20627 std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.string, 1);
20628 m_value.string =
nullptr;
20630 else if (is_binary())
20632 AllocatorType<binary_t> alloc;
20633 std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.binary);
20634 std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.binary, 1);
20635 m_value.binary =
nullptr;
20639 assert_invariant();
20645 result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator);
20651 result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator);
20708 template <
class IteratorType,
typename std::enable_if <
20712 IteratorType
erase(IteratorType first, IteratorType last)
20720 IteratorType
result = end();
20732 || !last.m_it.primitive_iterator.is_end()))
20739 AllocatorType<string_t> alloc;
20740 std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.string);
20741 std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.string, 1);
20742 m_value.string =
nullptr;
20744 else if (is_binary())
20746 AllocatorType<binary_t> alloc;
20747 std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.binary);
20748 std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.binary, 1);
20749 m_value.binary =
nullptr;
20753 assert_invariant();
20759 result.m_it.object_iterator = m_value.object->erase(first.m_it.object_iterator,
20760 last.m_it.object_iterator);
20766 result.m_it.array_iterator = m_value.array->erase(first.m_it.array_iterator,
20767 last.m_it.array_iterator);
20812 return m_value.object->erase(key);
20852 m_value.array->erase(m_value.array->begin() +
static_cast<difference_type>(idx));
20894 template<
typename KeyT>
20901 result.m_it.object_iterator = m_value.object->find(std::forward<KeyT>(
key));
20911 template<
typename KeyT>
20918 result.m_it.object_iterator = m_value.object->find(std::forward<KeyT>(
key));
20945 template<
typename KeyT>
20949 return is_object() ? m_value.object->count(std::forward<KeyT>(
key)) : 0;
20977 template <
typename KeyT,
typename std::enable_if <
20981 return is_object() && m_value.object->find(std::forward<KeyT>(
key)) != m_value.object->end();
21052 result.set_begin();
21092 result.set_begin();
21359 return ref.items();
21368 return ref.items();
21517 return m_value.array->empty();
21523 return m_value.object->empty();
21590 return m_value.array->size();
21596 return m_value.object->size();
21655 return m_value.array->max_size();
21661 return m_value.object->max_size();
21725 m_value.number_integer = 0;
21731 m_value.number_unsigned = 0;
21737 m_value.number_float = 0.0;
21743 m_value.boolean =
false;
21749 m_value.string->clear();
21755 m_value.binary->clear();
21761 m_value.array->clear();
21767 m_value.object->clear();
21809 assert_invariant();
21813 m_value.array->push_back(
std::move(val));
21844 assert_invariant();
21848 m_value.array->push_back(val);
21894 assert_invariant();
21898 m_value.object->insert(val);
21938 if (is_object() && init.size() == 2 && (*init.begin())->is_string())
21940 basic_json&&
key = init.begin()->moved_or_copied();
21941 push_back(
typename object_t::value_type(
21946 push_back(basic_json(init));
21983 template<
class... Args>
21997 assert_invariant();
22001 #ifdef JSON_HAS_CPP_17 22002 return m_value.array->emplace_back(std::forward<Args>(args)...);
22004 m_value.array->emplace_back(std::forward<Args>(args)...);
22005 return m_value.array->back();
22036 template<
class... Args>
22050 assert_invariant();
22054 auto res = m_value.object->emplace(std::forward<Args>(args)...);
22057 it.m_it.object_iterator = res.first;
22060 return {it, res.second};
22066 template<
typename... Args>
22117 return insert_iterator(pos, val);
22129 return insert(pos, val);
22168 return insert_iterator(pos, cnt, val);
22272 return insert_iterator(pos, ilist.begin(), ilist.end());
22346 m_value.object = create<object_t>();
22347 assert_invariant();
22359 for (
auto it = j.
cbegin(); it != j.
cend(); ++it)
22361 m_value.object->operator[](it.key()) = it.value();
22397 m_value.object = create<object_t>();
22398 assert_invariant();
22414 || !last.m_object->is_object()))
22419 for (
auto it = first; it != last; ++it)
22421 m_value.object->operator[](it.key()) = it.value();
22451 assert_invariant();
22695 const auto lhs_type = lhs.type();
22696 const auto rhs_type = rhs.type();
22698 if (lhs_type == rhs_type)
22703 return *lhs.m_value.array == *rhs.m_value.array;
22706 return *lhs.m_value.object == *rhs.m_value.object;
22712 return *lhs.m_value.string == *rhs.m_value.string;
22715 return lhs.m_value.boolean == rhs.m_value.boolean;
22718 return lhs.m_value.number_integer == rhs.m_value.number_integer;
22721 return lhs.m_value.number_unsigned == rhs.m_value.number_unsigned;
22724 return lhs.m_value.number_float == rhs.m_value.number_float;
22727 return *lhs.m_value.binary == *rhs.m_value.binary;
22735 return static_cast<number_float_t>(lhs.m_value.number_integer) == rhs.m_value.number_float;
22739 return lhs.m_value.number_float ==
static_cast<number_float_t>(rhs.m_value.number_integer);
22743 return static_cast<number_float_t>(lhs.m_value.number_unsigned) == rhs.m_value.number_float;
22747 return lhs.m_value.number_float ==
static_cast<number_float_t>(rhs.m_value.number_unsigned);
22751 return static_cast<number_integer_t>(lhs.m_value.number_unsigned) == rhs.m_value.number_integer;
22755 return lhs.m_value.number_integer ==
static_cast<number_integer_t>(rhs.m_value.number_unsigned);
22765 template<
typename ScalarType,
typename std::enable_if<
22769 return lhs == basic_json(rhs);
22776 template<
typename ScalarType,
typename std::enable_if<
22777 std::is_scalar<ScalarType>::value,
int>::type = 0>
22780 return basic_json(lhs) == rhs;
22803 return !(lhs == rhs);
22810 template<
typename ScalarType,
typename std::enable_if<
22811 std::is_scalar<ScalarType>::value,
int>::type = 0>
22814 return lhs != basic_json(rhs);
22821 template<
typename ScalarType,
typename std::enable_if<
22822 std::is_scalar<ScalarType>::value,
int>::type = 0>
22825 return basic_json(lhs) != rhs;
22856 const auto lhs_type = lhs.type();
22857 const auto rhs_type = rhs.type();
22859 if (lhs_type == rhs_type)
22866 return (*lhs.m_value.array) < (*rhs.m_value.array);
22869 return (*lhs.m_value.object) < (*rhs.m_value.object);
22875 return (*lhs.m_value.string) < (*rhs.m_value.string);
22878 return (lhs.m_value.boolean) < (rhs.m_value.boolean);
22881 return (lhs.m_value.number_integer) < (rhs.m_value.number_integer);
22884 return (lhs.m_value.number_unsigned) < (rhs.m_value.number_unsigned);
22887 return (lhs.m_value.number_float) < (rhs.m_value.number_float);
22890 return (*lhs.m_value.binary) < (*rhs.m_value.binary);
22898 return static_cast<number_float_t>(lhs.m_value.number_integer) < rhs.m_value.number_float;
22902 return lhs.m_value.number_float <
static_cast<number_float_t>(rhs.m_value.number_integer);
22906 return static_cast<number_float_t>(lhs.m_value.number_unsigned) < rhs.m_value.number_float;
22910 return lhs.m_value.number_float <
static_cast<number_float_t>(rhs.m_value.number_unsigned);
22914 return lhs.m_value.number_integer <
static_cast<number_integer_t>(rhs.m_value.number_unsigned);
22918 return static_cast<number_integer_t>(lhs.m_value.number_unsigned) < rhs.m_value.number_integer;
22931 template<
typename ScalarType,
typename std::enable_if<
22932 std::is_scalar<ScalarType>::value,
int>::type = 0>
22935 return lhs < basic_json(rhs);
22942 template<
typename ScalarType,
typename std::enable_if<
22943 std::is_scalar<ScalarType>::value,
int>::type = 0>
22946 return basic_json(lhs) < rhs;
22970 return !(rhs < lhs);
22977 template<
typename ScalarType,
typename std::enable_if<
22978 std::is_scalar<ScalarType>::value,
int>::type = 0>
22981 return lhs <= basic_json(rhs);
22988 template<
typename ScalarType,
typename std::enable_if<
22989 std::is_scalar<ScalarType>::value,
int>::type = 0>
22992 return basic_json(lhs) <= rhs;
23016 return !(lhs <= rhs);
23023 template<
typename ScalarType,
typename std::enable_if<
23024 std::is_scalar<ScalarType>::value,
int>::type = 0>
23027 return lhs > basic_json(rhs);
23034 template<
typename ScalarType,
typename std::enable_if<
23035 std::is_scalar<ScalarType>::value,
int>::type = 0>
23038 return basic_json(lhs) > rhs;
23062 return !(lhs < rhs);
23069 template<
typename ScalarType,
typename std::enable_if<
23070 std::is_scalar<ScalarType>::value,
int>::type = 0>
23073 return lhs >= basic_json(rhs);
23080 template<
typename ScalarType,
typename std::enable_if<
23081 std::is_scalar<ScalarType>::value,
int>::type = 0>
23084 return basic_json(lhs) >= rhs;
23127 friend std::ostream&
operator<<(std::ostream& o,
const basic_json& j)
23130 const bool pretty_print = o.width() > 0;
23131 const auto indentation = pretty_print ? o.width() : 0;
23138 s.dump(j, pretty_print,
false, static_cast<unsigned int>(indentation));
23151 friend
std::ostream& operator>>(const basic_json& j,
std::ostream& o)
23217 template<
typename InputType>
23221 const bool allow_exceptions =
true,
23222 const bool ignore_comments =
false)
23225 parser(
detail::input_adapter(std::forward<InputType>(i)), cb, allow_exceptions, ignore_comments).parse(
true, result);
23255 template<
typename IteratorType>
23260 const bool allow_exceptions =
true,
23261 const bool ignore_comments =
false)
23270 static basic_json parse(
detail::span_input_adapter&& i,
23272 const
bool allow_exceptions = true,
23273 const
bool ignore_comments = false)
23276 parser(i.get(), cb, allow_exceptions, ignore_comments).parse(
true, result);
23310 template<
typename InputType>
23312 const bool ignore_comments =
false)
23314 return parser(
detail::input_adapter(std::forward<InputType>(i)),
nullptr,
false, ignore_comments).accept(
true);
23317 template<
typename IteratorType>
23318 static bool accept(IteratorType first, IteratorType last,
23319 const bool ignore_comments =
false)
23326 static
bool accept(
detail::span_input_adapter&& i,
23327 const
bool ignore_comments = false)
23329 return parser(i.get(),
nullptr,
false, ignore_comments).accept(
true);
23372 template <
typename InputType,
typename SAX>
23374 static
bool sax_parse(InputType&& i, SAX* sax,
23376 const
bool strict = true,
23377 const
bool ignore_comments = false)
23381 ? parser(
std::move(ia),
nullptr,
true, ignore_comments).sax_parse(sax,
strict)
23385 template<
class IteratorType,
class SAX>
23387 static
bool sax_parse(IteratorType first, IteratorType last, SAX* sax,
23389 const
bool strict = true,
23390 const
bool ignore_comments = false)
23394 ? parser(
std::move(ia),
nullptr,
true, ignore_comments).sax_parse(sax,
strict)
23398 template <
typename SAX>
23401 static
bool sax_parse(
detail::span_input_adapter&& i, SAX* sax,
23403 const
bool strict = true,
23404 const
bool ignore_comments = false)
23408 ? parser(
std::move(ia),
nullptr,
true, ignore_comments).sax_parse(sax,
strict)
23421 friend
std::istream& operator<<(basic_json& j,
std::istream& i)
23423 return operator>>(i, j);
23513 return "discarded";
23530 json_value m_value = {};
23634 static std::vector<uint8_t>
to_cbor(
const basic_json& j)
23636 std::vector<uint8_t>
result;
23637 to_cbor(j, result);
23731 std::vector<uint8_t>
result;
23732 to_msgpack(j, result);
23833 const bool use_size =
false,
23834 const bool use_type =
false)
23836 std::vector<uint8_t>
result;
23837 to_ubjson(j, result, use_size, use_type);
23842 const bool use_size =
false,
const bool use_type =
false)
23848 const bool use_size =
false,
const bool use_type =
false)
23910 static std::vector<uint8_t>
to_bson(
const basic_json& j)
23912 std::vector<uint8_t>
result;
23913 to_bson(j, result);
24041 template<
typename InputType>
24044 const bool strict =
true,
24045 const bool allow_exceptions =
true,
24058 template<
typename IteratorType>
24060 static basic_json
from_cbor(IteratorType first, IteratorType last,
24061 const bool strict =
true,
24062 const bool allow_exceptions =
true,
24072 template<
typename T>
24076 const
bool strict = true,
24077 const
bool allow_exceptions = true,
24080 return from_cbor(ptr, ptr + len,
strict, allow_exceptions, tag_handler);
24086 static basic_json from_cbor(
detail::span_input_adapter&& i,
24087 const
bool strict = true,
24088 const
bool allow_exceptions = true,
24184 template<
typename InputType>
24187 const bool strict =
true,
24188 const bool allow_exceptions =
true)
24200 template<
typename IteratorType>
24203 const bool strict =
true,
24204 const bool allow_exceptions =
true)
24214 template<
typename T>
24218 const
bool strict = true,
24219 const
bool allow_exceptions = true)
24221 return from_msgpack(ptr, ptr + len,
strict, allow_exceptions);
24226 static basic_json from_msgpack(
detail::span_input_adapter&& i,
24227 const
bool strict = true,
24228 const
bool allow_exceptions = true)
24300 template<
typename InputType>
24303 const bool strict =
true,
24304 const bool allow_exceptions =
true)
24316 template<
typename IteratorType>
24319 const bool strict =
true,
24320 const bool allow_exceptions =
true)
24329 template<
typename T>
24333 const
bool strict = true,
24334 const
bool allow_exceptions = true)
24336 return from_ubjson(ptr, ptr + len,
strict, allow_exceptions);
24342 const
bool strict = true,
24343 const
bool allow_exceptions = true)
24413 template<
typename InputType>
24416 const bool strict =
true,
24417 const bool allow_exceptions =
true)
24429 template<
typename IteratorType>
24432 const bool strict =
true,
24433 const bool allow_exceptions =
true)
24442 template<
typename T>
24446 const
bool strict = true,
24447 const
bool allow_exceptions = true)
24449 return from_bson(ptr, ptr + len,
strict, allow_exceptions);
24455 const
bool strict = true,
24456 const
bool allow_exceptions = true)
24751 enum class patch_operations {add,
remove,
replace,
move, copy, test, invalid};
24757 return patch_operations::add;
24759 if (op ==
"remove")
24763 if (op ==
"replace")
24773 return patch_operations::copy;
24777 return patch_operations::test;
24780 return patch_operations::invalid;
24795 if (top_pointer != ptr)
24797 result.
at(top_pointer);
24801 const auto last_path = ptr.
back();
24805 switch (parent.m_type)
24811 parent[last_path] = val;
24817 if (last_path ==
"-")
24847 const auto last_path = ptr.
back();
24855 auto it = parent.
find(last_path);
24879 for (
const auto& val : json_patch)
24887 auto it = val.
m_value.object->find(member);
24890 const auto error_msg = (op ==
"op") ?
"operation" :
"operation '" + op +
"'";
24915 const auto op =
get_value(
"op",
"op",
true).template get<std::string>();
24916 const auto path =
get_value(op,
"path",
true).template get<std::string>();
24919 switch (get_op(op))
24921 case patch_operations::add:
24923 operation_add(ptr,
get_value(
"add",
"value",
false));
24929 operation_remove(ptr);
24936 result.
at(ptr) =
get_value(
"replace",
"value",
false);
24942 const auto from_path =
get_value(
"move",
"from",
true).template get<std::string>();
24952 operation_remove(from_ptr);
24953 operation_add(ptr, v);
24957 case patch_operations::copy:
24959 const auto from_path =
get_value(
"copy",
"from",
true).template get<std::string>();
24968 operation_add(ptr, v);
24972 case patch_operations::test:
24979 success = (result.
at(ptr) ==
get_value(
"test",
"value",
false));
25048 if (source == target)
25053 if (source.
type() != target.
type())
25058 {
"op",
"replace"}, {
"path", path}, {
"value", target}
25063 switch (source.
type())
25069 while (i < source.
size() && i < target.
size())
25072 auto temp_diff = diff(source[i], target[i], path +
"/" + std::to_string(i));
25073 result.
insert(result.
end(), temp_diff.begin(), temp_diff.end());
25082 while (i < source.
size())
25089 {
"path", path +
"/" + std::to_string(i)}
25095 while (i < target.
size())
25100 {
"path", path +
"/-"},
25101 {
"value", target[i]}
25112 for (
auto it = source.
cbegin(); it != source.
cend(); ++it)
25115 const auto key = json_pointer::escape(it.key());
25117 if (target.
find(it.key()) != target.
end())
25120 auto temp_diff = diff(it.value(), target[it.key()], path +
"/" +
key);
25121 result.
insert(result.
end(), temp_diff.begin(), temp_diff.end());
25128 {
"op",
"remove"}, {
"path", path +
"/" +
key}
25134 for (
auto it = target.
cbegin(); it != target.
cend(); ++it)
25136 if (source.
find(it.key()) == source.
end())
25139 const auto key = json_pointer::escape(it.key());
25142 {
"op",
"add"}, {
"path", path +
"/" +
key},
25143 {
"value", it.value()}
25156 {
"op",
"replace"}, {
"path", path}, {
"value", target}
25224 for (
auto it = apply_patch.
begin(); it != apply_patch.
end(); ++it)
25226 if (it.value().is_null())
25232 operator[](it.key()).merge_patch(it.value());
25238 *
this = apply_patch;
25302 #ifndef JSON_HAS_CPP_20 25364 #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) 25365 #pragma GCC diagnostic pop 25367 #if defined(__clang__) 25368 #pragma GCC diagnostic pop 25373 #undef JSON_INTERNAL_CATCH 25377 #undef JSON_PRIVATE_UNLESS_TESTED 25378 #undef JSON_HAS_CPP_14 25379 #undef JSON_HAS_CPP_17 25380 #undef NLOHMANN_BASIC_JSON_TPL_DECLARATION 25381 #undef NLOHMANN_BASIC_JSON_TPL 25382 #undef JSON_EXPLICIT 25385 #undef JSON_HEDLEY_ALWAYS_INLINE 25386 #undef JSON_HEDLEY_ARM_VERSION 25387 #undef JSON_HEDLEY_ARM_VERSION_CHECK 25388 #undef JSON_HEDLEY_ARRAY_PARAM 25389 #undef JSON_HEDLEY_ASSUME 25390 #undef JSON_HEDLEY_BEGIN_C_DECLS 25391 #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE 25392 #undef JSON_HEDLEY_CLANG_HAS_BUILTIN 25393 #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE 25394 #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE 25395 #undef JSON_HEDLEY_CLANG_HAS_EXTENSION 25396 #undef JSON_HEDLEY_CLANG_HAS_FEATURE 25397 #undef JSON_HEDLEY_CLANG_HAS_WARNING 25398 #undef JSON_HEDLEY_COMPCERT_VERSION 25399 #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK 25400 #undef JSON_HEDLEY_CONCAT 25401 #undef JSON_HEDLEY_CONCAT3 25402 #undef JSON_HEDLEY_CONCAT3_EX 25403 #undef JSON_HEDLEY_CONCAT_EX 25404 #undef JSON_HEDLEY_CONST 25405 #undef JSON_HEDLEY_CONSTEXPR 25406 #undef JSON_HEDLEY_CONST_CAST 25407 #undef JSON_HEDLEY_CPP_CAST 25408 #undef JSON_HEDLEY_CRAY_VERSION 25409 #undef JSON_HEDLEY_CRAY_VERSION_CHECK 25410 #undef JSON_HEDLEY_C_DECL 25411 #undef JSON_HEDLEY_DEPRECATED 25412 #undef JSON_HEDLEY_DEPRECATED_FOR 25413 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL 25414 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ 25415 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED 25416 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES 25417 #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS 25418 #undef JSON_HEDLEY_DIAGNOSTIC_POP 25419 #undef JSON_HEDLEY_DIAGNOSTIC_PUSH 25420 #undef JSON_HEDLEY_DMC_VERSION 25421 #undef JSON_HEDLEY_DMC_VERSION_CHECK 25422 #undef JSON_HEDLEY_EMPTY_BASES 25423 #undef JSON_HEDLEY_EMSCRIPTEN_VERSION 25424 #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK 25425 #undef JSON_HEDLEY_END_C_DECLS 25426 #undef JSON_HEDLEY_FLAGS 25427 #undef JSON_HEDLEY_FLAGS_CAST 25428 #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE 25429 #undef JSON_HEDLEY_GCC_HAS_BUILTIN 25430 #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE 25431 #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE 25432 #undef JSON_HEDLEY_GCC_HAS_EXTENSION 25433 #undef JSON_HEDLEY_GCC_HAS_FEATURE 25434 #undef JSON_HEDLEY_GCC_HAS_WARNING 25435 #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK 25436 #undef JSON_HEDLEY_GCC_VERSION 25437 #undef JSON_HEDLEY_GCC_VERSION_CHECK 25438 #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE 25439 #undef JSON_HEDLEY_GNUC_HAS_BUILTIN 25440 #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE 25441 #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE 25442 #undef JSON_HEDLEY_GNUC_HAS_EXTENSION 25443 #undef JSON_HEDLEY_GNUC_HAS_FEATURE 25444 #undef JSON_HEDLEY_GNUC_HAS_WARNING 25445 #undef JSON_HEDLEY_GNUC_VERSION 25446 #undef JSON_HEDLEY_GNUC_VERSION_CHECK 25447 #undef JSON_HEDLEY_HAS_ATTRIBUTE 25448 #undef JSON_HEDLEY_HAS_BUILTIN 25449 #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE 25450 #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS 25451 #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE 25452 #undef JSON_HEDLEY_HAS_EXTENSION 25453 #undef JSON_HEDLEY_HAS_FEATURE 25454 #undef JSON_HEDLEY_HAS_WARNING 25455 #undef JSON_HEDLEY_IAR_VERSION 25456 #undef JSON_HEDLEY_IAR_VERSION_CHECK 25457 #undef JSON_HEDLEY_IBM_VERSION 25458 #undef JSON_HEDLEY_IBM_VERSION_CHECK 25459 #undef JSON_HEDLEY_IMPORT 25460 #undef JSON_HEDLEY_INLINE 25461 #undef JSON_HEDLEY_INTEL_CL_VERSION 25462 #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK 25463 #undef JSON_HEDLEY_INTEL_VERSION 25464 #undef JSON_HEDLEY_INTEL_VERSION_CHECK 25465 #undef JSON_HEDLEY_IS_CONSTANT 25466 #undef JSON_HEDLEY_IS_CONSTEXPR_ 25467 #undef JSON_HEDLEY_LIKELY 25468 #undef JSON_HEDLEY_MALLOC 25469 #undef JSON_HEDLEY_MESSAGE 25470 #undef JSON_HEDLEY_MSVC_VERSION 25471 #undef JSON_HEDLEY_MSVC_VERSION_CHECK 25472 #undef JSON_HEDLEY_NEVER_INLINE 25473 #undef JSON_HEDLEY_NON_NULL 25474 #undef JSON_HEDLEY_NO_ESCAPE 25475 #undef JSON_HEDLEY_NO_RETURN 25476 #undef JSON_HEDLEY_NO_THROW 25477 #undef JSON_HEDLEY_NULL 25478 #undef JSON_HEDLEY_PELLES_VERSION 25479 #undef JSON_HEDLEY_PELLES_VERSION_CHECK 25480 #undef JSON_HEDLEY_PGI_VERSION 25481 #undef JSON_HEDLEY_PGI_VERSION_CHECK 25482 #undef JSON_HEDLEY_PREDICT 25483 #undef JSON_HEDLEY_PRINTF_FORMAT 25484 #undef JSON_HEDLEY_PRIVATE 25485 #undef JSON_HEDLEY_PUBLIC 25486 #undef JSON_HEDLEY_PURE 25487 #undef JSON_HEDLEY_REINTERPRET_CAST 25488 #undef JSON_HEDLEY_REQUIRE 25489 #undef JSON_HEDLEY_REQUIRE_CONSTEXPR 25490 #undef JSON_HEDLEY_REQUIRE_MSG 25491 #undef JSON_HEDLEY_RESTRICT 25492 #undef JSON_HEDLEY_RETURNS_NON_NULL 25493 #undef JSON_HEDLEY_SENTINEL 25494 #undef JSON_HEDLEY_STATIC_ASSERT 25495 #undef JSON_HEDLEY_STATIC_CAST 25496 #undef JSON_HEDLEY_STRINGIFY 25497 #undef JSON_HEDLEY_STRINGIFY_EX 25498 #undef JSON_HEDLEY_SUNPRO_VERSION 25499 #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK 25500 #undef JSON_HEDLEY_TINYC_VERSION 25501 #undef JSON_HEDLEY_TINYC_VERSION_CHECK 25502 #undef JSON_HEDLEY_TI_ARMCL_VERSION 25503 #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK 25504 #undef JSON_HEDLEY_TI_CL2000_VERSION 25505 #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK 25506 #undef JSON_HEDLEY_TI_CL430_VERSION 25507 #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK 25508 #undef JSON_HEDLEY_TI_CL6X_VERSION 25509 #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK 25510 #undef JSON_HEDLEY_TI_CL7X_VERSION 25511 #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK 25512 #undef JSON_HEDLEY_TI_CLPRU_VERSION 25513 #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK 25514 #undef JSON_HEDLEY_TI_VERSION 25515 #undef JSON_HEDLEY_TI_VERSION_CHECK 25516 #undef JSON_HEDLEY_UNAVAILABLE 25517 #undef JSON_HEDLEY_UNLIKELY 25518 #undef JSON_HEDLEY_UNPREDICTABLE 25519 #undef JSON_HEDLEY_UNREACHABLE 25520 #undef JSON_HEDLEY_UNREACHABLE_RETURN 25521 #undef JSON_HEDLEY_VERSION 25522 #undef JSON_HEDLEY_VERSION_DECODE_MAJOR 25523 #undef JSON_HEDLEY_VERSION_DECODE_MINOR 25524 #undef JSON_HEDLEY_VERSION_DECODE_REVISION 25525 #undef JSON_HEDLEY_VERSION_ENCODE 25526 #undef JSON_HEDLEY_WARNING 25527 #undef JSON_HEDLEY_WARN_UNUSED_RESULT 25528 #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG 25529 #undef JSON_HEDLEY_FALL_THROUGH 25533 #endif // INCLUDE_NLOHMANN_JSON_HPP_ void write_number_with_ubjson_prefix(const NumberType n, const bool add_prefix)
static constexpr CharType get_ubjson_float_prefix(float)
std::string exception_message(const input_format_t format, const std::string &detail, const std::string &context) const
constexpr bool operator<=(const optional< T > &lhs, const optional< U > &rhs)
relop
iter_impl & operator=(const iter_impl< const BasicJsonType > &other) noexcept
converting assignment
value_type const & operator*() const
json_pointer & operator/=(std::string token)
append an unescaped reference token at the end of this JSON pointer
bool parse_error(std::size_t, const std::string &, const detail::exception &)
decltype(std::declval< T & >().string(std::declval< String & >())) string_function_t
std::random_access_iterator_tag iterator_category
reference value() const
return the value of an iterator
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json binary(typename binary_t::container_type &&init, std::uint8_t subtype)
explicitly create a binary array (with subtype)
std::numeric_limits< CompatibleNumberIntegerType > CompatibleLimits
ValueType value(const json_pointer &ptr, const ValueType &default_value) const
access specified object element via JSON Pointer with default value
void from_json_array_impl(const BasicJsonType &j, typename BasicJsonType::array_t &arr, priority_tag< 3 >)
::nlohmann::json_pointer< basic_json > json_pointer
JSON Pointer, see nlohmann::json_pointer.
number_unsigned_t number_unsigned
number (unsigned integer)
static void construct(BasicJsonType &j, const CompatibleArrayType &arr)
bool get_cbor_binary(binary_t &result)
reads a CBOR byte array
iter_impl operator-(difference_type i) const
subtract from iterator
typename BasicJsonType::number_float_t number_float_t
reference emplace_back(Args &&...args)
add an object to an array
enum MQTTPropertyCodes value
typename T::pointer pointer_t
decltype(auto) get_value(std::false_type, T &&t)
const int id
the id of the exception
binary_t * get_impl_ptr(binary_t *) noexcept
get a pointer to the value (binary)
parse_error(int id_, std::size_t byte_, const char *what_arg)
static void construct(BasicJsonType &j, const CompatibleStringType &str)
IteratorType erase(IteratorType first, IteratorType last)
remove elements given an iterator range
static bool little_endianess(int num=1) noexcept
determine system byte order
bool_constant< is_integral< T >::value &&!std::is_same< T, bool >::value &&!std::is_same< T, char >::value &&!std::is_same< T, wchar_t >::value > is_integer
basic_json(InputIT first, InputIT last)
construct a JSON container given an iterator range
void from_json(const BasicJsonType &j, typename std::nullptr_t &n)
static constexpr CharType get_cbor_float_prefix(float)
iterator begin() noexcept
returns an iterator to the first element
array_t * array
array (stored with pointer to save storage)
typename BasicJsonType::binary_t binary_t
json_value(number_float_t v) noexcept
constructor for numbers (floating-point)
friend bool operator<(const_reference lhs, const_reference rhs) noexcept
comparison: less than
error_handler_t
how to treat decoding errors
typename std::char_traits< char_type >::int_type char_int_type
iteration_proxy_value(IteratorType it) noexcept
typename BasicJsonType::number_float_t number_float_t
static std::size_t calc_bson_string_size(const string_t &value)
#define JSON_CATCH(exception)
size_type size() const noexcept
returns the number of elements
void unget()
unget current character (read it again on next get)
FMT_INLINE std::basic_string< Char > format(const S &format_str, Args &&...args)
NLOHMANN_BASIC_JSON_TPL basic_json_t
workaround type for MSVC
stack_iterator< proxy_t, is_const > operator+(typename stack_iterator< proxy_t, is_const >::difference_type n, const stack_iterator< proxy_t, is_const > &r)
JSON_HEDLEY_RETURNS_NON_NULL const char * type_name() const noexcept
return the type as string
typename BasicJsonType::string_t string_t
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
#define JSON_HEDLEY_DIAGNOSTIC_POP
static diyfp sub(const diyfp &x, const diyfp &y) noexcept
returns x - y
decltype(input_adapter(std::declval< const char * >(), std::declval< const char * >())) contiguous_bytes_input_adapter
iter_impl & operator+=(difference_type i)
add to iterator
decltype(std::declval< T & >().boolean(std::declval< bool >())) boolean_function_t
bool parse_cbor_internal(const bool get_char, const cbor_tag_handler_t tag_handler)
value_t
the JSON type enumeration
primitive_iterator_t & operator+=(difference_type n) noexcept
iter_impl operator+(difference_type i) const
add to iterator
void grisu2_digit_gen(char *buffer, int &length, int &decimal_exponent, diyfp M_minus, diyfp w, diyfp M_plus)
auto key() const -> decltype(std::declval< Base >().key())
return the key of an object iterator
basic_object< reference > object
iter_impl(pointer object) noexcept
constructor for a given JSON instance
json_reverse_iterator const operator--(int)
post-decrement (it–)
void push_back(basic_json &&val)
add an object to an array
static BasicJsonType::size_type array_index(const std::string &s)
bool get_msgpack_object(const std::size_t len)
static void construct(BasicJsonType &j, typename BasicJsonType::number_float_t val) noexcept
void write_bson_object(const typename BasicJsonType::object_t &value)
iterator end() noexcept
returns an iterator to one past the last element
number_unsigned_t * get_impl_ptr(number_unsigned_t *) noexcept
get a pointer to the value (unsigned number)
typename std::remove_cv< typename std::remove_reference< T >::type >::type uncvref_t
bool operator==(fp x, fp y)
void push_back(const typename object_t::value_type &val)
add an object to an object
static void construct(BasicJsonType &j, typename BasicJsonType::array_t &&arr)
bool start_array(std::size_t len)
iterator insert(const_iterator pos, const_iterator first, const_iterator last)
inserts elements
ArrayType< basic_json, AllocatorType< basic_json >> array_t
a type for an array
typename InputAdapterType::char_type char_type
typename BasicJsonType::string_t string_t
json_value(const string_t &value)
constructor for strings
primitive_iterator_t & operator++() noexcept
Char thousands_sep(locale_ref loc)
void push_back(const basic_json &val)
add an object to an array
throw a parse_error exception in case of a tag
bool number_integer(number_integer_t val)
std::reverse_iterator< Base > base_iterator
shortcut to the reverse iterator adapter
bool operator!=(const iteration_proxy_value &o) const
inequality operator (needed for range-based for)
iterator insert(const_iterator pos, size_type cnt, const basic_json &val)
inserts elements
array (ordered collection of values)
basic_json & operator=(basic_json other) noexcept(std::is_nothrow_move_constructible< value_t >::value &&std::is_nothrow_move_assignable< value_t >::value &&std::is_nothrow_move_constructible< json_value >::value &&std::is_nothrow_move_assignable< json_value >::value)
copy assignment
void write_bson_double(const string_t &name, const double value)
Writes a BSON element with key name and double value value.
detail::parser_callback_t< basic_json > parser_callback_t
per-element parser callback type
json_pointer(const std::string &s="")
create JSON pointer
InputAdapterType ia
input adapter
primitive_iterator_t operator+(difference_type n) noexcept
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
basic_json(const BasicJsonType &val)
create a JSON value from an existing one
std::less< StringType > object_comparator_t
friend bool operator<=(const_reference lhs, const ScalarType rhs) noexcept
comparison: less than or equal
bool parse_msgpack_internal()
bool contains(const BasicJsonType *ptr) const
static other_error create(int id_, const std::string &what_arg)
iter_impl & operator++()
pre-increment (++it)
static constexpr CharType to_char_type(InputCharType x) noexcept
static void replace_substring(std::string &s, const std::string &f, const std::string &t)
replace all occurrences of a substring by another string
reference back()
access the last element
a template for a reverse iterator class
bool start_object(std::size_t=std::size_t(-1))
const char indent_char
the indentation character
iter_impl(const iter_impl< typename std::remove_const< BasicJsonType >::type > &other) noexcept
converting constructor
std::runtime_error m
an exception object as storage for error messages
a class to store JSON values
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json from_msgpack(IteratorType first, IteratorType last, const bool strict=true, const bool allow_exceptions=true)
ObjectType< StringType, basic_json, object_comparator_t, AllocatorType< std::pair< const StringType, basic_json >>> object_t
a type for an object
boolean_t * get_impl_ptr(boolean_t *) noexcept
get a pointer to the value (boolean)
typename T::iterator iterator_t
#define JSON_HEDLEY_DIAGNOSTIC_PUSH
void destroy(value_t t) noexcept
basic_json unflatten() const
unflatten a previously flattened JSON value
std::function< bool(int depth, parse_event_t event, BasicJsonType &parsed)> parser_callback_t
void to_json(BasicJsonType &j, const T &b)
typename BasicJsonType::binary_t binary_t
output_stream_adapter(std::basic_ostream< CharType > &s) noexcept
bool string(string_t &val)
string_t * get_impl_ptr(string_t *) noexcept
get a pointer to the value (string)
const std::string & back() const
return last reference token
basic_json flatten() const
return flattened JSON value
ValueType & get_to(ValueType &v) const noexcept(noexcept(JSONSerializer< ValueType >::from_json(std::declval< const basic_json_t & >(), v)))
get a value (explicit)
std::vector< std::pair< const Key, T >, Allocator > Container
value_type moved_or_copied() const
typename BasicJsonType::string_t string_t
default JSONSerializer template argument
std::shared_ptr< output_adapter_protocol< CharType >> output_adapter_t
a type to simplify interfaces
iter_impl const operator--(int)
post-decrement (it–)
std::ptrdiff_t difference_type
json_value(const array_t &value)
constructor for arrays
void assert_invariant() const noexcept
checks the class invariants
static JSON_HEDLEY_RETURNS_NON_NULL T * create(Args &&...args)
helper for exception-safe object creation
void write_compact_float(const number_float_t n, detail::input_format_t format)
friend std::ostream & operator<<(std::ostream &o, const basic_json &j)
serialize to stream
constexpr number_float_t get_number_float() const noexcept
return floating-point value
json_value(string_t &&value)
constructor for rvalue strings
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.
const_iterator cend() const noexcept
returns a const iterator to one past the last element
static bool accept(IteratorType first, IteratorType last, const bool ignore_comments=false)
void swap(binary_t &other)
exchanges the values
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())
::nlohmann::detail::output_adapter_t< CharType > output_adapter_t
static diyfp normalize_to(const diyfp &x, const int target_exponent) noexcept
normalize x such that the result has the exponent E
bool start_array(std::size_t len)
static std::string position_string(const position_t &pos)
#define JSON_HEDLEY_WARN_UNUSED_RESULT
binary_reader(InputAdapterType &&adapter)
create a binary reader
number value (signed integer)
bool string(string_t &val)
byte_container_with_subtype(const container_type &b, std::uint8_t subtype) noexcept(noexcept(container_type(b)))
#define JSON_INTERNAL_CATCH(exception)
void reset() noexcept
reset token_buffer; current character is beginning of token
Target reinterpret_bits(const Source source)
typename std::allocator_traits< allocator_type >::pointer pointer
the type of an element pointer
NumberIntegerType number_integer_t
a type for a number (integer)
difference_type operator-(const iter_impl &other) const
return difference
typename BasicJsonType::number_unsigned_t number_unsigned_t
the parser read [ and started to process a JSON array
output_adapter(StringType &s)
static void construct(BasicJsonType &j, const typename BasicJsonType::string_t &s)
auto operator()(const BasicJsonType &j, T &val) const noexcept(noexcept(from_json(j, val))) -> decltype(from_json(j, val), void())
json_reverse_iterator & operator+=(difference_type i)
add to iterator
difference_type operator-(const json_reverse_iterator &other) const
return difference
void grisu2_round(char *buf, int len, std::uint64_t dist, std::uint64_t delta, std::uint64_t rest, std::uint64_t ten_k)
static void unescape(std::string &s)
unescape "~1" to tilde and "~0" to slash (order is important!)
static constexpr CharType get_ubjson_float_prefix(double)
const_reference at(const typename object_t::key_type &key) const
access specified object element with bounds checking
friend bool operator!=(const ScalarType lhs, const_reference rhs) noexcept
comparison: not equal
const_reverse_iterator crend() const noexcept
returns a const reverse iterator to one before the first
BasicJsonType & get_and_create(BasicJsonType &j) const
create and return a reference to the pointed to value
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
static std::vector< uint8_t > to_msgpack(const basic_json &j)
create a MessagePack serialization of a given JSON value
friend bool operator>(const_reference lhs, const ScalarType rhs) noexcept
comparison: greater than
iteration_proxy(typename IteratorType::reference cont) noexcept
construct iteration proxy from a container
iter_impl & operator-=(difference_type i)
subtract from iterator
void push_back(std::string &&token)
append an unescaped token at the end of the reference pointer
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)
std::integral_constant< bool, std::numeric_limits< T >::is_signed||std::is_same< T, int128_t >::value > is_signed
void set_end() noexcept
set the iterator past the last value
bool start_object(std::size_t len)
pointer operator->() const
dereference the iterator
a template for a bidirectional iterator for the basic_json class This class implements a both iterato...
typename InputAdapterType::char_type char_type
bool parse_bson_element_list(const bool is_array)
Read a BSON element list (as specified in the BSON-spec)
std::size_t hash(const BasicJsonType &j)
hash a JSON value
friend bool operator==(const ScalarType lhs, const_reference rhs) noexcept
comparison: equal
void get_arithmetic_value(const BasicJsonType &j, ArithmeticType &val)
std::size_t chars_read_current_line
the number of characters read in the current line
std::bidirectional_iterator_tag iterator_category
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json diff(const basic_json &source, const basic_json &target, const std::string &path="")
creates a diff as a JSON patch
output_adapter(std::basic_ostream< CharType > &s)
const_iterator begin() const noexcept
returns a const iterator to the first element
void write_character(CharType c) override
cached_power get_cached_power_for_binary_exponent(int e)
decltype(std::declval< T & >().start_array(std::declval< std::size_t >())) start_array_function_t
string_t value(const typename object_t::key_type &key, const char *default_value) const
overload for a default value of type const char*
json_reverse_iterator(const typename base_iterator::iterator_type &it) noexcept
create reverse iterator from iterator
byte_container_with_subtype(container_type &&b) noexcept(noexcept(container_type(std::move(b))))
typename BasicJsonType::binary_t binary_t
typename BasicJsonType::binary_t::value_type binary_char_t
static std::vector< std::string > split(const std::string &reference_string)
split the string input to reference tokens
constexpr const number_integer_t * get_impl_ptr(const number_integer_t *) const noexcept
get a pointer to the value (integer number)
json_reverse_iterator operator+(difference_type i) const
add to iterator
size_type erase(const typename object_t::key_type &key)
remove element from a JSON object given a key
static void construct(BasicJsonType &j, typename BasicJsonType::number_unsigned_t val) noexcept
void write_bson(const BasicJsonType &j)
reference operator[](difference_type n) const
access to successor
json_value(const binary_t &value)
constructor for binary arrays (internal type)
void set_end() noexcept
set iterator to a defined past the end
typename BasicJsonType::number_integer_t number_integer_t
constexpr std::uint8_t subtype() const noexcept
return the binary subtype
friend bool operator==(json_pointer const &lhs, json_pointer const &rhs) noexcept
compares two JSON pointers for equality
void from_json(const BasicJsonType &j, std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > &m)
friend bool operator>(const ScalarType lhs, const_reference rhs) noexcept
comparison: greater than
bool get_bson_binary(const NumberType len, binary_t &result)
Parses a byte array input of length len from the BSON input.
constexpr const object_t * get_impl_ptr(const object_t *) const noexcept
get a pointer to the value (object)
serialization to CBOR and MessagePack values
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
iterator insert(const_iterator pos, initializer_list_t ilist)
inserts elements
output adapter for byte vectors
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)
const std::size_t byte
byte index of the parse error
reference operator[](difference_type n) const
access to successor
bool get_cbor_array(const std::size_t len, const cbor_tag_handler_t tag_handler)
typename BasicJsonType::number_unsigned_t number_unsigned_t
bool get_ubjson_value(const char_int_type prefix)
friend bool operator>=(const_reference lhs, const ScalarType rhs) noexcept
comparison: greater than or equal
BasicJsonType::object_t::iterator object_iterator
iterator for JSON objects
void to_json(BasicJsonType &j, T b) noexcept
ptrdiff_t difference_type
std::back_insert_iterator< Container > base_iterator(std::back_insert_iterator< Container > &it, checked_ptr< typename Container::value_type >)
bool operator>=(const iter_impl &other) const
comparison: greater than or equal
byte_container_with_subtype() noexcept(noexcept(container_type()))
number_integer_t * get_impl_ptr(number_integer_t *) noexcept
get a pointer to the value (integer number)
constexpr bool is_boolean() const noexcept
return whether value is a boolean
throw a type_error exception in case of invalid UTF-8
bool accept(const bool strict=true)
public accept interface
bool skip_bom()
skip the UTF-8 byte order mark
bool number_float(number_float_t val, const string_t &)
exception indicating access out of the defined range
byte_container_with_subtype(const container_type &b) noexcept(noexcept(container_type(b)))
reverse_iterator rend() noexcept
returns an iterator to the reverse-end
basic_json(CompatibleType &&val) noexcept(noexcept(JSONSerializer< U >::to_json(std::declval< basic_json_t & >(), std::forward< CompatibleType >(val))))
create a JSON value
typename BasicJsonType::number_unsigned_t number_unsigned_t
JSON_HEDLEY_RETURNS_NON_NULL BasicJsonType * handle_value(Value &&v)
primitive_iterator_t & operator--() noexcept
binary array (ordered collection of bytes)
void set_begin() noexcept
set iterator to a defined beginning
decltype(std::declval< T >().template get< U >()) get_template_function
void write_msgpack(const BasicJsonType &j)
the parser read ] and finished processing a JSON array
typename std::iterator_traits< T >::value_type value_type
static constexpr std::size_t calc_bson_unsigned_size(const std::uint64_t value) noexcept
bool get_bson_string(const NumberType len, string_t &result)
Parses a zero-terminated string of length len from the BSON input.
const string_type & key() const
return key of the iterator
IteratorType erase(IteratorType pos)
remove element given an iterator
void swap(typename binary_t::container_type &other)
static diyfp normalize(diyfp x) noexcept
normalize x such that the significand is >= 2^(q-1)
typename BasicJsonType::object_t object_t
typename BasicJsonType::exception exception_t
primitive_iterator_t const operator++(int) noexcept
void type_error(lua_State *L, int expected, int actual) noexcept(false)
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
typename T::difference_type difference_type_t
friend bool operator<(const_reference lhs, const ScalarType rhs) noexcept
comparison: less than
typename BasicJsonType::parser_callback_t parser_callback_t
bool operator>(const iter_impl &other) const
comparison: greater than
Char decimal_point(locale_ref loc)
void write_bson_string(const string_t &name, const string_t &value)
Writes a BSON element with key name and string value value.
iter_impl const operator++(int)
post-increment (it++)
typename BasicJsonType::number_float_t number_float_t
decltype(std::declval< T & >().end_object()) end_object_function_t
basic_json(const basic_json &other)
copy constructor
static void reverse(lua_State *L, StkId from, StkId to)
std::is_convertible< detected_t< Op, Args... >, To > is_detected_convertible
typename It::value_type value_type
SAX implementation to create a JSON value from SAX events.
typename detector< nonesuch, void, Op, Args... >::type detected_t
static void construct(BasicJsonType &j, const typename BasicJsonType::object_t &obj)
token_type scan_number()
scan a number literal
token_type
token types for the parser
static void to_msgpack(const basic_json &j, detail::output_adapter< char > o)
constexpr bool is_binary() const noexcept
return whether value is a binary array
NumberFloatType number_float_t
a type for a number (floating-point)
the parser read a key of a value in an object
typename BasicJsonType::number_unsigned_t number_unsigned_t
void erase(const size_type idx)
remove element from a JSON array given an index
bool get_cbor_string(string_t &result)
reads a CBOR string
ValueType value(const typename object_t::key_type &key, const ValueType &default_value) const
access specified object element with default value
exception indicating a parse error
constexpr int digits10() FMT_NOEXCEPT
#define JSON_THROW(exception)
json_reverse_iterator(const base_iterator &it) noexcept
create reverse iterator from base class
decltype(std::declval< T & >().parse_error(std::declval< std::size_t >(), std::declval< const std::string & >(), std::declval< const Exception & >())) parse_error_function_t
bool get_binary(const input_format_t format, const NumberType len, binary_t &result)
create a byte array by reading bytes from the input
typename detector< nonesuch, void, Op, Args... >::value_t is_detected
json_reverse_iterator const operator++(int)
post-increment (it++)
bool number_unsigned(number_unsigned_t val)
static void construct(BasicJsonType &j, const typename BasicJsonType::array_t &arr)
bool get_string(const input_format_t format, const NumberType len, string_t &result)
create a string by reading characters from the input
decltype(std::declval< T & >().end_array()) end_array_function_t
json_value(boolean_t v) noexcept
constructor for booleans
std::vector< CharType > & v
friend json_pointer operator/(const json_pointer &ptr, std::size_t array_idx)
create a new JSON pointer by appending the array-index-token at the end of the JSON pointer ...
const binary_t & get_binary() const
bool parse_bson_internal()
Reads in a BSON-object and passes it to the SAX-parser.
const_iterator cbegin() const noexcept
returns a const iterator to the first element
reverse_iterator rbegin() noexcept
returns an iterator to the reverse-beginning
std::ptrdiff_t difference_type
typename Base::reference reference
the reference type for the pointed-to element
#define JSON_HEDLEY_RETURNS_NON_NULL
primitive_iterator_t primitive_iterator
generic iterator for all other types
abstract output adapter interface
void write_character(CharType c) override
general exception of the basic_json class
std::size_t operator()(const nlohmann::json &j) const
return a hash value for a JSON object
IteratorType::reference container
the container to iterate
number_float_t * get_impl_ptr(number_float_t *) noexcept
get a pointer to the value (floating-point number)
JSON_HEDLEY_RETURNS_NON_NULL char * append_exponent(char *buf, int e)
appends a decimal representation of e to buf
BinaryType container_type
the type of the underlying container
boundaries compute_boundaries(FloatType value)
constexpr bool is_object() const noexcept
return whether value is an object
json_value(value_t t)
constructor for empty values of a given type
constexpr const array_t * get_impl_ptr(const array_t *) const noexcept
get a pointer to the value (array)
typename lexer_t::token_type token_type
json_value(binary_t &&value)
constructor for rvalue binary arrays (internal type)
BasicJsonType & get_unchecked(BasicJsonType *ptr) const
return a reference to the pointed to value
FMT_CONSTEXPR bool find(Ptr first, Ptr last, T value, Ptr &out)
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
value_type const * operator->() const
void write_bson_null(const string_t &name)
Writes a BSON element with key name and null value.
void clear() noexcept
clears the contents
bool get_msgpack_array(const std::size_t len)
const_reverse_iterator crbegin() const noexcept
returns a const reverse iterator to the last element
const error_handler_t error_handler
error_handler how to react on decoding errors
boolean_t get_impl(boolean_t *) const
get a boolean (explicit)
static void construct(BasicJsonType &j, typename BasicJsonType::number_integer_t val) noexcept
BasicJsonType::array_t::iterator array_iterator
iterator for JSON arrays
std::string exception_message(const token_type expected, const std::string &context)
typename std::conditional< std::is_const< BasicJsonType >::value, typename BasicJsonType::const_reference, typename BasicJsonType::reference >::type reference
defines a reference to the type iterated over (value_type)
friend bool operator==(const_reference lhs, const ScalarType rhs) noexcept
comparison: equal
bool number_integer(number_integer_t val)
output_adapter(std::vector< CharType > &vec)
an internal type for a backed binary type
ValueType & get_to(ValueType &v) const
internal_iterator< typename std::remove_const< BasicJsonType >::type > m_it
the actual iterator of the associated instance
typename std::remove_cv< typename std::remove_reference< decltype(std::declval< IteratorType >().key()) >::type >::type string_type
typename BasicJsonType::number_float_t number_float_t
the parser read } and finished processing a JSON object
bool next_byte_in_range(std::initializer_list< char_int_type > ranges)
check if the next byte(s) are inside a given range
BasicJsonType & get_checked(BasicJsonType *ptr) const
void push_back(const std::string &token)
append an unescaped token at the end of the reference pointer
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json from_bson(IteratorType first, IteratorType last, const bool strict=true, const bool allow_exceptions=true)
exception indicating errors with iterators
void swap(array_t &other)
exchanges the values
bool operator<(const value_t lhs, const value_t rhs) noexcept
comparison operator for JSON types
size_type max_size() const noexcept
returns the maximum possible number of elements
void from_json_tuple_impl(const BasicJsonType &j, Tuple &t, index_sequence< Idx... >)
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json meta()
returns version information on the library
void grisu2(char *buf, int &len, int &decimal_exponent, diyfp m_minus, diyfp v, diyfp m_plus)
reference operator+=(basic_json &&val)
add an object to an array
typename It::pointer pointer
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json object(initializer_list_t init={})
explicitly create an object from an initializer list
namespace for Niels Lohmann
static std::vector< uint8_t > to_ubjson(const basic_json &j, const bool use_size=false, const bool use_type=false)
create a UBJSON serialization of a given JSON value
std::pair< iterator, bool > emplace(Args &&...args)
add an object to an object if key does not exist
bool number_integer(number_integer_t)
bool number_float(number_float_t val, const string_t &)
token_type scan_string()
scan a string literal
#define JSON_HEDLEY_CONST
json_ref(std::initializer_list< json_ref > init)
bool parse_error(std::size_t, const std::string &, const Exception &ex)
typename BasicJsonType::string_t string_t
constexpr value_t type() const noexcept
return the type of the JSON value (explicit)
constexpr difference_type get_value() const noexcept
typename BasicJsonType::string_t string_t
const_reference operator[](size_type idx) const
access specified array element
typename BasicJsonType::number_integer_t number_integer_t
bool start_object(std::size_t len)
object (unordered set of name/value pairs)
void write_number(const NumberType n)
token_type get_token()
get next token from lexer
NumberUnsignedType number_unsigned_t
a type for a number (unsigned)
typename BasicJsonType::template json_serializer< T, void > serializer
typename BasicJsonType::number_float_t number_float_t
std::string get_token_string() const
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json array(initializer_list_t init={})
explicitly create an array from an initializer list
iterator find(KeyT &&key)
find an element in a JSON object
number_float_t number_float
number (floating-point)
typename std::enable_if< B, T >::type enable_if_t
json_value(number_integer_t v) noexcept
constructor for numbers (integer)
ordered_map(const Allocator &alloc=Allocator())
typename std::conditional< std::is_const< BasicJsonType >::value, typename BasicJsonType::const_pointer, typename BasicJsonType::pointer >::type pointer
defines a pointer to the type iterated over (value_type)
basic_json(const value_t v)
create an empty value with a given type
#define NLOHMANN_BASIC_JSON_TPL
std::string type_name(lua_State *L, type t)
friend bool operator!=(json_pointer const &lhs, json_pointer const &rhs) noexcept
compares two JSON pointers for inequality
exception indicating executing a member function with a wrong type
std::size_t combine(std::size_t seed, std::size_t h) noexcept
constexpr bool is_number_unsigned() const noexcept
return whether value is an unsigned integer number
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.
friend bool operator<=(const ScalarType lhs, const_reference rhs) noexcept
comparison: less than or equal
#define NLOHMANN_JSON_VERSION_PATCH
bool operator==(const byte_container_with_subtype &rhs) const
static void flatten(const std::string &reference_string, const BasicJsonType &value, BasicJsonType &result)
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.
typename BasicJsonType::number_integer_t number_integer_t
static constexpr CharType get_cbor_float_prefix(double)
constexpr bool is_begin() const noexcept
return whether the iterator can be dereferenced
constexpr bool is_primitive() const noexcept
return whether type is primitive
bool binary(binary_t &val)
typename BasicJsonType::number_float_t number_float_t
friend std::istream & operator>>(std::istream &i, basic_json &j)
deserialize from stream
bool get_msgpack_binary(binary_t &result)
reads a MessagePack byte array
std::initializer_list< detail::json_ref< basic_json >> initializer_list_t
helper type for initializer lists of basic_json values
typename BasicJsonType::parse_event_t parse_event_t
basic_json patch(const basic_json &json_patch) const
applies a JSON patch
basic_reference< false > reference
size_type erase(const Key &key)
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json binary(const typename binary_t::container_type &init)
explicitly create a binary array (without subtype)
size_type count(KeyT &&key) const
returns the number of occurrences of a key in a JSON object
typename BasicJsonType::template json_serializer< T, void > serializer
friend bool operator==(const_reference lhs, const_reference rhs) noexcept
comparison: equal
friend json_pointer operator/(const json_pointer &ptr, std::string token)
create a new JSON pointer by appending the unescaped token at the end of the JSON pointer ...
cbor_tag_handler_t
how to treat CBOR tags
static void construct(BasicJsonType &j, typename BasicJsonType::object_t &&obj)
static auto from_json(BasicJsonType &&j, ValueType &val) noexcept(noexcept(::nlohmann::from_json(std::forward< BasicJsonType >(j), val))) -> decltype(::nlohmann::from_json(std::forward< BasicJsonType >(j), val), void())
convert a JSON value to any value type
typename BasicJsonType::number_unsigned_t number_unsigned_t
decltype(std::declval< T & >().number_integer(std::declval< Integer >())) number_integer_function_t
#define JSON_HEDLEY_NON_NULL(...)
static void construct(BasicJsonType &j, typename BasicJsonType::binary_t &&b)
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
typename T::value_type value_type_t
output_vector_adapter(std::vector< CharType > &vec) noexcept
ring_iterator< RS, C > operator-(ring_iterator< RS, C > it, int i) nsrs_noexcept
char_int_type get_ignore_noop()
std::pair< iterator, bool > emplace(const key_type &key, T &&t)
static JSON_HEDLEY_PURE char get_decimal_point() noexcept
return the locale-dependent decimal point
size_type count(const Key &key) const
typename BasicJsonType::binary_t binary_t
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)
bool start_array(std::size_t=std::size_t(-1))
const_reference front() const
access the first element
static std::size_t calc_bson_array_size(const typename BasicJsonType::array_t &value)
decltype(std::declval< T & >().null()) null_function_t
std::ptrdiff_t difference_type
bool empty() const noexcept
return whether pointer points to the root document
typename BasicJsonType::number_float_t number_float_t
static void construct(BasicJsonType &j, const typename BasicJsonType::binary_t &b)
json_pointer & operator/=(std::size_t array_idx)
append an array index at the end of this JSON pointer
IteratorType anchor
the iterator
const T & operator[](const Key &key) const
void write_bson_array(const string_t &name, const typename BasicJsonType::array_t &value)
Writes a BSON element with key name and array value.
static invalid_iterator create(int id_, const std::string &what_arg)
std::is_same< Expected, detected_t< Op, Args... >> is_detected_exact
bool contains(const json_pointer &ptr) const
check the existence of an element in a JSON object given a JSON pointer
void parse(const bool strict, BasicJsonType &result)
public parser interface
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json from_ubjson(IteratorType first, IteratorType last, const bool strict=true, const bool allow_exceptions=true)
bool get_number(const input_format_t format, NumberType &result)
typename std::allocator_traits< allocator_type >::const_pointer const_pointer
the type of an element const pointer
bool empty() const noexcept
checks whether the container is empty.
typename BasicJsonType::exception exception_t
const T & at(const Key &key) const
constexpr bool is_number_float() const noexcept
return whether value is a floating-point number
BasicJsonType & root
the parsed JSON value
typename BasicJsonType::binary_t binary_t
iteration_proxy_value< IteratorType > begin() noexcept
return iterator begin (needed for range-based for)
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.
typename It::difference_type difference_type
bool get_cbor_object(const std::size_t len, const cbor_tag_handler_t tag_handler)
reference at(size_type idx)
access specified array element with bounds checking
void add(char_int_type c)
add a character to token_buffer
reference front()
access the first element
typename T::key_type key_type_t
output adapter for basic_string
typename std::char_traits< char_type >::int_type char_int_type
the parser read { and started to process a JSON object
static void to_ubjson(const basic_json &j, detail::output_adapter< char > o, const bool use_size=false, const bool use_type=false)
static int codepoint(lua_State *L)
const T & move(const T &v)
#define JSON_HEDLEY_LIKELY(expr)
iterator erase(iterator pos)
StringType string_t
a type for a string
friend bool operator>(const_reference lhs, const_reference rhs) noexcept
comparison: greater than
typename BasicJsonType::number_float_t number_float_t
bool number_unsigned(number_unsigned_t)
#define JSON_PRIVATE_UNLESS_TESTED
std::pair< iterator, bool > insert(const value_type &value)
iteration_proxy_value & operator*()
dereference operator (needed for range-based for)
void swap(reference other) noexcept(std::is_nothrow_move_constructible< value_t >::value &&std::is_nothrow_move_assignable< value_t >::value &&std::is_nothrow_move_constructible< json_value >::value &&std::is_nothrow_move_assignable< json_value >::value)
exchanges the values
binary_writer(output_adapter_t< CharType > adapter)
create a binary writer
static BasicJsonType unflatten(const BasicJsonType &value)
typename BasicJsonType::string_t string_t
output adapter for output streams
reference operator*() const
return a reference to the value pointed to by the iterator
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.
string_t * string
string (stored with pointer to save storage)
int get_codepoint()
get codepoint from 4 hex characters following \u
#define NLOHMANN_JSON_VERSION_MINOR
basic_json(size_type cnt, const basic_json &val)
construct an array with count copies of given value
typename BasicJsonType::object_t object_t
std::pair< iterator, bool > insert(value_type &&value)
BooleanType boolean_t
a type for a boolean
json_value(number_unsigned_t v) noexcept
constructor for numbers (unsigned)
typename It::iterator_category iterator_category
constexpr const number_unsigned_t * get_impl_ptr(const number_unsigned_t *) const noexcept
get a pointer to the value (unsigned number)
bool operator<(const iter_impl &other) const
comparison: smaller
iterator find(const Key &key)
json_ref(value_type &&value)
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json parse(InputType &&i, const parser_callback_t cb=nullptr, const bool allow_exceptions=true, const bool ignore_comments=false)
deserialize from a compatible input
exception indicating other library errors
typename BasicJsonType::number_integer_t number_integer_t
bool get_ubjson_size_value(std::size_t &result)
std::input_iterator_tag iterator_category
void update(const_reference j)
updates a JSON object from another object, overwriting existing keys
typename BasicJsonType::number_float_t number_float_t
JSON_HEDLEY_RETURNS_NON_NULL constexpr const char * get_error_message() const noexcept
return syntax error message
decltype(std::declval< T & >().number_float(std::declval< Float >(), std::declval< const String & >())) number_float_function_t
static std::size_t calc_bson_entry_header_size(const string_t &name)
static std::string name(const std::string &ename, int id_)
constexpr bool is_end() const noexcept
return whether the iterator is at end
typename BasicJsonType::string_t string_t
reference operator+=(const basic_json &val)
add an object to an array
friend bool operator>=(const ScalarType lhs, const_reference rhs) noexcept
comparison: greater than or equal
std::pair< bool, BasicJsonType * > handle_value(Value &&v, const bool skip_callback=false)
decltype(std::declval< T & >().start_object(std::declval< std::size_t >())) start_object_function_t
reference operator[](const json_pointer &ptr)
access specified element via JSON Pointer
json_pointer & operator/=(const json_pointer &ptr)
append another JSON pointer at the end of this JSON pointer
deserialization of CBOR, MessagePack, and UBJSON values
Array get_to(T(&v)[N]) const noexcept(noexcept(JSONSerializer< Array >::from_json(std::declval< const basic_json_t & >(), v)))
const_iterator find(KeyT &&key) const
find an element in a JSON object
const BasicJsonType & get_checked(const BasicJsonType *ptr) const
iterator insert(const_iterator pos, const basic_json &val)
inserts element
basic_json(std::nullptr_t=nullptr) noexcept
create a null object
friend void swap(reference left, reference right) noexcept(std::is_nothrow_move_constructible< value_t >::value &&std::is_nothrow_move_assignable< value_t >::value &&std::is_nothrow_move_constructible< json_value >::value &&std::is_nothrow_move_assignable< json_value >::value)
exchanges the values
AllocatorType< basic_json > allocator_type
the allocator type
void to_json_tuple_impl(BasicJsonType &j, const Tuple &t, index_sequence< Idx... >)
constexpr bool is_number_integer() const noexcept
return whether value is an integer number
static void to_bson(const basic_json &j, detail::output_adapter< char > o)
Serializes the given JSON object j to BSON and forwards the corresponding BSON-representation to the ...
typename BasicJsonType::value_type value_type
the type of the values when the iterator is dereferenced
void set_subtype(std::uint8_t subtype) noexcept
sets the binary subtype
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json binary(typename binary_t::container_type &&init)
explicitly create a binary array (without subtype)
bool parse_error(std::size_t, const std::string &, const Exception &ex)
bool scan_comment()
scan a comment
the parser finished reading a JSON value
std::size_t lines_read
the number of lines read
decltype(std::declval< T & >().number_unsigned(std::declval< Unsigned >())) number_unsigned_function_t
bool operator()(nlohmann::detail::value_t lhs, nlohmann::detail::value_t rhs) const noexcept
compare two value_t enum values
json_sax_dom_parser(BasicJsonType &r, const bool allow_exceptions_=true)
bool get_bson_cstr(string_t &result)
Parses a C-style string from the BSON input.
typename BasicJsonType::number_float_t number_float_t
static std::size_t calc_bson_integer_size(const std::int64_t value)
void insert(const_iterator first, const_iterator last)
inserts elements
friend constexpr bool operator==(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
constexpr bool is_errored() const
std::basic_ostream< CharType > & stream
InputAdapterType ia
input adapter
const_reference back() const
access the last element
typename BasicJsonType::binary_t binary_t
const_reverse_iterator rbegin() const noexcept
returns a const reverse iterator to the last element
reference operator+=(initializer_list_t init)
add an object to an object
static constexpr CharType get_msgpack_float_prefix(float)
IteratorType::reference value() const
return value of the iterator
auto get_ptr() noexcept-> decltype(std::declval< basic_json_t & >().get_impl_ptr(std::declval< PointerType >()))
get a pointer value (implicit)
bool get_ubjson_high_precision_number()
constexpr const number_float_t * get_impl_ptr(const number_float_t *) const noexcept
get a pointer to the value (floating-point number)
static void construct(BasicJsonType &j, const std::vector< bool > &arr)
constexpr bool is_number() const noexcept
return whether value is a number
static constexpr std::size_t size() noexcept
object_t * get_impl_ptr(object_t *) noexcept
get a pointer to the value (object)
void write_character(CharType c) override
void write_bson_integer(const string_t &name, const std::int64_t value)
Writes a BSON element with key name and integer value.
static auto to_json(BasicJsonType &j, ValueType &&val) noexcept(noexcept(::nlohmann::to_json(j, std::forward< ValueType >(val)))) -> decltype(::nlohmann::to_json(j, std::forward< ValueType >(val)), void())
convert any value type to a JSON value
decltype(T::from_json(std::declval< Args >()...)) from_json_function
std::string to_string() const
return a string representation of the JSON pointer
static CharType to_char_type(std::uint8_t x) noexcept
iter_impl & operator=(const iter_impl< typename std::remove_const< BasicJsonType >::type > &other) noexcept
converting assignment
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.
iterator insert(const_iterator pos, basic_json &&val)
inserts element
typename BasicJsonType::object_t object_t
void write_bson_boolean(const string_t &name, const bool value)
Writes a BSON element with key name and boolean value value.
iter_impl & operator--()
pre-decrement (–it)
replace invalid UTF-8 sequences with U+FFFD
static void to_msgpack(const basic_json &j, detail::output_adapter< uint8_t > o)
typename make_void< Ts... >::type void_t
static void construct(BasicJsonType &j, const std::valarray< T > &arr)
bool contains(KeyT &&key) const
check the existence of an element in a JSON object
constexpr bool is_array() const noexcept
return whether value is an array
static constexpr CharType to_char_type(std::uint8_t x) noexcept
int find_largest_pow10(const std::uint32_t n, std::uint32_t &pow10)
void update(const_iterator first, const_iterator last)
updates a JSON object from another object, overwriting existing keys
typename BasicJsonType::number_unsigned_t number_unsigned_t
typename BasicJsonType::string_t string_t
json_sax_dom_callback_parser(BasicJsonType &r, const parser_callback_t cb, const bool allow_exceptions_=true)
typename BasicJsonType::template json_serializer< T, void > serializer
static void to_cbor(const basic_json &j, detail::output_adapter< uint8_t > o)
ordered_map(It first, It last, const Allocator &alloc=Allocator())
input_format_t
the supported input formats
typename BasicJsonType::number_integer_t number_integer_t
iteration_proxy_value< IteratorType > end() noexcept
return iterator end (needed for range-based for)
typename BasicJsonType::number_unsigned_t number_unsigned_t
constexpr bool is_null() const noexcept
return whether value is null
static void construct(BasicJsonType &j, const CompatibleObjectType &obj)
static out_of_range create(int id_, const std::string &what_arg)
constexpr number_integer_t get_number_integer() const noexcept
return integer value
basic_json(const JsonRef &ref)
typename BasicJsonType::number_integer_t number_integer_t
bool get_msgpack_string(string_t &result)
reads a MessagePack string
decltype(get< N >(std::declval< ::nlohmann::detail::iteration_proxy_value< IteratorType >>())) type
typename BasicJsonType::number_unsigned_t number_unsigned_t
typename BasicJsonType::string_t string_t
typename BasicJsonType::difference_type difference_type
a type to represent differences between iterators
int construct(lua_State *L)
primitive_iterator_t const operator--(int) noexcept
typename detected_or< Default, Op, Args... >::type detected_or_t
void swap(string_t &other)
exchanges the values
constexpr const string_t * get_impl_ptr(const string_t *) const noexcept
get a pointer to the value (string)
T & operator[](const Key &key)
BasicJsonType & root
the parsed JSON value
parser(InputAdapterType &&adapter, const parser_callback_t< BasicJsonType > cb=nullptr, const bool allow_exceptions_=true, const bool skip_comments=false)
a parser reading from an input adapter
ReferenceType get_ref() const
get a reference value (implicit)
constexpr bool is_errored() const
void write_ubjson(const BasicJsonType &j, const bool use_count, const bool use_type, const bool add_prefix=true)
constexpr position_t get_position() const noexcept
return position of last read token
friend bool operator<(const ScalarType lhs, const_reference rhs) noexcept
comparison: less than
void swap(object_t &other)
exchanges the values
lexer(InputAdapterType &&adapter, bool ignore_comments_=false)
static std::size_t calc_bson_binary_size(const typename BasicJsonType::binary_t &value)
ordered_map(std::initializer_list< T > init, const Allocator &alloc=Allocator())
struct to capture the start position of the current token
bool operator<=(const iter_impl &other) const
comparison: less than or equal
static void to_cbor(const basic_json &j, detail::output_adapter< char > o)
iterator insert_iterator(const_iterator pos, Args &&...args)
typename BasicJsonType::number_unsigned_t number_unsigned_t
typename It::reference reference
~basic_json() noexcept
destructor
std::ptrdiff_t difference_type
a type to represent differences between iterators
bool operator==(const iteration_proxy_value &o) const
equality operator (needed for InputIterator)
bool parse_ubjson_internal(const bool get_char=true)
number value (unsigned integer)
number_integer_t number_integer
number (integer)
static bool accept(InputType &&i, const bool ignore_comments=false)
check if the input is valid JSON
iter_impl(const iter_impl< const BasicJsonType > &other) noexcept
const copy constructor
reference operator+=(const typename object_t::value_type &val)
add an object to an object
static ReferenceType get_ref_impl(ThisType &obj)
helper function to implement get_ref()
typename BasicJsonType::array_t array_t
serializer(output_adapter_t< char > s, const char ichar, error_handler_t error_handler_=error_handler_t::strict)
static void to_bson(const basic_json &j, detail::output_adapter< uint8_t > o)
Serializes the given JSON object j to BSON and forwards the corresponding BSON-representation to the ...
CharType ubjson_prefix(const BasicJsonType &j) const noexcept
determine the type prefix of container values
array_t * get_impl_ptr(array_t *) noexcept
get a pointer to the value (array)
const_reference operator[](const typename object_t::key_type &key) const
read-only access specified object element
decltype(std::declval< T & >().key(std::declval< String & >())) key_function_t
iteration_proxy< const_iterator > items() const noexcept
helper to access iterator member functions in range-based for
json_value(const typename binary_t::container_type &value)
constructor for binary arrays
byte_container_with_subtype(container_type &&b, std::uint8_t subtype) noexcept(noexcept(container_type(std::move(b))))
constexpr bool is_structured() const noexcept
return whether type is structured
const BasicJsonType & get_unchecked(const BasicJsonType *ptr) const
return a const reference to the pointed to value
reference at(const typename object_t::key_type &key)
access specified object element with bounds checking
static std::vector< uint8_t > to_bson(const basic_json &j)
Serializes the given JSON object j to BSON and returns a vector containing the corresponding BSON-rep...
friend bool operator!=(const_reference lhs, const ScalarType rhs) noexcept
comparison: not equal
typename T::iterator_category iterator_category_t
friend constexpr difference_type operator-(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
typename BasicJsonType::number_integer_t number_integer_t
void merge_patch(const basic_json &apply_patch)
applies a JSON Merge Patch
const object_t::key_type & key() const
return the key of an object iterator
ReferenceType get_ref()
get a reference value (implicit)
void remove(lua_State *L, int rawindex, int count)
json_value m_value
the value of the current element
iteration_proxy< iterator > items() noexcept
helper to access iterator member functions in range-based for
bool operator!=(const iter_impl &other) const
comparison: not equal
json_pointer parent_pointer() const
returns the parent of this JSON pointer
json_reverse_iterator operator-(difference_type i) const
subtract from iterator
std::string get_token_string() const
static allocator_type get_allocator()
returns the allocator associated with the container
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
decltype(T::to_json(std::declval< Args >()...)) to_json_function
typename BasicJsonType::number_integer_t number_integer_t
JSONSerializer< T, SFINAE > json_serializer
bool operator!=(const byte_container_with_subtype &rhs) const
void grisu2(char *buf, int &len, int &decimal_exponent, FloatType value)
json_value(array_t &&value)
constructor for rvalue arrays
typename T::reference reference_t
void push_back(initializer_list_t init)
add an object to an object
reference at(const json_pointer &ptr)
access specified element via JSON Pointer
constexpr const binary_t * get_impl_ptr(const binary_t *) const noexcept
get a pointer to the value (binary)
proxy class for the items() function
json_reverse_iterator & operator--()
pre-decrement (–it)
typename BasicJsonType::binary_t binary_t
reference value() const
return the value of an iterator
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 ...
bool operator==(const iter_impl &other) const
comparison: equal
bool number_unsigned(number_unsigned_t val)
typename BasicJsonType::number_float_t number_float_t
json_value(const object_t &value)
constructor for objects
void write_bson_unsigned(const string_t &name, const std::uint64_t value)
Writes a BSON element with key name and unsigned value.
string_t indent_string
the indentation string
constexpr number_unsigned_t get_number_unsigned() const noexcept
return unsigned integer value
const_reference at(size_type idx) const
access specified array element with bounds checking
std::size_t size_type
a type to represent container sizes
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json parse(IteratorType first, IteratorType last, const parser_callback_t cb=nullptr, const bool allow_exceptions=true, const bool ignore_comments=false)
deserialize from a pair of character iterators
friend constexpr bool operator<(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
reference operator[](size_type idx)
access specified array element
void write_bson_binary(const string_t &name, const binary_t &value)
Writes a BSON element with key name and binary value value.
bool binary(binary_t &val)
constexpr const boolean_t * get_impl_ptr(const boolean_t *) const noexcept
get a pointer to the value (boolean)
friend bool operator<=(const_reference lhs, const_reference rhs) noexcept
comparison: less than or equal
const_reference operator[](const json_pointer &ptr) const
access specified element via JSON Pointer
iterator_input_adapter_factory< IteratorType >::adapter_type input_adapter(IteratorType first, IteratorType last)
FMT_CONSTEXPR bool is_negative(T value)
number value (floating-point)
typename BasicJsonType::number_unsigned_t number_unsigned_t
constexpr diyfp(std::uint64_t f_, int e_) noexcept
friend bool operator>=(const_reference lhs, const_reference rhs) noexcept
comparison: greater than or equal
typename BasicJsonType::number_integer_t number_integer_t
std::vector< std::string > reference_tokens
the reference tokens
basic_json(basic_json &&other) noexcept
move constructor
friend bool operator!=(const_reference lhs, const_reference rhs) noexcept
comparison: not equal
constexpr bool is_discarded() const noexcept
return whether value is discarded
typename BasicJsonType::number_integer_t number_integer_t
void write_cbor(const BasicJsonType &j)
typename BasicJsonType::string_t string_t
static parse_error create(int id_, std::size_t byte_, const std::string &what_arg)
static void construct(BasicJsonType &j, typename BasicJsonType::boolean_t b) noexcept
reference operator[](const typename object_t::key_type &key)
access specified object element
std::size_t chars_read_total
the total number of characters read
typename lexer_base< BasicJsonType >::token_type token_type
#define JSON_HEDLEY_UNLIKELY(expr)
static std::vector< uint8_t > to_cbor(const basic_json &j)
create a CBOR serialization of a given JSON value
static void construct(BasicJsonType &j, typename BasicJsonType::string_t &&s)
std::numeric_limits< RealIntegerType > RealLimits
const_iterator end() const noexcept
returns a const iterator to one past the last element
const_reference at(const json_pointer &ptr) const
access specified element via JSON Pointer
static type_error create(int id_, const std::string &what_arg)
#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement)
#define NLOHMANN_BASIC_JSON_TPL_DECLARATION
binary_t * binary
binary (stored with pointer to save storage)
bool parse_bson_array()
Reads an array from the BSON input and passes it to the SAX-parser.
json_ref(const value_type &value)
json_value(object_t &&value)
constructor for rvalue objects
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.
json_reverse_iterator & operator++()
pre-increment (++it)
void int_to_string(string_type &target, std::size_t value)
output_string_adapter(StringType &s) noexcept
static parse_error create(int id_, const position_t &pos, const std::string &what_arg)
create a parse error exception
bool get_ubjson_size_type(std::pair< std::size_t, char_int_type > &result)
determine the type and size for a container
primitive_iterator_t & operator-=(difference_type n) noexcept
int count_digits(uint64_t n)
static void to_ubjson(const basic_json &j, detail::output_adapter< uint8_t > o, const bool use_size=false, const bool use_type=false)
const_reverse_iterator rend() const noexcept
returns a const reverse iterator to one before the first
json_value(typename binary_t::container_type &&value)
constructor for rvalue binary arrays
decltype(std::declval< T & >().binary(std::declval< Binary & >())) binary_function_t
static constexpr CharType get_msgpack_float_prefix(double)
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).
tie_t< std::remove_reference_t< Tn >... > tie(Tn &&...argn)
void clear_subtype() noexcept
clears the binary subtype
typename BasicJsonType::string_t string_t
string_t & get_string()
return current string value (implicitly resets the token; useful only once)
friend iter_impl operator+(difference_type i, const iter_impl &it)
addition of distance and iterator
discarded by the parser callback function
void pop_back()
remove last reference token
const_iterator find(const Key &key) const
#define NLOHMANN_JSON_VERSION_MAJOR
iteration_proxy_value & operator++()
increment operator (needed for range-based for)
constexpr bool is_string() const noexcept
return whether value is a string
bool get_ubjson_string(string_t &result, const bool get_char=true)
reads a UBJSON string
typename T::mapped_type mapped_type_t
constexpr auto get_ptr() const noexcept-> decltype(std::declval< const basic_json_t & >().get_impl_ptr(std::declval< PointerType >()))
get a pointer value (implicit)
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json binary(const typename binary_t::container_type &init, std::uint8_t subtype)
explicitly create a binary array (with subtype)
bool number_float(number_float_t, const string_t &)
static diyfp mul(const diyfp &x, const diyfp &y) noexcept
returns x * y
FMT_NOINLINE OutputIt fill(OutputIt it, size_t n, const fill_t< Char > &fill)
typename BasicJsonType::binary_t binary_t
constexpr bool has_subtype() const noexcept
return whether the value has a subtype
JSON_HEDLEY_RETURNS_NON_NULL const char * what() const noexceptoverride
returns the explanatory string