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

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