summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-02-16 20:15:23 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-02-16 20:15:23 +0100
commit129443ac808e69d5a61755451301633d2e07a3a6 (patch)
treea53343379c78e260505c0e1f3a637ff14df953cf
parent5374dcfd39d9a0ee5b493e93419018b734781c4a (diff)
downloadsink-129443ac808e69d5a61755451301633d2e07a3a6.tar.gz
sink-129443ac808e69d5a61755451301633d2e07a3a6.zip
Improved debug output and moved debug operators to cpp
-rw-r--r--common/domain/applicationdomaintype.cpp32
-rw-r--r--common/domain/applicationdomaintype.h31
2 files changed, 36 insertions, 27 deletions
diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp
index 530056d..fd88570 100644
--- a/common/domain/applicationdomaintype.cpp
+++ b/common/domain/applicationdomaintype.cpp
@@ -27,6 +27,38 @@
27 27
28SINK_DEBUG_AREA("applicationdomaintype"); 28SINK_DEBUG_AREA("applicationdomaintype");
29 29
30QDebug Sink::ApplicationDomain::operator<< (QDebug d, const Sink::ApplicationDomain::Mail::Contact &c)
31{
32 d << "Contact(" << c.name << ", " << c.emailAddress << ")";
33 return d;
34}
35
36QDebug Sink::ApplicationDomain::operator<< (QDebug d, const Sink::ApplicationDomain::ApplicationDomainType &type)
37{
38 d << "ApplicationDomainType(\n";
39 auto properties = type.mAdaptor->availableProperties();
40 std::sort(properties.begin(), properties.end());
41 d << " " << "Id: " << "\t" << type.identifier() << "\n";
42 d << " " << "Resource: " << "\t" << type.resourceInstanceIdentifier() << "\n";
43 for (const auto &property : properties) {
44 d << " " << property << "\t" << type.getProperty(property) << "\n";
45 }
46 d << ")";
47 return d;
48}
49
50QDebug Sink::ApplicationDomain::operator<< (QDebug d, const Sink::ApplicationDomain::Reference &ref)
51{
52 d << ref.value;
53 return d;
54}
55
56QDebug Sink::ApplicationDomain::operator<< (QDebug d, const Sink::ApplicationDomain::BLOB &blob)
57{
58 d << blob.value << "external:" << blob.isExternal ;
59 return d;
60}
61
30template <typename DomainType, typename Property> 62template <typename DomainType, typename Property>
31int registerProperty() { 63int registerProperty() {
32 Sink::Private::PropertyRegistry::instance().registerProperty<Property>(Sink::ApplicationDomain::getTypeName<DomainType>()); 64 Sink::Private::PropertyRegistry::instance().registerProperty<Property>(Sink::ApplicationDomain::getTypeName<DomainType>());
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h
index 7380c04..fee6344 100644
--- a/common/domain/applicationdomaintype.h
+++ b/common/domain/applicationdomaintype.h
@@ -262,27 +262,9 @@ inline bool operator==(const ApplicationDomainType& lhs, const ApplicationDomain
262 && lhs.resourceInstanceIdentifier() == rhs.resourceInstanceIdentifier(); 262 && lhs.resourceInstanceIdentifier() == rhs.resourceInstanceIdentifier();
263} 263}
264 264
265inline QDebug operator<< (QDebug d, const ApplicationDomainType &type) 265SINK_EXPORT QDebug operator<< (QDebug d, const ApplicationDomainType &type);
266{ 266SINK_EXPORT QDebug operator<< (QDebug d, const Reference &ref);
267 d << "ApplicationDomainType(\n"; 267SINK_EXPORT QDebug operator<< (QDebug d, const BLOB &blob);
268 for (const auto &property : type.mAdaptor->availableProperties()) {
269 d << " " << property << "\t" << type.getProperty(property) << "\n";
270 }
271 d << ")";
272 return d;
273}
274
275inline QDebug operator<< (QDebug d, const Reference &ref)
276{
277 d << ref.value;
278 return d;
279}
280
281inline QDebug operator<< (QDebug d, const BLOB &blob)
282{
283 d << blob.value << "external:" << blob.isExternal ;
284 return d;
285}
286 268
287 269
288struct SINK_EXPORT SinkAccount : public ApplicationDomainType { 270struct SINK_EXPORT SinkAccount : public ApplicationDomainType {
@@ -389,12 +371,7 @@ struct SINK_EXPORT Mail : public Entity {
389 SINK_INDEX_PROPERTY(QByteArray, ThreadId, threadId); 371 SINK_INDEX_PROPERTY(QByteArray, ThreadId, threadId);
390}; 372};
391 373
392inline QDebug operator<< (QDebug d, const Mail::Contact &c) 374SINK_EXPORT QDebug operator<< (QDebug d, const Mail::Contact &c);
393{
394 d << "Contact(" << c.name << ", " << c.emailAddress << ")";
395 return d;
396}
397
398 375
399/** 376/**
400 * The status of an account or resource. 377 * The status of an account or resource.