Libkleo

debug.cpp
1/*
2 kleo/debug.cpp
3
4 This file is part of libkleopatra, the KDE keymanagement library
5 SPDX-FileCopyrightText: 2021, 2022 g10 Code GmbH
6 SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
7
8 SPDX-License-Identifier: GPL-2.0-or-later
9*/
10
11#include <config-libkleo.h>
12
13#include "debug.h"
14
15#include "keygroup.h"
16
17#include <libkleo/formatting.h>
18
19#include <QDebug>
20
21using namespace Kleo;
22
23QDebug operator<<(QDebug debug, const GpgME::Key &key)
24{
25 const bool oldSetting = debug.autoInsertSpaces();
26 debug.nospace() << "GpgME::Key(";
27 if (key.isNull()) {
28 debug << "null";
29 } else if (key.primaryFingerprint()) {
30 debug << Formatting::summaryLine(key) << ", fpr: " << key.primaryFingerprint();
31 } else {
32 debug << Formatting::summaryLine(key) << ", id: " << key.keyID();
33 }
34 debug << ')';
35 debug.setAutoInsertSpaces(oldSetting);
36 return debug.maybeSpace();
37}
38
39QDebug operator<<(QDebug debug, const Kleo::KeyGroup &group)
40{
41 const bool oldSetting = debug.autoInsertSpaces();
42 if (group.isNull()) {
43 debug << "Null";
44 } else {
45 debug.nospace() << group.name() << " (id: " << group.id() << ", source: " << group.source() << ", keys: " << group.keys().size()
46 << ", isImmutable: " << group.isImmutable() << ")";
47 }
48 debug.setAutoInsertSpaces(oldSetting);
49 return debug.maybeSpace();
50}
KTEXTEDITOR_EXPORT QDebug operator<<(QDebug s, const MovingCursor &cursor)
bool autoInsertSpaces() const const
QDebug & maybeSpace()
QDebug & nospace()
void setAutoInsertSpaces(bool b)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 14 2024 11:51:59 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.