File indexing completed on 2025-02-16 04:50:10

0001 /*
0002     SPDX-FileCopyrightText: 2017 Krzysztof Nowicki <krissn@op.pl>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <Akonadi/Collection>
0010 #include <Akonadi/Item>
0011 
0012 #include "ewsclient.h"
0013 #include "ewsclient_debug.h"
0014 #include "ewsres_agentif_debug.h"
0015 #include "ewsres_debug.h"
0016 
0017 inline QDebug operator<<(QDebug debug, const Akonadi::Item::List &items)
0018 {
0019     QDebugStateSaver saver(debug);
0020     QStringList itemStrs;
0021     itemStrs.reserve(items.count());
0022     for (const Akonadi::Item &item : items) {
0023         itemStrs.append(ewsHash(item.remoteId()));
0024     }
0025     debug.nospace().noquote() << "Akonadi::Item::List(" << itemStrs.join(QChar::fromLatin1(',')) << ")";
0026     return debug.maybeSpace();
0027 }
0028 
0029 inline QDebug operator<<(QDebug debug, const Akonadi::Item &item)
0030 {
0031     QDebugStateSaver saver(debug);
0032     debug.nospace().noquote() << "Akonadi::Item(" << ewsHash(item.remoteId()) << ")";
0033     return debug.maybeSpace();
0034 }
0035 
0036 inline QDebug operator<<(QDebug debug, const Akonadi::Collection::List &cols)
0037 {
0038     QDebugStateSaver saver(debug);
0039     QStringList itemStrs;
0040     itemStrs.reserve(cols.count());
0041     for (const Akonadi::Collection &col : cols) {
0042         itemStrs.append(EwsClient::folderHash.value(col.remoteId(), ewsHash(col.remoteId())));
0043     }
0044     debug.nospace().noquote() << "Akonadi::Collection::List(" << itemStrs.join(QLatin1Char(',')) << ")";
0045     return debug.maybeSpace();
0046 }
0047 
0048 inline QDebug operator<<(QDebug debug, const Akonadi::Collection &col)
0049 {
0050     QDebugStateSaver saver(debug);
0051     debug.nospace().noquote() << "Akonadi::Collection(" << EwsClient::folderHash.value(col.remoteId(), ewsHash(col.remoteId())) << ")";
0052     return debug.maybeSpace();
0053 }
0054 
0055 inline QDebug operator<<(QDebug debug, const QSet<QByteArray> &items)
0056 {
0057     QDebugStateSaver saver(debug);
0058     QStringList itemStrs;
0059     itemStrs.reserve(items.count());
0060     for (const QByteArray &item : items) {
0061         itemStrs.append(QString::fromLatin1(item));
0062     }
0063     debug.nospace().noquote() << "QSet<QByteArray>(" << itemStrs.join(QLatin1Char(',')) << ")";
0064     return debug.maybeSpace();
0065 }