1
0
mirror of https://github.com/anope/anope.git synced 2026-06-26 13:16:38 +02:00

Move serialization from Serializable to a Serialize::Type child.

This commit is contained in:
Sadie Powell
2025-03-12 10:29:11 +00:00
parent 718f2e922a
commit cdcf0e2f9a
40 changed files with 778 additions and 452 deletions
+26 -20
View File
@@ -139,29 +139,35 @@ NickAlias *NickAlias::Find(const Anope::string &nick)
return NULL;
}
void NickAlias::Serialize(Serialize::Data &data) const
NickAlias::Type::Type()
: Serialize::Type("NickAlias")
{
data.Store("nick", this->nick);
data.Store("last_quit", this->last_quit);
data.Store("last_realname", this->last_realname);
data.Store("last_usermask", this->last_usermask);
data.Store("last_realhost", this->last_realhost);
data.Store("time_registered", this->time_registered);
data.Store("last_seen", this->last_seen);
data.Store("nc", this->nc->display);
if (this->HasVHost())
{
data.Store("vhost_ident", this->GetVHostIdent());
data.Store("vhost_host", this->GetVHostHost());
data.Store("vhost_creator", this->GetVHostCreator());
data.Store("vhost_time", this->GetVHostCreated());
}
Extensible::ExtensibleSerialize(this, this, data);
}
Serializable *NickAlias::Unserialize(Serializable *obj, Serialize::Data &data)
void NickAlias::Type::Serialize(const Serializable *obj, Serialize::Data &data) const
{
const auto *na = static_cast<const NickAlias *>(obj);
data.Store("nick", na->nick);
data.Store("last_quit", na->last_quit);
data.Store("last_realname", na->last_realname);
data.Store("last_usermask", na->last_usermask);
data.Store("last_realhost", na->last_realhost);
data.Store("time_registered", na->time_registered);
data.Store("last_seen", na->last_seen);
data.Store("nc", na->nc->display);
if (na->HasVHost())
{
data.Store("vhost_ident", na->GetVHostIdent());
data.Store("vhost_host", na->GetVHostHost());
data.Store("vhost_creator", na->GetVHostCreator());
data.Store("vhost_time", na->GetVHostCreated());
}
Extensible::ExtensibleSerialize(na, na, data);
}
Serializable *NickAlias::Type::Unserialize(Serializable *obj, Serialize::Data &data) const
{
Anope::string snc, snick;