ferencd@0: /* ferencd@0: __ _____ _____ _____ ferencd@0: __| | __| | | | JSON for Modern C++ ferencd@0: | | |__ | | | | | | version 3.7.0 ferencd@0: |_____|_____|_____|_|___| https://github.com/nlohmann/json ferencd@0: ferencd@0: Licensed under the MIT License . ferencd@0: SPDX-License-Identifier: MIT ferencd@0: Copyright (c) 2013-2019 Niels Lohmann . ferencd@0: ferencd@0: Permission is hereby granted, free of charge, to any person obtaining a copy ferencd@0: of this software and associated documentation files (the "Software"), to deal ferencd@0: in the Software without restriction, including without limitation the rights ferencd@0: to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ferencd@0: copies of the Software, and to permit persons to whom the Software is ferencd@0: furnished to do so, subject to the following conditions: ferencd@0: ferencd@0: The above copyright notice and this permission notice shall be included in all ferencd@0: copies or substantial portions of the Software. ferencd@0: ferencd@0: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ferencd@0: IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ferencd@0: FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ferencd@0: AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ferencd@0: LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ferencd@0: OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ferencd@0: SOFTWARE. ferencd@0: */ ferencd@0: ferencd@0: #ifndef INCLUDE_NLOHMANN_JSON_HPP_ ferencd@0: #define INCLUDE_NLOHMANN_JSON_HPP_ ferencd@0: ferencd@0: #define NLOHMANN_JSON_VERSION_MAJOR 3 ferencd@0: #define NLOHMANN_JSON_VERSION_MINOR 7 ferencd@0: #define NLOHMANN_JSON_VERSION_PATCH 0 ferencd@0: ferencd@0: #include // all_of, find, for_each ferencd@0: #include // assert ferencd@0: #include // and, not, or ferencd@0: #include // nullptr_t, ptrdiff_t, size_t ferencd@0: #include // hash, less ferencd@0: #include // initializer_list ferencd@0: #include // istream, ostream ferencd@0: #include // random_access_iterator_tag ferencd@0: #include // unique_ptr ferencd@0: #include // accumulate ferencd@0: #include // string, stoi, to_string ferencd@0: #include // declval, forward, move, pair, swap ferencd@0: #include // vector ferencd@0: ferencd@0: // #include ferencd@0: ferencd@0: ferencd@0: #include ferencd@0: ferencd@0: // #include ferencd@0: ferencd@0: ferencd@0: #include // transform ferencd@0: #include // array ferencd@0: #include // and, not ferencd@0: #include // forward_list ferencd@0: #include // inserter, front_inserter, end ferencd@0: #include // map ferencd@0: #include // string ferencd@0: #include // tuple, make_tuple ferencd@0: #include // is_arithmetic, is_same, is_enum, underlying_type, is_convertible ferencd@0: #include // unordered_map ferencd@0: #include // pair, declval ferencd@0: #include // valarray ferencd@0: ferencd@0: // #include ferencd@0: ferencd@0: ferencd@0: #include // exception ferencd@0: #include // runtime_error ferencd@0: #include // to_string ferencd@0: ferencd@0: // #include ferencd@0: ferencd@0: ferencd@0: #include // size_t ferencd@0: ferencd@0: namespace nlohmann ferencd@0: { ferencd@0: namespace detail ferencd@0: { ferencd@0: /// struct to capture the start position of the current token ferencd@0: struct position_t ferencd@0: { ferencd@0: /// the total number of characters read ferencd@0: std::size_t chars_read_total = 0; ferencd@0: /// the number of characters read in the current line ferencd@0: std::size_t chars_read_current_line = 0; ferencd@0: /// the number of lines read ferencd@0: std::size_t lines_read = 0; ferencd@0: ferencd@0: /// conversion to size_t to preserve SAX interface ferencd@0: constexpr operator size_t() const ferencd@0: { ferencd@0: return chars_read_total; ferencd@0: } ferencd@0: }; ferencd@0: ferencd@0: } // namespace detail ferencd@0: } // namespace nlohmann ferencd@0: ferencd@0: // #include ferencd@0: ferencd@0: ferencd@0: #include // pair ferencd@0: // #include ferencd@0: /* Hedley - https://nemequ.github.io/hedley ferencd@0: * Created by Evan Nemerson ferencd@0: * ferencd@0: * To the extent possible under law, the author(s) have dedicated all ferencd@0: * copyright and related and neighboring rights to this software to ferencd@0: * the public domain worldwide. This software is distributed without ferencd@0: * any warranty. ferencd@0: * ferencd@0: * For details, see . ferencd@0: * SPDX-License-Identifier: CC0-1.0 ferencd@0: */ ferencd@0: ferencd@0: #if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 9) ferencd@0: #if defined(JSON_HEDLEY_VERSION) ferencd@0: #undef JSON_HEDLEY_VERSION ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_VERSION 9 ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_STRINGIFY_EX) ferencd@0: #undef JSON_HEDLEY_STRINGIFY_EX ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_STRINGIFY_EX(x) #x ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_STRINGIFY) ferencd@0: #undef JSON_HEDLEY_STRINGIFY ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x) ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_CONCAT_EX) ferencd@0: #undef JSON_HEDLEY_CONCAT_EX ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_CONCAT_EX(a,b) a##b ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_CONCAT) ferencd@0: #undef JSON_HEDLEY_CONCAT ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b) ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_VERSION_ENCODE) ferencd@0: #undef JSON_HEDLEY_VERSION_ENCODE ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision)) ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR) ferencd@0: #undef JSON_HEDLEY_VERSION_DECODE_MAJOR ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000) ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_VERSION_DECODE_MINOR) ferencd@0: #undef JSON_HEDLEY_VERSION_DECODE_MINOR ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000) ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_VERSION_DECODE_REVISION) ferencd@0: #undef JSON_HEDLEY_VERSION_DECODE_REVISION ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000) ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GNUC_VERSION) ferencd@0: #undef JSON_HEDLEY_GNUC_VERSION ferencd@0: #endif ferencd@0: #if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) ferencd@0: #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) ferencd@0: #elif defined(__GNUC__) ferencd@0: #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GNUC_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_GNUC_VERSION_CHECK ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_GNUC_VERSION) ferencd@0: #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_MSVC_VERSION) ferencd@0: #undef JSON_HEDLEY_MSVC_VERSION ferencd@0: #endif ferencd@0: #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) ferencd@0: #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100) ferencd@0: #elif defined(_MSC_FULL_VER) ferencd@0: #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10) ferencd@0: #elif defined(_MSC_VER) ferencd@0: #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_MSVC_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_MSVC_VERSION_CHECK ferencd@0: #endif ferencd@0: #if !defined(_MSC_VER) ferencd@0: #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #elif defined(_MSC_VER) && (_MSC_VER >= 1400) ferencd@0: #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) ferencd@0: #elif defined(_MSC_VER) && (_MSC_VER >= 1200) ferencd@0: #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor))) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_INTEL_VERSION) ferencd@0: #undef JSON_HEDLEY_INTEL_VERSION ferencd@0: #endif ferencd@0: #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) ferencd@0: #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE) ferencd@0: #elif defined(__INTEL_COMPILER) ferencd@0: #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_INTEL_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_INTEL_VERSION_CHECK ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_INTEL_VERSION) ferencd@0: #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_PGI_VERSION) ferencd@0: #undef JSON_HEDLEY_PGI_VERSION ferencd@0: #endif ferencd@0: #if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__) ferencd@0: #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_PGI_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_PGI_VERSION_CHECK ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_PGI_VERSION) ferencd@0: #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_SUNPRO_VERSION) ferencd@0: #undef JSON_HEDLEY_SUNPRO_VERSION ferencd@0: #endif ferencd@0: #if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) ferencd@0: #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) ferencd@0: #elif defined(__SUNPRO_C) ferencd@0: #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf) ferencd@0: #elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) ferencd@0: #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) ferencd@0: #elif defined(__SUNPRO_CC) ferencd@0: #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_SUNPRO_VERSION) ferencd@0: #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) ferencd@0: #undef JSON_HEDLEY_EMSCRIPTEN_VERSION ferencd@0: #endif ferencd@0: #if defined(__EMSCRIPTEN__) ferencd@0: #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) ferencd@0: #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_ARM_VERSION) ferencd@0: #undef JSON_HEDLEY_ARM_VERSION ferencd@0: #endif ferencd@0: #if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) ferencd@0: #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100) ferencd@0: #elif defined(__CC_ARM) && defined(__ARMCC_VERSION) ferencd@0: #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_ARM_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_ARM_VERSION_CHECK ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_ARM_VERSION) ferencd@0: #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_IBM_VERSION) ferencd@0: #undef JSON_HEDLEY_IBM_VERSION ferencd@0: #endif ferencd@0: #if defined(__ibmxl__) ferencd@0: #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__) ferencd@0: #elif defined(__xlC__) && defined(__xlC_ver__) ferencd@0: #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff) ferencd@0: #elif defined(__xlC__) ferencd@0: #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_IBM_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_IBM_VERSION_CHECK ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_IBM_VERSION) ferencd@0: #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_TI_VERSION) ferencd@0: #undef JSON_HEDLEY_TI_VERSION ferencd@0: #endif ferencd@0: #if defined(__TI_COMPILER_VERSION__) ferencd@0: #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_TI_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_TI_VERSION_CHECK ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_TI_VERSION) ferencd@0: #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_CRAY_VERSION) ferencd@0: #undef JSON_HEDLEY_CRAY_VERSION ferencd@0: #endif ferencd@0: #if defined(_CRAYC) ferencd@0: #if defined(_RELEASE_PATCHLEVEL) ferencd@0: #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) ferencd@0: #endif ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_CRAY_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_CRAY_VERSION_CHECK ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_CRAY_VERSION) ferencd@0: #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_IAR_VERSION) ferencd@0: #undef JSON_HEDLEY_IAR_VERSION ferencd@0: #endif ferencd@0: #if defined(__IAR_SYSTEMS_ICC__) ferencd@0: #if __VER__ > 1000 ferencd@0: #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(VER / 100, __VER__ % 100, 0) ferencd@0: #endif ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_IAR_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_IAR_VERSION_CHECK ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_IAR_VERSION) ferencd@0: #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_TINYC_VERSION) ferencd@0: #undef JSON_HEDLEY_TINYC_VERSION ferencd@0: #endif ferencd@0: #if defined(__TINYC__) ferencd@0: #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_TINYC_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_TINYC_VERSION_CHECK ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_TINYC_VERSION) ferencd@0: #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_DMC_VERSION) ferencd@0: #undef JSON_HEDLEY_DMC_VERSION ferencd@0: #endif ferencd@0: #if defined(__DMC__) ferencd@0: #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_DMC_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_DMC_VERSION_CHECK ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_DMC_VERSION) ferencd@0: #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_COMPCERT_VERSION) ferencd@0: #undef JSON_HEDLEY_COMPCERT_VERSION ferencd@0: #endif ferencd@0: #if defined(__COMPCERT_VERSION__) ferencd@0: #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_COMPCERT_VERSION) ferencd@0: #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_PELLES_VERSION) ferencd@0: #undef JSON_HEDLEY_PELLES_VERSION ferencd@0: #endif ferencd@0: #if defined(__POCC__) ferencd@0: #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_PELLES_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_PELLES_VERSION_CHECK ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_PELLES_VERSION) ferencd@0: #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GCC_VERSION) ferencd@0: #undef JSON_HEDLEY_GCC_VERSION ferencd@0: #endif ferencd@0: #if \ ferencd@0: defined(JSON_HEDLEY_GNUC_VERSION) && \ ferencd@0: !defined(__clang__) && \ ferencd@0: !defined(JSON_HEDLEY_INTEL_VERSION) && \ ferencd@0: !defined(JSON_HEDLEY_PGI_VERSION) && \ ferencd@0: !defined(JSON_HEDLEY_ARM_VERSION) && \ ferencd@0: !defined(JSON_HEDLEY_TI_VERSION) && \ ferencd@0: !defined(__COMPCERT__) ferencd@0: #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GCC_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_GCC_VERSION_CHECK ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_GCC_VERSION) ferencd@0: #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_HAS_ATTRIBUTE) ferencd@0: #undef JSON_HEDLEY_HAS_ATTRIBUTE ferencd@0: #endif ferencd@0: #if defined(__has_attribute) ferencd@0: #define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE) ferencd@0: #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE ferencd@0: #endif ferencd@0: #if defined(__has_attribute) ferencd@0: #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) __has_attribute(attribute) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE) ferencd@0: #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE ferencd@0: #endif ferencd@0: #if defined(__has_attribute) ferencd@0: #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) __has_attribute(attribute) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE) ferencd@0: #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE ferencd@0: #endif ferencd@0: #if defined(__has_cpp_attribute) && defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE) ferencd@0: #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE ferencd@0: #endif ferencd@0: #if defined(__has_cpp_attribute) && defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE) ferencd@0: #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE ferencd@0: #endif ferencd@0: #if defined(__has_cpp_attribute) && defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_HAS_BUILTIN) ferencd@0: #undef JSON_HEDLEY_HAS_BUILTIN ferencd@0: #endif ferencd@0: #if defined(__has_builtin) ferencd@0: #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN) ferencd@0: #undef JSON_HEDLEY_GNUC_HAS_BUILTIN ferencd@0: #endif ferencd@0: #if defined(__has_builtin) ferencd@0: #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GCC_HAS_BUILTIN) ferencd@0: #undef JSON_HEDLEY_GCC_HAS_BUILTIN ferencd@0: #endif ferencd@0: #if defined(__has_builtin) ferencd@0: #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_HAS_FEATURE) ferencd@0: #undef JSON_HEDLEY_HAS_FEATURE ferencd@0: #endif ferencd@0: #if defined(__has_feature) ferencd@0: #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_HAS_FEATURE(feature) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GNUC_HAS_FEATURE) ferencd@0: #undef JSON_HEDLEY_GNUC_HAS_FEATURE ferencd@0: #endif ferencd@0: #if defined(__has_feature) ferencd@0: #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GCC_HAS_FEATURE) ferencd@0: #undef JSON_HEDLEY_GCC_HAS_FEATURE ferencd@0: #endif ferencd@0: #if defined(__has_feature) ferencd@0: #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_HAS_EXTENSION) ferencd@0: #undef JSON_HEDLEY_HAS_EXTENSION ferencd@0: #endif ferencd@0: #if defined(__has_extension) ferencd@0: #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_HAS_EXTENSION(extension) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION) ferencd@0: #undef JSON_HEDLEY_GNUC_HAS_EXTENSION ferencd@0: #endif ferencd@0: #if defined(__has_extension) ferencd@0: #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GCC_HAS_EXTENSION) ferencd@0: #undef JSON_HEDLEY_GCC_HAS_EXTENSION ferencd@0: #endif ferencd@0: #if defined(__has_extension) ferencd@0: #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE) ferencd@0: #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE ferencd@0: #endif ferencd@0: #if defined(__has_declspec_attribute) ferencd@0: #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE) ferencd@0: #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE ferencd@0: #endif ferencd@0: #if defined(__has_declspec_attribute) ferencd@0: #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) ferencd@0: #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE ferencd@0: #endif ferencd@0: #if defined(__has_declspec_attribute) ferencd@0: #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_HAS_WARNING) ferencd@0: #undef JSON_HEDLEY_HAS_WARNING ferencd@0: #endif ferencd@0: #if defined(__has_warning) ferencd@0: #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_HAS_WARNING(warning) (0) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GNUC_HAS_WARNING) ferencd@0: #undef JSON_HEDLEY_GNUC_HAS_WARNING ferencd@0: #endif ferencd@0: #if defined(__has_warning) ferencd@0: #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GCC_HAS_WARNING) ferencd@0: #undef JSON_HEDLEY_GCC_HAS_WARNING ferencd@0: #endif ferencd@0: #if defined(__has_warning) ferencd@0: #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) ferencd@0: #endif ferencd@0: ferencd@0: #if \ ferencd@0: (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ ferencd@0: defined(__clang__) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ ferencd@0: JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ ferencd@0: JSON_HEDLEY_TI_VERSION_CHECK(6,0,0) || \ ferencd@0: JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \ ferencd@0: JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \ ferencd@0: JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \ ferencd@0: (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR)) ferencd@0: #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value) ferencd@0: #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) ferencd@0: #define JSON_HEDLEY_PRAGMA(value) __pragma(value) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_PRAGMA(value) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH) ferencd@0: #undef JSON_HEDLEY_DIAGNOSTIC_PUSH ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_DIAGNOSTIC_POP) ferencd@0: #undef JSON_HEDLEY_DIAGNOSTIC_POP ferencd@0: #endif ferencd@0: #if defined(__clang__) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") ferencd@0: #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") ferencd@0: #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") ferencd@0: #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push)) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop)) ferencd@0: #elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push") ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop") ferencd@0: #elif JSON_HEDLEY_TI_VERSION_CHECK(8,1,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push") ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop") ferencd@0: #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") ferencd@0: #else ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_PUSH ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_POP ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) ferencd@0: #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED ferencd@0: #endif ferencd@0: #if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") ferencd@0: #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") ferencd@0: #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") ferencd@0: #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") ferencd@0: #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) ferencd@0: #elif JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") ferencd@0: #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") ferencd@0: #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") ferencd@0: #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") ferencd@0: #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") ferencd@0: #else ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) ferencd@0: #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS ferencd@0: #endif ferencd@0: #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") ferencd@0: #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") ferencd@0: #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") ferencd@0: #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") ferencd@0: #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068)) ferencd@0: #elif JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") ferencd@0: #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161") ferencd@0: #else ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL) ferencd@0: #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL ferencd@0: #endif ferencd@0: #if JSON_HEDLEY_HAS_WARNING("-Wcast-qual") ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"") ferencd@0: #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)") ferencd@0: #elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") ferencd@0: #else ferencd@0: #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_DEPRECATED) ferencd@0: #undef JSON_HEDLEY_DEPRECATED ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_DEPRECATED_FOR) ferencd@0: #undef JSON_HEDLEY_DEPRECATED_FOR ferencd@0: #endif ferencd@0: #if defined(__cplusplus) && (__cplusplus >= 201402L) ferencd@0: #define JSON_HEDLEY_DEPRECATED(since) [[deprecated("Since " #since)]] ferencd@0: #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) [[deprecated("Since " #since "; use " #replacement)]] ferencd@0: #elif \ ferencd@0: JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ ferencd@0: JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \ ferencd@0: JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ ferencd@0: JSON_HEDLEY_TI_VERSION_CHECK(8,3,0) ferencd@0: #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since))) ferencd@0: #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) ferencd@0: #elif \ ferencd@0: JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ ferencd@0: JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ ferencd@0: (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) ferencd@0: #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) ferencd@0: #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__)) ferencd@0: #elif JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) ferencd@0: #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) ferencd@0: #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) ferencd@0: #elif \ ferencd@0: JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ ferencd@0: JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) ferencd@0: #define JSON_HEDLEY_DEPRECATED(since) _declspec(deprecated) ferencd@0: #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated) ferencd@0: #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) ferencd@0: #define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated") ferencd@0: #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated") ferencd@0: #else ferencd@0: #define JSON_HEDLEY_DEPRECATED(since) ferencd@0: #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_UNAVAILABLE) ferencd@0: #undef JSON_HEDLEY_UNAVAILABLE ferencd@0: #endif ferencd@0: #if \ ferencd@0: JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) ferencd@0: #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since))) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_UNAVAILABLE(available_since) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_WARN_UNUSED_RESULT) ferencd@0: #undef JSON_HEDLEY_WARN_UNUSED_RESULT ferencd@0: #endif ferencd@0: #if defined(__cplusplus) && (__cplusplus >= 201703L) ferencd@0: #define JSON_HEDLEY_WARN_UNUSED_RESULT [[nodiscard]] ferencd@0: #elif \ ferencd@0: JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ ferencd@0: (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ ferencd@0: (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ ferencd@0: JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) ferencd@0: #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) ferencd@0: #elif defined(_Check_return_) /* SAL */ ferencd@0: #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_ ferencd@0: #else ferencd@0: #define JSON_HEDLEY_WARN_UNUSED_RESULT ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_SENTINEL) ferencd@0: #undef JSON_HEDLEY_SENTINEL ferencd@0: #endif ferencd@0: #if \ ferencd@0: JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) ferencd@0: #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position))) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_SENTINEL(position) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_NO_RETURN) ferencd@0: #undef JSON_HEDLEY_NO_RETURN ferencd@0: #endif ferencd@0: #if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) ferencd@0: #define JSON_HEDLEY_NO_RETURN __noreturn ferencd@0: #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) ferencd@0: #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) ferencd@0: #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L ferencd@0: #define JSON_HEDLEY_NO_RETURN _Noreturn ferencd@0: #elif defined(__cplusplus) && (__cplusplus >= 201103L) ferencd@0: #define JSON_HEDLEY_NO_RETURN [[noreturn]] ferencd@0: #elif \ ferencd@0: JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \ ferencd@0: JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ ferencd@0: JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ ferencd@0: JSON_HEDLEY_TI_VERSION_CHECK(18,0,0) || \ ferencd@0: (JSON_HEDLEY_TI_VERSION_CHECK(17,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) ferencd@0: #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) ferencd@0: #elif JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) ferencd@0: #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) ferencd@0: #elif JSON_HEDLEY_TI_VERSION_CHECK(6,0,0) && defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;") ferencd@0: #elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) ferencd@0: #define JSON_HEDLEY_NO_RETURN __attribute((noreturn)) ferencd@0: #elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) ferencd@0: #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_NO_RETURN ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_UNREACHABLE) ferencd@0: #undef JSON_HEDLEY_UNREACHABLE ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_UNREACHABLE_RETURN) ferencd@0: #undef JSON_HEDLEY_UNREACHABLE_RETURN ferencd@0: #endif ferencd@0: #if \ ferencd@0: (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) ferencd@0: #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable() ferencd@0: #elif JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) ferencd@0: #define JSON_HEDLEY_UNREACHABLE() __assume(0) ferencd@0: #elif JSON_HEDLEY_TI_VERSION_CHECK(6,0,0) ferencd@0: #if defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_UNREACHABLE() std::_nassert(0) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_UNREACHABLE() _nassert(0) ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return value ferencd@0: #elif defined(EXIT_FAILURE) ferencd@0: #define JSON_HEDLEY_UNREACHABLE() abort() ferencd@0: #else ferencd@0: #define JSON_HEDLEY_UNREACHABLE() ferencd@0: #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return value ferencd@0: #endif ferencd@0: #if !defined(JSON_HEDLEY_UNREACHABLE_RETURN) ferencd@0: #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE() ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_ASSUME) ferencd@0: #undef JSON_HEDLEY_ASSUME ferencd@0: #endif ferencd@0: #if \ ferencd@0: JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) ferencd@0: #define JSON_HEDLEY_ASSUME(expr) __assume(expr) ferencd@0: #elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume) ferencd@0: #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr) ferencd@0: #elif JSON_HEDLEY_TI_VERSION_CHECK(6,0,0) ferencd@0: #if defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_ASSUME(expr) _nassert(expr) ferencd@0: #endif ferencd@0: #elif \ ferencd@0: (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && !defined(JSON_HEDLEY_ARM_VERSION)) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) ferencd@0: #define JSON_HEDLEY_ASSUME(expr) ((void) ((expr) ? 1 : (__builtin_unreachable(), 1))) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_ASSUME(expr) ((void) (expr)) ferencd@0: #endif ferencd@0: ferencd@0: ferencd@0: JSON_HEDLEY_DIAGNOSTIC_PUSH ferencd@0: #if \ ferencd@0: JSON_HEDLEY_HAS_WARNING("-Wvariadic-macros") || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) ferencd@0: #if defined(__clang__) ferencd@0: #pragma clang diagnostic ignored "-Wvariadic-macros" ferencd@0: #elif defined(JSON_HEDLEY_GCC_VERSION) ferencd@0: #pragma GCC diagnostic ignored "-Wvariadic-macros" ferencd@0: #endif ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_NON_NULL) ferencd@0: #undef JSON_HEDLEY_NON_NULL ferencd@0: #endif ferencd@0: #if \ ferencd@0: JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) ferencd@0: #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__))) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_NON_NULL(...) ferencd@0: #endif ferencd@0: JSON_HEDLEY_DIAGNOSTIC_POP ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_PRINTF_FORMAT) ferencd@0: #undef JSON_HEDLEY_PRINTF_FORMAT ferencd@0: #endif ferencd@0: #if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO) ferencd@0: #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check))) ferencd@0: #elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO) ferencd@0: #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check))) ferencd@0: #elif \ ferencd@0: JSON_HEDLEY_HAS_ATTRIBUTE(format) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ ferencd@0: JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ ferencd@0: JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ ferencd@0: (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) ferencd@0: #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) ferencd@0: #elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0) ferencd@0: #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_CONSTEXPR) ferencd@0: #undef JSON_HEDLEY_CONSTEXPR ferencd@0: #endif ferencd@0: #if defined(__cplusplus) ferencd@0: #if __cplusplus >= 201103L ferencd@0: #define JSON_HEDLEY_CONSTEXPR constexpr ferencd@0: #endif ferencd@0: #endif ferencd@0: #if !defined(JSON_HEDLEY_CONSTEXPR) ferencd@0: #define JSON_HEDLEY_CONSTEXPR ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_PREDICT) ferencd@0: #undef JSON_HEDLEY_PREDICT ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_LIKELY) ferencd@0: #undef JSON_HEDLEY_LIKELY ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_UNLIKELY) ferencd@0: #undef JSON_HEDLEY_UNLIKELY ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_UNPREDICTABLE) ferencd@0: #undef JSON_HEDLEY_UNPREDICTABLE ferencd@0: #endif ferencd@0: #if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable) ferencd@0: #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable(!!(expr)) ferencd@0: #endif ferencd@0: #if \ ferencd@0: JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) ferencd@0: # define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability(expr, value, probability) ferencd@0: # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1, probability) ferencd@0: # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0, probability) ferencd@0: # define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) ferencd@0: # define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) ferencd@0: #if !defined(JSON_HEDLEY_BUILTIN_UNPREDICTABLE) ferencd@0: #define JSON_HEDLEY_BUILTIN_UNPREDICTABLE(expr) __builtin_expect_with_probability(!!(expr), 1, 0.5) ferencd@0: #endif ferencd@0: #elif \ ferencd@0: JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ ferencd@0: JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ ferencd@0: JSON_HEDLEY_TI_VERSION_CHECK(6,1,0) || \ ferencd@0: JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) ferencd@0: # define JSON_HEDLEY_PREDICT(expr, expected, probability) \ ferencd@0: (((probability) >= 0.9) ? __builtin_expect(!!(expr), (expected)) : (((void) (expected)), !!(expr))) ferencd@0: # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ ferencd@0: (__extension__ ({ \ ferencd@0: JSON_HEDLEY_CONSTEXPR double hedley_probability_ = (probability); \ ferencd@0: ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ ferencd@0: })) ferencd@0: # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ ferencd@0: (__extension__ ({ \ ferencd@0: JSON_HEDLEY_CONSTEXPR double hedley_probability_ = (probability); \ ferencd@0: ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ ferencd@0: })) ferencd@0: # define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) ferencd@0: # define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) ferencd@0: #else ferencd@0: # define JSON_HEDLEY_PREDICT(expr, expected, probability) (((void) (expected)), !!(expr)) ferencd@0: # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr)) ferencd@0: # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) ferencd@0: # define JSON_HEDLEY_LIKELY(expr) (!!(expr)) ferencd@0: # define JSON_HEDLEY_UNLIKELY(expr) (!!(expr)) ferencd@0: #endif ferencd@0: #if !defined(JSON_HEDLEY_UNPREDICTABLE) ferencd@0: #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_MALLOC) ferencd@0: #undef JSON_HEDLEY_MALLOC ferencd@0: #endif ferencd@0: #if \ ferencd@0: JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ ferencd@0: JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ ferencd@0: JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ ferencd@0: (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) ferencd@0: #define JSON_HEDLEY_MALLOC __attribute__((__malloc__)) ferencd@0: #elif JSON_HEDLEY_MSVC_VERSION_CHECK(14, 0, 0) ferencd@0: #define JSON_HEDLEY_MALLOC __declspec(restrict) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_MALLOC ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_PURE) ferencd@0: #undef JSON_HEDLEY_PURE ferencd@0: #endif ferencd@0: #if \ ferencd@0: JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ ferencd@0: JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ ferencd@0: JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ ferencd@0: (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ ferencd@0: JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) ferencd@0: #define JSON_HEDLEY_PURE __attribute__((__pure__)) ferencd@0: #elif JSON_HEDLEY_TI_VERSION_CHECK(6,0,0) && defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;") ferencd@0: #else ferencd@0: #define JSON_HEDLEY_PURE ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_CONST) ferencd@0: #undef JSON_HEDLEY_CONST ferencd@0: #endif ferencd@0: #if \ ferencd@0: JSON_HEDLEY_HAS_ATTRIBUTE(const) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ ferencd@0: JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ ferencd@0: JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ ferencd@0: (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ ferencd@0: JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) ferencd@0: #define JSON_HEDLEY_CONST __attribute__((__const__)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_RESTRICT) ferencd@0: #undef JSON_HEDLEY_RESTRICT ferencd@0: #endif ferencd@0: #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_RESTRICT restrict ferencd@0: #elif \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ ferencd@0: JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ ferencd@0: JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ ferencd@0: JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ ferencd@0: JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ ferencd@0: (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \ ferencd@0: JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ ferencd@0: defined(__clang__) ferencd@0: #define JSON_HEDLEY_RESTRICT __restrict ferencd@0: #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_RESTRICT _Restrict ferencd@0: #else ferencd@0: #define JSON_HEDLEY_RESTRICT ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_INLINE) ferencd@0: #undef JSON_HEDLEY_INLINE ferencd@0: #endif ferencd@0: #if \ ferencd@0: (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ ferencd@0: (defined(__cplusplus) && (__cplusplus >= 199711L)) ferencd@0: #define JSON_HEDLEY_INLINE inline ferencd@0: #elif \ ferencd@0: defined(JSON_HEDLEY_GCC_VERSION) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0) ferencd@0: #define JSON_HEDLEY_INLINE __inline__ ferencd@0: #elif \ ferencd@0: JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ ferencd@0: JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) ferencd@0: #define JSON_HEDLEY_INLINE __inline ferencd@0: #else ferencd@0: #define JSON_HEDLEY_INLINE ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_ALWAYS_INLINE) ferencd@0: #undef JSON_HEDLEY_ALWAYS_INLINE ferencd@0: #endif ferencd@0: #if \ ferencd@0: JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ ferencd@0: JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ ferencd@0: JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ ferencd@0: (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) ferencd@0: #define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE ferencd@0: #elif JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) ferencd@0: #define JSON_HEDLEY_ALWAYS_INLINE __forceinline ferencd@0: #elif JSON_HEDLEY_TI_VERSION_CHECK(7,0,0) && defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") ferencd@0: #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) ferencd@0: #define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") ferencd@0: #else ferencd@0: #define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_NEVER_INLINE) ferencd@0: #undef JSON_HEDLEY_NEVER_INLINE ferencd@0: #endif ferencd@0: #if \ ferencd@0: JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ ferencd@0: JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ ferencd@0: JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ ferencd@0: (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) ferencd@0: #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__)) ferencd@0: #elif JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) ferencd@0: #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) ferencd@0: #elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0) ferencd@0: #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline") ferencd@0: #elif JSON_HEDLEY_TI_VERSION_CHECK(6,0,0) && defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;") ferencd@0: #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) ferencd@0: #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never") ferencd@0: #elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) ferencd@0: #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline)) ferencd@0: #elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) ferencd@0: #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_NEVER_INLINE ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_PRIVATE) ferencd@0: #undef JSON_HEDLEY_PRIVATE ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_PUBLIC) ferencd@0: #undef JSON_HEDLEY_PUBLIC ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_IMPORT) ferencd@0: #undef JSON_HEDLEY_IMPORT ferencd@0: #endif ferencd@0: #if defined(_WIN32) || defined(__CYGWIN__) ferencd@0: #define JSON_HEDLEY_PRIVATE ferencd@0: #define JSON_HEDLEY_PUBLIC __declspec(dllexport) ferencd@0: #define JSON_HEDLEY_IMPORT __declspec(dllimport) ferencd@0: #else ferencd@0: #if \ ferencd@0: JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ ferencd@0: JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ ferencd@0: JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ ferencd@0: JSON_HEDLEY_TI_VERSION_CHECK(8,0,0) || \ ferencd@0: (JSON_HEDLEY_TI_VERSION_CHECK(7,3,0) && defined(__TI_EABI__) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) ferencd@0: #define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) ferencd@0: #define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default"))) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_PRIVATE ferencd@0: #define JSON_HEDLEY_PUBLIC ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_IMPORT extern ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_NO_THROW) ferencd@0: #undef JSON_HEDLEY_NO_THROW ferencd@0: #endif ferencd@0: #if \ ferencd@0: JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) ferencd@0: #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__)) ferencd@0: #elif \ ferencd@0: JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) ferencd@0: #define JSON_HEDLEY_NO_THROW __declspec(nothrow) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_NO_THROW ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_FALL_THROUGH) ferencd@0: #undef JSON_HEDLEY_FALL_THROUGH ferencd@0: #endif ferencd@0: #if \ ferencd@0: defined(__cplusplus) && \ ferencd@0: (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \ ferencd@0: !defined(JSON_HEDLEY_PGI_VERSION) ferencd@0: #if \ ferencd@0: (__cplusplus >= 201703L) || \ ferencd@0: ((__cplusplus >= 201103L) && JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough)) ferencd@0: #define JSON_HEDLEY_FALL_THROUGH [[fallthrough]] ferencd@0: #elif (__cplusplus >= 201103L) && JSON_HEDLEY_HAS_CPP_ATTRIBUTE(clang::fallthrough) ferencd@0: #define JSON_HEDLEY_FALL_THROUGH [[clang::fallthrough]] ferencd@0: #elif (__cplusplus >= 201103L) && JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) ferencd@0: #define JSON_HEDLEY_FALL_THROUGH [[gnu::fallthrough]] ferencd@0: #endif ferencd@0: #endif ferencd@0: #if !defined(JSON_HEDLEY_FALL_THROUGH) ferencd@0: #if JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(fallthrough,7,0,0) && !defined(JSON_HEDLEY_PGI_VERSION) ferencd@0: #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) ferencd@0: #elif defined(__fallthrough) /* SAL */ ferencd@0: #define JSON_HEDLEY_FALL_THROUGH __fallthrough ferencd@0: #else ferencd@0: #define JSON_HEDLEY_FALL_THROUGH ferencd@0: #endif ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_RETURNS_NON_NULL) ferencd@0: #undef JSON_HEDLEY_RETURNS_NON_NULL ferencd@0: #endif ferencd@0: #if \ ferencd@0: JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) ferencd@0: #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__)) ferencd@0: #elif defined(_Ret_notnull_) /* SAL */ ferencd@0: #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_ ferencd@0: #else ferencd@0: #define JSON_HEDLEY_RETURNS_NON_NULL ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_ARRAY_PARAM) ferencd@0: #undef JSON_HEDLEY_ARRAY_PARAM ferencd@0: #endif ferencd@0: #if \ ferencd@0: defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ ferencd@0: !defined(__STDC_NO_VLA__) && \ ferencd@0: !defined(__cplusplus) && \ ferencd@0: !defined(JSON_HEDLEY_PGI_VERSION) && \ ferencd@0: !defined(JSON_HEDLEY_TINYC_VERSION) ferencd@0: #define JSON_HEDLEY_ARRAY_PARAM(name) (name) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_ARRAY_PARAM(name) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_IS_CONSTANT) ferencd@0: #undef JSON_HEDLEY_IS_CONSTANT ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR) ferencd@0: #undef JSON_HEDLEY_REQUIRE_CONSTEXPR ferencd@0: #endif ferencd@0: /* Note the double-underscore. For internal use only; no API ferencd@0: * guarantees! */ ferencd@0: #if defined(JSON_HEDLEY__IS_CONSTEXPR) ferencd@0: #undef JSON_HEDLEY__IS_CONSTEXPR ferencd@0: #endif ferencd@0: ferencd@0: #if \ ferencd@0: JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ ferencd@0: JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ ferencd@0: JSON_HEDLEY_TI_VERSION_CHECK(6,1,0) || \ ferencd@0: JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) || \ ferencd@0: JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) ferencd@0: #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr) ferencd@0: #endif ferencd@0: #if !defined(__cplusplus) ferencd@0: # if \ ferencd@0: JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ ferencd@0: JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ ferencd@0: JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24) ferencd@0: #if defined(__INTPTR_TYPE__) ferencd@0: #define JSON_HEDLEY__IS_CONSTEXPR(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*) ferencd@0: #else ferencd@0: #include ferencd@0: #define JSON_HEDLEY__IS_CONSTEXPR(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*) ferencd@0: #endif ferencd@0: # elif \ ferencd@0: (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && !defined(JSON_HEDLEY_SUNPRO_VERSION) && !defined(JSON_HEDLEY_PGI_VERSION)) || \ ferencd@0: JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \ ferencd@0: JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ ferencd@0: JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0) ferencd@0: #if defined(__INTPTR_TYPE__) ferencd@0: #define JSON_HEDLEY__IS_CONSTEXPR(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0) ferencd@0: #else ferencd@0: #include ferencd@0: #define JSON_HEDLEY__IS_CONSTEXPR(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0) ferencd@0: #endif ferencd@0: # elif \ ferencd@0: defined(JSON_HEDLEY_GCC_VERSION) || \ ferencd@0: defined(JSON_HEDLEY_INTEL_VERSION) || \ ferencd@0: defined(JSON_HEDLEY_TINYC_VERSION) || \ ferencd@0: defined(JSON_HEDLEY_TI_VERSION) || \ ferencd@0: defined(__clang__) ferencd@0: # define JSON_HEDLEY__IS_CONSTEXPR(expr) ( \ ferencd@0: sizeof(void) != \ ferencd@0: sizeof(*( \ ferencd@0: 1 ? \ ferencd@0: ((void*) ((expr) * 0L) ) : \ ferencd@0: ((struct { char v[sizeof(void) * 2]; } *) 1) \ ferencd@0: ) \ ferencd@0: ) \ ferencd@0: ) ferencd@0: # endif ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY__IS_CONSTEXPR) ferencd@0: #if !defined(JSON_HEDLEY_IS_CONSTANT) ferencd@0: #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY__IS_CONSTEXPR(expr) ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY__IS_CONSTEXPR(expr) ? (expr) : (-1)) ferencd@0: #else ferencd@0: #if !defined(JSON_HEDLEY_IS_CONSTANT) ferencd@0: #define JSON_HEDLEY_IS_CONSTANT(expr) (0) ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_BEGIN_C_DECLS) ferencd@0: #undef JSON_HEDLEY_BEGIN_C_DECLS ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_END_C_DECLS) ferencd@0: #undef JSON_HEDLEY_END_C_DECLS ferencd@0: #endif ferencd@0: #if defined(JSON_HEDLEY_C_DECL) ferencd@0: #undef JSON_HEDLEY_C_DECL ferencd@0: #endif ferencd@0: #if defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_BEGIN_C_DECLS extern "C" { ferencd@0: #define JSON_HEDLEY_END_C_DECLS } ferencd@0: #define JSON_HEDLEY_C_DECL extern "C" ferencd@0: #else ferencd@0: #define JSON_HEDLEY_BEGIN_C_DECLS ferencd@0: #define JSON_HEDLEY_END_C_DECLS ferencd@0: #define JSON_HEDLEY_C_DECL ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_STATIC_ASSERT) ferencd@0: #undef JSON_HEDLEY_STATIC_ASSERT ferencd@0: #endif ferencd@0: #if \ ferencd@0: !defined(__cplusplus) && ( \ ferencd@0: (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ ferencd@0: JSON_HEDLEY_HAS_FEATURE(c_static_assert) || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ ferencd@0: defined(_Static_assert) \ ferencd@0: ) ferencd@0: # define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message) ferencd@0: #elif \ ferencd@0: (defined(__cplusplus) && (__cplusplus >= 201703L)) || \ ferencd@0: JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \ ferencd@0: (defined(__cplusplus) && JSON_HEDLEY_TI_VERSION_CHECK(8,3,0)) ferencd@0: # define JSON_HEDLEY_STATIC_ASSERT(expr, message) static_assert(expr, message) ferencd@0: #elif defined(__cplusplus) && (__cplusplus >= 201103L) ferencd@0: # define JSON_HEDLEY_STATIC_ASSERT(expr, message) static_assert(expr) ferencd@0: #else ferencd@0: # define JSON_HEDLEY_STATIC_ASSERT(expr, message) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_CONST_CAST) ferencd@0: #undef JSON_HEDLEY_CONST_CAST ferencd@0: #endif ferencd@0: #if defined(__cplusplus) ferencd@0: # define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast(expr)) ferencd@0: #elif \ ferencd@0: JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) ferencd@0: # define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ ferencd@0: JSON_HEDLEY_DIAGNOSTIC_PUSH \ ferencd@0: JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ ferencd@0: ((T) (expr)); \ ferencd@0: JSON_HEDLEY_DIAGNOSTIC_POP \ ferencd@0: })) ferencd@0: #else ferencd@0: # define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr)) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_REINTERPRET_CAST) ferencd@0: #undef JSON_HEDLEY_REINTERPRET_CAST ferencd@0: #endif ferencd@0: #if defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast(expr)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (*((T*) &(expr))) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_STATIC_CAST) ferencd@0: #undef JSON_HEDLEY_STATIC_CAST ferencd@0: #endif ferencd@0: #if defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast(expr)) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_CPP_CAST) ferencd@0: #undef JSON_HEDLEY_CPP_CAST ferencd@0: #endif ferencd@0: #if defined(__cplusplus) ferencd@0: #define JSON_HEDLEY_CPP_CAST(T, expr) static_cast(expr) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_CPP_CAST(T, expr) (expr) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_MESSAGE) ferencd@0: #undef JSON_HEDLEY_MESSAGE ferencd@0: #endif ferencd@0: #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") ferencd@0: # define JSON_HEDLEY_MESSAGE(msg) \ ferencd@0: JSON_HEDLEY_DIAGNOSTIC_PUSH \ ferencd@0: JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ ferencd@0: JSON_HEDLEY_PRAGMA(message msg) \ ferencd@0: JSON_HEDLEY_DIAGNOSTIC_POP ferencd@0: #elif \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \ ferencd@0: JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) ferencd@0: # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg) ferencd@0: #elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) ferencd@0: # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg) ferencd@0: #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) ferencd@0: # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) ferencd@0: #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0) ferencd@0: # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) ferencd@0: #else ferencd@0: # define JSON_HEDLEY_MESSAGE(msg) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_WARNING) ferencd@0: #undef JSON_HEDLEY_WARNING ferencd@0: #endif ferencd@0: #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") ferencd@0: # define JSON_HEDLEY_WARNING(msg) \ ferencd@0: JSON_HEDLEY_DIAGNOSTIC_PUSH \ ferencd@0: JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ ferencd@0: JSON_HEDLEY_PRAGMA(clang warning msg) \ ferencd@0: JSON_HEDLEY_DIAGNOSTIC_POP ferencd@0: #elif \ ferencd@0: JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \ ferencd@0: JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) ferencd@0: # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg) ferencd@0: #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) ferencd@0: # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg)) ferencd@0: #else ferencd@0: # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_REQUIRE_MSG) ferencd@0: #undef JSON_HEDLEY_REQUIRE_MSG ferencd@0: #endif ferencd@0: #if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if) ferencd@0: # if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat") ferencd@0: # define JSON_HEDLEY_REQUIRE_MSG(expr, msg) \ ferencd@0: JSON_HEDLEY_DIAGNOSTIC_PUSH \ ferencd@0: _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ ferencd@0: __attribute__((__diagnose_if__(!(expr), msg, "error"))) \ ferencd@0: JSON_HEDLEY_DIAGNOSTIC_POP ferencd@0: # else ferencd@0: # define JSON_HEDLEY_REQUIRE_MSG(expr, msg) __attribute__((__diagnose_if__(!(expr), msg, "error"))) ferencd@0: # endif ferencd@0: #else ferencd@0: # define JSON_HEDLEY_REQUIRE_MSG(expr, msg) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_REQUIRE) ferencd@0: #undef JSON_HEDLEY_REQUIRE ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_REQUIRE(expr) JSON_HEDLEY_REQUIRE_MSG(expr, #expr) ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_FLAGS) ferencd@0: #undef JSON_HEDLEY_FLAGS ferencd@0: #endif ferencd@0: #if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) ferencd@0: #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__)) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_FLAGS_CAST) ferencd@0: #undef JSON_HEDLEY_FLAGS_CAST ferencd@0: #endif ferencd@0: #if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0) ferencd@0: # define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \ ferencd@0: JSON_HEDLEY_DIAGNOSTIC_PUSH \ ferencd@0: _Pragma("warning(disable:188)") \ ferencd@0: ((T) (expr)); \ ferencd@0: JSON_HEDLEY_DIAGNOSTIC_POP \ ferencd@0: })) ferencd@0: #else ferencd@0: # define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr) ferencd@0: #endif ferencd@0: ferencd@0: /* Remaining macros are deprecated. */ ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) ferencd@0: #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK ferencd@0: #endif ferencd@0: #if defined(__clang__) ferencd@0: #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0) ferencd@0: #else ferencd@0: #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) ferencd@0: #endif ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE) ferencd@0: #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) ferencd@0: #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN) ferencd@0: #undef JSON_HEDLEY_CLANG_HAS_BUILTIN ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin) ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_CLANG_HAS_FEATURE) ferencd@0: #undef JSON_HEDLEY_CLANG_HAS_FEATURE ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature) ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION) ferencd@0: #undef JSON_HEDLEY_CLANG_HAS_EXTENSION ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension) ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) ferencd@0: #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) ferencd@0: ferencd@0: #if defined(JSON_HEDLEY_CLANG_HAS_WARNING) ferencd@0: #undef JSON_HEDLEY_CLANG_HAS_WARNING ferencd@0: #endif ferencd@0: #define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning) ferencd@0: ferencd@0: #endif /* !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < X) */ ferencd@0: ferencd@0: ferencd@0: // This file contains all internal macro definitions ferencd@0: // You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them ferencd@0: ferencd@0: // exclude unsupported compilers ferencd@0: #if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) ferencd@0: #if defined(__clang__) ferencd@0: #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 ferencd@0: #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" ferencd@0: #endif ferencd@0: #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) ferencd@0: #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 ferencd@0: #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" ferencd@0: #endif ferencd@0: #endif ferencd@0: #endif ferencd@0: ferencd@0: // C++ language standard detection ferencd@0: #if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 ferencd@0: #define JSON_HAS_CPP_17 ferencd@0: #define JSON_HAS_CPP_14 ferencd@0: #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) ferencd@0: #define JSON_HAS_CPP_14 ferencd@0: #endif ferencd@0: ferencd@0: // disable float-equal warnings on GCC/clang ferencd@0: #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) ferencd@0: #pragma GCC diagnostic push ferencd@0: #pragma GCC diagnostic ignored "-Wfloat-equal" ferencd@0: #endif ferencd@0: ferencd@0: // disable documentation warnings on clang ferencd@0: #if defined(__clang__) ferencd@0: #pragma GCC diagnostic push ferencd@0: #pragma GCC diagnostic ignored "-Wdocumentation" ferencd@0: #endif ferencd@0: ferencd@0: // allow to disable exceptions ferencd@0: #if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) ferencd@0: #define JSON_THROW(exception) throw exception ferencd@0: #define JSON_TRY try ferencd@0: #define JSON_CATCH(exception) catch(exception) ferencd@0: #define JSON_INTERNAL_CATCH(exception) catch(exception) ferencd@0: #else ferencd@0: #include ferencd@0: #define JSON_THROW(exception) std::abort() ferencd@0: #define JSON_TRY if(true) ferencd@0: #define JSON_CATCH(exception) if(false) ferencd@0: #define JSON_INTERNAL_CATCH(exception) if(false) ferencd@0: #endif ferencd@0: ferencd@0: // override exception macros ferencd@0: #if defined(JSON_THROW_USER) ferencd@0: #undef JSON_THROW ferencd@0: #define JSON_THROW JSON_THROW_USER ferencd@0: #endif ferencd@0: #if defined(JSON_TRY_USER) ferencd@0: #undef JSON_TRY ferencd@0: #define JSON_TRY JSON_TRY_USER ferencd@0: #endif ferencd@0: #if defined(JSON_CATCH_USER) ferencd@0: #undef JSON_CATCH ferencd@0: #define JSON_CATCH JSON_CATCH_USER ferencd@0: #undef JSON_INTERNAL_CATCH ferencd@0: #define JSON_INTERNAL_CATCH JSON_CATCH_USER ferencd@0: #endif ferencd@0: #if defined(JSON_INTERNAL_CATCH_USER) ferencd@0: #undef JSON_INTERNAL_CATCH ferencd@0: #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER ferencd@0: #endif ferencd@0: ferencd@0: /*! ferencd@0: @brief macro to briefly define a mapping between an enum and JSON ferencd@0: @def NLOHMANN_JSON_SERIALIZE_ENUM ferencd@0: @since version 3.4.0 ferencd@0: */ ferencd@0: #define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ ferencd@0: template \ ferencd@0: inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \ ferencd@0: { \ ferencd@0: static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ ferencd@0: static const std::pair m[] = __VA_ARGS__; \ ferencd@0: auto it = std::find_if(std::begin(m), std::end(m), \ ferencd@0: [e](const std::pair& ej_pair) -> bool \ ferencd@0: { \ ferencd@0: return ej_pair.first == e; \ ferencd@0: }); \ ferencd@0: j = ((it != std::end(m)) ? it : std::begin(m))->second; \ ferencd@0: } \ ferencd@0: template \ ferencd@0: inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \ ferencd@0: { \ ferencd@0: static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ ferencd@0: static const std::pair m[] = __VA_ARGS__; \ ferencd@0: auto it = std::find_if(std::begin(m), std::end(m), \ ferencd@0: [j](const std::pair& ej_pair) -> bool \ ferencd@0: { \ ferencd@0: return ej_pair.second == j; \ ferencd@0: }); \ ferencd@0: e = ((it != std::end(m)) ? it : std::begin(m))->first; \ ferencd@0: } ferencd@0: ferencd@0: // Ugly macros to avoid uglier copy-paste when specializing basic_json. They ferencd@0: // may be removed in the future once the class is split. ferencd@0: ferencd@0: #define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ ferencd@0: template class ObjectType, \ ferencd@0: template class ArrayType, \ ferencd@0: class StringType, class BooleanType, class NumberIntegerType, \ ferencd@0: class NumberUnsignedType, class NumberFloatType, \ ferencd@0: template class AllocatorType, \ ferencd@0: template class JSONSerializer> ferencd@0: ferencd@0: #define NLOHMANN_BASIC_JSON_TPL \ ferencd@0: basic_json ferencd@0: ferencd@0: ferencd@0: namespace nlohmann ferencd@0: { ferencd@0: namespace detail ferencd@0: { ferencd@0: //////////////// ferencd@0: // exceptions // ferencd@0: //////////////// ferencd@0: ferencd@0: /*! ferencd@0: @brief general exception of the @ref basic_json class ferencd@0: ferencd@0: This class is an extension of `std::exception` objects with a member @a id for ferencd@0: exception ids. It is used as the base class for all exceptions thrown by the ferencd@0: @ref basic_json class. This class can hence be used as "wildcard" to catch ferencd@0: exceptions. ferencd@0: ferencd@0: Subclasses: ferencd@0: - @ref parse_error for exceptions indicating a parse error ferencd@0: - @ref invalid_iterator for exceptions indicating errors with iterators ferencd@0: - @ref type_error for exceptions indicating executing a member function with ferencd@0: a wrong type ferencd@0: - @ref out_of_range for exceptions indicating access out of the defined range ferencd@0: - @ref other_error for exceptions indicating other library errors ferencd@0: ferencd@0: @internal ferencd@0: @note To have nothrow-copy-constructible exceptions, we internally use ferencd@0: `std::runtime_error` which can cope with arbitrary-length error messages. ferencd@0: Intermediate strings are built with static functions and then passed to ferencd@0: the actual constructor. ferencd@0: @endinternal ferencd@0: ferencd@0: @liveexample{The following code shows how arbitrary library exceptions can be ferencd@0: caught.,exception} ferencd@0: ferencd@0: @since version 3.0.0 ferencd@0: */ ferencd@0: class exception : public std::exception ferencd@0: { ferencd@0: public: ferencd@0: /// returns the explanatory string ferencd@0: JSON_HEDLEY_RETURNS_NON_NULL ferencd@0: const char* what() const noexcept override ferencd@0: { ferencd@0: return m.what(); ferencd@0: } ferencd@0: ferencd@0: /// the id of the exception ferencd@0: const int id; ferencd@0: ferencd@0: protected: ferencd@0: JSON_HEDLEY_NON_NULL(3) ferencd@0: exception(int id_, const char* what_arg) : id(id_), m(what_arg) {} ferencd@0: ferencd@0: static std::string name(const std::string& ename, int id_) ferencd@0: { ferencd@0: return "[json.exception." + ename + "." + std::to_string(id_) + "] "; ferencd@0: } ferencd@0: ferencd@0: private: ferencd@0: /// an exception object as storage for error messages ferencd@0: std::runtime_error m; ferencd@0: }; ferencd@0: ferencd@0: /*! ferencd@0: @brief exception indicating a parse error ferencd@0: ferencd@0: This exception is thrown by the library when a parse error occurs. Parse errors ferencd@0: can occur during the deserialization of JSON text, CBOR, MessagePack, as well ferencd@0: as when using JSON Patch. ferencd@0: ferencd@0: Member @a byte holds the byte index of the last read character in the input ferencd@0: file. ferencd@0: ferencd@0: Exceptions have ids 1xx. ferencd@0: ferencd@0: name / id | example message | description ferencd@0: ------------------------------ | --------------- | ------------------------- ferencd@0: json.exception.parse_error.101 | parse error at 2: unexpected end of input; expected string literal | This error indicates a syntax error while deserializing a JSON text. The error message describes that an unexpected token (character) was encountered, and the member @a byte indicates the error position. ferencd@0: json.exception.parse_error.102 | parse error at 14: missing or wrong low surrogate | JSON uses the `\uxxxx` format to describe Unicode characters. Code points above above 0xFFFF are split into two `\uxxxx` entries ("surrogate pairs"). This error indicates that the surrogate pair is incomplete or contains an invalid code point. ferencd@0: json.exception.parse_error.103 | parse error: code points above 0x10FFFF are invalid | Unicode supports code points up to 0x10FFFF. Code points above 0x10FFFF are invalid. ferencd@0: json.exception.parse_error.104 | parse error: JSON patch must be an array of objects | [RFC 6902](https://tools.ietf.org/html/rfc6902) requires a JSON Patch document to be a JSON document that represents an array of objects. ferencd@0: json.exception.parse_error.105 | parse error: operation must have string member 'op' | An operation of a JSON Patch document must contain exactly one "op" member, whose value indicates the operation to perform. Its value must be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors. ferencd@0: json.exception.parse_error.106 | parse error: array index '01' must not begin with '0' | An array index in a JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) may be `0` or any number without a leading `0`. ferencd@0: json.exception.parse_error.107 | parse error: JSON pointer must be empty or begin with '/' - was: 'foo' | A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a `/` character. ferencd@0: json.exception.parse_error.108 | parse error: escape character '~' must be followed with '0' or '1' | In a JSON Pointer, only `~0` and `~1` are valid escape sequences. ferencd@0: json.exception.parse_error.109 | parse error: array index 'one' is not a number | A JSON Pointer array index must be a number. ferencd@0: json.exception.parse_error.110 | parse error at 1: cannot read 2 bytes from vector | When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read. ferencd@0: json.exception.parse_error.112 | parse error at 1: error reading CBOR; last byte: 0xF8 | Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read. ferencd@0: json.exception.parse_error.113 | parse error at 2: expected a CBOR string; last byte: 0x98 | While parsing a map key, a value that is not a string has been read. ferencd@0: json.exception.parse_error.114 | parse error: Unsupported BSON record type 0x0F | The parsing of the corresponding BSON record type is not implemented (yet). ferencd@0: ferencd@0: @note For an input with n bytes, 1 is the index of the first character and n+1 ferencd@0: is the index of the terminating null byte or the end of file. This also ferencd@0: holds true when reading a byte vector (CBOR or MessagePack). ferencd@0: ferencd@0: @liveexample{The following code shows how a `parse_error` exception can be ferencd@0: caught.,parse_error} ferencd@0: ferencd@0: @sa - @ref exception for the base class of the library exceptions ferencd@0: @sa - @ref invalid_iterator for exceptions indicating errors with iterators ferencd@0: @sa - @ref type_error for exceptions indicating executing a member function with ferencd@0: a wrong type ferencd@0: @sa - @ref out_of_range for exceptions indicating access out of the defined range ferencd@0: @sa - @ref other_error for exceptions indicating other library errors ferencd@0: ferencd@0: @since version 3.0.0 ferencd@0: */ ferencd@0: class parse_error : public exception ferencd@0: { ferencd@0: public: ferencd@0: /*! ferencd@0: @brief create a parse error exception ferencd@0: @param[in] id_ the id of the exception ferencd@0: @param[in] pos the position where the error occurred (or with ferencd@0: chars_read_total=0 if the position cannot be ferencd@0: determined) ferencd@0: @param[in] what_arg the explanatory string ferencd@0: @return parse_error object ferencd@0: */ ferencd@0: static parse_error create(int id_, const position_t& pos, const std::string& what_arg) ferencd@0: { ferencd@0: std::string w = exception::name("parse_error", id_) + "parse error" + ferencd@0: position_string(pos) + ": " + what_arg; ferencd@0: return parse_error(id_, pos.chars_read_total, w.c_str()); ferencd@0: } ferencd@0: ferencd@0: static parse_error create(int id_, std::size_t byte_, const std::string& what_arg) ferencd@0: { ferencd@0: std::string w = exception::name("parse_error", id_) + "parse error" + ferencd@0: (byte_ != 0 ? (" at byte " + std::to_string(byte_)) : "") + ferencd@0: ": " + what_arg; ferencd@0: return parse_error(id_, byte_, w.c_str()); ferencd@0: } ferencd@0: ferencd@0: /*! ferencd@0: @brief byte index of the parse error ferencd@0: ferencd@0: The byte index of the last read character in the input file. ferencd@0: ferencd@0: @note For an input with n bytes, 1 is the index of the first character and ferencd@0: n+1 is the index of the terminating null byte or the end of file. ferencd@0: This also holds true when reading a byte vector (CBOR or MessagePack). ferencd@0: */ ferencd@0: const std::size_t byte; ferencd@0: ferencd@0: private: ferencd@0: parse_error(int id_, std::size_t byte_, const char* what_arg) ferencd@0: : exception(id_, what_arg), byte(byte_) {} ferencd@0: ferencd@0: static std::string position_string(const position_t& pos) ferencd@0: { ferencd@0: return " at line " + std::to_string(pos.lines_read + 1) + ferencd@0: ", column " + std::to_string(pos.chars_read_current_line); ferencd@0: } ferencd@0: }; ferencd@0: ferencd@0: /*! ferencd@0: @brief exception indicating errors with iterators ferencd@0: ferencd@0: This exception is thrown if iterators passed to a library function do not match ferencd@0: the expected semantics. ferencd@0: ferencd@0: Exceptions have ids 2xx. ferencd@0: ferencd@0: name / id | example message | description ferencd@0: ----------------------------------- | --------------- | ------------------------- ferencd@0: json.exception.invalid_iterator.201 | iterators are not compatible | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid. ferencd@0: json.exception.invalid_iterator.202 | iterator does not fit current value | In an erase or insert function, the passed iterator @a pos does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion. ferencd@0: json.exception.invalid_iterator.203 | iterators do not fit current value | Either iterator passed to function @ref erase(IteratorType first, IteratorType last) does not belong to the JSON value from which values shall be erased. It hence does not define a valid range to delete values from. ferencd@0: json.exception.invalid_iterator.204 | iterators out of range | When an iterator range for a primitive type (number, boolean, or string) is passed to a constructor or an erase function, this range has to be exactly (@ref begin(), @ref end()), because this is the only way the single stored value is expressed. All other ranges are invalid. ferencd@0: json.exception.invalid_iterator.205 | iterator out of range | When an iterator for a primitive type (number, boolean, or string) is passed to an erase function, the iterator has to be the @ref begin() iterator, because it is the only way to address the stored value. All other iterators are invalid. ferencd@0: json.exception.invalid_iterator.206 | cannot construct with iterators from null | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) belong to a JSON null value and hence to not define a valid range. ferencd@0: json.exception.invalid_iterator.207 | cannot use key() for non-object iterators | The key() member function can only be used on iterators belonging to a JSON object, because other types do not have a concept of a key. ferencd@0: json.exception.invalid_iterator.208 | cannot use operator[] for object iterators | The operator[] to specify a concrete offset cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. ferencd@0: json.exception.invalid_iterator.209 | cannot use offsets with object iterators | The offset operators (+, -, +=, -=) cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. ferencd@0: json.exception.invalid_iterator.210 | iterators do not fit | The iterator range passed to the insert function are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid. ferencd@0: json.exception.invalid_iterator.211 | passed iterators may not belong to container | The iterator range passed to the insert function must not be a subrange of the container to insert to. ferencd@0: json.exception.invalid_iterator.212 | cannot compare iterators of different containers | When two iterators are compared, they must belong to the same container. ferencd@0: json.exception.invalid_iterator.213 | cannot compare order of object iterators | The order of object iterators cannot be compared, because JSON objects are unordered. ferencd@0: json.exception.invalid_iterator.214 | cannot get value | Cannot get value for iterator: Either the iterator belongs to a null value or it is an iterator to a primitive type (number, boolean, or string), but the iterator is different to @ref begin(). ferencd@0: ferencd@0: @liveexample{The following code shows how an `invalid_iterator` exception can be ferencd@0: caught.,invalid_iterator} ferencd@0: ferencd@0: @sa - @ref exception for the base class of the library exceptions ferencd@0: @sa - @ref parse_error for exceptions indicating a parse error ferencd@0: @sa - @ref type_error for exceptions indicating executing a member function with ferencd@0: a wrong type ferencd@0: @sa - @ref out_of_range for exceptions indicating access out of the defined range ferencd@0: @sa - @ref other_error for exceptions indicating other library errors ferencd@0: ferencd@0: @since version 3.0.0 ferencd@0: */ ferencd@0: class invalid_iterator : public exception ferencd@0: { ferencd@0: public: ferencd@0: static invalid_iterator create(int id_, const std::string& what_arg) ferencd@0: { ferencd@0: std::string w = exception::name("invalid_iterator", id_) + what_arg; ferencd@0: return invalid_iterator(id_, w.c_str()); ferencd@0: } ferencd@0: ferencd@0: private: ferencd@0: JSON_HEDLEY_NON_NULL(3) ferencd@0: invalid_iterator(int id_, const char* what_arg) ferencd@0: : exception(id_, what_arg) {} ferencd@0: }; ferencd@0: ferencd@0: /*! ferencd@0: @brief exception indicating executing a member function with a wrong type ferencd@0: ferencd@0: This exception is thrown in case of a type error; that is, a library function is ferencd@0: executed on a JSON value whose type does not match the expected semantics. ferencd@0: ferencd@0: Exceptions have ids 3xx. ferencd@0: ferencd@0: name / id | example message | description ferencd@0: ----------------------------- | --------------- | ------------------------- ferencd@0: json.exception.type_error.301 | cannot create object from initializer list | To create an object from an initializer list, the initializer list must consist only of a list of pairs whose first element is a string. When this constraint is violated, an array is created instead. ferencd@0: json.exception.type_error.302 | type must be object, but is array | During implicit or explicit value conversion, the JSON type must be compatible to the target type. For instance, a JSON string can only be converted into string types, but not into numbers or boolean types. ferencd@0: json.exception.type_error.303 | incompatible ReferenceType for get_ref, actual type is object | To retrieve a reference to a value stored in a @ref basic_json object with @ref get_ref, the type of the reference must match the value type. For instance, for a JSON array, the @a ReferenceType must be @ref array_t &. ferencd@0: json.exception.type_error.304 | cannot use at() with string | The @ref at() member functions can only be executed for certain JSON types. ferencd@0: json.exception.type_error.305 | cannot use operator[] with string | The @ref operator[] member functions can only be executed for certain JSON types. ferencd@0: json.exception.type_error.306 | cannot use value() with string | The @ref value() member functions can only be executed for certain JSON types. ferencd@0: json.exception.type_error.307 | cannot use erase() with string | The @ref erase() member functions can only be executed for certain JSON types. ferencd@0: json.exception.type_error.308 | cannot use push_back() with string | The @ref push_back() and @ref operator+= member functions can only be executed for certain JSON types. ferencd@0: json.exception.type_error.309 | cannot use insert() with | The @ref insert() member functions can only be executed for certain JSON types. ferencd@0: json.exception.type_error.310 | cannot use swap() with number | The @ref swap() member functions can only be executed for certain JSON types. ferencd@0: json.exception.type_error.311 | cannot use emplace_back() with string | The @ref emplace_back() member function can only be executed for certain JSON types. ferencd@0: json.exception.type_error.312 | cannot use update() with string | The @ref update() member functions can only be executed for certain JSON types. ferencd@0: json.exception.type_error.313 | invalid value to unflatten | The @ref unflatten function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well defined. ferencd@0: json.exception.type_error.314 | only objects can be unflattened | The @ref unflatten function only works for an object whose keys are JSON Pointers. ferencd@0: json.exception.type_error.315 | values in object must be primitive | The @ref unflatten function only works for an object whose keys are JSON Pointers and whose values are primitive. ferencd@0: json.exception.type_error.316 | invalid UTF-8 byte at index 10: 0x7E | The @ref dump function only works with UTF-8 encoded strings; that is, if you assign a `std::string` to a JSON value, make sure it is UTF-8 encoded. | ferencd@0: json.exception.type_error.317 | JSON value cannot be serialized to requested format | The dynamic type of the object cannot be represented in the requested serialization format (e.g. a raw `true` or `null` JSON object cannot be serialized to BSON) | ferencd@0: ferencd@0: @liveexample{The following code shows how a `type_error` exception can be ferencd@0: caught.,type_error} ferencd@0: ferencd@0: @sa - @ref exception for the base class of the library exceptions ferencd@0: @sa - @ref parse_error for exceptions indicating a parse error ferencd@0: @sa - @ref invalid_iterator for exceptions indicating errors with iterators ferencd@0: @sa - @ref out_of_range for exceptions indicating access out of the defined range ferencd@0: @sa - @ref other_error for exceptions indicating other library errors ferencd@0: ferencd@0: @since version 3.0.0 ferencd@0: */ ferencd@0: class type_error : public exception ferencd@0: { ferencd@0: public: ferencd@0: static type_error create(int id_, const std::string& what_arg) ferencd@0: { ferencd@0: std::string w = exception::name("type_error", id_) + what_arg; ferencd@0: return type_error(id_, w.c_str()); ferencd@0: } ferencd@0: ferencd@0: private: ferencd@0: JSON_HEDLEY_NON_NULL(3) ferencd@0: type_error(int id_, const char* what_arg) : exception(id_, what_arg) {} ferencd@0: }; ferencd@0: ferencd@0: /*! ferencd@0: @brief exception indicating access out of the defined range ferencd@0: ferencd@0: This exception is thrown in case a library function is called on an input ferencd@0: parameter that exceeds the expected range, for instance in case of array ferencd@0: indices or nonexisting object keys. ferencd@0: ferencd@0: Exceptions have ids 4xx. ferencd@0: ferencd@0: name / id | example message | description ferencd@0: ------------------------------- | --------------- | ------------------------- ferencd@0: json.exception.out_of_range.401 | array index 3 is out of range | The provided array index @a i is larger than @a size-1. ferencd@0: json.exception.out_of_range.402 | array index '-' (3) is out of range | The special array index `-` in a JSON Pointer never describes a valid element of the array, but the index past the end. That is, it can only be used to add elements at this position, but not to read it. ferencd@0: json.exception.out_of_range.403 | key 'foo' not found | The provided key was not found in the JSON object. ferencd@0: json.exception.out_of_range.404 | unresolved reference token 'foo' | A reference token in a JSON Pointer could not be resolved. ferencd@0: json.exception.out_of_range.405 | JSON pointer has no parent | The JSON Patch operations 'remove' and 'add' can not be applied to the root element of the JSON value. ferencd@0: json.exception.out_of_range.406 | number overflow parsing '10E1000' | A parsed number could not be stored as without changing it to NaN or INF. ferencd@0: json.exception.out_of_range.407 | number overflow serializing '9223372036854775808' | UBJSON and BSON only support integer numbers up to 9223372036854775807. | ferencd@0: json.exception.out_of_range.408 | excessive array size: 8658170730974374167 | The size (following `#`) of an UBJSON array or object exceeds the maximal capacity. | ferencd@0: json.exception.out_of_range.409 | BSON key cannot contain code point U+0000 (at byte 2) | Key identifiers to be serialized to BSON cannot contain code point U+0000, since the key is stored as zero-terminated c-string | ferencd@0: ferencd@0: @liveexample{The following code shows how an `out_of_range` exception can be ferencd@0: caught.,out_of_range} ferencd@0: ferencd@0: @sa - @ref exception for the base class of the library exceptions ferencd@0: @sa - @ref parse_error for exceptions indicating a parse error ferencd@0: @sa - @ref invalid_iterator for exceptions indicating errors with iterators ferencd@0: @sa - @ref type_error for exceptions indicating executing a member function with ferencd@0: a wrong type ferencd@0: @sa - @ref other_error for exceptions indicating other library errors ferencd@0: ferencd@0: @since version 3.0.0 ferencd@0: */ ferencd@0: class out_of_range : public exception ferencd@0: { ferencd@0: public: ferencd@0: static out_of_range create(int id_, const std::string& what_arg) ferencd@0: { ferencd@0: std::string w = exception::name("out_of_range", id_) + what_arg; ferencd@0: return out_of_range(id_, w.c_str()); ferencd@0: } ferencd@0: ferencd@0: private: ferencd@0: JSON_HEDLEY_NON_NULL(3) ferencd@0: out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {} ferencd@0: }; ferencd@0: ferencd@0: /*! ferencd@0: @brief exception indicating other library errors ferencd@0: ferencd@0: This exception is thrown in case of errors that cannot be classified with the ferencd@0: other exception types. ferencd@0: ferencd@0: Exceptions have ids 5xx. ferencd@0: ferencd@0: name / id | example message | description ferencd@0: ------------------------------ | --------------- | ------------------------- ferencd@0: json.exception.other_error.501 | unsuccessful: {"op":"test","path":"/baz", "value":"bar"} | A JSON Patch operation 'test' failed. The unsuccessful operation is also printed. ferencd@0: ferencd@0: @sa - @ref exception for the base class of the library exceptions ferencd@0: @sa - @ref parse_error for exceptions indicating a parse error ferencd@0: @sa - @ref invalid_iterator for exceptions indicating errors with iterators ferencd@0: @sa - @ref type_error for exceptions indicating executing a member function with ferencd@0: a wrong type ferencd@0: @sa - @ref out_of_range for exceptions indicating access out of the defined range ferencd@0: ferencd@0: @liveexample{The following code shows how an `other_error` exception can be ferencd@0: caught.,other_error} ferencd@0: ferencd@0: @since version 3.0.0 ferencd@0: */ ferencd@0: class other_error : public exception ferencd@0: { ferencd@0: public: ferencd@0: static other_error create(int id_, const std::string& what_arg) ferencd@0: { ferencd@0: std::string w = exception::name("other_error", id_) + what_arg; ferencd@0: return other_error(id_, w.c_str()); ferencd@0: } ferencd@0: ferencd@0: private: ferencd@0: JSON_HEDLEY_NON_NULL(3) ferencd@0: other_error(int id_, const char* what_arg) : exception(id_, what_arg) {} ferencd@0: }; ferencd@0: } // namespace detail ferencd@0: } // namespace nlohmann ferencd@0: ferencd@0: // #include ferencd@0: ferencd@0: // #include ferencd@0: ferencd@0: ferencd@0: #include // not ferencd@0: #include // size_t ferencd@0: #include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type ferencd@0: ferencd@0: namespace nlohmann ferencd@0: { ferencd@0: namespace detail ferencd@0: { ferencd@0: // alias templates to reduce boilerplate ferencd@0: template ferencd@0: using enable_if_t = typename std::enable_if::type; ferencd@0: ferencd@0: template ferencd@0: using uncvref_t = typename std::remove_cv::type>::type; ferencd@0: ferencd@0: // implementation of C++14 index_sequence and affiliates ferencd@0: // source: https://stackoverflow.com/a/32223343 ferencd@0: template ferencd@0: struct index_sequence ferencd@0: { ferencd@0: using type = index_sequence; ferencd@0: using value_type = std::size_t; ferencd@0: static constexpr std::size_t size() noexcept ferencd@0: { ferencd@0: return sizeof...(Ints); ferencd@0: } ferencd@0: }; ferencd@0: ferencd@0: template ferencd@0: struct merge_and_renumber; ferencd@0: ferencd@0: template ferencd@0: struct merge_and_renumber, index_sequence> ferencd@0: : index_sequence < I1..., (sizeof...(I1) + I2)... > {}; ferencd@0: ferencd@0: template ferencd@0: struct make_index_sequence ferencd@0: : merge_and_renumber < typename make_index_sequence < N / 2 >::type, ferencd@0: typename make_index_sequence < N - N / 2 >::type > {}; ferencd@0: ferencd@0: template<> struct make_index_sequence<0> : index_sequence<> {}; ferencd@0: template<> struct make_index_sequence<1> : index_sequence<0> {}; ferencd@0: ferencd@0: template ferencd@0: using index_sequence_for = make_index_sequence; ferencd@0: ferencd@0: // dispatch utility (taken from ranges-v3) ferencd@0: template struct priority_tag : priority_tag < N - 1 > {}; ferencd@0: template<> struct priority_tag<0> {}; ferencd@0: ferencd@0: // taken from ranges-v3 ferencd@0: template ferencd@0: struct static_const ferencd@0: { ferencd@0: static constexpr T value{}; ferencd@0: }; ferencd@0: ferencd@0: template ferencd@0: constexpr T static_const::value; ferencd@0: } // namespace detail ferencd@0: } // namespace nlohmann ferencd@0: ferencd@0: // #include ferencd@0: ferencd@0: ferencd@0: #include // not ferencd@0: #include // numeric_limits ferencd@0: #include // false_type, is_constructible, is_integral, is_same, true_type ferencd@0: #include // declval ferencd@0: ferencd@0: // #include ferencd@0: ferencd@0: ferencd@0: #include // random_access_iterator_tag ferencd@0: ferencd@0: // #include ferencd@0: ferencd@0: ferencd@0: namespace nlohmann ferencd@0: { ferencd@0: namespace detail ferencd@0: { ferencd@0: template struct make_void ferencd@0: { ferencd@0: using type = void; ferencd@0: }; ferencd@0: template using void_t = typename make_void::type; ferencd@0: } // namespace detail ferencd@0: } // namespace nlohmann ferencd@0: ferencd@0: // #include ferencd@0: ferencd@0: ferencd@0: namespace nlohmann ferencd@0: { ferencd@0: namespace detail ferencd@0: { ferencd@0: template ferencd@0: struct iterator_types {}; ferencd@0: ferencd@0: template ferencd@0: struct iterator_types < ferencd@0: It, ferencd@0: void_t> ferencd@0: { ferencd@0: using difference_type = typename It::difference_type; ferencd@0: using value_type = typename It::value_type; ferencd@0: using pointer = typename It::pointer; ferencd@0: using reference = typename It::reference; ferencd@0: using iterator_category = typename It::iterator_category; ferencd@0: }; ferencd@0: ferencd@0: // This is required as some compilers implement std::iterator_traits in a way that ferencd@0: // doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341. ferencd@0: template ferencd@0: struct iterator_traits ferencd@0: { ferencd@0: }; ferencd@0: ferencd@0: template ferencd@0: struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> ferencd@0: : iterator_types ferencd@0: { ferencd@0: }; ferencd@0: ferencd@0: template ferencd@0: struct iterator_traits::value>> ferencd@0: { ferencd@0: using iterator_category = std::random_access_iterator_tag; ferencd@0: using value_type = T; ferencd@0: using difference_type = ptrdiff_t; ferencd@0: using pointer = T*; ferencd@0: using reference = T&; ferencd@0: }; ferencd@0: } // namespace detail ferencd@0: } // namespace nlohmann ferencd@0: ferencd@0: // #include ferencd@0: ferencd@0: // #include ferencd@0: ferencd@0: // #include ferencd@0: ferencd@0: ferencd@0: #include ferencd@0: ferencd@0: // #include ferencd@0: ferencd@0: ferencd@0: // http://en.cppreference.com/w/cpp/experimental/is_detected ferencd@0: namespace nlohmann ferencd@0: { ferencd@0: namespace detail ferencd@0: { ferencd@0: struct nonesuch ferencd@0: { ferencd@0: nonesuch() = delete; ferencd@0: ~nonesuch() = delete; ferencd@0: nonesuch(nonesuch const&) = delete; ferencd@0: nonesuch(nonesuch const&&) = delete; ferencd@0: void operator=(nonesuch const&) = delete; ferencd@0: void operator=(nonesuch&&) = delete; ferencd@0: }; ferencd@0: ferencd@0: template class Op, ferencd@0: class... Args> ferencd@0: struct detector ferencd@0: { ferencd@0: using value_t = std::false_type; ferencd@0: using type = Default; ferencd@0: }; ferencd@0: ferencd@0: template class Op, class... Args> ferencd@0: struct detector>, Op, Args...> ferencd@0: { ferencd@0: using value_t = std::true_type; ferencd@0: using type = Op; ferencd@0: }; ferencd@0: ferencd@0: template