Coverage Report

Created: 2026-01-25 07:18

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/qtbase/src/dbus/qdbuserror.h
Line
Count
Source
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#ifndef QDBUSERROR_H
6
#define QDBUSERROR_H
7
8
#include <QtDBus/qtdbusglobal.h>
9
#include <QtCore/qobjectdefs.h>
10
#include <QtCore/qstring.h>
11
12
#ifndef QT_NO_DBUS
13
14
struct DBusError;
15
16
QT_BEGIN_NAMESPACE
17
18
19
class QDBusMessage;
20
21
class Q_DBUS_EXPORT QDBusError
22
{
23
    Q_GADGET
24
public:
25
    enum ErrorType {
26
        NoError = 0,
27
        Other = 1,
28
        Failed,
29
        NoMemory,
30
        ServiceUnknown,
31
        NoReply,
32
        BadAddress,
33
        NotSupported,
34
        LimitsExceeded,
35
        AccessDenied,
36
        NoServer,
37
        Timeout,
38
        NoNetwork,
39
        AddressInUse,
40
        Disconnected,
41
        InvalidArgs,
42
        UnknownMethod,
43
        TimedOut,
44
        InvalidSignature,
45
        UnknownInterface,
46
        UnknownObject,
47
        UnknownProperty,
48
        PropertyReadOnly,
49
        InternalError,
50
        InvalidService,
51
        InvalidObjectPath,
52
        InvalidInterface,
53
        InvalidMember,
54
55
#ifndef Q_QDOC
56
        // don't use this one!
57
        LastErrorType = InvalidMember
58
#endif
59
    };
60
0
    Q_ENUM(ErrorType)
Unexecuted instantiation: qt_getEnumMetaObject(QDBusError::ErrorType)
Unexecuted instantiation: qt_getEnumName(QDBusError::ErrorType)
61
0
62
0
    QDBusError();
63
0
#ifndef QT_BOOTSTRAPPED
64
0
    explicit QDBusError(const DBusError *error);
65
0
    Q_IMPLICIT QDBusError(const QDBusMessage& msg);
66
0
#endif
67
0
    QDBusError(ErrorType error, const QString &message);
68
0
    QDBusError(const QDBusError &other);
69
0
    QDBusError(QDBusError &&other) noexcept
70
0
        : code(other.code), msg(std::move(other.msg)), nm(std::move(other.nm))
71
0
    {}
72
0
    QDBusError &operator=(QDBusError &&other) noexcept { swap(other); return *this; }
73
    QDBusError &operator=(const QDBusError &other);
74
#ifndef QT_BOOTSTRAPPED
75
    QDBusError &operator=(const QDBusMessage &msg);
76
#endif
77
78
    void swap(QDBusError &other) noexcept
79
0
    {
80
0
        std::swap(code, other.code);
81
0
        msg.swap(other.msg);
82
0
        nm.swap(other.nm);
83
0
    }
84
85
    ErrorType type() const;
86
    QString name() const;
87
    QString message() const;
88
    bool isValid() const;
89
90
    static QString errorString(ErrorType error);
91
92
private:
93
    ErrorType code;
94
    QString msg;
95
    QString nm;
96
    // ### This class has an implicit (therefore inline) destructor
97
    // so the following field cannot be used:
98
    void *unused;
99
};
100
0
Q_DECLARE_SHARED(QDBusError)
101
0
102
0
#ifndef QT_NO_DEBUG_STREAM
103
0
Q_DBUS_EXPORT QDebug operator<<(QDebug, const QDBusError &);
104
0
#endif
105
0
106
0
QT_END_NAMESPACE
107
0
108
QT_DECL_METATYPE_EXTERN(QDBusError, Q_DBUS_EXPORT)
Unexecuted instantiation: int qRegisterNormalizedMetaType<QDBusError>(QByteArray const&)
Unexecuted instantiation: QMetaTypeId<QDBusError>::qt_metatype_id()
109
#else
110
QT_BEGIN_NAMESPACE
111
class Q_DBUS_EXPORT QDBusError {}; // dummy class for moc
112
QT_END_NAMESPACE
113
#endif // QT_NO_DBUS
114
#endif