NLOHMANN_DEFINE_TYPE_INTRUSIVE_IMPL and NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_IMPL are added. NLOHMANN_DEFINE_TYPE_INTRUSIVE and NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE are updated to work via XXX_IMPL verions. Also doxygen documentation is improved
This commit is contained in:
parent
4f25c5c408
commit
251972147d
@ -275,22 +275,40 @@
|
|||||||
#define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1);
|
#define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@brief macro
|
@brief macro to briefly define intrusive serialization of a given type to/from JSON
|
||||||
@def NLOHMANN_DEFINE_TYPE_INTRUSIVE
|
@note you can define your own specialized macroses like NLOHMANN_DEFINE_TYPE_INTRUSIVE
|
||||||
@since version 3.9.0
|
@def NLOHMANN_DEFINE_TYPE_INTRUSIVE_IMPL
|
||||||
|
@since version 3.9.2
|
||||||
*/
|
*/
|
||||||
#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \
|
#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_IMPL(BasicJsonType, Type, ...) \
|
||||||
friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
|
friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
|
||||||
friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
|
friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@brief macro
|
@brief macro to briefly define non-intrusive serialization of a given type to/from JSON
|
||||||
|
@note you can define your own specialized macroses like NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE
|
||||||
|
@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_IMPL
|
||||||
|
@since version 3.9.2
|
||||||
|
*/
|
||||||
|
#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_IMPL(BasicJsonType, Type, ...) \
|
||||||
|
inline void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
|
||||||
|
inline void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@brief macro to briefly define intrusive serialization of given type to/from nlohmann::json
|
||||||
|
@def NLOHMANN_DEFINE_TYPE_INTRUSIVE
|
||||||
|
@since version 3.9.0
|
||||||
|
@sa NLOHMANN_DEFINE_TYPE_INTRUSIVE_IMPL
|
||||||
|
*/
|
||||||
|
#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) NLOHMANN_DEFINE_TYPE_INTRUSIVE_IMPL(nlohmann::json, Type, __VA_ARGS__)
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@brief macro to briefly define non-intrusive serialization of given type to/from nlohmann::json
|
||||||
@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE
|
@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE
|
||||||
@since version 3.9.0
|
@since version 3.9.0
|
||||||
|
@sa NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_IMPL
|
||||||
*/
|
*/
|
||||||
#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \
|
#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_IMPL(nlohmann::json, Type, __VA_ARGS__)
|
||||||
inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
|
|
||||||
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 to briefly define intrusive serialization of a given type to/from any basic_json object
|
@brief macro to briefly define intrusive serialization of a given type to/from any basic_json object
|
||||||
|
|||||||
@ -2352,22 +2352,40 @@ JSON_HEDLEY_DIAGNOSTIC_POP
|
|||||||
#define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1);
|
#define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@brief macro
|
@brief macro to briefly define intrusive serialization of a given type to/from JSON
|
||||||
@def NLOHMANN_DEFINE_TYPE_INTRUSIVE
|
@note you can define your own specialized macroses like NLOHMANN_DEFINE_TYPE_INTRUSIVE
|
||||||
@since version 3.9.0
|
@def NLOHMANN_DEFINE_TYPE_INTRUSIVE_IMPL
|
||||||
|
@since version 3.9.2
|
||||||
*/
|
*/
|
||||||
#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \
|
#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_IMPL(BasicJsonType, Type, ...) \
|
||||||
friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
|
friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
|
||||||
friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
|
friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@brief macro
|
@brief macro to briefly define non-intrusive serialization of a given type to/from JSON
|
||||||
|
@note you can define your own specialized macroses like NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE
|
||||||
|
@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_IMPL
|
||||||
|
@since version 3.9.2
|
||||||
|
*/
|
||||||
|
#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_IMPL(BasicJsonType, Type, ...) \
|
||||||
|
inline void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
|
||||||
|
inline void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@brief macro to briefly define intrusive serialization of given type to/from nlohmann::json
|
||||||
|
@def NLOHMANN_DEFINE_TYPE_INTRUSIVE
|
||||||
|
@since version 3.9.0
|
||||||
|
@sa NLOHMANN_DEFINE_TYPE_INTRUSIVE_IMPL
|
||||||
|
*/
|
||||||
|
#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) NLOHMANN_DEFINE_TYPE_INTRUSIVE_IMPL(nlohmann::json, Type, __VA_ARGS__)
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@brief macro to briefly define non-intrusive serialization of given type to/from nlohmann::json
|
||||||
@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE
|
@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE
|
||||||
@since version 3.9.0
|
@since version 3.9.0
|
||||||
|
@sa NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_IMPL
|
||||||
*/
|
*/
|
||||||
#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \
|
#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_IMPL(nlohmann::json, Type, __VA_ARGS__)
|
||||||
inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
|
|
||||||
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 to briefly define intrusive serialization of a given type to/from any basic_json object
|
@brief macro to briefly define intrusive serialization of a given type to/from any basic_json object
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user