[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [attica] src: Provide QDebug helpers for some Attica classes
From: Aleix Pol <aleixpol () kde ! org>
Date: 2016-05-31 22:13:07
Message-ID: E1b7ruN-0000O7-0L () scm ! kde ! org
[Download RAW message or body]
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 <QtCore/QString>
+#include <QtCore/QDebug>
using namespace Attica;
+QDebug operator<<(QDebug s, const Attica::Category& cat)
+{
+ const QString name = cat.isValid() ? cat.name() : QStringLiteral("Invalid");
+ 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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic