OpenCoverage

qdbuserror.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/dbus/qdbuserror.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtDBus module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qdbuserror.h"-
41-
42#include <qdebug.h>-
43#include <qvarlengtharray.h>-
44-
45#ifndef QT_BOOTSTRAPPED-
46#include "qdbus_symbols_p.h"-
47#include "qdbusmessage.h"-
48#include "qdbusmessage_p.h"-
49#endif-
50-
51#ifndef QT_NO_DBUS-
52-
53QT_BEGIN_NAMESPACE-
54-
55/*-
56 * Use the following Perl script to generate the error string index list:-
57===== PERL SCRIPT ====-
58print "static const char errorMessages_string[] =\n";-
59$counter = 0;-
60$i = 0;-
61while (<STDIN>) {-
62 chomp;-
63 print " \"$_\\0\"\n";-
64 $sizes[$i++] = $counter;-
65 $counter += 1 + length $_;-
66}-
67print " \"\\0\";\n\nstatic const int errorMessages_indices[] = {\n ";-
68for ($j = 0; $j < $i; ++$j) {-
69 printf "$sizes[$j], ";-
70}-
71print "0\n};\n";-
72===== PERL SCRIPT ====-
73-
74 * The input data is as follows:-
75other-
76org.freedesktop.DBus.Error.Failed-
77org.freedesktop.DBus.Error.NoMemory-
78org.freedesktop.DBus.Error.ServiceUnknown-
79org.freedesktop.DBus.Error.NoReply-
80org.freedesktop.DBus.Error.BadAddress-
81org.freedesktop.DBus.Error.NotSupported-
82org.freedesktop.DBus.Error.LimitsExceeded-
83org.freedesktop.DBus.Error.AccessDenied-
84org.freedesktop.DBus.Error.NoServer-
85org.freedesktop.DBus.Error.Timeout-
86org.freedesktop.DBus.Error.NoNetwork-
87org.freedesktop.DBus.Error.AddressInUse-
88org.freedesktop.DBus.Error.Disconnected-
89org.freedesktop.DBus.Error.InvalidArgs-
90org.freedesktop.DBus.Error.UnknownMethod-
91org.freedesktop.DBus.Error.TimedOut-
92org.freedesktop.DBus.Error.InvalidSignature-
93org.freedesktop.DBus.Error.UnknownInterface-
94org.freedesktop.DBus.Error.UnknownObject-
95org.freedesktop.DBus.Error.UnknownProperty-
96org.freedesktop.DBus.Error.PropertyReadOnly-
97org.qtproject.QtDBus.Error.InternalError-
98org.qtproject.QtDBus.Error.InvalidService-
99org.qtproject.QtDBus.Error.InvalidObjectPath-
100org.qtproject.QtDBus.Error.InvalidInterface-
101org.qtproject.QtDBus.Error.InvalidMember-
102*/-
103-
104// in the same order as KnownErrors!-
105static const char errorMessages_string[] =-
106 "other\0"-
107 "org.freedesktop.DBus.Error.Failed\0"-
108 "org.freedesktop.DBus.Error.NoMemory\0"-
109 "org.freedesktop.DBus.Error.ServiceUnknown\0"-
110 "org.freedesktop.DBus.Error.NoReply\0"-
111 "org.freedesktop.DBus.Error.BadAddress\0"-
112 "org.freedesktop.DBus.Error.NotSupported\0"-
113 "org.freedesktop.DBus.Error.LimitsExceeded\0"-
114 "org.freedesktop.DBus.Error.AccessDenied\0"-
115 "org.freedesktop.DBus.Error.NoServer\0"-
116 "org.freedesktop.DBus.Error.Timeout\0"-
117 "org.freedesktop.DBus.Error.NoNetwork\0"-
118 "org.freedesktop.DBus.Error.AddressInUse\0"-
119 "org.freedesktop.DBus.Error.Disconnected\0"-
120 "org.freedesktop.DBus.Error.InvalidArgs\0"-
121 "org.freedesktop.DBus.Error.UnknownMethod\0"-
122 "org.freedesktop.DBus.Error.TimedOut\0"-
123 "org.freedesktop.DBus.Error.InvalidSignature\0"-
124 "org.freedesktop.DBus.Error.UnknownInterface\0"-
125 "org.freedesktop.DBus.Error.UnknownObject\0"-
126 "org.freedesktop.DBus.Error.UnknownProperty\0"-
127 "org.freedesktop.DBus.Error.PropertyReadOnly\0"-
128 "org.qtproject.QtDBus.Error.InternalError\0"-
129 "org.qtproject.QtDBus.Error.InvalidService\0"-
130 "org.qtproject.QtDBus.Error.InvalidObjectPath\0"-
131 "org.qtproject.QtDBus.Error.InvalidInterface\0"-
132 "org.qtproject.QtDBus.Error.InvalidMember\0"-
133 "\0";-
134-
135static const int errorMessages_indices[] = {-
136 0, 6, 40, 76, 118, 153, 191, 231,-
137 273, 313, 349, 384, 421, 461, 501, 540,-
138 581, 617, 661, 705, 746, 789, 833, 874,-
139 916, 961, 1005-
140};-
141-
142static const int errorMessages_count = sizeof errorMessages_indices /-
143 sizeof errorMessages_indices[0];-
144-
145static inline const char *get(QDBusError::ErrorType code)-
146{-
147 int intcode = qBound(0, int(code) - int(QDBusError::Other), errorMessages_count);-
148 return errorMessages_string + errorMessages_indices[intcode];
executed 409 times by 13 tests: return errorMessages_string + errorMessages_indices[intcode];
Executed by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_no_bus - unknown status
  • tst_qdbusconnection_no_libdbus - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuslocalcalls - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
  • tst_qdbusthreading - unknown status
409
149}-
150-
151#ifndef QT_BOOTSTRAPPED-
152static inline QDBusError::ErrorType get(const char *name)-
153{-
154 if (!name || !*name)
!nameDescription
TRUEnever evaluated
FALSEevaluated 905 times by 32 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QSystemTrayIcon
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_no_bus - unknown status
  • tst_qdbusconnection_no_libdbus - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • ...
!*nameDescription
TRUEnever evaluated
FALSEevaluated 905 times by 32 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QSystemTrayIcon
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_no_bus - unknown status
  • tst_qdbusconnection_no_libdbus - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • ...
0-905
155 return QDBusError::NoError;
never executed: return QDBusError::NoError;
0
156 for (int i = 0; i < errorMessages_count; ++i)
i < errorMessages_countDescription
TRUEevaluated 16421 times by 32 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QSystemTrayIcon
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_no_bus - unknown status
  • tst_qdbusconnection_no_libdbus - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • ...
FALSEevaluated 93 times by 24 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QSystemTrayIcon
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
93-16421
157 if (strcmp(name, errorMessages_string + errorMessages_indices[i]) == 0)
strcmp(name, e...dices[i]) == 0Description
TRUEevaluated 812 times by 31 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QSystemTrayIcon
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_no_bus - unknown status
  • tst_qdbusconnection_no_libdbus - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbusinterface - unknown status
  • ...
FALSEevaluated 15609 times by 32 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QSystemTrayIcon
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_no_bus - unknown status
  • tst_qdbusconnection_no_libdbus - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • ...
812-15609
158 return QDBusError::ErrorType(i + int(QDBusError::Other));
executed 812 times by 31 tests: return QDBusError::ErrorType(i + int(QDBusError::Other));
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QSystemTrayIcon
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_no_bus - unknown status
  • tst_qdbusconnection_no_libdbus - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbusinterface - unknown status
  • ...
812
159 return QDBusError::Other;
executed 93 times by 24 tests: return QDBusError::Other;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QSystemTrayIcon
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
93
160}-
161#endif-
162-
163/*!-
164 \class QDBusError-
165 \inmodule QtDBus-
166 \since 4.2-
167-
168 \brief The QDBusError class represents an error received from the-
169 D-Bus bus or from remote applications found in the bus.-
170-
171 When dealing with the D-Bus bus service or with remote-
172 applications over D-Bus, a number of error conditions can-
173 happen. This error conditions are sometimes signalled by a-
174 returned error value or by a QDBusError.-
175-
176 C++ and Java exceptions are a valid analogy for D-Bus errors:-
177 instead of returning normally with a return value, remote-
178 applications and the bus may decide to throw an error-
179 condition. However, the Qt D-Bus implementation does not use the C++-
180 exception-throwing mechanism, so you will receive QDBusErrors in-
181 the return reply (see QDBusReply::error()).-
182-
183 QDBusError objects are used to inspect the error name and message-
184 as received from the bus and remote applications. You should not-
185 create such objects yourself to signal error conditions when-
186 called from D-Bus: instead, use QDBusMessage::createError() and-
187 QDBusConnection::send().-
188-
189 \sa QDBusConnection::send(), QDBusMessage, QDBusReply-
190*/-
191-
192/*!-
193 \enum QDBusError::ErrorType-
194-
195 In order to facilitate verification of the most common D-Bus errors generated by the D-Bus-
196 implementation and by the bus daemon itself, QDBusError can be compared to a set of pre-defined-
197 values:-
198-
199 \value NoError QDBusError is invalid (i.e., the call succeeded)-
200 \value Other QDBusError contains an error that is one of the well-known ones-
201 \value Failed The call failed (\c org.freedesktop.DBus.Error.Failed)-
202 \value NoMemory Out of memory (\c org.freedesktop.DBus.Error.NoMemory)-
203 \value ServiceUnknown The called service is not known-
204 (\c org.freedesktop.DBus.Error.ServiceUnknown)-
205 \value NoReply The called method did not reply within the specified timeout-
206 (\c org.freedesktop.DBus.Error.NoReply)-
207 \value BadAddress The address given is not valid-
208 (\c org.freedesktop.DBus.Error.BadAddress)-
209 \value NotSupported The call/operation is not supported-
210 (\c org.freedesktop.DBus.Error.NotSupported)-
211 \value LimitsExceeded The limits allocated to this process/call/connection exceeded the-
212 pre-defined values (\c org.freedesktop.DBus.Error.LimitsExceeded)-
213 \value AccessDenied The call/operation tried to access a resource it isn't allowed to-
214 (\c org.freedesktop.DBus.Error.AccessDenied)-
215 \value NoServer \e {Documentation doesn't say what this is for}-
216 (\c org.freedesktop.DBus.Error.NoServer)-
217 \value Timeout \e {Documentation doesn't say what this is for or how it's used}-
218 (\c org.freedesktop.DBus.Error.Timeout)-
219 \value NoNetwork \e {Documentation doesn't say what this is for}-
220 (\c org.freedesktop.DBus.Error.NoNetwork)-
221 \value AddressInUse QDBusServer tried to bind to an address that is already in use-
222 (\c org.freedesktop.DBus.Error.AddressInUse)-
223 \value Disconnected The call/process/message was sent after QDBusConnection disconnected-
224 (\c org.freedesktop.DBus.Error.Disconnected)-
225 \value InvalidArgs The arguments passed to this call/operation are not valid-
226 (\c org.freedesktop.DBus.Error.InvalidArgs)-
227 \value UnknownMethod The method called was not found in this object/interface with the-
228 given parameters (\c org.freedesktop.DBus.Error.UnknownMethod)-
229 \value TimedOut \e {Documentation doesn't say...}-
230 (\c org.freedesktop.DBus.Error.TimedOut)-
231 \value InvalidSignature The type signature is not valid or compatible-
232 (\c org.freedesktop.DBus.Error.InvalidSignature)-
233 \value UnknownInterface The interface is not known in this object-
234 (\c org.freedesktop.DBus.Error.UnknownInterface)-
235 \value UnknownObject The object path points to an object that does not exist-
236 (\c org.freedesktop.DBus.Error.UnknownObject)-
237 \value UnknownProperty The property does not exist in this interface-
238 (\c org.freedesktop.DBus.Error.UnknownProperty)-
239 \value PropertyReadOnly The property set failed because the property is read-only-
240 (\c org.freedesktop.DBus.Error.PropertyReadOnly)-
241-
242 \value InternalError An internal error occurred-
243-
244 \value InvalidObjectPath The object path provided is invalid.-
245-
246 \value InvalidService The service requested is invalid.-
247-
248 \value InvalidMember The member is invalid.-
249-
250 \value InvalidInterface The interface is invalid.-
251*/-
252-
253/*!-
254 \internal-
255 Constructs a QDBusError that represents no error.-
256*/-
257QDBusError::QDBusError()-
258 : code(NoError)-
259{-
260 // ### This class has an implicit (therefore inline) destructor-
261 // so the following field cannot be used.-
262 Q_UNUSED(unused);-
263}
executed 10818 times by 161 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDesktopWidget
  • ...
