From kde-commits Tue May 31 22:13:07 2016 From: Aleix Pol Date: Tue, 31 May 2016 22:13:07 +0000 To: kde-commits Subject: [attica] src: Provide QDebug helpers for some Attica classes Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=146473279516881 Git commit 2bc9c5b7f0f5f39f1ee43e7d8bbdf86d34e847ab by Aleix Pol. Committed on 30/05/2016 at 15:38. Pushed by apol into branch 'master'. Provide QDebug helpers for some Attica classes M +8 -0 src/category.cpp M +2 -0 src/category.h M +9 -0 src/provider.cpp M +2 -0 src/provider.h http://commits.kde.org/attica/2bc9c5b7f0f5f39f1ee43e7d8bbdf86d34e847ab diff --git a/src/category.cpp b/src/category.cpp index 5e6a242..99b542f 100644 --- a/src/category.cpp +++ b/src/category.cpp @@ -24,9 +24,17 @@ #include "category.h" = #include +#include = using namespace Attica; = +QDebug operator<<(QDebug s, const Attica::Category& cat) +{ + const QString name =3D cat.isValid() ? cat.name() : QStringLiteral("In= valid"); + s.nospace() << "Category(" << name << ')'; + return s.space(); +} + class Category::Private : public QSharedData { public: diff --git a/src/category.h b/src/category.h index f5d608e..3719d6b 100644 --- a/src/category.h +++ b/src/category.h @@ -102,4 +102,6 @@ private: = } = +QDebug operator<<(QDebug s, const Attica::Category& cat); + #endif diff --git a/src/provider.cpp b/src/provider.cpp index 8cf5ea8..39fc8f8 100644 --- a/src/provider.cpp +++ b/src/provider.cpp @@ -91,6 +91,15 @@ = using namespace Attica; = +QDebug operator<<(QDebug s, const Attica::Provider& prov) +{ + if (prov.isValid()) + s.nospace() << "Provider(" << prov.name() << ':' << prov.baseUrl()= << ')'; + else + s.nospace() << "Provider(Invalid)"; + return s.space(); +} + class Provider::Private : public QSharedData { public: diff --git a/src/provider.h b/src/provider.h index e41505e..c6fb28d 100644 --- a/src/provider.h +++ b/src/provider.h @@ -699,4 +699,6 @@ private: }; } = +static QDebug operator<<(QDebug s, const Attica::Provider& prov); + #endif