RflySimSDK v4.10
RflySimSDK说明文档
载入中...
搜索中...
未找到
adl_serializer.hpp
1// __ _____ _____ _____
2// __| | __| | | | JSON for Modern C++
3// | | |__ | | | | | | version 3.12.0
4// |_____|_____|_____|_|___| https://github.com/nlohmann/json
5//
6// SPDX-FileCopyrightText: 2013-2025 Niels Lohmann <https://nlohmann.me>
7// SPDX-License-Identifier: MIT
8
9#pragma once
10
11#include <utility>
12
13#include <nlohmann/detail/abi_macros.hpp>
14#include <nlohmann/detail/conversions/from_json.hpp>
15#include <nlohmann/detail/conversions/to_json.hpp>
16#include <nlohmann/detail/meta/identity_tag.hpp>
17
18NLOHMANN_JSON_NAMESPACE_BEGIN
19
20/// @sa https://json.nlohmann.me/api/adl_serializer/
21template<typename ValueType, typename>
23{
24 /// @brief convert a JSON value to any value type
25 /// @sa https://json.nlohmann.me/api/adl_serializer/from_json/
26 template<typename BasicJsonType, typename TargetType = ValueType>
27 static auto from_json(BasicJsonType && j, TargetType& val) noexcept(
28 noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val)))
29 -> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val), void())
30 {
31 ::nlohmann::from_json(std::forward<BasicJsonType>(j), val);
32 }
33
34 /// @brief convert a JSON value to any value type
35 /// @sa https://json.nlohmann.me/api/adl_serializer/from_json/
36 template<typename BasicJsonType, typename TargetType = ValueType>
37 static auto from_json(BasicJsonType && j) noexcept(
38 noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {})))
39 -> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}))
40 {
41 return ::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {});
42 }
43
44 /// @brief convert any value type to a JSON value
45 /// @sa https://json.nlohmann.me/api/adl_serializer/to_json/
46 template<typename BasicJsonType, typename TargetType = ValueType>
47 static auto to_json(BasicJsonType& j, TargetType && val) noexcept(
48 noexcept(::nlohmann::to_json(j, std::forward<TargetType>(val))))
49 -> decltype(::nlohmann::to_json(j, std::forward<TargetType>(val)), void())
50 {
51 ::nlohmann::to_json(j, std::forward<TargetType>(val));
52 }
53};
54
55NLOHMANN_JSON_NAMESPACE_END
namespace for Niels Lohmann
定义 adl_serializer.hpp:23
static auto from_json(BasicJsonType &&j) noexcept(noexcept(::nlohmann::from_json(std::forward< BasicJsonType >(j), detail::identity_tag< TargetType > {}))) -> decltype(::nlohmann::from_json(std::forward< BasicJsonType >(j), detail::identity_tag< TargetType > {}))
convert a JSON value to any value type
定义 adl_serializer.hpp:37
static auto to_json(BasicJsonType &j, TargetType &&val) noexcept(noexcept(::nlohmann::to_json(j, std::forward< TargetType >(val)))) -> decltype(::nlohmann::to_json(j, std::forward< TargetType >(val)), void())
convert any value type to a JSON value
定义 adl_serializer.hpp:47
static auto from_json(BasicJsonType &&j, TargetType &val) noexcept(noexcept(::nlohmann::from_json(std::forward< BasicJsonType >(j), val))) -> decltype(::nlohmann::from_json(std::forward< BasicJsonType >(j), val), void())
convert a JSON value to any value type
定义 adl_serializer.hpp:27
定义 identity_tag.hpp:18