diff options
author | Your Name <you@example.com> | 2021-05-20 17:00:53 -0400 |
---|---|---|
committer | Your Name <you@example.com> | 2021-05-20 17:00:53 -0400 |
commit | b27700a7e0b281ece3dea23060c17e0cae28715d (patch) | |
tree | ef13e98281dd0183c4fb1e32cdf371ea1f6c1794 /src/defines.h | |
parent | be88609c825e18201f240415fe74a31c1a789484 (diff) | |
download | dmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.tar.gz dmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.tar.bz2 dmtool-b27700a7e0b281ece3dea23060c17e0cae28715d.zip |
Reduced exposure of implementation details
Diffstat (limited to 'src/defines.h')
-rw-r--r-- | src/defines.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/defines.h b/src/defines.h index 78ab770..f55a56f 100644 --- a/src/defines.h +++ b/src/defines.h @@ -6,8 +6,12 @@ #define NLOHMANN_FRIEND_DECLARES(Type) \ friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t); \ friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t); \ - virtual nlohmann::json serialize(void) const override { nlohmann::json ret; to_json(ret, *this); return ret; } + virtual nlohmann::json serialize(void) const { nlohmann::json ret; to_json(ret, *this); return ret; } #define NLOHMANN_FRIEND_DEFS(Super, Derived, PImpl) \ 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::to_json(nlohmann_json_j, *nlohmann_json_t.PImpl); } \ 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::from_json(nlohmann_json_j, *nlohmann_json_t.PImpl); } + +#define NLOHMANN_FRIEND_DEFS_BASE(Type, PImpl) \ + void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, *nlohmann_json_t.PImpl); } \ + void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, *nlohmann_json_t.PImpl); } |