aboutsummaryrefslogtreecommitdiff
path: root/src/defines.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-05-19 18:00:16 -0400
committerYour Name <you@example.com>2021-05-19 18:00:16 -0400
commitbe88609c825e18201f240415fe74a31c1a789484 (patch)
tree8b051262fcd9e1388ba45f14369112d3d9fb0d52 /src/defines.h
parent38e33d8756a5b652965be8ada478b5c4238b857c (diff)
downloaddmtool-be88609c825e18201f240415fe74a31c1a789484.tar.gz
dmtool-be88609c825e18201f240415fe74a31c1a789484.tar.bz2
dmtool-be88609c825e18201f240415fe74a31c1a789484.zip
Added git command; refactoring
Diffstat (limited to 'src/defines.h')
-rw-r--r--src/defines.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/defines.h b/src/defines.h
index 587656a..78ab770 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -2,3 +2,12 @@
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; }
+
+#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; }
+
+#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); }