diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-02-16 20:15:23 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-02-16 20:15:23 +0100 |
commit | 129443ac808e69d5a61755451301633d2e07a3a6 (patch) | |
tree | a53343379c78e260505c0e1f3a637ff14df953cf | |
parent | 5374dcfd39d9a0ee5b493e93419018b734781c4a (diff) | |
download | sink-129443ac808e69d5a61755451301633d2e07a3a6.tar.gz sink-129443ac808e69d5a61755451301633d2e07a3a6.zip |
Improved debug output and moved debug operators to cpp
-rw-r--r-- | common/domain/applicationdomaintype.cpp | 32 | ||||
-rw-r--r-- | common/domain/applicationdomaintype.h | 31 |
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 | ||
28 | SINK_DEBUG_AREA("applicationdomaintype"); | 28 | SINK_DEBUG_AREA("applicationdomaintype"); |
29 | 29 | ||
30 | QDebug Sink::ApplicationDomain::operator<< (QDebug d, const Sink::ApplicationDomain::Mail::Contact &c) | ||
31 | { | ||
32 | d << "Contact(" << c.name << ", " << c.emailAddress << ")"; | ||
33 | return d; | ||
34 | } | ||
35 | |||
36 | QDebug 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 | |||
50 | QDebug Sink::ApplicationDomain::operator<< (QDebug d, const Sink::ApplicationDomain::Reference &ref) | ||
51 | { | ||
52 | d << ref.value; | ||
53 | return d; | ||
54 | } | ||
55 | |||
56 | QDebug Sink::ApplicationDomain::operator<< (QDebug d, const Sink::ApplicationDomain::BLOB &blob) | ||
57 | { | ||
58 | d << blob.value << "external:" << blob.isExternal ; | ||
59 | return d; | ||
60 | } | ||
61 | |||
30 | template <typename DomainType, typename Property> | 62 | template <typename DomainType, typename Property> |
31 | int registerProperty() { | 63 | int 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 | ||
265 | inline QDebug operator<< (QDebug d, const ApplicationDomainType &type) | 265 | SINK_EXPORT QDebug operator<< (QDebug d, const ApplicationDomainType &type); |
266 | { | 266 | SINK_EXPORT QDebug operator<< (QDebug d, const Reference &ref); |
267 | d << "ApplicationDomainType(\n"; | 267 | SINK_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 | |||
275 | inline QDebug operator<< (QDebug d, const Reference &ref) | ||
276 | { | ||
277 | d << ref.value; | ||
278 | return d; | ||
279 | } | ||
280 | |||
281 | inline QDebug operator<< (QDebug d, const BLOB &blob) | ||
282 | { | ||
283 | d << blob.value << "external:" << blob.isExternal ; | ||
284 | return d; | ||
285 | } | ||
286 | 268 | ||
287 | 269 | ||
288 | struct SINK_EXPORT SinkAccount : public ApplicationDomainType { | 270 | struct 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 | ||
392 | inline QDebug operator<< (QDebug d, const Mail::Contact &c) | 374 | SINK_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. |