From 8d7c38efb15bdb0e9bb8b7b69ae8c3b3dd62908a Mon Sep 17 00:00:00 2001 From: Krylov Yaroslav Date: Mon, 14 Dec 2020 13:57:34 +0300 Subject: [PATCH] Two new macroses NLOHMANN_DEFINE_TYPE_INTRUSIVE_2 and NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_2 are renamed to *_T. Also doxygen docs for them are improved --- include/nlohmann/detail/macro_scope.hpp | 12 ++++++------ single_include/nlohmann/json.hpp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/nlohmann/detail/macro_scope.hpp b/include/nlohmann/detail/macro_scope.hpp index 317113500..94a5c0053 100644 --- a/include/nlohmann/detail/macro_scope.hpp +++ b/include/nlohmann/detail/macro_scope.hpp @@ -293,20 +293,20 @@ inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } /*! -@brief macro -@def NLOHMANN_DEFINE_TYPE_INTRUSIVE_2 +@brief macro to briefly define intrusive serialization of a given type to/from any basic_json object +@def NLOHMANN_DEFINE_TYPE_INTRUSIVE_T @since version 3.9.2 */ -#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_2(Type, ...) \ +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_T(Type, ...) \ template friend void to_json(JsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ template friend void from_json(const JsonType& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } /*! -@brief macro -@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_2 +@brief macro to briefly define non-intrusive serialization of a given type to/from any basic_json object +@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_T @since version 3.9.2 */ -#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_2(Type, ...) \ +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_T(Type, ...) \ template void to_json(JsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ template void from_json(const JsonType& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 80b211fa2..6f8098e51 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -2370,20 +2370,20 @@ JSON_HEDLEY_DIAGNOSTIC_POP inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } /*! -@brief macro -@def NLOHMANN_DEFINE_TYPE_INTRUSIVE_2 +@brief macro to briefly define intrusive serialization of a given type to/from any basic_json object +@def NLOHMANN_DEFINE_TYPE_INTRUSIVE_T @since version 3.9.2 */ -#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_2(Type, ...) \ +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_T(Type, ...) \ template friend void to_json(JsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ template friend void from_json(const JsonType& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } /*! -@brief macro -@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_2 +@brief macro to briefly define non-intrusive serialization of a given type to/from any basic_json object +@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_T @since version 3.9.2 */ -#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_2(Type, ...) \ +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_T(Type, ...) \ template void to_json(JsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ template void from_json(const JsonType& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }