From 129443ac808e69d5a61755451301633d2e07a3a6 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 16 Feb 2017 20:15:23 +0100 Subject: Improved debug output and moved debug operators to cpp --- common/domain/applicationdomaintype.cpp | 32 ++++++++++++++++++++++++++++++++ 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 @@ SINK_DEBUG_AREA("applicationdomaintype"); +QDebug Sink::ApplicationDomain::operator<< (QDebug d, const Sink::ApplicationDomain::Mail::Contact &c) +{ + d << "Contact(" << c.name << ", " << c.emailAddress << ")"; + return d; +} + +QDebug Sink::ApplicationDomain::operator<< (QDebug d, const Sink::ApplicationDomain::ApplicationDomainType &type) +{ + d << "ApplicationDomainType(\n"; + auto properties = type.mAdaptor->availableProperties(); + std::sort(properties.begin(), properties.end()); + d << " " << "Id: " << "\t" << type.identifier() << "\n"; + d << " " << "Resource: " << "\t" << type.resourceInstanceIdentifier() << "\n"; + for (const auto &property : properties) { + d << " " << property << "\t" << type.getProperty(property) << "\n"; + } + d << ")"; + return d; +} + +QDebug Sink::ApplicationDomain::operator<< (QDebug d, const Sink::ApplicationDomain::Reference &ref) +{ + d << ref.value; + return d; +} + +QDebug Sink::ApplicationDomain::operator<< (QDebug d, const Sink::ApplicationDomain::BLOB &blob) +{ + d << blob.value << "external:" << blob.isExternal ; + return d; +} + template int registerProperty() { Sink::Private::PropertyRegistry::instance().registerProperty(Sink::ApplicationDomain::getTypeName()); 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 && lhs.resourceInstanceIdentifier() == rhs.resourceInstanceIdentifier(); } -inline QDebug operator<< (QDebug d, const ApplicationDomainType &type) -{ - d << "ApplicationDomainType(\n"; - for (const auto &property : type.mAdaptor->availableProperties()) { - d << " " << property << "\t" << type.getProperty(property) << "\n"; - } - d << ")"; - return d; -} - -inline QDebug operator<< (QDebug d, const Reference &ref) -{ - d << ref.value; - return d; -} - -inline QDebug operator<< (QDebug d, const BLOB &blob) -{ - d << blob.value << "external:" << blob.isExternal ; - return d; -} +SINK_EXPORT QDebug operator<< (QDebug d, const ApplicationDomainType &type); +SINK_EXPORT QDebug operator<< (QDebug d, const Reference &ref); +SINK_EXPORT QDebug operator<< (QDebug d, const BLOB &blob); struct SINK_EXPORT SinkAccount : public ApplicationDomainType { @@ -389,12 +371,7 @@ struct SINK_EXPORT Mail : public Entity { SINK_INDEX_PROPERTY(QByteArray, ThreadId, threadId); }; -inline QDebug operator<< (QDebug d, const Mail::Contact &c) -{ - d << "Contact(" << c.name << ", " << c.emailAddress << ")"; - return d; -} - +SINK_EXPORT QDebug operator<< (QDebug d, const Mail::Contact &c); /** * The status of an account or resource. -- cgit v1.2.3