From bfa5f9ac86313d69276067f6b9447061008f915c Mon Sep 17 00:00:00 2001 From: Florian Albrechtskirchinger Date: Mon, 18 Jul 2022 22:35:10 +0200 Subject: [PATCH] Add versioned inline namespace Add a versioned inline namespace to prevent ABI issues when linking code using multiple library versions. --- include/nlohmann/adl_serializer.hpp | 3 + .../nlohmann/byte_container_with_subtype.hpp | 3 + .../nlohmann/detail/conversions/from_json.hpp | 27 ++- .../nlohmann/detail/conversions/to_chars.hpp | 9 +- .../nlohmann/detail/conversions/to_json.hpp | 27 ++- include/nlohmann/detail/exceptions.hpp | 4 + include/nlohmann/detail/hash.hpp | 3 + .../nlohmann/detail/input/binary_reader.hpp | 3 + .../nlohmann/detail/input/input_adapters.hpp | 5 +- include/nlohmann/detail/input/json_sax.hpp | 3 + include/nlohmann/detail/input/lexer.hpp | 3 + include/nlohmann/detail/input/parser.hpp | 3 + include/nlohmann/detail/input/position_t.hpp | 7 +- .../detail/iterators/internal_iterator.hpp | 3 + .../nlohmann/detail/iterators/iter_impl.hpp | 7 +- .../detail/iterators/iteration_proxy.hpp | 5 +- .../detail/iterators/iterator_traits.hpp | 7 +- .../iterators/json_reverse_iterator.hpp | 3 + .../detail/iterators/primitive_iterator.hpp | 3 + include/nlohmann/detail/json_pointer.hpp | 3 + include/nlohmann/detail/json_ref.hpp | 3 + .../nlohmann/detail/meta/call_std/begin.hpp | 5 +- include/nlohmann/detail/meta/call_std/end.hpp | 3 + include/nlohmann/detail/meta/cpp_future.hpp | 3 + include/nlohmann/detail/meta/detected.hpp | 3 + include/nlohmann/detail/meta/identity_tag.hpp | 3 + include/nlohmann/detail/meta/is_sax.hpp | 3 + include/nlohmann/detail/meta/type_traits.hpp | 3 + include/nlohmann/detail/meta/void_t.hpp | 5 +- .../nlohmann/detail/output/binary_writer.hpp | 3 + .../detail/output/output_adapters.hpp | 3 + include/nlohmann/detail/output/serializer.hpp | 3 + include/nlohmann/detail/string_concat.hpp | 7 +- include/nlohmann/detail/string_escape.hpp | 7 +- include/nlohmann/detail/value_t.hpp | 3 + include/nlohmann/json.hpp | 7 +- include/nlohmann/json_fwd.hpp | 3 + include/nlohmann/ordered_map.hpp | 3 + single_include/nlohmann/json.hpp | 201 +++++++++++++++--- 39 files changed, 340 insertions(+), 62 deletions(-) diff --git a/include/nlohmann/adl_serializer.hpp b/include/nlohmann/adl_serializer.hpp index 835a102aa..770159ded 100644 --- a/include/nlohmann/adl_serializer.hpp +++ b/include/nlohmann/adl_serializer.hpp @@ -18,6 +18,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ /// @sa https://json.nlohmann.me/api/adl_serializer/ template @@ -53,4 +55,5 @@ struct adl_serializer ::nlohmann::to_json(j, std::forward(val)); } }; +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/byte_container_with_subtype.hpp b/include/nlohmann/byte_container_with_subtype.hpp index c78772ef1..ab939c3cc 100644 --- a/include/nlohmann/byte_container_with_subtype.hpp +++ b/include/nlohmann/byte_container_with_subtype.hpp @@ -14,6 +14,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ /// @brief an internal type for a backed binary type /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/ @@ -99,4 +101,5 @@ class byte_container_with_subtype : public BinaryType bool m_has_subtype = false; }; +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/conversions/from_json.hpp b/include/nlohmann/detail/conversions/from_json.hpp index af2abddbf..22006290b 100644 --- a/include/nlohmann/detail/conversions/from_json.hpp +++ b/include/nlohmann/detail/conversions/from_json.hpp @@ -30,20 +30,34 @@ #if JSON_HAS_EXPERIMENTAL_FILESYSTEM #include -namespace nlohmann::detail +namespace nlohmann +{ +inline namespace json_v3_10_5 +{ +namespace detail { namespace std_fs = std::experimental::filesystem; -} // namespace nlohmann::detail +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann #elif JSON_HAS_FILESYSTEM #include -namespace nlohmann::detail +namespace nlohmann +{ +inline namespace json_v3_10_5 +{ +namespace detail { namespace std_fs = std::filesystem; -} // namespace nlohmann::detail +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann #endif namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { template @@ -503,6 +517,7 @@ namespace // NOLINT(cert-dcl59-cpp,fuchsia-header-anon-namespaces,google-build-n JSON_INLINE_VARIABLE constexpr const auto& from_json = // NOLINT(misc-definitions-in-headers) detail::static_const::value; #ifndef JSON_HAS_CPP_17 -} // namespace +} // namespace #endif -} // namespace nlohmann +} // namespace json_v3_10_5 +} // namespace nlohmann diff --git a/include/nlohmann/detail/conversions/to_chars.hpp b/include/nlohmann/detail/conversions/to_chars.hpp index fb457311c..5f9e8f743 100644 --- a/include/nlohmann/detail/conversions/to_chars.hpp +++ b/include/nlohmann/detail/conversions/to_chars.hpp @@ -20,6 +20,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { @@ -1048,7 +1050,7 @@ inline char* format_buffer(char* buf, int len, int decimal_exponent, return append_exponent(buf, n - 1); } -} // namespace dtoa_impl +} // namespace dtoa_impl /*! @brief generates a decimal representation of the floating-point number value in [first, last). @@ -1115,5 +1117,6 @@ char* to_chars(char* first, const char* last, FloatType value) return dtoa_impl::format_buffer(first, len, decimal_exponent, kMinExp, kMaxExp); } -} // namespace detail -} // namespace nlohmann +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann diff --git a/include/nlohmann/detail/conversions/to_json.hpp b/include/nlohmann/detail/conversions/to_json.hpp index 2dc45d624..3d6c0455c 100644 --- a/include/nlohmann/detail/conversions/to_json.hpp +++ b/include/nlohmann/detail/conversions/to_json.hpp @@ -25,20 +25,34 @@ #if JSON_HAS_EXPERIMENTAL_FILESYSTEM #include -namespace nlohmann::detail +namespace nlohmann +{ +inline namespace json_v3_10_5 +{ +namespace detail { namespace std_fs = std::experimental::filesystem; -} // namespace nlohmann::detail +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann #elif JSON_HAS_FILESYSTEM #include -namespace nlohmann::detail +namespace nlohmann +{ +inline namespace json_v3_10_5 +{ +namespace detail { namespace std_fs = std::filesystem; -} // namespace nlohmann::detail +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann #endif namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { ////////////////// @@ -447,6 +461,7 @@ namespace // NOLINT(cert-dcl59-cpp,fuchsia-header-anon-namespaces,google-build-n JSON_INLINE_VARIABLE constexpr const auto& to_json = // NOLINT(misc-definitions-in-headers) detail::static_const::value; #ifndef JSON_HAS_CPP_17 -} // namespace +} // namespace #endif -} // namespace nlohmann +} // namespace json_v3_10_5 +} // namespace nlohmann diff --git a/include/nlohmann/detail/exceptions.hpp b/include/nlohmann/detail/exceptions.hpp index 4c8f83f20..a229f7c16 100644 --- a/include/nlohmann/detail/exceptions.hpp +++ b/include/nlohmann/detail/exceptions.hpp @@ -25,8 +25,11 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { + //////////////// // exceptions // //////////////// @@ -252,4 +255,5 @@ class other_error : public exception }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/hash.hpp b/include/nlohmann/detail/hash.hpp index 923e37762..6ee516f35 100644 --- a/include/nlohmann/detail/hash.hpp +++ b/include/nlohmann/detail/hash.hpp @@ -17,6 +17,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { @@ -127,4 +129,5 @@ std::size_t hash(const BasicJsonType& j) } } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/input/binary_reader.hpp b/include/nlohmann/detail/input/binary_reader.hpp index c6363b7d0..d8c679437 100644 --- a/include/nlohmann/detail/input/binary_reader.hpp +++ b/include/nlohmann/detail/input/binary_reader.hpp @@ -34,6 +34,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { @@ -2970,4 +2972,5 @@ class binary_reader json_sax_t* sax = nullptr; }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/input/input_adapters.hpp b/include/nlohmann/detail/input/input_adapters.hpp index a034a6df6..35ac87e53 100644 --- a/include/nlohmann/detail/input/input_adapters.hpp +++ b/include/nlohmann/detail/input/input_adapters.hpp @@ -28,6 +28,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /// the supported input formats @@ -410,7 +412,7 @@ struct container_input_adapter_factory< ContainerType, } }; -} // namespace container_input_adapter_factory_impl +} // namespace container_input_adapter_factory_impl template typename container_input_adapter_factory_impl::container_input_adapter_factory::adapter_type input_adapter(const ContainerType& container) @@ -490,4 +492,5 @@ class span_input_adapter contiguous_bytes_input_adapter ia; }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/input/json_sax.hpp b/include/nlohmann/detail/input/json_sax.hpp index 03da50e90..551dacfa5 100644 --- a/include/nlohmann/detail/input/json_sax.hpp +++ b/include/nlohmann/detail/input/json_sax.hpp @@ -19,6 +19,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ /*! @brief SAX interface @@ -726,4 +728,5 @@ class json_sax_acceptor }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/input/lexer.hpp b/include/nlohmann/detail/input/lexer.hpp index b115c316a..91b18e9d9 100644 --- a/include/nlohmann/detail/input/lexer.hpp +++ b/include/nlohmann/detail/input/lexer.hpp @@ -24,6 +24,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /////////// @@ -1628,4 +1630,5 @@ scan_number_done: const char_int_type decimal_point_char = '.'; }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/input/parser.hpp b/include/nlohmann/detail/input/parser.hpp index 8b9925743..2538f4e45 100644 --- a/include/nlohmann/detail/input/parser.hpp +++ b/include/nlohmann/detail/input/parser.hpp @@ -26,6 +26,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { //////////// @@ -505,4 +507,5 @@ class parser }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/input/position_t.hpp b/include/nlohmann/detail/input/position_t.hpp index 4cf4fd11d..2003ae5ba 100644 --- a/include/nlohmann/detail/input/position_t.hpp +++ b/include/nlohmann/detail/input/position_t.hpp @@ -12,6 +12,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /// struct to capture the start position of the current token @@ -31,5 +33,6 @@ struct position_t } }; -} // namespace detail -} // namespace nlohmann +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann diff --git a/include/nlohmann/detail/iterators/internal_iterator.hpp b/include/nlohmann/detail/iterators/internal_iterator.hpp index 317e0c9b2..3339f4a50 100644 --- a/include/nlohmann/detail/iterators/internal_iterator.hpp +++ b/include/nlohmann/detail/iterators/internal_iterator.hpp @@ -12,6 +12,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /*! @@ -30,4 +32,5 @@ template struct internal_iterator primitive_iterator_t primitive_iterator {}; }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/iterators/iter_impl.hpp b/include/nlohmann/detail/iterators/iter_impl.hpp index c55197d7a..62ce6106f 100644 --- a/include/nlohmann/detail/iterators/iter_impl.hpp +++ b/include/nlohmann/detail/iterators/iter_impl.hpp @@ -21,6 +21,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { // forward declare, to be able to friend it later on @@ -746,5 +748,6 @@ class iter_impl // NOLINT(cppcoreguidelines-special-member-functions,hicpp-speci /// the actual iterator of the associated instance internal_iterator::type> m_it {}; }; -} // namespace detail -} // namespace nlohmann +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann diff --git a/include/nlohmann/detail/iterators/iteration_proxy.hpp b/include/nlohmann/detail/iterators/iteration_proxy.hpp index 5f5010080..fabd8d384 100644 --- a/include/nlohmann/detail/iterators/iteration_proxy.hpp +++ b/include/nlohmann/detail/iterators/iteration_proxy.hpp @@ -23,6 +23,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { template @@ -202,6 +204,7 @@ auto get(const nlohmann::detail::iteration_proxy_value& i) -> decl return i.value(); } } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // The Addition to the STD Namespace is required to add @@ -230,7 +233,7 @@ class tuple_element> #if defined(__clang__) #pragma clang diagnostic pop #endif -} // namespace std +} // namespace std #if JSON_HAS_RANGES template diff --git a/include/nlohmann/detail/iterators/iterator_traits.hpp b/include/nlohmann/detail/iterators/iterator_traits.hpp index e803786df..7bbd55298 100644 --- a/include/nlohmann/detail/iterators/iterator_traits.hpp +++ b/include/nlohmann/detail/iterators/iterator_traits.hpp @@ -15,6 +15,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { template @@ -55,5 +57,6 @@ struct iterator_traits::value>> using pointer = T*; using reference = T&; }; -} // namespace detail -} // namespace nlohmann +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann diff --git a/include/nlohmann/detail/iterators/json_reverse_iterator.hpp b/include/nlohmann/detail/iterators/json_reverse_iterator.hpp index ccc68184d..fd4595258 100644 --- a/include/nlohmann/detail/iterators/json_reverse_iterator.hpp +++ b/include/nlohmann/detail/iterators/json_reverse_iterator.hpp @@ -14,6 +14,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { ////////////////////// @@ -124,4 +126,5 @@ class json_reverse_iterator : public std::reverse_iterator } }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/iterators/primitive_iterator.hpp b/include/nlohmann/detail/iterators/primitive_iterator.hpp index 262689d35..85582ce2c 100644 --- a/include/nlohmann/detail/iterators/primitive_iterator.hpp +++ b/include/nlohmann/detail/iterators/primitive_iterator.hpp @@ -15,6 +15,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /* @@ -128,4 +130,5 @@ class primitive_iterator_t } }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/json_pointer.hpp b/include/nlohmann/detail/json_pointer.hpp index 79776bcc6..4798edbf1 100644 --- a/include/nlohmann/detail/json_pointer.hpp +++ b/include/nlohmann/detail/json_pointer.hpp @@ -29,6 +29,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ /// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document /// @sa https://json.nlohmann.me/api/json_pointer/ @@ -897,4 +899,5 @@ inline bool operator!=(json_pointer const& lhs, { return !(lhs == rhs); } +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/json_ref.hpp b/include/nlohmann/detail/json_ref.hpp index d2aa83296..5dd9cb443 100644 --- a/include/nlohmann/detail/json_ref.hpp +++ b/include/nlohmann/detail/json_ref.hpp @@ -15,6 +15,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { template @@ -73,4 +75,5 @@ class json_ref value_type const* value_ref = nullptr; }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/meta/call_std/begin.hpp b/include/nlohmann/detail/meta/call_std/begin.hpp index 62bc56a2f..c03c064f3 100644 --- a/include/nlohmann/detail/meta/call_std/begin.hpp +++ b/include/nlohmann/detail/meta/call_std/begin.hpp @@ -12,5 +12,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); -} // namespace nlohmann +} // namespace json_v3_10_5 +} // namespace nlohmann diff --git a/include/nlohmann/detail/meta/call_std/end.hpp b/include/nlohmann/detail/meta/call_std/end.hpp index 239245567..df06524fb 100644 --- a/include/nlohmann/detail/meta/call_std/end.hpp +++ b/include/nlohmann/detail/meta/call_std/end.hpp @@ -12,5 +12,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ NLOHMANN_CAN_CALL_STD_FUNC_IMPL(end); +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/meta/cpp_future.hpp b/include/nlohmann/detail/meta/cpp_future.hpp index 757d7d9f9..00292befb 100644 --- a/include/nlohmann/detail/meta/cpp_future.hpp +++ b/include/nlohmann/detail/meta/cpp_future.hpp @@ -17,6 +17,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { @@ -164,4 +166,5 @@ struct static_const #endif } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/meta/detected.hpp b/include/nlohmann/detail/meta/detected.hpp index 8d7e560bc..3361dab5e 100644 --- a/include/nlohmann/detail/meta/detected.hpp +++ b/include/nlohmann/detail/meta/detected.hpp @@ -15,6 +15,8 @@ // https://en.cppreference.com/w/cpp/experimental/is_detected namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { struct nonesuch @@ -66,4 +68,5 @@ template class Op, class... Args> using is_detected_convertible = std::is_convertible, To>; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/meta/identity_tag.hpp b/include/nlohmann/detail/meta/identity_tag.hpp index 4c4ac2fc0..688d9c184 100644 --- a/include/nlohmann/detail/meta/identity_tag.hpp +++ b/include/nlohmann/detail/meta/identity_tag.hpp @@ -10,9 +10,12 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { // dispatching helper struct template struct identity_tag {}; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/meta/is_sax.hpp b/include/nlohmann/detail/meta/is_sax.hpp index 1c74eabf0..598045bc9 100644 --- a/include/nlohmann/detail/meta/is_sax.hpp +++ b/include/nlohmann/detail/meta/is_sax.hpp @@ -17,6 +17,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { template @@ -154,4 +156,5 @@ struct is_sax_static_asserts "std::string&, const exception&)"); }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/meta/type_traits.hpp b/include/nlohmann/detail/meta/type_traits.hpp index 796d5b0cd..336677b4a 100644 --- a/include/nlohmann/detail/meta/type_traits.hpp +++ b/include/nlohmann/detail/meta/type_traits.hpp @@ -24,6 +24,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ /*! @brief detail namespace with internal helper functions @@ -686,4 +688,5 @@ inline constexpr bool value_in_range_of(T val) } } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/meta/void_t.hpp b/include/nlohmann/detail/meta/void_t.hpp index 5d6f65eb5..163256140 100644 --- a/include/nlohmann/detail/meta/void_t.hpp +++ b/include/nlohmann/detail/meta/void_t.hpp @@ -10,6 +10,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { template struct make_void @@ -17,5 +19,6 @@ template struct make_void using type = void; }; template using void_t = typename make_void::type; -} // namespace detail +} // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/output/binary_writer.hpp b/include/nlohmann/detail/output/binary_writer.hpp index 3501b410c..3007f4751 100644 --- a/include/nlohmann/detail/output/binary_writer.hpp +++ b/include/nlohmann/detail/output/binary_writer.hpp @@ -26,6 +26,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /////////////////// @@ -1834,4 +1836,5 @@ class binary_writer output_adapter_t oa = nullptr; }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/output/output_adapters.hpp b/include/nlohmann/detail/output/output_adapters.hpp index 134bd9aab..f769d2516 100644 --- a/include/nlohmann/detail/output/output_adapters.hpp +++ b/include/nlohmann/detail/output/output_adapters.hpp @@ -24,6 +24,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /// abstract output adapter interface @@ -143,4 +145,5 @@ class output_adapter output_adapter_t oa = nullptr; }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/output/serializer.hpp b/include/nlohmann/detail/output/serializer.hpp index 0f8f320f6..293e734f8 100644 --- a/include/nlohmann/detail/output/serializer.hpp +++ b/include/nlohmann/detail/output/serializer.hpp @@ -33,6 +33,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /////////////////// @@ -984,4 +986,5 @@ class serializer const error_handler_t error_handler; }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/detail/string_concat.hpp b/include/nlohmann/detail/string_concat.hpp index 4f128ceab..caecb8f1e 100644 --- a/include/nlohmann/detail/string_concat.hpp +++ b/include/nlohmann/detail/string_concat.hpp @@ -17,6 +17,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { @@ -143,5 +145,6 @@ inline OutStringType concat(Args && ... args) return str; } -} // namespace detail -} // namespace nlohmann +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann diff --git a/include/nlohmann/detail/string_escape.hpp b/include/nlohmann/detail/string_escape.hpp index 467e19d50..3202eca01 100644 --- a/include/nlohmann/detail/string_escape.hpp +++ b/include/nlohmann/detail/string_escape.hpp @@ -12,6 +12,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { @@ -69,5 +71,6 @@ static void unescape(StringType& s) replace_substring(s, StringType{"~0"}, StringType{"~"}); } -} // namespace detail -} // namespace nlohmann +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann diff --git a/include/nlohmann/detail/value_t.hpp b/include/nlohmann/detail/value_t.hpp index bdf4ad7f9..0b435e8bf 100644 --- a/include/nlohmann/detail/value_t.hpp +++ b/include/nlohmann/detail/value_t.hpp @@ -20,6 +20,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /////////////////////////// @@ -114,4 +116,5 @@ inline bool operator<(const value_t lhs, const value_t rhs) noexcept } #endif } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 24812fde5..c1348b79d 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -85,6 +85,8 @@ */ namespace nlohmann { +inline namespace json_v3_10_5 +{ /*! @brief a class to store JSON values @@ -5086,7 +5088,8 @@ std::string to_string(const NLOHMANN_BASIC_JSON_TPL& j) return j.dump(); } -} // namespace nlohmann +} // namespace json_v3_10_5 +} // namespace nlohmann /////////////////////// // nonmember support // @@ -5140,7 +5143,7 @@ inline void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL& j1, nlohmann::NLOHMANN_BASIC #endif -} // namespace std +} // namespace std /// @brief user-defined string literal for JSON values /// @sa https://json.nlohmann.me/api/basic_json/operator_literal_json/ diff --git a/include/nlohmann/json_fwd.hpp b/include/nlohmann/json_fwd.hpp index f3fb3f797..6e05a2526 100644 --- a/include/nlohmann/json_fwd.hpp +++ b/include/nlohmann/json_fwd.hpp @@ -22,6 +22,8 @@ */ namespace nlohmann { +inline namespace json_v3_10_5 +{ /*! @brief default JSONSerializer template argument @@ -67,6 +69,7 @@ struct ordered_map; /// @sa https://json.nlohmann.me/api/ordered_json/ using ordered_json = basic_json; +} // namespace json_v3_10_5 } // namespace nlohmann #endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ diff --git a/include/nlohmann/ordered_map.hpp b/include/nlohmann/ordered_map.hpp index 76c1d5077..03d0efbd7 100644 --- a/include/nlohmann/ordered_map.hpp +++ b/include/nlohmann/ordered_map.hpp @@ -22,6 +22,8 @@ namespace nlohmann { +inline namespace json_v3_10_5 +{ /// ordered_map: a minimal map-like container that preserves insertion order /// for use within nlohmann::basic_json @@ -357,4 +359,5 @@ private: JSON_NO_UNIQUE_ADDRESS key_compare m_compare = key_compare(); }; +} // namespace json_v3_10_5 } // namespace nlohmann diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 3341f0286..4412fc4bc 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -2199,6 +2199,8 @@ JSON_HEDLEY_DIAGNOSTIC_POP namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { template struct make_void @@ -2206,13 +2208,16 @@ template struct make_void using type = void; }; template using void_t = typename make_void::type; -} // namespace detail +} // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // https://en.cppreference.com/w/cpp/experimental/is_detected namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { struct nonesuch @@ -2264,6 +2269,7 @@ template class Op, class... Args> using is_detected_convertible = std::is_convertible, To>; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann @@ -2730,6 +2736,8 @@ using is_detected_convertible = namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /////////////////////////// @@ -2824,6 +2832,7 @@ inline bool operator<(const value_t lhs, const value_t rhs) noexcept } #endif } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -2842,6 +2851,8 @@ inline bool operator<(const value_t lhs, const value_t rhs) noexcept namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { @@ -2899,8 +2910,9 @@ static void unescape(StringType& s) replace_substring(s, StringType{"~0"}, StringType{"~"}); } -} // namespace detail -} // namespace nlohmann +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann // #include // __ _____ _____ _____ @@ -2917,6 +2929,8 @@ static void unescape(StringType& s) namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /// struct to capture the start position of the current token @@ -2936,8 +2950,9 @@ struct position_t } }; -} // namespace detail -} // namespace nlohmann +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann // #include @@ -2962,6 +2977,8 @@ struct position_t namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { @@ -3109,6 +3126,7 @@ struct static_const #endif } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -3150,6 +3168,8 @@ struct static_const namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { template @@ -3190,8 +3210,9 @@ struct iterator_traits::value>> using pointer = T*; using reference = T&; }; -} // namespace detail -} // namespace nlohmann +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann // #include // __ _____ _____ _____ @@ -3209,8 +3230,11 @@ struct iterator_traits::value>> namespace nlohmann { +inline namespace json_v3_10_5 +{ NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); -} // namespace nlohmann +} // namespace json_v3_10_5 +} // namespace nlohmann // #include // __ _____ _____ _____ @@ -3228,7 +3252,10 @@ NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); namespace nlohmann { +inline namespace json_v3_10_5 +{ NLOHMANN_CAN_CALL_STD_FUNC_IMPL(end); +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -3260,6 +3287,8 @@ NLOHMANN_CAN_CALL_STD_FUNC_IMPL(end); */ namespace nlohmann { +inline namespace json_v3_10_5 +{ /*! @brief default JSONSerializer template argument @@ -3305,6 +3334,7 @@ struct ordered_map; /// @sa https://json.nlohmann.me/api/ordered_json/ using ordered_json = basic_json; +} // namespace json_v3_10_5 } // namespace nlohmann #endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ @@ -3312,6 +3342,8 @@ using ordered_json = basic_json; namespace nlohmann { +inline namespace json_v3_10_5 +{ /*! @brief detail namespace with internal helper functions @@ -3974,6 +4006,7 @@ inline constexpr bool value_in_range_of(T val) } } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -3998,6 +4031,8 @@ inline constexpr bool value_in_range_of(T val) namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { @@ -4124,15 +4159,19 @@ inline OutStringType concat(Args && ... args) return str; } -} // namespace detail -} // namespace nlohmann +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { + //////////////// // exceptions // //////////////// @@ -4358,6 +4397,7 @@ class other_error : public exception }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -4377,11 +4417,14 @@ class other_error : public exception namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { // dispatching helper struct template struct identity_tag {}; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -4393,20 +4436,34 @@ template struct identity_tag {}; #if JSON_HAS_EXPERIMENTAL_FILESYSTEM #include -namespace nlohmann::detail +namespace nlohmann +{ +inline namespace json_v3_10_5 +{ +namespace detail { namespace std_fs = std::experimental::filesystem; -} // namespace nlohmann::detail +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann #elif JSON_HAS_FILESYSTEM #include -namespace nlohmann::detail +namespace nlohmann +{ +inline namespace json_v3_10_5 +{ +namespace detail { namespace std_fs = std::filesystem; -} // namespace nlohmann::detail +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann #endif namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { template @@ -4866,9 +4923,10 @@ namespace // NOLINT(cert-dcl59-cpp,fuchsia-header-anon-namespaces,google-build-n JSON_INLINE_VARIABLE constexpr const auto& from_json = // NOLINT(misc-definitions-in-headers) detail::static_const::value; #ifndef JSON_HAS_CPP_17 -} // namespace +} // namespace #endif -} // namespace nlohmann +} // namespace json_v3_10_5 +} // namespace nlohmann // #include // __ _____ _____ _____ @@ -4920,6 +4978,8 @@ JSON_INLINE_VARIABLE constexpr const auto& from_json = // NOLINT(misc-definition namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { template @@ -5099,6 +5159,7 @@ auto get(const nlohmann::detail::iteration_proxy_value& i) -> decl return i.value(); } } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // The Addition to the STD Namespace is required to add @@ -5127,7 +5188,7 @@ class tuple_element> #if defined(__clang__) #pragma clang diagnostic pop #endif -} // namespace std +} // namespace std #if JSON_HAS_RANGES template @@ -5143,20 +5204,34 @@ class tuple_element> #if JSON_HAS_EXPERIMENTAL_FILESYSTEM #include -namespace nlohmann::detail +namespace nlohmann +{ +inline namespace json_v3_10_5 +{ +namespace detail { namespace std_fs = std::experimental::filesystem; -} // namespace nlohmann::detail +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann #elif JSON_HAS_FILESYSTEM #include -namespace nlohmann::detail +namespace nlohmann +{ +inline namespace json_v3_10_5 +{ +namespace detail { namespace std_fs = std::filesystem; -} // namespace nlohmann::detail +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann #endif namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { ////////////////// @@ -5565,9 +5640,10 @@ namespace // NOLINT(cert-dcl59-cpp,fuchsia-header-anon-namespaces,google-build-n JSON_INLINE_VARIABLE constexpr const auto& to_json = // NOLINT(misc-definitions-in-headers) detail::static_const::value; #ifndef JSON_HAS_CPP_17 -} // namespace +} // namespace #endif -} // namespace nlohmann +} // namespace json_v3_10_5 +} // namespace nlohmann // #include @@ -5576,6 +5652,8 @@ JSON_INLINE_VARIABLE constexpr const auto& to_json = // NOLINT(misc-definitions- namespace nlohmann { +inline namespace json_v3_10_5 +{ /// @sa https://json.nlohmann.me/api/adl_serializer/ template @@ -5611,6 +5689,7 @@ struct adl_serializer ::nlohmann::to_json(j, std::forward(val)); } }; +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -5630,6 +5709,8 @@ struct adl_serializer namespace nlohmann { +inline namespace json_v3_10_5 +{ /// @brief an internal type for a backed binary type /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/ @@ -5715,6 +5796,7 @@ class byte_container_with_subtype : public BinaryType bool m_has_subtype = false; }; +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -5745,6 +5827,8 @@ class byte_container_with_subtype : public BinaryType namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { @@ -5855,6 +5939,7 @@ std::size_t hash(const BasicJsonType& j) } } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -5917,6 +6002,8 @@ std::size_t hash(const BasicJsonType& j) namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /// the supported input formats @@ -6299,7 +6386,7 @@ struct container_input_adapter_factory< ContainerType, } }; -} // namespace container_input_adapter_factory_impl +} // namespace container_input_adapter_factory_impl template typename container_input_adapter_factory_impl::container_input_adapter_factory::adapter_type input_adapter(const ContainerType& container) @@ -6379,6 +6466,7 @@ class span_input_adapter contiguous_bytes_input_adapter ia; }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -6406,6 +6494,8 @@ class span_input_adapter namespace nlohmann { +inline namespace json_v3_10_5 +{ /*! @brief SAX interface @@ -7113,6 +7203,7 @@ class json_sax_acceptor }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -7145,6 +7236,8 @@ class json_sax_acceptor namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /////////// @@ -8749,6 +8842,7 @@ scan_number_done: const char_int_type decimal_point_char = '.'; }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -8775,6 +8869,8 @@ scan_number_done: namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { template @@ -8912,6 +9008,7 @@ struct is_sax_static_asserts "std::string&, const exception&)"); }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -8923,6 +9020,8 @@ struct is_sax_static_asserts namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { @@ -11859,6 +11958,7 @@ class binary_reader json_sax_t* sax = nullptr; }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -11902,6 +12002,8 @@ class binary_reader namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { //////////// @@ -12381,6 +12483,7 @@ class parser }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -12413,6 +12516,8 @@ class parser namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /* @@ -12526,11 +12631,14 @@ class primitive_iterator_t } }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /*! @@ -12549,6 +12657,7 @@ template struct internal_iterator primitive_iterator_t primitive_iterator {}; }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -12582,6 +12691,8 @@ template struct internal_iterator namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { // forward declare, to be able to friend it later on @@ -13307,8 +13418,9 @@ class iter_impl // NOLINT(cppcoreguidelines-special-member-functions,hicpp-speci /// the actual iterator of the associated instance internal_iterator::type> m_it {}; }; -} // namespace detail -} // namespace nlohmann +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann // #include @@ -13329,6 +13441,8 @@ class iter_impl // NOLINT(cppcoreguidelines-special-member-functions,hicpp-speci namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { ////////////////////// @@ -13439,6 +13553,7 @@ class json_reverse_iterator : public std::reverse_iterator } }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -13480,6 +13595,8 @@ class json_reverse_iterator : public std::reverse_iterator namespace nlohmann { +inline namespace json_v3_10_5 +{ /// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document /// @sa https://json.nlohmann.me/api/json_pointer/ @@ -14348,6 +14465,7 @@ inline bool operator!=(json_pointer const& lhs, { return !(lhs == rhs); } +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -14369,6 +14487,8 @@ inline bool operator!=(json_pointer const& lhs, namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { template @@ -14427,6 +14547,7 @@ class json_ref value_type const* value_ref = nullptr; }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -14493,6 +14614,8 @@ class json_ref namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /// abstract output adapter interface @@ -14612,6 +14735,7 @@ class output_adapter output_adapter_t oa = nullptr; }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -14619,6 +14743,8 @@ class output_adapter namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /////////////////// @@ -16427,6 +16553,7 @@ class binary_writer output_adapter_t oa = nullptr; }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -16480,6 +16607,8 @@ class binary_writer namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { @@ -17508,7 +17637,7 @@ inline char* format_buffer(char* buf, int len, int decimal_exponent, return append_exponent(buf, n - 1); } -} // namespace dtoa_impl +} // namespace dtoa_impl /*! @brief generates a decimal representation of the floating-point number value in [first, last). @@ -17575,8 +17704,9 @@ char* to_chars(char* first, const char* last, FloatType value) return dtoa_impl::format_buffer(first, len, decimal_exponent, kMinExp, kMaxExp); } -} // namespace detail -} // namespace nlohmann +} // namespace detail +} // namespace json_v3_10_5 +} // namespace nlohmann // #include @@ -17595,6 +17725,8 @@ char* to_chars(char* first, const char* last, FloatType value) namespace nlohmann { +inline namespace json_v3_10_5 +{ namespace detail { /////////////////// @@ -18546,6 +18678,7 @@ class serializer const error_handler_t error_handler; }; } // namespace detail +} // namespace json_v3_10_5 } // namespace nlohmann // #include @@ -18579,6 +18712,8 @@ class serializer namespace nlohmann { +inline namespace json_v3_10_5 +{ /// ordered_map: a minimal map-like container that preserves insertion order /// for use within nlohmann::basic_json @@ -18914,6 +19049,7 @@ private: JSON_NO_UNIQUE_ADDRESS key_compare m_compare = key_compare(); }; +} // namespace json_v3_10_5 } // namespace nlohmann @@ -18929,6 +19065,8 @@ private: */ namespace nlohmann { +inline namespace json_v3_10_5 +{ /*! @brief a class to store JSON values @@ -23930,7 +24068,8 @@ std::string to_string(const NLOHMANN_BASIC_JSON_TPL& j) return j.dump(); } -} // namespace nlohmann +} // namespace json_v3_10_5 +} // namespace nlohmann /////////////////////// // nonmember support // @@ -23984,7 +24123,7 @@ inline void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL& j1, nlohmann::NLOHMANN_BASIC #endif -} // namespace std +} // namespace std /// @brief user-defined string literal for JSON values /// @sa https://json.nlohmann.me/api/basic_json/operator_literal_json/