10818
264-
265#ifndef QT_BOOTSTRAPPED-
266/*!-
267 \internal-
268 Constructs a QDBusError from a DBusError structure.-
269*/-
270QDBusError::QDBusError(const DBusError *error)-
271 : code(NoError)-
272{-
273 if (!error || !q_dbus_error_is_set(error))
!errorDescription
TRUEnever evaluated
FALSEevaluated 11 times by 5 tests
Evaluated by:
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_no_bus - unknown status
  • tst_qdbusconnection_no_libdbus - unknown status
  • tst_qdbusconnection_spyhook - unknown status
!q_dbus_error_is_set(error)Description
TRUEnever evaluated
FALSEevaluated 11 times by 5 tests
Evaluated by:
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_no_bus - unknown status
  • tst_qdbusconnection_no_libdbus - unknown status
  • tst_qdbusconnection_spyhook - unknown status
0-11
274 return;
never executed: return;
0
275-
276 code = ::get(error->name);-
277 msg = QString::fromUtf8(error->message);-
278 nm = QString::fromUtf8(error->name);-
279}
executed 11 times by 5 tests: end of block
Executed by:
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_no_bus - unknown status
  • tst_qdbusconnection_no_libdbus - unknown status
  • tst_qdbusconnection_spyhook - unknown status
