Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:44:48

0001 //     __ _____ _____ _____
0002 //  __|  |   __|     |   | |  JSON for Modern C++
0003 // |  |  |__   |  |  | | | |  version 3.11.2
0004 // |_____|_____|_____|_|___|  https://github.com/nlohmann/json
0005 //
0006 // SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
0007 // SPDX-License-Identifier: MIT
0008 
0009 #pragma once
0010 
0011 #include <utility>
0012 
0013 #include <nlohmann/detail/abi_macros.hpp>
0014 #include <nlohmann/detail/conversions/from_json.hpp>
0015 #include <nlohmann/detail/conversions/to_json.hpp>
0016 #include <nlohmann/detail/meta/identity_tag.hpp>
0017 
0018 NLOHMANN_JSON_NAMESPACE_BEGIN
0019 
0020 /// @sa https://json.nlohmann.me/api/adl_serializer/
0021 template<typename ValueType, typename>
0022 struct adl_serializer
0023 {
0024     /// @brief convert a JSON value to any value type
0025     /// @sa https://json.nlohmann.me/api/adl_serializer/from_json/
0026     template<typename BasicJsonType, typename TargetType = ValueType>
0027     static auto from_json(BasicJsonType && j, TargetType& val) noexcept(
0028         noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val)))
0029     -> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val), void())
0030     {
0031         ::nlohmann::from_json(std::forward<BasicJsonType>(j), val);
0032     }
0033 
0034     /// @brief convert a JSON value to any value type
0035     /// @sa https://json.nlohmann.me/api/adl_serializer/from_json/
0036     template<typename BasicJsonType, typename TargetType = ValueType>
0037     static auto from_json(BasicJsonType && j) noexcept(
0038     noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {})))
0039     -> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}))
0040     {
0041         return ::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {});
0042     }
0043 
0044     /// @brief convert any value type to a JSON value
0045     /// @sa https://json.nlohmann.me/api/adl_serializer/to_json/
0046     template<typename BasicJsonType, typename TargetType = ValueType>
0047     static auto to_json(BasicJsonType& j, TargetType && val) noexcept(
0048         noexcept(::nlohmann::to_json(j, std::forward<TargetType>(val))))
0049     -> decltype(::nlohmann::to_json(j, std::forward<TargetType>(val)), void())
0050     {
0051         ::nlohmann::to_json(j, std::forward<TargetType>(val));
0052     }
0053 };
0054 
0055 NLOHMANN_JSON_NAMESPACE_END