diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-12-15 11:15:34 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-12-15 11:15:34 +0100 |
commit | 2b517b2fd28e804e82036f55967a1777c1b8d2e9 (patch) | |
tree | a64dee652b7f61ebc0c45657321eb8f21f4f0829 /common/domain/applicationdomaintype.cpp | |
parent | 42f70f035f7c7799ace26f6dfc85d189ec27f5ae (diff) | |
download | sink-2b517b2fd28e804e82036f55967a1777c1b8d2e9.tar.gz sink-2b517b2fd28e804e82036f55967a1777c1b8d2e9.zip |
Made references serializable so we can store them in config files
Diffstat (limited to 'common/domain/applicationdomaintype.cpp')
-rw-r--r-- | common/domain/applicationdomaintype.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
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 { | |||
31 | 31 | ||
32 | constexpr const char *Mail::ThreadId::name; | 32 | constexpr const char *Mail::ThreadId::name; |
33 | 33 | ||
34 | int foo = [] { | 34 | static const int foo = [] { |
35 | QMetaType::registerEqualsComparator<Reference>(); | 35 | QMetaType::registerEqualsComparator<Reference>(); |
36 | QMetaType::registerDebugStreamOperator<Reference>(); | 36 | QMetaType::registerDebugStreamOperator<Reference>(); |
37 | QMetaType::registerConverter<Reference, QByteArray>(); | 37 | QMetaType::registerConverter<Reference, QByteArray>(); |
38 | QMetaType::registerDebugStreamOperator<BLOB>(); | 38 | QMetaType::registerDebugStreamOperator<BLOB>(); |
39 | QMetaType::registerDebugStreamOperator<Mail::Contact>(); | 39 | QMetaType::registerDebugStreamOperator<Mail::Contact>(); |
40 | qRegisterMetaTypeStreamOperators<Sink::ApplicationDomain::Reference>(); | ||
40 | return 0; | 41 | return 0; |
41 | }(); | 42 | }(); |
42 | 43 | ||
@@ -395,3 +396,15 @@ bool isGlobalType(const QByteArray &type) { | |||
395 | } | 396 | } |
396 | } | 397 | } |
397 | 398 | ||
399 | QDataStream &operator<<(QDataStream &out, const Sink::ApplicationDomain::Reference &reference) | ||
400 | { | ||
401 | out << reference.value; | ||
402 | return out; | ||
403 | } | ||
404 | |||
405 | QDataStream &operator>>(QDataStream &in, Sink::ApplicationDomain::Reference &reference) | ||
406 | { | ||
407 | in >> reference.value; | ||
408 | return in; | ||
409 | } | ||
410 | |||