aboutsummaryrefslogtreecommitdiff
path: root/src/defines.h
blob: 587656aa519eef9a043ffbb85bc50cec331a7f67 (plain)
1
2
3
4
#define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(Super, Derived, ...)  \
    friend void to_json(nlohmann::json& nlohmann_json_j, const Derived& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast<Super>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
    friend void from_json(const nlohmann::json& nlohmann_json_j, Derived& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast<Super&>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } \
    virtual nlohmann::json serialize(void) const override { nlohmann::json ret; to_json(ret, *this); return ret; }