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)
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) {}
2436 static std::string
name(
const std::string& ename,
int id_)
2438 return "[json.exception." + ename +
"." +
std::to_string(id_) +
"] ";
2443 std::runtime_error
m;
2738 #include <type_traits>
2745 template<
bool B,
typename T =
void>
2748 template<
typename T>
2749 using uncvref_t =
typename std::remove_cv<typename std::remove_reference<T>::type>::type;
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>
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>
2934 std::is_convertible<
detected_t<Op, Args...>, To>;
2939 #ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_
2940 #define INCLUDE_NLOHMANN_JSON_FWD_HPP_
2962 template<
typename T =
void,
typename SFINAE =
void>
2963 struct adl_serializer;
2965 template<
template<
typename U,
typename V,
typename... Args>
class ObjectType =
2967 template<
typename U,
typename... Args>
class ArrayType = std::vector,
2968 class StringType = std::string,
class BooleanType = bool,
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>
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>;
3136 const BasicJsonType&>::value;
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,
3193 is_detected<key_type_t, CompatibleObjectType>::value >>
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,
3218 is_detected<key_type_t, ConstructibleObjectType>::value >>
3223 (std::is_default_constructible<ConstructibleObjectType>::value &&
3224 (std::is_move_assignable<ConstructibleObjectType>::value ||
3225 std::is_copy_assignable<ConstructibleObjectType>::value) &&
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,
3254 std::is_constructible<typename BasicJsonType::string_t, CompatibleStringType>::value;
3257 template<
typename BasicJsonType,
typename ConstructibleStringType>
3261 template<
typename BasicJsonType,
typename ConstructibleStringType,
3265 template<
typename BasicJsonType,
typename ConstructibleStringType>
3267 BasicJsonType, ConstructibleStringType,
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,
3287 is_detected<iterator_t, CompatibleArrayType>::value&&
3292 iterator_traits<CompatibleArrayType >>::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)&&
3321 is_detected<value_type_t, ConstructibleArrayType>::value&&
3322 is_detected<iterator_t, ConstructibleArrayType>::value&&
3324 detected_t<value_type_t, ConstructibleArrayType >>::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 >>
3362 std::is_constructible<RealIntegerType,
3363 CompatibleNumberIntegerType>::value &&
3364 CompatibleLimits::is_integer &&
3365 RealLimits::is_signed == CompatibleLimits::is_signed;
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,
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,
3504 enable_if_t < std::is_arithmetic<ArithmeticType>::value&&
3505 !std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value,
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,
3555 is_constructible_string_type<BasicJsonType, ConstructibleStringType>::value&&
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,
3588 enable_if_t<std::is_enum<EnumType>::value,
int> = 0>
3591 typename std::underlying_type<EnumType>::type val;
3593 e =
static_cast<EnumType
>(val);
3597 template<
typename BasicJsonType,
typename T,
typename Allocator,
3598 enable_if_t<is_getable<BasicJsonType, T>::value,
int> = 0>
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>();
3675 arr = std::move(ret);
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>();
3693 arr = std::move(ret);
3696 template <
typename BasicJsonType,
typename ConstructibleArrayType,
3698 is_constructible_array_type<BasicJsonType, ConstructibleArrayType>::value&&
3699 !is_constructible_object_type<BasicJsonType, ConstructibleArrayType>::value&&
3700 !is_constructible_string_type<BasicJsonType, ConstructibleArrayType>::value&&
3701 !std::is_same<ConstructibleArrayType, typename BasicJsonType::binary_t>::value&&
3702 !is_basic_json<ConstructibleArrayType>::value,
3704 auto from_json(
const BasicJsonType& j, ConstructibleArrayType& arr)
3706 j.template get<typename ConstructibleArrayType::value_type>(),
3712 std::string(j.type_name())));
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,
3730 enable_if_t<is_constructible_object_type<BasicJsonType, ConstructibleObjectType>::value,
int> = 0>
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>());
3748 obj = std::move(ret);
3755 template <
typename BasicJsonType,
typename ArithmeticType,
3757 std::is_arithmetic<ArithmeticType>::value&&
3758 !std::is_same<ArithmeticType, typename BasicJsonType::number_unsigned_t>::value&&
3759 !std::is_same<ArithmeticType, typename BasicJsonType::number_integer_t>::value&&
3760 !std::is_same<ArithmeticType, typename BasicJsonType::number_float_t>::value&&
3761 !std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value,
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>
3802 t = std::make_tuple(j.at(Idx).template
get<
typename std::tuple_element<Idx, Tuple>::type>()...);
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>
3916 using string_type =
typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().
key() ) >::type >::type;
3965 switch (
anchor.m_object->type())
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>
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)
4110 j.m_value = std::move(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)
4141 typename BasicJsonType::binary_t
value{std::move(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)
4198 j.m_value = std::move(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)
4257 j.m_value = std::move(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,
4279 enable_if_t<std::is_same<T, typename BasicJsonType::boolean_t>::value,
int> = 0>
4285 template<
typename BasicJsonType,
typename CompatibleString,
4286 enable_if_t<std::is_constructible<typename BasicJsonType::string_t, CompatibleString>::value,
int> = 0>
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,
4299 enable_if_t<std::is_floating_point<FloatType>::value,
int> = 0>
4300 void to_json(BasicJsonType& j, FloatType val) noexcept
4305 template<
typename BasicJsonType,
typename CompatibleNumberUnsignedType,
4306 enable_if_t<is_compatible_integer_type<typename BasicJsonType::number_unsigned_t, CompatibleNumberUnsignedType>::value,
int> = 0>
4307 void to_json(BasicJsonType& j, CompatibleNumberUnsignedType val) noexcept
4312 template<
typename BasicJsonType,
typename CompatibleNumberIntegerType,
4313 enable_if_t<is_compatible_integer_type<typename BasicJsonType::number_integer_t, CompatibleNumberIntegerType>::value,
int> = 0>
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
4323 using underlying_type =
typename std::underlying_type<EnumType>::type;
4327 template<
typename BasicJsonType>
4328 void to_json(BasicJsonType& j,
const std::vector<bool>& e)
4333 template <
typename BasicJsonType,
typename CompatibleArrayType,
4334 enable_if_t < is_compatible_array_type<BasicJsonType,
4335 CompatibleArrayType>::value&&
4336 !is_compatible_object_type<BasicJsonType, CompatibleArrayType>::value&&
4337 !is_compatible_string_type<BasicJsonType, CompatibleArrayType>::value&&
4338 !std::is_same<typename BasicJsonType::binary_t, CompatibleArrayType>::value&&
4339 !is_basic_json<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,
4353 enable_if_t<std::is_convertible<T, BasicJsonType>::value,
int> = 0>
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,
4366 enable_if_t < is_compatible_object_type<BasicJsonType, CompatibleObjectType>::value&& !is_basic_json<CompatibleObjectType>::value,
int > = 0 >
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,
4381 const T(&)[N]>::value,
4388 template < typename BasicJsonType, typename T1, typename T2, enable_if_t < std::is_constructible<BasicJsonType, T1>::value&& std::is_constructible<BasicJsonType, T2>::value,
int > = 0 >
4389 void to_json(BasicJsonType& j,
const std::pair<T1, T2>& p)
4391 j = { p.first, p.second };
4395 template<
typename BasicJsonType,
typename T,
4396 enable_if_t<std::is_same<T, iteration_proxy_value<typename BasicJsonType::iterator>>::value,
int> = 0>
4399 j = { {b.key(), b.value()} };
4402 template<
typename BasicJsonType,
typename Tuple, std::size_t... Idx>
4405 j = { std::get<Idx>(t)... };
4408 template<typename BasicJsonType, typename T, enable_if_t<is_constructible_tuple<BasicJsonType, T>::value,
int > = 0>
4409 void to_json(BasicJsonType& j,
const T& t)
4416 template<
typename BasicJsonType,
typename T>
4417 auto operator()(BasicJsonType& j, T&& val)
const noexcept(noexcept(
to_json(j, std::forward<T>(val))))
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>
4538 return !(rhs == *
this);
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:
4696 case BasicJsonType::value_t::object:
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&>());
4724 case BasicJsonType::value_t::boolean:
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);
4929 return std::char_traits<char_type>::eof();
4937 template<
typename BaseInputAdapter,
size_t T>
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>
5086 fill_buffer<sizeof(WideCharType)>();
5108 std::array<std::char_traits<char>::int_type, 4>
utf8_bytes = {{0, 0, 0, 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>
5159 return factory_type::create(
first, last);
5163 template<
typename ContainerType>
5192 template <
typename CharT,
5193 typename std::enable_if <
5194 std::is_pointer<CharT>::value&&
5195 !std::is_array<CharT>::value&&
5196 std::is_integral<typename std::remove_pointer<CharT>::type>::value&&
5197 sizeof(
typename std::remove_pointer<CharT>::type) == 1,
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 <
5220 std::is_pointer<CharT>::value&&
5221 std::is_integral<typename std::remove_pointer<CharT>::type>::value&&
5222 sizeof(
typename std::remove_pointer<CharT>::type) == 1,
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,
5236 return std::move(ia);
5269 template<
typename BasicJsonType>
5282 virtual bool null() = 0;
5373 const std::string& last_token,
5395 template<
typename BasicJsonType>
5508 template<
class Exception>
5510 const Exception& ex)
5513 static_cast<void>(ex);
5533 template<
typename Value>
5539 root = BasicJsonType(std::forward<Value>(v));
5547 ref_stack.back()->m_value.array->emplace_back(std::forward<Value>(v));
5548 return &(
ref_stack.back()->m_value.array->back());
5569 template<
typename BasicJsonType>
5583 const bool allow_exceptions_ =
true)
5644 auto val =
handle_value(BasicJsonType::value_t::object,
true);
5658 BasicJsonType
k = BasicJsonType(val);
5691 if (it->is_discarded())
5707 auto val =
handle_value(BasicJsonType::value_t::array,
true);
5741 ref_stack.back()->m_value.array->pop_back();
5747 template<
class Exception>
5749 const Exception& ex)
5752 static_cast<void>(ex);
5781 template<
typename Value>
5782 std::pair<bool, BasicJsonType*>
handle_value(Value&& v,
const bool skip_callback =
false)
5790 return {
false,
nullptr};
5794 auto value = BasicJsonType(std::forward<Value>(v));
5802 return {
false,
nullptr};
5808 return {
true, &
root};
5815 return {
false,
nullptr};
5825 return {
true, &(
ref_stack.back()->m_value.array->back())};
5837 return {
false,
nullptr};
5862 BasicJsonType
discarded = BasicJsonType::value_t::discarded;
5865 template<
typename BasicJsonType>
5952 #include <initializer_list>
5972 template<
typename BasicJsonType>
6006 return "<uninitialized>";
6008 return "true literal";
6010 return "false literal";
6012 return "null literal";
6014 return "string literal";
6018 return "number literal";
6032 return "<parse error>";
6034 return "end of input";
6036 return "'[', '{', or a literal";
6039 return "unknown token";
6049 template<
typename BasicJsonType,
typename InputAdapterType>
6062 explicit lexer(InputAdapterType&& adapter,
bool ignore_comments_ =
false)
6063 :
ia(std::move(adapter))
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)
6121 codepoint +=
static_cast<int>((
static_cast<unsigned int>(
current) - 0x30u) << factor);
6125 codepoint +=
static_cast<int>((
static_cast<unsigned int>(
current) - 0x37u) << factor);
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)
6207 case std::char_traits<char_type>::eof():
6210 return token_type::parse_error;
6216 return token_type::value_string;
6261 int codepoint = codepoint1;
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)
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)
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;
6773 return token_type::parse_error;
6796 case std::char_traits<char_type>::eof():
6813 case std::char_traits<char_type>::eof():
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;
6979 return token_type::parse_error;
6990 goto scan_number_decimal1;
6997 goto scan_number_exponent;
7001 goto scan_number_done;
7020 goto scan_number_any1;
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;
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);
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);
7218 return token_type::value_integer;
7230 return token_type::value_float;
7243 for (std::size_t i = 1; i < length; ++i)
7248 return token_type::parse_error;
7342 token_buffer.push_back(
static_cast<typename string_t::value_type
>(c));
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));
7403 result.push_back(
static_cast<std::string::value_type
>(c));
7430 return get() == 0xBB &&
get() == 0xBF;
7453 error_message =
"invalid BOM; must be 0xEF 0xBB 0xBF if given";
7454 return token_type::parse_error;
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);
7526 case std::char_traits<char_type>::eof():
7527 return token_type::end_of_input;
7532 return token_type::parse_error;
7590 template<
typename T>
7593 template<
typename T>
7595 decltype(std::declval<T&>().
boolean(std::declval<bool>()));
7597 template<
typename T,
typename Integer>
7599 decltype(std::declval<T&>().
number_integer(std::declval<Integer>()));
7601 template<
typename T,
typename Un
signed>
7603 decltype(std::declval<T&>().
number_unsigned(std::declval<Unsigned>()));
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,
7864 std::int32_t document_size{};
7877 return sax->end_object();
7889 auto out = std::back_inserter(
result);
7901 *out++ =
static_cast<typename string_t::value_type
>(
current);
7916 template<
typename NumberType>
7937 template<
typename NumberType>
7947 std::uint8_t subtype{};
7949 result.set_subtype(subtype);
7965 const std::size_t element_type_parse_position)
7967 switch (element_type)
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));
8025 return sax->parse_error(element_type_parse_position, std::string(cr.data()),
parse_error::create(114, element_type_parse_position,
"Unsupported BSON record type 0x" + std::string(cr.data())));
8046 while (
auto element_type =
get())
8053 const std::size_t element_type_parse_position =
chars_read;
8059 if (!is_array && !
sax->key(
key))
8082 std::int32_t document_size{};
8095 return sax->end_array();
8116 case std::char_traits<char_type>::eof():
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{};
8205 std::uint16_t number{};
8211 std::uint32_t number{};
8217 std::uint64_t number{};
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{};
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{};
8420 switch (tag_handler)
8440 std::uint16_t len{};
8446 std::uint32_t len{};
8452 std::uint64_t len{};
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
8602 std::uint16_t len{};
8608 std::uint32_t len{};
8614 std::uint64_t len{};
8620 while (
get() != 0xFF)
8698 std::uint16_t len{};
8705 std::uint32_t len{};
8712 std::uint64_t len{};
8719 while (
get() != 0xFF)
8726 result.insert(
result.end(), chunk.begin(), chunk.end());
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():
9058 return sax->boolean(
false);
9061 return sax->boolean(
true);
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));
9270 std::uint16_t len{};
9276 std::uint32_t len{};
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();
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")));
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);
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;
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{};
9734 return sax->string(s);
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)
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)
9891 return sax->end_object();
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();
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));
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)
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,
10040 bool success =
true;
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,
10073 bool success =
true;
10074 for (NumberType i = 0; i < len; i++)
10108 std::array<char, 3> cr{{}};
10109 (std::snprintf)(cr.data(), cr.size(),
"%.2hhX",
static_cast<unsigned char>(
current));
10110 return std::string{cr.data()};
10120 const std::string& detail,
10121 const std::string& context)
const
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;
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)
10271 result.assert_invariant();
10291 if (
result.is_discarded())
10300 result.assert_invariant();
10332 template<
typename SAX>
10342 return sax->parse_error(
m_lexer.get_position(),
10352 template<
typename SAX>
10358 std::vector<bool> states;
10360 bool skip_to_state_evaluation =
false;
10364 if (!skip_to_state_evaluation)
10369 case token_type::begin_object:
10377 if (
get_token() == token_type::end_object)
10389 return sax->parse_error(
m_lexer.get_position(),
10402 return sax->parse_error(
m_lexer.get_position(),
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(),
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(),
10524 return sax->parse_error(
m_lexer.get_position(),
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(),
10579 if (
get_token() == token_type::value_separator)
10584 return sax->parse_error(
m_lexer.get_position(),
10598 return sax->parse_error(
m_lexer.get_position(),
10623 skip_to_state_evaluation =
true;
10627 return sax->parse_error(
m_lexer.get_position(),
10643 std::string error_msg =
"syntax error ";
10645 if (!context.empty())
10647 error_msg +=
"while parsing " + context +
" ";
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));
10748 return lhs.m_it == rhs.m_it;
10753 return lhs.m_it < rhs.m_it;
10765 return lhs.m_it - rhs.m_it;
10835 #include <iterator>
10836 #include <type_traits>
10858 template<
typename IteratorType>
class iteration_proxy;
10859 template<
typename IteratorType>
class iteration_proxy_value;
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");
10906 using pointer =
typename std::conditional<std::is_const<BasicJsonType>::value,
10907 typename BasicJsonType::const_pointer,
10908 typename BasicJsonType::pointer>::type;
10911 typename std::conditional<std::is_const<BasicJsonType>::value,
10912 typename BasicJsonType::const_reference,
10928 switch (m_object->m_type)
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)
11051 switch (m_object->m_type)
11082 switch (m_object->m_type)
11119 switch (m_object->m_type)
11164 switch (m_object->m_type)
11207 switch (m_object->m_type)
11245 switch (m_object->m_type)
11281 switch (m_object->m_type)
11300 return !other.operator < (*this);
11329 switch (m_object->m_type)
11400 switch (m_object->m_type)
11421 switch (m_object->m_type)
11448 const typename object_t::key_type&
key()
const
11484 #include <iterator>
11513 template<
typename Base>
11585 auto key() const -> decltype(std::declval<Base>().
key())
11587 auto it = --this->base();
11594 auto it = --this->base();
11595 return it.operator * ();
11606 #include <algorithm>
11623 template<
typename BasicJsonType>
11674 [](
const std::string & a,
const std::string & b)
11676 return a +
"/" + escape(b);
11681 operator std::string()
const
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);
12018 if (reference_token ==
"0")
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));
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"));
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));
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"));
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++)
12316 if (idx >= ptr->size())
12322 ptr = &ptr->operator[](idx);
12348 static std::vector<std::string>
split(
const std::string& reference_string)
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')))
12424 const std::string& t)
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()))
12436 static std::string escape(std::string
s)
12458 static void flatten(
const std::string& reference_string,
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)
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>
12675 #include <algorithm>
12690 #include <algorithm>
12693 #include <iterator>
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>
12879 oa->write_character(j.m_value.boolean
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));
12899 write_number(
static_cast<std::uint8_t
>(j.m_value.number_integer));
12904 write_number(
static_cast<std::uint16_t
>(j.m_value.number_integer));
12909 write_number(
static_cast<std::uint32_t
>(j.m_value.number_integer));
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));
12929 write_number(
static_cast<std::uint8_t
>(positive_number));
12934 write_number(
static_cast<std::uint16_t
>(positive_number));
12939 write_number(
static_cast<std::uint32_t
>(positive_number));
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));
12959 write_number(
static_cast<std::uint8_t
>(j.m_value.number_unsigned));
12964 write_number(
static_cast<std::uint16_t
>(j.m_value.number_unsigned));
12969 write_number(
static_cast<std::uint32_t
>(j.m_value.number_unsigned));
12974 write_number(
static_cast<std::uint64_t
>(j.m_value.number_unsigned));
12981 if (std::isnan(j.m_value.number_float))
12988 else if (std::isinf(j.m_value.number_float))
13005 const auto N = j.m_value.string->size();
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();
13072 for (
const auto& el : *j.m_value.array)
13081 if (j.m_value.binary->has_subtype())
13088 const auto N = j.m_value.binary->size();
13117 oa->write_characters(
13118 reinterpret_cast<const CharType*
>(j.m_value.binary->data()),
13127 const auto N = j.m_value.object->size();
13156 for (
const auto& el : *j.m_value.object)
13184 oa->write_character(j.m_value.boolean
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));
13206 write_number(
static_cast<std::uint8_t
>(j.m_value.number_integer));
13212 write_number(
static_cast<std::uint16_t
>(j.m_value.number_integer));
13218 write_number(
static_cast<std::uint32_t
>(j.m_value.number_integer));
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));
13239 write_number(
static_cast<std::int8_t
>(j.m_value.number_integer));
13246 write_number(
static_cast<std::int16_t
>(j.m_value.number_integer));
13253 write_number(
static_cast<std::int32_t
>(j.m_value.number_integer));
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));
13277 write_number(
static_cast<std::uint8_t
>(j.m_value.number_integer));
13283 write_number(
static_cast<std::uint16_t
>(j.m_value.number_integer));
13289 write_number(
static_cast<std::uint32_t
>(j.m_value.number_integer));
13295 write_number(
static_cast<std::uint64_t
>(j.m_value.number_integer));
13309 const auto N = j.m_value.string->size();
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();
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;
13423 std::uint8_t output_type = use_ext
13432 std::uint8_t output_type = use_ext
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)));
13477 for (
const auto& el : *j.m_value.object)
13497 const bool use_type,
const bool add_prefix =
true)
13514 oa->write_character(j.m_value.boolean
13546 oa->write_characters(
13547 reinterpret_cast<const CharType*
>(j.m_value.string->c_str()),
13548 j.m_value.string->size());
13559 bool prefix_required =
true;
13560 if (use_type && !j.m_value.array->empty())
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;
13574 oa->write_character(first_prefix);
13584 for (
const auto& el : *j.m_value.array)
13586 write_ubjson(el, use_count, use_type, prefix_required);
13604 if (use_type && !j.m_value.binary->empty())
13608 oa->write_character(
'U');
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)
13628 oa->write_character(j.m_value.binary->data()[i]);
13647 bool prefix_required =
true;
13648 if (use_type && !j.m_value.object->empty())
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;
13662 oa->write_character(first_prefix);
13672 for (
const auto& el : *j.m_value.object)
13675 oa->write_characters(
13676 reinterpret_cast<const CharType*
>(el.first.c_str()),
13678 write_ubjson(el.second, use_count, use_type, prefix_required);
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)
13722 oa->write_characters(
13723 reinterpret_cast<const CharType*
>(name.c_str()),
13741 const double value)
13744 write_number<double, true>(
value);
13752 return sizeof(std::int32_t) +
value.size() + 1ul;
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()),
13783 ?
sizeof(std::int32_t)
13784 :
sizeof(std::int64_t);
13791 const std::int64_t value)
13796 write_number<std::int32_t, true>(
static_cast<std::int32_t
>(
value));
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)
13824 write_number<std::int32_t, true>(
static_cast<std::int32_t
>(
value));
13829 write_number<std::int64_t, true>(
static_cast<std::int64_t
>(
value));
13841 const typename BasicJsonType::object_t& 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)
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)
13879 std::size_t array_index = 0ul;
13881 for (
const auto& el :
value)
13897 write_number<std::int32_t, true>(
static_cast<std::int32_t
>(
value.size()));
13900 oa->write_characters(
reinterpret_cast<const CharType*
>(
value.data()),
value.size());
13908 const BasicJsonType& j)
13923 return header_size + 1ul;
13926 return header_size + 8ul;
13938 return header_size + 0ul;
13956 const BasicJsonType& j)
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;
14020 for (
const auto& el :
value)
14061 template<
typename NumberType,
typename std::enable_if<
14062 std::is_floating_point<NumberType>::value,
int>::type = 0>
14064 const bool add_prefix)
14074 template<
typename NumberType,
typename std::enable_if<
14075 std::is_unsigned<NumberType>::value,
int>::type = 0>
14077 const bool add_prefix)
14126 const auto number = BasicJsonType(n).dump();
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 <
14137 std::is_signed<NumberType>::value&&
14138 !std::is_floating_point<NumberType>::value,
int >::type = 0 >
14140 const bool add_prefix)
14190 const auto number = BasicJsonType(n).dump();
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';
14308 template<
typename NumberType,
bool OutputIsLittleEndian = false>
14312 std::array<CharType,
sizeof(NumberType)> vec;
14313 std::memcpy(vec.data(), &n,
sizeof(NumberType));
14319 std::reverse(vec.begin(), vec.end());
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))
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");
14362 static_assert(std::is_trivial<CharType>::value,
"CharType must be trivial");
14364 std::memcpy(&
result, &
x,
sizeof(
x));
14368 template<
typename C = CharType,
14375 template <
typename InputCharType,
typename C = CharType,
14377 std::is_signed<C>::value &&
14378 std::is_signed<char>::value &&
14379 std::is_same<char, typename std::remove_cv<InputCharType>::type>::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));
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);
14615 using bits_type =
typename std::conditional<kPrecision == 24, std::uint32_t, std::uint64_t >::type;
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;
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);
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)
14954 inline void grisu2_round(
char* buf,
int len, std::uint64_t dist, std::uint64_t delta,
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;
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;
15236 inline
void grisu2(
char* buf,
int& len,
int& decimal_exponent,
15253 const diyfp c_minus_k(cached.
f, cached.
e);
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>
15296 void
grisu2(
char* buf,
int& len,
int& decimal_exponent, FloatType value)
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;
15509 constexpr
int kMaxExp = std::numeric_limits<FloatType>::digits10;
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>
15570 ,
loc(std::localeconv())
15608 const bool pretty_print,
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;
15635 auto i = val.m_value.object->cbegin();
15636 for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i)
15639 o->write_character(
'\"');
15641 o->write_characters(
"\": ", 3);
15643 o->write_characters(
",\n", 2);
15648 JSON_ASSERT(std::next(i) == val.m_value.object->cend());
15650 o->write_character(
'\"');
15652 o->write_characters(
"\": ", 3);
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(
'\"');
15669 o->write_characters(
"\":", 2);
15671 o->write_character(
',');
15676 JSON_ASSERT(std::next(i) == val.m_value.object->cend());
15677 o->write_character(
'\"');
15679 o->write_characters(
"\":", 2);
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;
15708 for (
auto i = val.m_value.array->cbegin();
15709 i != val.m_value.array->cend() - 1; ++i)
15713 o->write_characters(
",\n", 2);
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)
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(
'\"');
15751 o->write_character(
'\"');
15759 o->write_characters(
"{\n", 2);
15762 const auto new_indent = current_indent + indent_step;
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);
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);
15893 std::uint32_t codepoint;
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))
15964 if ((codepoint <= 0x1F) || (
ensure_ascii && (codepoint >= 0x7F)))
15966 if (codepoint <= 0xFFFF)
15969 static_cast<std::uint16_t
>(codepoint));
15975 static_cast<std::uint16_t
>(0xD7C0u + (codepoint >> 10u)),
15976 static_cast<std::uint16_t
>(0xDC00u + (codepoint & 0x3FFu)));
16011 std::string sn(3,
'\0');
16012 (std::snprintf)(&sn[0], sn.size(),
"%.2X",
byte);
16105 std::string sn(3,
'\0');
16106 (std::snprintf)(&sn[0], sn.size(),
"%.2X",
static_cast<std::uint8_t
>(s.back()));
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;
16184 std::is_same<NumberType, number_unsigned_t>::value ||
16185 std::is_same<NumberType, number_integer_t>::value ||
16186 std::is_same<NumberType, binary_char_t>::value,
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');
16216 const bool is_negative = std::is_same<NumberType, number_integer_t>::value && !(
x >= 0);
16219 unsigned int n_chars;
16227 n_chars = 1 + count_digits(abs_value);
16232 n_chars = count_digits(abs_value);
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);
16277 if (!std::isfinite(
x))
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>());
16300 o->write_characters(begin,
static_cast<size_t>(end - begin));
16306 static constexpr
auto d = std::numeric_limits<number_float_t>::max_digits10;
16336 o->write_characters(
number_buffer.data(),
static_cast<std::size_t
>(len));
16339 const bool value_is_int_like =
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];
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];
16435 output_adapter_t<char> o =
nullptr;
16468 #include <functional>
16481 template <
class Key,
class T,
class IgnoredLess = std::less<Key>,
16482 class Allocator = std::allocator<std::pair<const Key, T>>>
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};
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"));
16538 const T&
at(
const Key& key)
const
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)
16561 new (&*it) value_type{std::move(*next)};
16563 Container::pop_back();
16575 for (
auto next = it; ++next != this->end(); ++it)
16578 new (&*it) value_type{std::move(*next)};
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();
16608 const_iterator
find(
const Key& key)
const
16610 for (
auto it = this->begin(); it != this->end(); ++it)
16612 if (it->first == key)
16617 return Container::end();
16620 std::pair<iterator, bool>
insert( value_type&& value )
16622 return emplace(value.first, std::move(value.second));
16625 std::pair<iterator, bool>
insert(
const value_type& value )
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__)
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"}};
16962 result[
"compiler"][
"c++"] =
"unknown";
16977 #if defined(JSON_HAS_CPP_14)
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);
17497 AllocatorTraits::construct(alloc,
object.
get(), std::forward<Args>(args)...);
17499 return object.release();
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);
17641 string = create<string_t>(std::move(
value));
17647 object = create<object_t>(
value);
17653 object = create<object_t>(std::move(
value));
17695 std::vector<basic_json>
stack;
17706 for (
auto&& it : *
object)
17708 stack.push_back(std::move(it.second));
17712 while (!
stack.empty())
17722 std::move(current_item.
m_value.array->begin(), current_item.
m_value.array->end(),
17723 std::back_inserter(
stack));
17725 current_item.
m_value.array->clear();
17729 for (
auto&& it : *current_item.
m_value.object)
17731 stack.push_back(std::move(it.second));
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;
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;
17771 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
binary, 1);
18006 template <
typename CompatibleType,
18012 std::forward<CompatibleType>(val))))
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())
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());
18254 res.m_value = init;
18291 res.m_value =
binary_t(init, subtype);
18301 res.m_value = std::move(init);
18311 res.m_value =
binary_t(std::move(init), subtype);
18427 m_value.array = create<array_t>(cnt, val);
18486 template <
class InputIT,
typename std::enable_if <
18487 std::is_same<InputIT, typename basic_json_t::iterator>::value ||
18488 std::is_same<InputIT, typename basic_json_t::const_iterator>::value,
int >
::type = 0 >
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;
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);
18578 std::string(
first.m_object->type_name())));
18589 template<
typename JsonRef,
18591 std::is_same<typename JsonRef::value_type, basic_json>>
::value,
int> = 0 >
18620 : m_type(other.m_type)
18709 : m_type(std::move(other.m_type)),
18710 m_value(std::move(other.m_value))
18713 other.assert_invariant();
18717 other.m_value = {};
18746 std::is_nothrow_move_constructible<value_t>::value&&
18747 std::is_nothrow_move_assignable<value_t>::value&&
18748 std::is_nothrow_move_constructible<json_value>::value&&
18749 std::is_nothrow_move_assignable<json_value>::value
18756 swap(m_type, other.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);
19383 template<
typename ReferenceType,
typename ThisType>
19387 auto ptr = obj.template get_ptr<typename std::add_pointer<ReferenceType>::type>();
19440 !std::is_same<BasicJsonType, basic_json>::value&&
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(
19493 JSONSerializer<ValueType>::
from_json(std::declval<const
basic_json_t&>(), std::declval<ValueType&>())))
19498 static_assert(!std::is_reference<ValueTypeCV>::value,
19499 "get() cannot be used with reference types, you might want to use get_ref()");
19500 static_assert(std::is_default_constructible<ValueType>::value,
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(
19546 static_assert(!std::is_reference<ValueTypeCV>::value,
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<
19649 std::is_pointer<PointerType>::value,
int>
::type = 0>
19653 return get_impl_ptr(
static_cast<PointerType
>(
nullptr));
19660 template <
typename PointerType,
typename std::enable_if <
19661 std::is_pointer<PointerType>::value&&
19662 std::is_const<typename std::remove_pointer<PointerType>::type>
::value,
int >
::type = 0 >
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>
19701 return get_ptr<PointerType>();
19708 template<
typename PointerType,
typename std::enable_if<
19709 std::is_pointer<PointerType>::value,
int>
::type = 0>
19713 return get_ptr<PointerType>();
19742 template<
typename ReferenceType,
typename std::enable_if<
19743 std::is_reference<ReferenceType>::value,
int>
::type = 0>
19747 return get_ref_impl<ReferenceType>(*
this);
19754 template <
typename ReferenceType,
typename std::enable_if <
19755 std::is_reference<ReferenceType>::value&&
19756 std::is_const<typename std::remove_reference<ReferenceType>::type>
::value,
int >
::type = 0 >
19760 return get_ref_impl<ReferenceType>(*
this);
19792 template <
typename ValueType,
typename std::enable_if <
19793 !std::is_pointer<ValueType>::value&&
19794 !std::is_same<ValueType, detail::json_ref<basic_json>>
::value&&
19795 !std::is_same<ValueType, typename string_t::value_type>::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))
19799 && !std::is_same<ValueType, typename std::string_view>::value
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>();
20085 if (idx >=
m_value.array->size())
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>();
20168 return m_value.object->operator[](key);
20210 return m_value.object->find(key)->second;
20243 template<
typename T>
20258 return m_value.object->operator[](key);
20294 template<
typename T>
20302 return m_value.object->find(key)->second;
20359 template <
class ValueType,
typename std::enable_if <
20361 && !std::is_same<value_t, ValueType>::value,
int >
::type = 0 >
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;
20384 string_t value(
const typename object_t::key_type& key,
const char* default_value)
const
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 <
20596 std::is_same<IteratorType, typename basic_json_t::iterator>::value ||
20597 std::is_same<IteratorType, typename basic_json_t::const_iterator>::value,
int >
::type
20625 AllocatorType<string_t> alloc;
20627 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
m_value.string, 1);
20632 AllocatorType<binary_t> alloc;
20634 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
m_value.binary, 1);
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 <
20709 std::is_same<IteratorType, typename basic_json_t::iterator>::value ||
20710 std::is_same<IteratorType, typename basic_json_t::const_iterator>::value,
int >
::type
20732 || !last.m_it.primitive_iterator.is_end()))
20739 AllocatorType<string_t> alloc;
20741 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
m_value.string, 1);
20746 AllocatorType<binary_t> alloc;
20748 std::allocator_traits<decltype(alloc)>::deallocate(alloc,
m_value.binary, 1);
20760 last.m_it.object_iterator);
20767 last.m_it.array_iterator);
20812 return m_value.object->erase(key);
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>
20977 template <
typename KeyT,
typename std::enable_if <
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();
21813 m_value.array->push_back(std::move(val));
21848 m_value.array->push_back(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(
21942 std::move(key.get_ref<
string_t&>()), (init.begin() + 1)->moved_or_copied()));
21983 template<
class... Args>
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>
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>
22074 result.m_it.array_iterator =
m_value.array->begin() + insert_pos;
22129 return insert(pos, val);
22346 m_value.object = create<object_t>();
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>();
22414 || !last.m_object->is_object()))
22419 for (
auto it =
first; it != last; ++it)
22421 m_value.object->operator[](it.key()) = it.value();
22443 std::is_nothrow_move_constructible<value_t>::value&&
22444 std::is_nothrow_move_assignable<value_t>::value&&
22445 std::is_nothrow_move_constructible<json_value>::value&&
22446 std::is_nothrow_move_assignable<json_value>::value
22473 std::is_nothrow_move_constructible<value_t>::value&&
22474 std::is_nothrow_move_assignable<value_t>::value&&
22475 std::is_nothrow_move_constructible<json_value>::value&&
22476 std::is_nothrow_move_assignable<json_value>::value
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<
22766 std::is_scalar<ScalarType>::value,
int>
::type = 0>
22776 template<
typename ScalarType,
typename std::enable_if<
22777 std::is_scalar<ScalarType>::value,
int>
::type = 0>
22803 return !(lhs == rhs);
22810 template<
typename ScalarType,
typename std::enable_if<
22811 std::is_scalar<ScalarType>::value,
int>
::type = 0>
22821 template<
typename ScalarType,
typename std::enable_if<
22822 std::is_scalar<ScalarType>::value,
int>
::type = 0>
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>
22942 template<
typename ScalarType,
typename std::enable_if<
22943 std::is_scalar<ScalarType>::value,
int>
::type = 0>
22970 return !(rhs < lhs);
22977 template<
typename ScalarType,
typename std::enable_if<
22978 std::is_scalar<ScalarType>::value,
int>
::type = 0>
22988 template<
typename ScalarType,
typename std::enable_if<
22989 std::is_scalar<ScalarType>::value,
int>
::type = 0>
23016 return !(lhs <= rhs);
23023 template<
typename ScalarType,
typename std::enable_if<
23024 std::is_scalar<ScalarType>::value,
int>
::type = 0>
23034 template<
typename ScalarType,
typename std::enable_if<
23035 std::is_scalar<ScalarType>::value,
int>
::type = 0>
23062 return !(lhs < rhs);
23069 template<
typename ScalarType,
typename std::enable_if<
23070 std::is_scalar<ScalarType>::value,
int>
::type = 0>
23080 template<
typename ScalarType,
typename std::enable_if<
23081 std::is_scalar<ScalarType>::value,
int>
::type = 0>
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)
23255 template<
typename IteratorType>
23260 const bool allow_exceptions =
true,
23261 const bool ignore_comments =
false)
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)
23317 template<
typename IteratorType>
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>
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>
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>
23403 const
bool strict = true,
23404 const
bool ignore_comments = false)
23408 ?
parser(std::move(ia),
nullptr,
true, ignore_comments).sax_parse(sax, strict)
23513 return "discarded";
23636 std::vector<uint8_t>
result;
23731 std::vector<uint8_t>
result;
23833 const bool use_size =
false,
23834 const bool use_type =
false)
23836 std::vector<uint8_t>
result;
23842 const bool use_size =
false,
const bool use_type =
false)
23848 const bool use_size =
false,
const bool use_type =
false)
23912 std::vector<uint8_t>
result;
24041 template<
typename InputType>
24044 const bool strict =
true,
24045 const bool allow_exceptions =
true,
24058 template<
typename IteratorType>
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);
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);
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};
24753 const auto get_op = [](
const std::string & op)
24757 return patch_operations::add;
24759 if (op ==
"remove")
24761 return patch_operations::remove;
24763 if (op ==
"replace")
24765 return patch_operations::replace;
24769 return patch_operations::move;
24773 return patch_operations::copy;
24777 return patch_operations::test;
24780 return patch_operations::invalid;
24795 if (top_pointer != ptr)
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)
24882 const auto get_value = [&val](
const std::string & op,
24883 const std::string & member,
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));
24927 case patch_operations::remove:
24929 operation_remove(ptr);
24933 case patch_operations::replace:
24936 result.at(ptr) = get_value(
"replace",
"value",
false);
24940 case patch_operations::move:
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:
24974 bool success =
false;
24979 success = (
result.at(ptr) == get_value(
"test",
"value",
false));
25042 const std::string& path =
"")
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())
25073 result.insert(
result.end(), temp_diff.begin(), temp_diff.end());
25082 while (i < source.
size())
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());
25126 result.push_back(
object(
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())
25238 *
this = apply_patch;
25302 #ifndef JSON_HAS_CPP_20
25311 is_nothrow_move_constructible<nlohmann::json>::value&&
25312 is_nothrow_move_assignable<nlohmann::json>::value
25338 return nlohmann::json::parse(s, s + n);
25355 inline
nlohmann::
json::json_pointer operator "" _json_pointer(const
char* s, std::
size_t n)
25357 return nlohmann::json::json_pointer(std::string(s, n));
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
double f(double x, void *params)
a class to store JSON values
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)
constexpr auto get() const noexcept -> decltype(std::declval< const basic_json_t & >().template get_ptr< PointerType >())
get a pointer value (explicit)
void insert(const_iterator first, const_iterator last)
inserts elements
detail::parser_callback_t< basic_json > parser_callback_t
per-element parser callback type
bool contains(KeyT &&key) const
check the existence of an element in a JSON object
const_reverse_iterator crbegin() const noexcept
returns a const reverse iterator to the last element
number_unsigned_t number_unsigned
number (unsigned integer)
const_reference operator[](const json_pointer &ptr) const
access specified element via JSON Pointer
basic_json get() const
get special-case overload
reference operator[](const json_pointer &ptr)
access specified element via JSON Pointer
ValueType value(const typename object_t::key_type &key, const ValueType &default_value) const
access specified object element with default value
constexpr bool is_number_float() const noexcept
return whether value is a floating-point number
NumberIntegerType number_integer_t
a type for a number (integer)
friend bool operator==(const_reference lhs, const_reference rhs) noexcept
comparison: equal
friend bool operator>(const ScalarType lhs, const_reference rhs) noexcept
comparison: greater than
NLOHMANN_BASIC_JSON_TPL basic_json_t
workaround type for MSVC
static bool sax_parse(InputType &&i, SAX *sax, input_format_t format=input_format_t::json, const bool strict=true, const bool ignore_comments=false)
generate SAX events
constexpr const number_integer_t * get_impl_ptr(const number_integer_t *) const noexcept
get a pointer to the value (integer number)
ReferenceType get_ref()
get a reference value (implicit)
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
reference emplace_back(Args &&... args)
add an object to an array
const_iterator find(KeyT &&key) const
find an element in a JSON object
basic_json(const value_t v)
create an empty value with a given type
static void to_ubjson(const basic_json &j, detail::output_adapter< uint8_t > o, const bool use_size=false, const bool use_type=false)
create a CBOR serialization of a given JSON value
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
size_type max_size() const noexcept
returns the maximum possible number of elements
basic_json(CompatibleType &&val) noexcept(noexcept(JSONSerializer< U >::to_json(std::declval< basic_json_t & >(), std::forward< CompatibleType >(val))))
create a JSON value
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
void erase(const size_type idx)
remove element from a JSON array given an index
const_reverse_iterator crend() const noexcept
returns a const reverse iterator to one before the first
const_reference at(const typename object_t::key_type &key) const
access specified object element with bounds checking
static iteration_proxy< iterator > iterator_wrapper(reference ref) noexcept
wrapper to access iterator member functions in range-based for
reference at(const typename object_t::key_type &key)
access specified object element with bounds checking
iterator begin() noexcept
returns an iterator to the first element
basic_json(InputIT first, InputIT last)
construct a JSON container given an iterator range
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
json_value(object_t &&value)
constructor for rvalue objects
boolean_t * get_impl_ptr(boolean_t *) noexcept
get a pointer to the value (boolean)
basic_json(const JsonRef &ref)
explicitly create a binary array (without subtype)
static void to_cbor(const basic_json &j, detail::output_adapter< uint8_t > o)
create a CBOR serialization of a given JSON value
string_t * get_impl_ptr(string_t *) noexcept
get a pointer to the value (string)
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json array(initializer_list_t init={})
explicitly create an array from an initializer list
json_value(number_float_t v) noexcept
constructor for numbers (floating-point)
const_reverse_iterator rend() const noexcept
returns a const reverse iterator to one before the first
json_value(string_t &&value)
constructor for rvalue strings
const_iterator cend() const noexcept
returns a const iterator to one past the last element
json_value(number_integer_t v) noexcept
constructor for numbers (integer)
reference back()
access the last element
static bool accept(InputType &&i, const bool ignore_comments=false)
check if the input is valid JSON
StringType string_t
a type for a string
size_type size() const noexcept
returns the number of elements
void push_back(const basic_json &val)
add an object to an array
friend std::ostream & operator>>(const basic_json &j, std::ostream &o)
serialize to stream
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json meta()
returns version information on the library
ValueType value(const json_pointer &ptr, const ValueType &default_value) const
access specified object element via JSON Pointer with default value
void update(const_reference j)
updates a JSON object from another object, overwriting existing keys
constexpr const binary_t * get_impl_ptr(const binary_t *) const noexcept
get a pointer to the value (binary)
std::size_t size_type
a type to represent container sizes
array_t * get_impl_ptr(array_t *) noexcept
get a pointer to the value (array)
std::ptrdiff_t difference_type
a type to represent differences between iterators
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json binary(const typename binary_t::container_type &init)
explicitly create a binary array (without subtype)
reference operator[](const typename object_t::key_type &key)
access specified object element
number_float_t * get_impl_ptr(number_float_t *) noexcept
get a pointer to the value (floating-point number)
json_value(number_unsigned_t v) noexcept
constructor for numbers (unsigned)
reference operator+=(basic_json &&val)
add an object to an array
basic_json(const BasicJsonType &val)
create a JSON value from an existing one
typename std::allocator_traits< allocator_type >::const_pointer const_pointer
the type of an element const pointer
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json from_bson(IteratorType first, IteratorType last, const bool strict=true, const bool allow_exceptions=true)
friend bool operator>(const_reference lhs, const ScalarType rhs) noexcept
comparison: greater than
typename std::allocator_traits< allocator_type >::pointer pointer
the type of an element pointer
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
BooleanType boolean_t
a type for a boolean
void push_back(initializer_list_t init)
add an object to an object
JSON_HEDLEY_RETURNS_NON_NULL const char * type_name() const noexcept
return the type as string
boolean_t get_impl(boolean_t *) const
get a boolean (explicit)
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
static bool accept(IteratorType first, IteratorType last, const bool ignore_comments=false)
deserialize from stream
IteratorType erase(IteratorType pos)
remove element given an iterator
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.
constexpr bool is_structured() const noexcept
return whether type is structured
const_iterator begin() const noexcept
returns a const iterator to the first element
iteration_proxy< const_iterator > items() const noexcept
helper to access iterator member functions in range-based for
reference at(size_type idx)
access specified array element with bounds checking
reference front()
access the first element
constexpr bool is_primitive() const noexcept
return whether type is primitive
constexpr bool is_number_unsigned() const noexcept
return whether value is an unsigned integer number
static void to_cbor(const basic_json &j, detail::output_adapter< char > o)
create a CBOR serialization of a given JSON value
void swap(object_t &other)
exchanges the values
constexpr bool is_object() const noexcept
return whether value is an object
const_reference front() const
access the first element
binary_t * get_impl_ptr(binary_t *) noexcept
get a pointer to the value (binary)
constexpr value_t type() const noexcept
return the type of the JSON value (explicit)
NumberFloatType number_float_t
a type for a number (floating-point)
json_reverse_iterator< typename basic_json::iterator > reverse_iterator
a reverse iterator for a basic_json container
friend bool operator<=(const_reference lhs, const_reference rhs) noexcept
comparison: less than or equal
bool empty() const noexcept
checks whether the container is empty.
constexpr const number_unsigned_t * get_impl_ptr(const number_unsigned_t *) const noexcept
get a pointer to the value (unsigned number)
friend std::ostream & operator<<(std::ostream &o, const basic_json &j)
serialize to stream
friend bool operator>=(const ScalarType lhs, const_reference rhs) noexcept
comparison: greater than or equal
json_value(value_t t)
constructor for empty values of a given type
basic_json(const basic_json &other)
copy constructor
constexpr const boolean_t * get_impl_ptr(const boolean_t *) const noexcept
get a pointer to the value (boolean)
~basic_json() noexcept
destructor
BasicJsonType get() const
get special-case overload
basic_json(basic_json &&other) noexcept
move constructor
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 ...
friend bool operator>=(const_reference lhs, const ScalarType rhs) noexcept
comparison: greater than or equal
static void to_ubjson(const basic_json &j, detail::output_adapter< char > o, const bool use_size=false, const bool use_type=false)
create a CBOR serialization of a given JSON value
friend bool operator!=(const_reference lhs, const_reference rhs) noexcept
comparison: not equal
iterator insert(const_iterator pos, size_type cnt, const basic_json &val)
inserts elements
json_value m_value
the value of the current element
void swap(typename binary_t::container_type &other)
friend bool operator>=(const_reference lhs, const_reference rhs) noexcept
comparison: greater than or equal
constexpr const object_t * get_impl_ptr(const object_t *) const noexcept
get a pointer to the value (object)
void swap(array_t &other)
exchanges the values
friend bool operator<(const_reference lhs, const ScalarType rhs) noexcept
comparison: less than
reverse_iterator rend() noexcept
returns an iterator to the reverse-end
friend bool operator<=(const_reference lhs, const ScalarType rhs) noexcept
comparison: less than or equal
json_value(const string_t &value)
constructor for strings
json_value(const binary_t &value)
constructor for binary arrays (internal type)
ReferenceType get_ref() const
get a reference value (implicit)
json_value(const array_t &value)
constructor for arrays
iterator insert(const_iterator pos, const_iterator first, const_iterator last)
inserts elements
auto get() noexcept -> decltype(std::declval< basic_json_t & >().template get_ptr< PointerType >())
get a pointer value (explicit)
const_reference at(const json_pointer &ptr) const
access specified element via JSON Pointer
const_iterator end() const noexcept
returns a const iterator to one past the last element
void merge_patch(const basic_json &apply_patch)
applies a JSON Merge Patch
auto get_ptr() noexcept -> decltype(std::declval< basic_json_t & >().get_impl_ptr(std::declval< PointerType >()))
get a pointer value (implicit)
iterator insert(const_iterator pos, initializer_list_t ilist)
inserts elements
ArrayType< basic_json, AllocatorType< basic_json > > array_t
a type for an array
Array get_to(T(&v)[N]) const noexcept(noexcept(JSONSerializer< Array >::from_json(std::declval< const basic_json_t & >(), v)))
get special-case overload
friend bool operator>(const_reference lhs, const_reference rhs) noexcept
comparison: greater than
json_value(const object_t &value)
constructor for objects
IteratorType erase(IteratorType first, IteratorType last)
remove elements given an iterator range
object_t * get_impl_ptr(object_t *) noexcept
get a pointer to the value (object)
json_value(typename binary_t::container_type &&value)
constructor for rvalue binary arrays
json_value(boolean_t v) noexcept
constructor for booleans
ValueType get() const noexcept(noexcept(JSONSerializer< ValueType >::from_json(std::declval< const basic_json_t & >(), std::declval< ValueType & >())))
get a value (explicit)
constexpr bool is_boolean() const noexcept
return whether value is a boolean
iteration_proxy< iterator > items() noexcept
helper to access iterator member functions in range-based for
iterator end() noexcept
returns an iterator to one past the last element
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
void clear() noexcept
clears the contents
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json from_msgpack(IteratorType first, IteratorType last, const bool strict=true, const bool allow_exceptions=true)
constexpr bool is_binary() const noexcept
return whether value is a binary array
static std::vector< uint8_t > to_msgpack(const basic_json &j)
create a MessagePack serialization of a given JSON value
binary_t * binary
binary (stored with pointer to save storage)
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json object(initializer_list_t init={})
explicitly create an object from an initializer list
constexpr const number_float_t * get_impl_ptr(const number_float_t *) const noexcept
get a pointer to the value (floating-point number)
iterator insert(const_iterator pos, basic_json &&val)
inserts element
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json from_ubjson(IteratorType first, IteratorType last, const bool strict=true, const bool allow_exceptions=true)
reference operator[](size_type idx)
access specified array element
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 ...
void update(const_iterator first, const_iterator last)
updates a JSON object from another object, overwriting existing keys
reference at(const json_pointer &ptr)
access specified element via JSON Pointer
ValueType & get_to(ValueType &v) const noexcept(noexcept(JSONSerializer< ValueType >::from_json(std::declval< const basic_json_t & >(), v)))
get a value (explicit)
void swap(binary_t &other)
exchanges the values
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...
json_reverse_iterator< typename basic_json::const_iterator > const_reverse_iterator
a const reverse iterator for a basic_json container
void assert_invariant() const noexcept
checks the class invariants
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
static void to_msgpack(const basic_json &j, detail::output_adapter< uint8_t > o)
create a CBOR serialization of a given JSON value
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)
number_unsigned_t * get_impl_ptr(number_unsigned_t *) noexcept
get a pointer to the value (unsigned number)
const_reverse_iterator rbegin() const noexcept
returns a const reverse iterator to the last element
void swap(string_t &other)
exchanges the values
const_reference back() const
access the last element
friend bool operator<(const_reference lhs, const_reference rhs) noexcept
comparison: less than
friend std::istream & operator>>(std::istream &i, basic_json &j)
deserialize from stream
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json binary(typename binary_t::container_type &&init)
explicitly create a binary array (without subtype)
friend bool operator!=(const ScalarType lhs, const_reference rhs) noexcept
comparison: not equal
constexpr bool is_string() const noexcept
return whether value is a string
number_integer_t * get_impl_ptr(number_integer_t *) noexcept
get a pointer to the value (integer number)
constexpr bool is_array() const noexcept
return whether value is an array
iterator insert_iterator(const_iterator pos, Args &&... args)
Helper for insertion of an iterator.
basic_json flatten() const
return flattened JSON value
void push_back(basic_json &&val)
add an object to an array
friend bool operator==(const_reference lhs, const ScalarType rhs) noexcept
comparison: equal
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)
size_type count(KeyT &&key) const
returns the number of occurrences of a key in a JSON object
json_value(const typename binary_t::container_type &value)
constructor for binary arrays
const binary_t & get_binary() const
json_value()=default
default constructor (for null values)
constexpr bool is_number() const noexcept
return whether value is a number
number_float_t number_float
number (floating-point)
friend bool operator<(const ScalarType lhs, const_reference rhs) noexcept
comparison: less than
std::less< StringType > object_comparator_t
a type for an object
string_t * string
string (stored with pointer to save storage)
std::pair< iterator, bool > emplace(Args &&... args)
add an object to an object if key does not exist
reference operator+=(initializer_list_t init)
add an object to an object
::nlohmann::detail::output_adapter_t< CharType > output_adapter_t
constexpr bool is_number_integer() const noexcept
return whether value is an integer number
static JSON_HEDLEY_RETURNS_NON_NULL T * create(Args &&... args)
helper for exception-safe object creation
std::initializer_list< detail::json_ref< basic_json > > initializer_list_t
helper type for initializer lists of basic_json values
constexpr const array_t * get_impl_ptr(const array_t *) const noexcept
get a pointer to the value (array)
ValueType & get_to(ValueType &v) const
get special-case overload
json_value(binary_t &&value)
constructor for rvalue binary arrays (internal type)
static void to_msgpack(const basic_json &j, detail::output_adapter< char > o)
create a CBOR serialization of a given JSON value
const_reference operator[](const typename object_t::key_type &key) const
read-only access specified object element
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)
iterator find(KeyT &&key)
find an element in a JSON object
basic_json(std::nullptr_t=nullptr) noexcept
create a null object
const_reference operator[](size_type idx) const
access specified array element
array_t * array
array (stored with pointer to save storage)
AllocatorType< basic_json > allocator_type
the allocator type
nlohmann::byte_container_with_subtype< BinaryType > binary_t
a type for a packed binary type
JSONSerializer< T, SFINAE > json_serializer
void push_back(const typename object_t::value_type &val)
add an object to an object
friend bool operator<=(const ScalarType lhs, const_reference rhs) noexcept
comparison: less than or equal
ValueType get() const noexcept(noexcept(JSONSerializer< ValueType >::from_json(std::declval< const basic_json_t & >())))
get a value (explicit); special case
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
number_integer_t number_integer
number (integer)
constexpr const string_t * get_impl_ptr(const string_t *) const noexcept
get a pointer to the value (string)
static std::vector< uint8_t > to_cbor(const basic_json &j)
create a CBOR serialization of a given JSON value
bool contains(const json_pointer &ptr) const
check the existence of an element in a JSON object given a JSON pointer
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
void destroy(value_t t) noexcept
basic_json patch(const basic_json &json_patch) const
applies a JSON patch
string_t value(const typename object_t::key_type &key, const char *default_value) const
overload for a default value of type const char*
basic_json unflatten() const
unflatten a previously flattened JSON value
NumberUnsignedType number_unsigned_t
a type for a number (unsigned)
reference operator+=(const typename object_t::value_type &val)
add an object to an object
const_iterator cbegin() const noexcept
returns a const iterator to the first element
json_value(array_t &&value)
constructor for rvalue arrays
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
const_reference at(size_type idx) const
access specified array element with bounds checking
iterator insert(const_iterator pos, const basic_json &val)
inserts element
constexpr bool is_discarded() const noexcept
return whether value is discarded
constexpr bool is_null() const noexcept
return whether value is null
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
friend bool operator==(const ScalarType lhs, const_reference rhs) noexcept
comparison: equal
ObjectType< StringType, basic_json, object_comparator_t, AllocatorType< std::pair< const StringType, basic_json > >> object_t
a type for an object
reference operator+=(const basic_json &val)
add an object to an array
size_type erase(const typename object_t::key_type &key)
remove element from a JSON object given a key
static ReferenceType get_ref_impl(ThisType &obj)
helper function to implement get_ref()
basic_json(size_type cnt, const basic_json &val)
construct an array with count copies of given value
static allocator_type get_allocator()
returns the allocator associated with the container
constexpr auto get_ptr() const noexcept -> decltype(std::declval< const basic_json_t & >().get_impl_ptr(std::declval< PointerType >()))
get a pointer value (implicit)
friend bool operator!=(const_reference lhs, const ScalarType rhs) noexcept
comparison: not equal
reverse_iterator rbegin() noexcept
returns an iterator to the reverse-beginning
an internal type for a backed binary type
BinaryType container_type
the type of the underlying container
byte_container_with_subtype(const container_type &b) noexcept(noexcept(container_type(b)))
byte_container_with_subtype(container_type &&b) noexcept(noexcept(container_type(std::move(b))))
bool operator!=(const byte_container_with_subtype &rhs) const
void clear_subtype() noexcept
clears the binary subtype
byte_container_with_subtype(container_type &&b, std::uint8_t subtype) noexcept(noexcept(container_type(std::move(b))))
byte_container_with_subtype() noexcept(noexcept(container_type()))
constexpr bool has_subtype() const noexcept
return whether the value has a subtype
void set_subtype(std::uint8_t subtype) noexcept
sets the binary subtype
byte_container_with_subtype(const container_type &b, std::uint8_t subtype) noexcept(noexcept(container_type(b)))
constexpr std::uint8_t subtype() const noexcept
return the binary subtype
bool operator==(const byte_container_with_subtype &rhs) const
deserialization of CBOR, MessagePack, and UBJSON values
typename BasicJsonType::number_unsigned_t number_unsigned_t
bool get_msgpack_array(const std::size_t len)
bool get_bson_string(const NumberType len, string_t &result)
Parses a zero-terminated string of length len from the BSON input.
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.
bool parse_bson_array()
Reads an array from the BSON input and passes it to the SAX-parser.
char_int_type get_ignore_noop()
bool get_ubjson_high_precision_number()
typename BasicJsonType::number_integer_t number_integer_t
bool get_bson_cstr(string_t &result)
Parses a C-style string from the BSON input.
binary_reader & operator=(const binary_reader &)=delete
bool get_cbor_array(const std::size_t len, const cbor_tag_handler_t tag_handler)
bool get_msgpack_binary(binary_t &result)
reads a MessagePack byte array
bool get_cbor_object(const std::size_t len, const cbor_tag_handler_t tag_handler)
bool get_ubjson_string(string_t &result, const bool get_char=true)
reads a UBJSON string
bool parse_bson_element_list(const bool is_array)
Read a BSON element list (as specified in the BSON-spec)
bool parse_cbor_internal(const bool get_char, const cbor_tag_handler_t tag_handler)
bool get_string(const input_format_t format, const NumberType len, string_t &result)
create a string by reading characters from the input
bool get_cbor_string(string_t &result)
reads a CBOR string
InputAdapterType ia
input adapter
bool get_binary(const input_format_t format, const NumberType len, binary_t &result)
create a byte array by reading bytes from the input
bool parse_ubjson_internal(const bool get_char=true)
bool unexpect_eof(const input_format_t format, const char *context) const
bool get_ubjson_size_type(std::pair< std::size_t, char_int_type > &result)
determine the type and size for a container
std::string get_token_string() const
bool get_ubjson_value(const char_int_type prefix)
typename BasicJsonType::string_t string_t
bool get_msgpack_object(const std::size_t len)
bool get_bson_binary(const NumberType len, binary_t &result)
Parses a byte array input of length len from the BSON input.
std::string exception_message(const input_format_t format, const std::string &detail, const std::string &context) const
std::size_t chars_read
the number of characters read
typename std::char_traits< char_type >::int_type char_int_type
binary_reader(const binary_reader &)=delete
char_int_type current
the current character
bool sax_parse(const input_format_t format, json_sax_t *sax_, const bool strict=true, const cbor_tag_handler_t tag_handler=cbor_tag_handler_t::error)
json_sax_t * sax
the SAX parser
bool get_ubjson_size_value(std::size_t &result)
typename InputAdapterType::char_type char_type
bool parse_bson_internal()
Reads in a BSON-object and passes it to the SAX-parser.
bool get_number(const input_format_t format, NumberType &result)
bool get_cbor_binary(binary_t &result)
reads a CBOR byte array
binary_reader(binary_reader &&)=default
typename BasicJsonType::binary_t binary_t
char_int_type get()
get next character from the input
binary_reader & operator=(binary_reader &&)=default
const bool is_little_endian
whether we can assume little endianess
binary_reader(InputAdapterType &&adapter)
create a binary reader
bool get_msgpack_string(string_t &result)
reads a MessagePack string
bool parse_msgpack_internal()
typename BasicJsonType::number_float_t number_float_t
serialization to CBOR and MessagePack values
void write_bson_array(const string_t &name, const typename BasicJsonType::array_t &value)
Writes a BSON element with key name and array value.
const bool is_little_endian
whether we can assume little endianess
void write_number_with_ubjson_prefix(const NumberType n, const bool add_prefix)
void write_ubjson(const BasicJsonType &j, const bool use_count, const bool use_type, const bool add_prefix=true)
static constexpr CharType get_ubjson_float_prefix(double)
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.
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.
void write_bson_double(const string_t &name, const double value)
Writes a BSON element with key name and double value value.
void write_bson_object(const typename BasicJsonType::object_t &value)
typename BasicJsonType::string_t string_t
static constexpr CharType get_cbor_float_prefix(float)
static constexpr CharType to_char_type(InputCharType x) noexcept
typename BasicJsonType::binary_t binary_t
binary_writer(output_adapter_t< CharType > adapter)
create a binary writer
static constexpr CharType get_msgpack_float_prefix(double)
CharType ubjson_prefix(const BasicJsonType &j) const noexcept
determine the type prefix of container values
void write_bson_integer(const string_t &name, const std::int64_t value)
Writes a BSON element with key name and integer value.
static std::size_t calc_bson_entry_header_size(const string_t &name)
void write_bson_unsigned(const string_t &name, const std::uint64_t value)
Writes a BSON element with key name and unsigned value.
static CharType to_char_type(std::uint8_t x) noexcept
void write_bson_string(const string_t &name, const string_t &value)
Writes a BSON element with key name and string value value.
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.
static constexpr CharType get_ubjson_float_prefix(float)
void write_number(const NumberType n)
output_adapter_t< CharType > oa
the output
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.
void write_bson_binary(const string_t &name, const binary_t &value)
Writes a BSON element with key name and binary value value.
void write_bson_null(const string_t &name)
Writes a BSON element with key name and null value.
static std::size_t calc_bson_binary_size(const typename BasicJsonType::binary_t &value)
void write_bson(const BasicJsonType &j)
void write_cbor(const BasicJsonType &j)
static constexpr std::size_t calc_bson_unsigned_size(const std::uint64_t value) noexcept
static constexpr CharType to_char_type(std::uint8_t x) noexcept
typename BasicJsonType::number_float_t number_float_t
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.
static constexpr CharType get_msgpack_float_prefix(float)
void write_bson_boolean(const string_t &name, const bool value)
Writes a BSON element with key name and boolean value value.
void write_msgpack(const BasicJsonType &j)
void write_compact_float(const number_float_t n, detail::input_format_t format)
static std::size_t calc_bson_string_size(const string_t &value)
static std::size_t calc_bson_integer_size(const std::int64_t value)
static std::size_t calc_bson_array_size(const typename BasicJsonType::array_t &value)
static constexpr CharType get_cbor_float_prefix(double)
general exception of the basic_json class
const int id
the id of the exception
JSON_HEDLEY_RETURNS_NON_NULL const char * what() const noexcept override
returns the explanatory string
static std::string name(const std::string &ename, int id_)
std::runtime_error m
an exception object as storage for error messages
exception indicating errors with iterators
static invalid_iterator create(int id_, const std::string &what_arg)
invalid_iterator(int id_, const char *what_arg)
a template for a bidirectional iterator for the basic_json class This class implements a both iterato...
bool operator<(const iter_impl &other) const
comparison: smaller
iter_impl operator-(difference_type i) const
subtract from iterator
const object_t::key_type & key() const
return the key of an object iterator
iter_impl()=default
default constructor
iter_impl const operator--(int)
post-decrement (it–)
void set_end() noexcept
set the iterator past the last value
bool operator==(const iter_impl &other) const
comparison: equal
typename BasicJsonType::difference_type difference_type
a type to represent differences between iterators
iter_impl & operator+=(difference_type i)
add to iterator
difference_type operator-(const iter_impl &other) const
return difference
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)
reference operator*() const
return a reference to the value pointed to by the iterator
bool operator>=(const iter_impl &other) const
comparison: greater than or equal
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)
pointer operator->() const
dereference the iterator
iter_impl & operator=(const iter_impl< typename std::remove_const< BasicJsonType >::type > &other) noexcept
converting assignment
iter_impl(const iter_impl< const BasicJsonType > &other) noexcept
const copy constructor
iter_impl const operator++(int)
post-increment (it++)
iter_impl & operator--()
pre-decrement (–it)
iter_impl(const iter_impl< typename std::remove_const< BasicJsonType >::type > &other) noexcept
converting constructor
iter_impl(pointer object) noexcept
constructor for a given JSON instance
internal_iterator< typename std::remove_const< BasicJsonType >::type > m_it
the actual iterator of the associated instance
iter_impl operator+(difference_type i) const
add to iterator
friend iter_impl operator+(difference_type i, const iter_impl &it)
addition of distance and iterator
iter_impl & operator=(const iter_impl< const BasicJsonType > &other) noexcept
converting assignment
bool operator>(const iter_impl &other) const
comparison: greater than
typename BasicJsonType::value_type value_type
the type of the values when the iterator is dereferenced
reference value() const
return the value of an iterator
typename BasicJsonType::object_t object_t
iter_impl & operator-=(difference_type i)
subtract from iterator
iter_impl & operator++()
pre-increment (++it)
reference operator[](difference_type n) const
access to successor
bool operator<=(const iter_impl &other) const
comparison: less than or equal
std::bidirectional_iterator_tag iterator_category
The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17.
bool operator!=(const iter_impl &other) const
comparison: not equal
typename BasicJsonType::array_t array_t
IteratorType anchor
the iterator
iteration_proxy_value & operator*()
dereference operator (needed for range-based for)
std::input_iterator_tag iterator_category
typename std::remove_cv< typename std::remove_reference< decltype(std::declval< IteratorType >().key()) >::type >::type string_type
const string_type empty_str
an empty string (to return a reference for primitive values)
iteration_proxy_value(IteratorType it) noexcept
bool operator!=(const iteration_proxy_value &o) const
inequality operator (needed for range-based for)
std::size_t array_index_last
last stringified array index
string_type array_index_str
a string representation of the array index
IteratorType::reference value() const
return value of the iterator
std::size_t array_index
an index for arrays (used to create key names)
std::ptrdiff_t difference_type
iteration_proxy_value & operator++()
increment operator (needed for range-based for)
const string_type & key() const
return key of the iterator
bool operator==(const iteration_proxy_value &o) const
equality operator (needed for InputIterator)
proxy class for the items() function
iteration_proxy_value< IteratorType > begin() noexcept
return iterator begin (needed for range-based for)
IteratorType::reference container
the container to iterate
iteration_proxy_value< IteratorType > end() noexcept
return iterator end (needed for range-based for)
iteration_proxy(typename IteratorType::reference cont) noexcept
construct iteration proxy from a container
json_ref(const json_ref &)=delete
json_ref(json_ref &&)=default
json_ref(Args &&... args)
json_ref(const value_type &value)
json_ref & operator=(const json_ref &)=delete
json_ref & operator=(json_ref &&)=delete
value_type const & operator*() const
value_type const * operator->() const
json_ref(std::initializer_list< json_ref > init)
json_ref(value_type &&value)
value_type moved_or_copied() const
a template for a reverse iterator class
json_reverse_iterator(const typename base_iterator::iterator_type &it) noexcept
create reverse iterator from iterator
json_reverse_iterator & operator--()
pre-decrement (–it)
json_reverse_iterator & operator++()
pre-increment (++it)
json_reverse_iterator const operator--(int)
post-decrement (it–)
typename Base::reference reference
the reference type for the pointed-to element
json_reverse_iterator & operator+=(difference_type i)
add to iterator
json_reverse_iterator operator-(difference_type i) const
subtract from iterator
std::reverse_iterator< Base > base_iterator
shortcut to the reverse iterator adapter
json_reverse_iterator(const base_iterator &it) noexcept
create reverse iterator from base class
reference operator[](difference_type n) const
access to successor
std::ptrdiff_t difference_type
difference_type operator-(const json_reverse_iterator &other) const
return difference
json_reverse_iterator operator+(difference_type i) const
add to iterator
json_reverse_iterator const operator++(int)
post-increment (it++)
auto key() const -> decltype(std::declval< Base >().key())
return the key of an object iterator
reference value() const
return the value of an iterator
typename BasicJsonType::string_t string_t
typename BasicJsonType::number_integer_t number_integer_t
typename BasicJsonType::number_float_t number_float_t
typename BasicJsonType::binary_t binary_t
bool start_object(std::size_t=std::size_t(-1))
bool start_array(std::size_t=std::size_t(-1))
bool parse_error(std::size_t, const std::string &, const detail::exception &)
bool number_integer(number_integer_t)
bool number_unsigned(number_unsigned_t)
typename BasicJsonType::number_unsigned_t number_unsigned_t
bool number_float(number_float_t, const string_t &)
typename BasicJsonType::string_t string_t
bool start_object(std::size_t len)
const bool allow_exceptions
whether to throw exceptions in case of errors
constexpr bool is_errored() const
typename BasicJsonType::number_unsigned_t number_unsigned_t
BasicJsonType * object_element
helper to hold the reference for the next object element
typename BasicJsonType::number_integer_t number_integer_t
const parser_callback_t callback
callback function
typename BasicJsonType::parser_callback_t parser_callback_t
bool start_array(std::size_t len)
~json_sax_dom_callback_parser()=default
json_sax_dom_callback_parser(const json_sax_dom_callback_parser &)=delete
typename BasicJsonType::binary_t binary_t
json_sax_dom_callback_parser & operator=(const json_sax_dom_callback_parser &)=delete
json_sax_dom_callback_parser & operator=(json_sax_dom_callback_parser &&)=default
bool binary(binary_t &val)
bool number_integer(number_integer_t val)
BasicJsonType & root
the parsed JSON value
std::vector< BasicJsonType * > ref_stack
stack to model hierarchy of values
std::pair< bool, BasicJsonType * > handle_value(Value &&v, const bool skip_callback=false)
BasicJsonType discarded
a discarded value for the callback
std::vector< bool > key_keep_stack
stack to manage which object keys to keep
typename BasicJsonType::number_float_t number_float_t
typename BasicJsonType::parse_event_t parse_event_t
bool errored
whether a syntax error occurred
std::vector< bool > keep_stack
stack to manage which values to keep
bool number_unsigned(number_unsigned_t val)
bool string(string_t &val)
bool number_float(number_float_t val, const string_t &)
json_sax_dom_callback_parser(json_sax_dom_callback_parser &&)=default
bool parse_error(std::size_t, const std::string &, const Exception &ex)
json_sax_dom_callback_parser(BasicJsonType &r, const parser_callback_t cb, const bool allow_exceptions_=true)
SAX implementation to create a JSON value from SAX events.
bool start_array(std::size_t len)
json_sax_dom_parser(const json_sax_dom_parser &)=delete
typename BasicJsonType::binary_t binary_t
bool number_unsigned(number_unsigned_t val)
bool errored
whether a syntax error occurred
typename BasicJsonType::number_integer_t number_integer_t
~json_sax_dom_parser()=default
bool parse_error(std::size_t, const std::string &, const Exception &ex)
bool string(string_t &val)
typename BasicJsonType::number_unsigned_t number_unsigned_t
json_sax_dom_parser & operator=(const json_sax_dom_parser &)=delete
bool start_object(std::size_t len)
BasicJsonType * object_element
helper to hold the reference for the next object element
JSON_HEDLEY_RETURNS_NON_NULL BasicJsonType * handle_value(Value &&v)
std::vector< BasicJsonType * > ref_stack
stack to model hierarchy of values
bool binary(binary_t &val)
const bool allow_exceptions
whether to throw exceptions in case of errors
constexpr bool is_errored() const
json_sax_dom_parser(json_sax_dom_parser &&)=default
typename BasicJsonType::number_float_t number_float_t
BasicJsonType & root
the parsed JSON value
bool number_float(number_float_t val, const string_t &)
json_sax_dom_parser(BasicJsonType &r, const bool allow_exceptions_=true)
typename BasicJsonType::string_t string_t
bool number_integer(number_integer_t val)
json_sax_dom_parser & operator=(json_sax_dom_parser &&)=default
token_type
token types for the parser
@ value_float
an floating point number – use get_number_float() for actual value
@ begin_array
the character for array begin [
@ value_string
a string – use get_string() for actual value
@ end_array
the character for array end ]
@ uninitialized
indicating the scanner is uninitialized
@ parse_error
indicating a parse error
@ value_integer
a signed integer – use get_number_integer() for actual value
@ value_separator
the value separator ,
@ end_object
the character for object end }
@ literal_true
the true literal
@ begin_object
the character for object begin {
@ value_unsigned
an unsigned integer – use get_number_unsigned() for actual value
@ literal_null
the null literal
@ end_of_input
indicating the end of the input buffer
@ name_separator
the name separator :
@ literal_or_value
a literal or the begin of a value (only for diagnostics)
@ literal_false
the false literal
JSON_HEDLEY_RETURNS_NON_NULL static JSON_HEDLEY_CONST const char * token_type_name(const token_type t) noexcept
return name of values of type token_type (only used for errors)
number_float_t value_float
const bool ignore_comments
whether comments should be ignored (true) or signaled as errors (false)
lexer & operator=(lexer &&)=default
void add(char_int_type c)
add a character to token_buffer
void reset() noexcept
reset token_buffer; current character is beginning of token
bool next_unget
whether the next get() call should just return current
char_int_type current
the current character
typename BasicJsonType::number_float_t number_float_t
typename std::char_traits< char_type >::int_type char_int_type
static JSON_HEDLEY_PURE char get_decimal_point() noexcept
return the locale-dependent decimal point
number_integer_t value_integer
InputAdapterType ia
input adapter
lexer(InputAdapterType &&adapter, bool ignore_comments_=false)
typename BasicJsonType::number_integer_t number_integer_t
static void strtof(float &f, const char *str, char **endptr) noexcept
const char_int_type decimal_point_char
the decimal point
string_t & get_string()
return current string value (implicitly resets the token; useful only once)
bool skip_bom()
skip the UTF-8 byte order mark
const char * error_message
a description of occurred lexer errors
position_t position
the start position of the current token
constexpr position_t get_position() const noexcept
return position of last read token
std::vector< char_type > token_string
raw input token string (for error messages)
constexpr number_integer_t get_number_integer() const noexcept
return integer value
constexpr JSON_HEDLEY_RETURNS_NON_NULL const char * get_error_message() const noexcept
return syntax error message
typename lexer_base< BasicJsonType >::token_type token_type
typename InputAdapterType::char_type char_type
token_type scan_number()
scan a number literal
void unget()
unget current character (read it again on next get)
token_type scan_string()
scan a string literal
lexer(const lexer &)=delete
constexpr number_unsigned_t get_number_unsigned() const noexcept
return unsigned integer value
string_t token_buffer
buffer for variable-length tokens (numbers, strings)
token_type scan_literal(const char_type *literal_text, const std::size_t length, token_type return_type)
constexpr number_float_t get_number_float() const noexcept
return floating-point value
int get_codepoint()
get codepoint from 4 hex characters following \u
std::string get_token_string() const
return the last read token (for errors only).
number_unsigned_t value_unsigned
typename BasicJsonType::number_unsigned_t number_unsigned_t
bool next_byte_in_range(std::initializer_list< char_int_type > ranges)
check if the next byte(s) are inside a given range
lexer & operator=(lexer &)=delete
typename BasicJsonType::string_t string_t
bool scan_comment()
scan a comment
exception indicating other library errors
static other_error create(int id_, const std::string &what_arg)
other_error(int id_, const char *what_arg)
exception indicating access out of the defined range
static out_of_range create(int id_, const std::string &what_arg)
out_of_range(int id_, const char *what_arg)
output_adapter(std::vector< CharType > &vec)
output_adapter(std::basic_ostream< CharType > &s)
output_adapter(StringType &s)
output adapter for output streams
void write_character(CharType c) override
std::basic_ostream< CharType > & stream
output_stream_adapter(std::basic_ostream< CharType > &s) noexcept
output adapter for basic_string
void write_character(CharType c) override
output_string_adapter(StringType &s) noexcept
output adapter for byte vectors
std::vector< CharType > & v
output_vector_adapter(std::vector< CharType > &vec) noexcept
void write_character(CharType c) override
exception indicating a parse error
parse_error(int id_, std::size_t byte_, const char *what_arg)
static parse_error create(int id_, const position_t &pos, const std::string &what_arg)
create a parse error exception
const std::size_t byte
byte index of the parse error
static parse_error create(int id_, std::size_t byte_, const std::string &what_arg)
static std::string position_string(const position_t &pos)
bool sax_parse(SAX *sax, const bool strict=true)
token_type get_token()
get next token from lexer
token_type last_token
the type of the last read token
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
bool accept(const bool strict=true)
public accept interface
typename BasicJsonType::string_t string_t
typename BasicJsonType::number_unsigned_t number_unsigned_t
typename lexer_t::token_type token_type
lexer< BasicJsonType, InputAdapterType > lexer_t
bool sax_parse_internal(SAX *sax)
const parser_callback_t< BasicJsonType > callback
callback function
void parse(const bool strict, BasicJsonType &result)
public parser interface
std::string exception_message(const token_type expected, const std::string &context)
typename BasicJsonType::number_float_t number_float_t
const bool allow_exceptions
whether to throw exceptions in case of errors
typename BasicJsonType::number_integer_t number_integer_t
primitive_iterator_t operator+(difference_type n) noexcept
primitive_iterator_t & operator-=(difference_type n) noexcept
constexpr bool is_end() const noexcept
return whether the iterator is at end
constexpr friend bool operator<(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
constexpr friend difference_type operator-(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
constexpr bool is_begin() const noexcept
return whether the iterator can be dereferenced
void set_begin() noexcept
set iterator to a defined beginning
primitive_iterator_t const operator++(int) noexcept
static constexpr difference_type end_value
primitive_iterator_t & operator--() noexcept
primitive_iterator_t & operator++() noexcept
void set_end() noexcept
set iterator to a defined past the end
constexpr difference_type get_value() const noexcept
primitive_iterator_t & operator+=(difference_type n) noexcept
primitive_iterator_t const operator--(int) noexcept
std::ptrdiff_t difference_type
constexpr friend bool operator==(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
static constexpr difference_type begin_value
const error_handler_t error_handler
error_handler how to react on decoding errors
typename BasicJsonType::number_unsigned_t number_unsigned_t
const std::lconv * loc
the locale
std::array< char, 64 > number_buffer
a (hopefully) large enough character buffer
static constexpr std::uint8_t UTF8_ACCEPT
serializer(serializer &&)=delete
const char decimal_point
the locale's decimal point character
typename BasicJsonType::number_float_t number_float_t
serializer & operator=(const serializer &)=delete
const char thousands_sep
the locale's thousand separator character
std::size_t undumped_chars
static constexpr std::uint8_t UTF8_REJECT
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
const char indent_char
the indentation character
std::size_t bytes_after_last_accept
std::array< char, 512 > string_buffer
string buffer
typename BasicJsonType::binary_t::value_type binary_char_t
JSON_PRIVATE_UNLESS_TESTED const bool ensure_ascii
serializer(output_adapter_t< char > s, const char ichar, error_handler_t error_handler_=error_handler_t::strict)
serializer & operator=(serializer &&)=delete
typename BasicJsonType::string_t string_t
serializer(const serializer &)=delete
typename BasicJsonType::number_integer_t number_integer_t
string_t indent_string
the indentation string
exception indicating executing a member function with a wrong type
type_error(int id_, const char *what_arg)
static type_error create(int id_, const std::string &what_arg)
std::vector< std::string > reference_tokens
the reference tokens
const std::string & back() const
return last reference token
BasicJsonType & get_checked(BasicJsonType *ptr) const
std::string to_string() const
return a string representation of the JSON pointer
friend bool operator==(json_pointer const &lhs, json_pointer const &rhs) noexcept
compares two JSON pointers for equality
void pop_back()
remove last reference token
const BasicJsonType & get_checked(const BasicJsonType *ptr) const
BasicJsonType & get_unchecked(BasicJsonType *ptr) const
return a reference to the pointed to value
BasicJsonType & get_and_create(BasicJsonType &j) const
create and return a reference to the pointed to value
bool empty() const noexcept
return whether pointer points to the root document
friend bool operator!=(json_pointer const &lhs, json_pointer const &rhs) noexcept
compares two JSON pointers for inequality
void push_back(const std::string &token)
append an unescaped token at the end of the reference pointer
json_pointer & operator/=(const json_pointer &ptr)
append another JSON pointer at the end of this JSON pointer
json_pointer & operator/=(std::size_t array_idx)
append an array index at the end of this JSON pointer
json_pointer(const std::string &s="")
create JSON pointer
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 contains(const BasicJsonType *ptr) const
static BasicJsonType unflatten(const BasicJsonType &value)
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
static void replace_substring(std::string &s, const std::string &f, const std::string &t)
replace all occurrences of a substring by another string
JSON_PRIVATE_UNLESS_TESTED replace_substring(s, "/", "~1")
static void flatten(const std::string &reference_string, const BasicJsonType &value, BasicJsonType &result)
static void unescape(std::string &s)
unescape "~1" to tilde and "~0" to slash (order is important!)
json_pointer & operator/=(std::string token)
append an unescaped reference token at the end of this JSON pointer
void push_back(std::string &&token)
append an unescaped token at the end of the reference pointer
const BasicJsonType & get_unchecked(const BasicJsonType *ptr) const
return a const reference to the pointed to value
static std::vector< std::string > split(const std::string &reference_string)
split the string input to reference tokens
static BasicJsonType::size_type array_index(const std::string &s)
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
json_pointer parent_pointer() const
returns the parent of this JSON pointer
decltype(get< N >(std::declval< ::nlohmann::detail::iteration_proxy_value< IteratorType > >())) type
int64x64_t operator-(const int64x64_t &lhs, const int64x64_t &rhs)
Subtraction operator.
int64x64_t operator+(const int64x64_t &lhs, const int64x64_t &rhs)
Addition operator.
#define NLOHMANN_BASIC_JSON_TPL_DECLARATION
#define JSON_HEDLEY_CONST
#define JSON_HEDLEY_DIAGNOSTIC_PUSH
#define JSON_HEDLEY_WARN_UNUSED_RESULT
#define JSON_PRIVATE_UNLESS_TESTED
#define NLOHMANN_JSON_VERSION_PATCH
#define JSON_HEDLEY_LIKELY(expr)
#define JSON_HEDLEY_NON_NULL(...)
#define JSON_INTERNAL_CATCH(exception)
#define JSON_HEDLEY_RETURNS_NON_NULL
#define JSON_CATCH(exception)
#define JSON_THROW(exception)
#define NLOHMANN_JSON_VERSION_MAJOR
#define NLOHMANN_BASIC_JSON_TPL
#define JSON_HEDLEY_UNLIKELY(expr)
#define NLOHMANN_JSON_VERSION_MINOR
#define JSON_HEDLEY_DIAGNOSTIC_POP
#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement)
std::string reference
reference tag
def indent(source, debug, level)
void grisu2(char *buf, int &len, int &decimal_exponent, diyfp m_minus, diyfp v, diyfp m_plus)
v = buf * 10^decimal_exponent len is the length of the buffer (number of decimal digits) The buffer m...
Target reinterpret_bits(const Source source)
boundaries compute_boundaries(FloatType value)
Compute the (normalized) diyfp representing the input number 'value' and its boundaries.
int find_largest_pow10(const std::uint32_t n, std::uint32_t &pow10)
For n != 0, returns k, such that pow10 := 10^(k-1) <= n < 10^k.
void grisu2_round(char *buf, int len, std::uint64_t dist, std::uint64_t delta, std::uint64_t rest, std::uint64_t ten_k)
void grisu2_digit_gen(char *buffer, int &length, int &decimal_exponent, diyfp M_minus, diyfp w, diyfp M_plus)
Generates V = buffer * 10^decimal_exponent, such that M- <= V <= M+.
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
JSON_HEDLEY_RETURNS_NON_NULL char * append_exponent(char *buf, int e)
appends a decimal representation of e to buf
cached_power get_cached_power_for_binary_exponent(int e)
For a normalized diyfp w = f * 2^e, this function returns a (normalized) cached power-of-ten c = f_c ...
typename std::enable_if< B, T >::type enable_if_t
typename T::reference reference_t
bool operator<(const value_t lhs, const value_t rhs) noexcept
comparison operator for JSON types
decltype(T::from_json(std::declval< Args >()...)) from_json_function
void to_json(BasicJsonType &j, T b) noexcept
value_t
the JSON type enumeration
@ number_integer
number value (signed integer)
@ discarded
discarded by the parser callback function
@ binary
binary array (ordered collection of bytes)
@ object
object (unordered set of name/value pairs)
@ number_float
number value (floating-point)
@ number_unsigned
number value (unsigned integer)
@ array
array (ordered collection of values)
void from_json(const BasicJsonType &j, typename std::nullptr_t &n)
decltype(std::declval< T & >().parse_error(std::declval< std::size_t >(), std::declval< const std::string & >(), std::declval< const Exception & >())) parse_error_function_t
typename T::pointer pointer_t
decltype(std::declval< T & >().string(std::declval< String & >())) string_function_t
void from_json_tuple_impl(const BasicJsonType &j, Tuple &t, index_sequence< Idx... >)
@ value
the parser finished reading a JSON value
@ key
the parser read a key of a value in an object
@ array_end
the parser read ] and finished processing a JSON array
@ array_start
the parser read [ and started to process a JSON array
@ object_start
the parser read { and started to process a JSON object
@ object_end
the parser read } and finished processing a JSON object
typename T::difference_type difference_type_t
typename detector< nonesuch, void, Op, Args... >::type detected_t
void int_to_string(string_type &target, std::size_t value)
void from_json_array_impl(const BasicJsonType &j, typename BasicJsonType::array_t &arr, priority_tag< 3 >)
decltype(std::declval< T & >().key(std::declval< String & >())) key_function_t
decltype(std::declval< T & >().boolean(std::declval< bool >())) boolean_function_t
decltype(std::declval< T & >().binary(std::declval< Binary & >())) binary_function_t
decltype(std::declval< T & >().number_integer(std::declval< Integer >())) number_integer_function_t
void to_json_tuple_impl(BasicJsonType &j, const Tuple &t, index_sequence< Idx... >)
std::is_convertible< detected_t< Op, Args... >, To > is_detected_convertible
typename std::remove_cv< typename std::remove_reference< T >::type >::type uncvref_t
cbor_tag_handler_t
how to treat CBOR tags
@ error
throw a parse_error exception in case of a tag
error_handler_t
how to treat decoding errors
@ strict
throw a type_error exception in case of invalid UTF-8
@ ignore
ignore invalid UTF-8 sequences
@ replace
replace invalid UTF-8 sequences with U+FFFD
decltype(std::declval< T & >().start_object(std::declval< std::size_t >())) start_object_function_t
typename T::key_type key_type_t
std::size_t combine(std::size_t seed, std::size_t h) noexcept
std::size_t hash(const BasicJsonType &j)
hash a JSON value
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).
decltype(std::declval< T & >().number_unsigned(std::declval< Unsigned >())) number_unsigned_function_t
std::is_same< Expected, detected_t< Op, Args... > > is_detected_exact
typename detected_or< Default, Op, Args... >::type detected_or_t
decltype(std::declval< T & >().start_array(std::declval< std::size_t >())) start_array_function_t
void get_arithmetic_value(const BasicJsonType &j, ArithmeticType &val)
typename detector< nonesuch, void, Op, Args... >::value_t is_detected
typename make_void< Ts... >::type void_t
std::function< bool(int depth, parse_event_t event, BasicJsonType &parsed)> parser_callback_t
std::shared_ptr< output_adapter_protocol< CharType > > output_adapter_t
a type to simplify interfaces
typename T::mapped_type mapped_type_t
typename T::iterator iterator_t
input_format_t
the supported input formats
void to_json(BasicJsonType &j, const T &b)
decltype(std::declval< T >().template get< U >()) get_template_function
decltype(input_adapter(std::declval< const char * >(), std::declval< const char * >())) contiguous_bytes_input_adapter
decltype(std::declval< T & >().null()) null_function_t
auto get(const nlohmann::detail::iteration_proxy_value< IteratorType > &i) -> decltype(i.key())
iterator_input_adapter_factory< IteratorType >::adapter_type input_adapter(IteratorType first, IteratorType last)
typename T::iterator_category iterator_category_t
static bool little_endianess(int num=1) noexcept
determine system byte order
decltype(std::declval< T & >().number_float(std::declval< Float >(), std::declval< const String & >())) number_float_function_t
decltype(std::declval< T & >().end_array()) end_array_function_t
void from_json(const BasicJsonType &j, std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > &m)
decltype(std::declval< T & >().end_object()) end_object_function_t
decltype(T::to_json(std::declval< Args >()...)) to_json_function
typename T::value_type value_type_t
namespace for Niels Lohmann
basic_json<> json
default JSON class
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
Time & operator+=(Time &lhs, const Time &rhs)
Compound addition assignment for Time.
void swap(UUID &uuid1, UUID &uuid2) noexcept
list x
Random number samples.
#define E(name, start, end)
default JSONSerializer template argument
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
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
static constexpr int kPrecision
static diyfp normalize(diyfp x) noexcept
normalize x such that the significand is >= 2^(q-1)
static diyfp normalize_to(const diyfp &x, const int target_exponent) noexcept
normalize x such that the result has the exponent E
static diyfp mul(const diyfp &x, const diyfp &y) noexcept
returns x * y
constexpr diyfp(std::uint64_t f_, int e_) noexcept
static diyfp sub(const diyfp &x, const diyfp &y) noexcept
returns x - y
static void construct(BasicJsonType &j, const CompatibleArrayType &arr)
static void construct(BasicJsonType &j, const std::valarray< T > &arr)
static void construct(BasicJsonType &j, const std::vector< bool > &arr)
static void construct(BasicJsonType &j, typename BasicJsonType::array_t &&arr)
static void construct(BasicJsonType &j, const typename BasicJsonType::array_t &arr)
static void construct(BasicJsonType &j, const typename BasicJsonType::binary_t &b)
static void construct(BasicJsonType &j, typename BasicJsonType::binary_t &&b)
static void construct(BasicJsonType &j, typename BasicJsonType::boolean_t b) noexcept
static void construct(BasicJsonType &j, typename BasicJsonType::number_float_t val) noexcept
static void construct(BasicJsonType &j, typename BasicJsonType::number_integer_t val) noexcept
static void construct(BasicJsonType &j, typename BasicJsonType::number_unsigned_t val) noexcept
static void construct(BasicJsonType &j, typename BasicJsonType::object_t &&obj)
static void construct(BasicJsonType &j, const typename BasicJsonType::object_t &obj)
static void construct(BasicJsonType &j, const CompatibleObjectType &obj)
static void construct(BasicJsonType &j, typename BasicJsonType::string_t &&s)
static void construct(BasicJsonType &j, const CompatibleStringType &str)
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())
typename BasicJsonType::template json_serializer< T, void > serializer
typename BasicJsonType::template json_serializer< T, void > serializer
typename BasicJsonType::template json_serializer< T, void > serializer
static constexpr std::size_t size() noexcept
primitive_iterator_t primitive_iterator
generic iterator for all other types
BasicJsonType::array_t::iterator array_iterator
iterator for JSON arrays
BasicJsonType::object_t::iterator object_iterator
iterator for JSON objects
std::numeric_limits< CompatibleNumberIntegerType > CompatibleLimits
std::numeric_limits< RealIntegerType > RealLimits
typename BasicJsonType::object_t object_t
typename BasicJsonType::object_t object_t
static constexpr bool value
typename std::iterator_traits< T >::value_type value_type
typename BasicJsonType::string_t string_t
typename BasicJsonType::exception exception_t
typename BasicJsonType::number_integer_t number_integer_t
typename BasicJsonType::number_float_t number_float_t
typename BasicJsonType::binary_t binary_t
typename BasicJsonType::number_unsigned_t number_unsigned_t
typename BasicJsonType::number_float_t number_float_t
typename BasicJsonType::number_unsigned_t number_unsigned_t
typename BasicJsonType::exception exception_t
static constexpr bool value
typename BasicJsonType::number_integer_t number_integer_t
typename BasicJsonType::string_t string_t
typename BasicJsonType::binary_t binary_t
std::random_access_iterator_tag iterator_category
ptrdiff_t difference_type
typename It::difference_type difference_type
typename It::reference reference
typename It::iterator_category iterator_category
typename It::pointer pointer
typename It::value_type value_type
nonesuch(nonesuch const &)=delete
void operator=(nonesuch &&)=delete
nonesuch(nonesuch const &&)=delete
void operator=(nonesuch const &)=delete
abstract output adapter interface
virtual void write_characters(const CharType *s, std::size_t length)=0
virtual void write_character(CharType c)=0
virtual ~output_adapter_protocol()=default
struct to capture the start position of the current token
std::size_t lines_read
the number of lines read
std::size_t chars_read_current_line
the number of characters read in the current line
std::size_t chars_read_total
the total number of characters read
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())
virtual bool start_object(std::size_t elements)=0
the beginning of an object was read
virtual bool string(string_t &val)=0
a string was read
typename BasicJsonType::number_integer_t number_integer_t
typename BasicJsonType::binary_t binary_t
virtual bool end_array()=0
the end of an array was read
virtual bool key(string_t &val)=0
an object key was read
typename BasicJsonType::number_unsigned_t number_unsigned_t
virtual bool binary(binary_t &val)=0
a binary string was read
typename BasicJsonType::number_float_t number_float_t
virtual bool start_array(std::size_t elements)=0
the beginning of an array was read
virtual bool parse_error(std::size_t position, const std::string &last_token, const detail::exception &ex)=0
a parse error occurred
virtual bool boolean(bool val)=0
a boolean value was read
virtual bool end_object()=0
the end of an object was read
virtual bool number_unsigned(number_unsigned_t val)=0
an unsigned integer number was read
typename BasicJsonType::string_t string_t
virtual bool number_float(number_float_t val, const string_t &s)=0
an floating-point number was read
virtual ~json_sax()=default
virtual bool number_integer(number_integer_t val)=0
an integer number was read
ordered_map: a minimal map-like container that preserves insertion order for use within nlohmann::bas...
std::pair< iterator, bool > insert(const value_type &value)
ordered_map(std::initializer_list< T > init, const Allocator &alloc=Allocator())
std::vector< std::pair< const Key, T >, Allocator > Container
iterator find(const Key &key)
iterator erase(iterator pos)
std::pair< iterator, bool > emplace(const key_type &key, T &&t)
const_iterator find(const Key &key) const
std::pair< iterator, bool > insert(value_type &&value)
size_type erase(const Key &key)
const T & operator[](const Key &key) const
ordered_map(const Allocator &alloc=Allocator())
const T & at(const Key &key) const
ordered_map(It first, It last, const Allocator &alloc=Allocator())
T & operator[](const Key &key)
size_type count(const Key &key) const
std::size_t operator()(const nlohmann::json &j) const
return a hash value for a JSON object
bool operator()(nlohmann::detail::value_t lhs, nlohmann::detail::value_t rhs) const noexcept
compare two value_t enum values