From 2b517b2fd28e804e82036f55967a1777c1b8d2e9 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 15 Dec 2016 11:15:34 +0100 Subject: Made references serializable so we can store them in config files --- common/domain/applicationdomaintype.cpp | 15 ++++++++++++++- common/domain/applicationdomaintype.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp index 42ae11a..c59a01e 100644 --- a/common/domain/applicationdomaintype.cpp +++ b/common/domain/applicationdomaintype.cpp @@ -31,12 +31,13 @@ namespace ApplicationDomain { constexpr const char *Mail::ThreadId::name; -int foo = [] { +static const int foo = [] { QMetaType::registerEqualsComparator(); QMetaType::registerDebugStreamOperator(); QMetaType::registerConverter(); QMetaType::registerDebugStreamOperator(); QMetaType::registerDebugStreamOperator(); + qRegisterMetaTypeStreamOperators(); return 0; }(); @@ -395,3 +396,15 @@ bool isGlobalType(const QByteArray &type) { } } +QDataStream &operator<<(QDataStream &out, const Sink::ApplicationDomain::Reference &reference) +{ + out << reference.value; + return out; +} + +QDataStream &operator>>(QDataStream &in, Sink::ApplicationDomain::Reference &reference) +{ + in >> reference.value; + return in; +} + diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index 1848224..b4d6f8a 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h @@ -502,6 +502,8 @@ class SINK_EXPORT TypeImplementation; REGISTER_TYPE(Sink::ApplicationDomain::SinkAccount); \ REGISTER_TYPE(Sink::ApplicationDomain::Identity); \ +QDataStream & SINK_EXPORT operator<<(QDataStream &out, const Sink::ApplicationDomain::Reference &reference); +QDataStream & SINK_EXPORT operator>>(QDataStream &in, Sink::ApplicationDomain::Reference &reference); Q_DECLARE_METATYPE(Sink::ApplicationDomain::ApplicationDomainType) Q_DECLARE_METATYPE(Sink::ApplicationDomain::ApplicationDomainType::Ptr) -- cgit v1.2.3