11
280-
281/*!-
282 \internal-
283 Constructs a QDBusError from a QDBusMessage.-
284*/-
285QDBusError::QDBusError(const QDBusMessage &qdmsg)-
286 : code(NoError)-
287{-
288 if (qdmsg.type() != QDBusMessage::ErrorMessage)
qdmsg.type() !...::ErrorMessageDescription
TRUEevaluated 2570 times by 158 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDesktopWidget
  • ...
FALSEevaluated 894 times by 30 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QSystemTrayIcon
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuslocalcalls - unknown status
  • ...
894-2570
289 return;
executed 2570 times by 158 tests: return;
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDesktopWidget
  • ...
2570
290-
291 code = ::get(qdmsg.errorName().toUtf8().constData());-
292 nm = qdmsg.errorName();-
293 msg = qdmsg.errorMessage();-
294}
executed 894 times by 30 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QSystemTrayIcon
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuslocalcalls - unknown status
  • ...
894
295#endif-
296-
297/*!-
298 \internal-
299 Constructs a QDBusError from a well-known error code-
300*/-
301QDBusError::QDBusError(ErrorType error, const QString &mess)-
302 : code(error)-
303{-
304 nm = QLatin1String(::get(error));-
305 msg = mess;-
306}
executed 152 times by 12 tests: end of block
Executed by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_no_bus - unknown status
  • tst_qdbusconnection_no_libdbus - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuslocalcalls - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
