diff options
author | Sadie Powell <sadie@witchery.services> | 2025-03-12 10:29:11 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2025-03-12 15:53:52 +0000 |
commit | cdcf0e2f9a8fb0e1c363fc65f71f3131fc6c5ea5 (patch) | |
tree | 3a665673235bb4dea58b99474492d90e0f711697 /src/xline.cpp | |
parent | 718f2e922a6e1113d66fc6e96131213942d507b2 (diff) |
Move serialization from Serializable to a Serialize::Type child.
Diffstat (limited to 'src/xline.cpp')
-rw-r--r-- | src/xline.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/xline.cpp b/src/xline.cpp index 9e8dd41bf..eca34cda2 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -151,19 +151,26 @@ bool XLine::IsRegex() const return !this->mask.empty() && this->mask[0] == '/' && this->mask[this->mask.length() - 1] == '/'; } -void XLine::Serialize(Serialize::Data &data) const +XLine::Type::Type() + : Serialize::Type("XLine") { - data.Store("mask", this->mask); - data.Store("by", this->by); - data.Store("created", this->created); - data.Store("expires", this->expires); - data.Store("reason", this->reason); - data.Store("uid", this->id); - if (this->manager) - data.Store("manager", this->manager->name); } -Serializable *XLine::Unserialize(Serializable *obj, Serialize::Data &data) +void XLine::Type::Serialize(const Serializable *obj, Serialize::Data &data) const +{ + const auto *xl = static_cast<const XLine *>(obj); + + data.Store("mask", xl->mask); + data.Store("by", xl->by); + data.Store("created", xl->created); + data.Store("expires", xl->expires); + data.Store("reason", xl->reason); + data.Store("uid", xl->id); + if (xl->manager) + data.Store("manager", xl->manager->name); +} + +Serializable *XLine::Type::Unserialize(Serializable *obj, Serialize::Data &data) const { Anope::string smanager; |