summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleix Pol <[email protected]>2016-10-24 17:48:49 +0200
committerAleix Pol <[email protected]>2016-10-24 17:48:49 +0200
commitddd97e7a8ad25cee760dc1fdd09b3311bd07291e (patch)
tree76ec0e2817b10577e3b8a3c7eab518c5ff8ed97c
parent24cc188b38ddee678583eb4ebb97afa1532f20f0 (diff)
Make filters printable into qdebug
-rw-r--r--libdiscover/resources/AbstractResourcesBackend.cpp15
-rw-r--r--libdiscover/resources/AbstractResourcesBackend.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/libdiscover/resources/AbstractResourcesBackend.cpp b/libdiscover/resources/AbstractResourcesBackend.cpp
index a5f1e0e..45cbe54 100644
--- a/libdiscover/resources/AbstractResourcesBackend.cpp
+++ b/libdiscover/resources/AbstractResourcesBackend.cpp
@@ -27,6 +27,21 @@
#include <QDebug>
#include <QTimer>
+QDebug operator<<(QDebug debug, const AbstractResourcesBackend::Filters& filters)
+{
+ QDebugStateSaver saver(debug);
+ debug.nospace() << "Filters(";
+ if (filters.category) debug.nospace() << "category: " << filters.category << ',';
+ if (filters.state) debug.nospace() << "state: " << filters.state << ',';
+ if (!filters.mimetype.isEmpty()) debug.nospace() << "mimetype: " << filters.mimetype << ',';
+ if (!filters.search.isEmpty()) debug.nospace() << "search: " << filters.search << ',';
+ if (!filters.extends.isEmpty()) debug.nospace() << "extends:" << filters.extends << ',';
+ if (!filters.roles.isEmpty()) debug.nospace() << "roles:" << filters.roles << ',';
+ debug.nospace() << ')';
+
+ return debug;
+}
+
ResultsStream::ResultsStream(const QString &objectName, const QVector<AbstractResource*>& resources)
: ResultsStream(objectName)
{
diff --git a/libdiscover/resources/AbstractResourcesBackend.h b/libdiscover/resources/AbstractResourcesBackend.h
index efe8458..720aec9 100644
--- a/libdiscover/resources/AbstractResourcesBackend.h
+++ b/libdiscover/resources/AbstractResourcesBackend.h
@@ -231,6 +231,8 @@ static T containerValues(const W& container)
return ret;
}
+DISCOVERCOMMON_EXPORT QDebug operator<<(QDebug dbg, const AbstractResourcesBackend::Filters& filters);
+
/**
* @internal Workaround because QPluginLoader enforces 1 instance per plugin
*/