152
307-
308/*!-
309 \internal-
310 Constructs a QDBusError from another QDBusError object-
311*/-
312QDBusError::QDBusError(const QDBusError &other)-
313 : code(other.code), msg(other.msg), nm(other.nm)-
314{-
315}
executed 459 times by 29 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QSystemTrayIcon
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuslocalcalls - unknown status
  • ...
459
316-
317/*!-
318 \internal-
319 Assignment operator-
320*/-
321-
322QDBusError &QDBusError::operator=(const QDBusError &other)-
323{-
324 code = other.code;-
325 msg = other.msg;-
326 nm = other.nm;-
327 return *this;
executed 161 times by 29 tests: return *this;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QSystemTrayIcon
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • ...
161
328}-
329-
330#ifndef QT_BOOTSTRAPPED-
331/*!-
332 \internal-
333 Assignment operator from a QDBusMessage-
334*/-
335QDBusError &QDBusError::operator=(const QDBusMessage &qdmsg)-
336{-
337 if (qdmsg.type() == QDBusMessage::ErrorMessage) {
qdmsg.type() =...::ErrorMessageDescription
TRUEnever evaluated
FALSEnever evaluated
0
338 code = ::get(qdmsg.errorName().toUtf8().constData());-
339 nm = qdmsg.errorName();-
340 msg = qdmsg.errorMessage();-
341 } else {
never executed: end of block
0
342 code =NoError;-
343 nm.clear();-
344 msg.clear();-
345 }
never executed: end of block
0
346 return *this;
never executed: return *this;
0
347}-
348#endif-
349-
350/*!-
351 Returns this error's ErrorType.-
352-
353 \sa ErrorType-
354*/-
355-
356QDBusError::ErrorType QDBusError::type() const-
357{-
358 return code;
executed 34 times by 9 tests: return code;
Executed by:
  • tst_QSystemTrayIcon
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuslocalcalls - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
34
359}-
360-
361/*!-
362 Returns this error's name. Error names are similar to D-Bus Interface names, like-
363 \c org.freedesktop.DBus.InvalidArgs.-
364-
365 \sa type()-
366*/-
367-
368QString QDBusError::name() const-
369{-
370 return nm;
executed 130 times by 11 tests: return nm;
Executed by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_delayed - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbuslocalcalls - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
130
371}-
372-
373/*!-
374 Returns the message that the callee associated with this error. Error messages are-
375 implementation defined and usually contain a human-readable error code, though this does not-
376 mean it is suitable for your end-users.-
377*/-
378-
379QString QDBusError::message() const-
380{-
381 return msg;
executed 123 times by 9 tests: return msg;
Executed by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbuslocalcalls - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qdbusmetaobject - unknown status
  • tst_qdbusreply - unknown status
123
382}-
383-
384/*!-
385 Returns \c true if this is a valid error condition (i.e., if there was an error),-
386 otherwise false.-
387*/-
388-
389bool QDBusError::isValid() const-
390{-
391 return (code != NoError);
executed 1617 times by 160 tests: return (code != NoError);
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDesktopWidget
  • ...
1617
392}-
393-
394/*!-
395 \since 4.3-
396 Returns the error name associated with error condition \a error.-
397*/-
398QString QDBusError::errorString(ErrorType error)-
399{-
400 return QLatin1String(::get(error));
executed 257 times by 8 tests: return QLatin1String(::get(error));
Executed by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuslocalcalls - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusthreading - unknown status
257
401}-
402-
403#ifndef QT_NO_DEBUG_STREAM-
404QDebug operator<<(QDebug dbg, const QDBusError &msg)-
405{-
406 QDebugStateSaver saver(dbg);-
407 dbg.nospace() << "QDBusError(" << msg.name() << ", " << msg.message() << ')';-
408 return dbg;
never executed: return dbg;
0
409}-
410#endif-
411-
412QT_END_NAMESPACE-
413-
414#endif // QT_NO_DBUS-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9