qdbuserror.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9static const char errorMessages_string[] = -
10 "other\0" -
11 "org.freedesktop.DBus.Error.Failed\0" -
12 "org.freedesktop.DBus.Error.NoMemory\0" -
13 "org.freedesktop.DBus.Error.ServiceUnknown\0" -
14 "org.freedesktop.DBus.Error.NoReply\0" -
15 "org.freedesktop.DBus.Error.BadAddress\0" -
16 "org.freedesktop.DBus.Error.NotSupported\0" -
17 "org.freedesktop.DBus.Error.LimitsExceeded\0" -
18 "org.freedesktop.DBus.Error.AccessDenied\0" -
19 "org.freedesktop.DBus.Error.NoServer\0" -
20 "org.freedesktop.DBus.Error.Timeout\0" -
21 "org.freedesktop.DBus.Error.NoNetwork\0" -
22 "org.freedesktop.DBus.Error.AddressInUse\0" -
23 "org.freedesktop.DBus.Error.Disconnected\0" -
24 "org.freedesktop.DBus.Error.InvalidArgs\0" -
25 "org.freedesktop.DBus.Error.UnknownMethod\0" -
26 "org.freedesktop.DBus.Error.TimedOut\0" -
27 "org.freedesktop.DBus.Error.InvalidSignature\0" -
28 "org.freedesktop.DBus.Error.UnknownInterface\0" -
29 "org.freedesktop.DBus.Error.UnknownObject\0" -
30 "org.freedesktop.DBus.Error.UnknownProperty\0" -
31 "org.freedesktop.DBus.Error.PropertyReadOnly\0" -
32 "org.qtproject.QtDBus.Error.InternalError\0" -
33 "org.qtproject.QtDBus.Error.InvalidService\0" -
34 "org.qtproject.QtDBus.Error.InvalidObjectPath\0" -
35 "org.qtproject.QtDBus.Error.InvalidInterface\0" -
36 "org.qtproject.QtDBus.Error.InvalidMember\0" -
37 "\0"; -
38 -
39static const int errorMessages_indices[] = { -
40 0, 6, 40, 76, 118, 153, 191, 231, -
41 273, 313, 349, 384, 421, 461, 501, 540, -
42 581, 617, 661, 705, 746, 789, 833, 874, -
43 916, 961, 1005, -1 -
44}; -
45 -
46static const int errorMessages_count = sizeof errorMessages_indices / -
47 sizeof errorMessages_indices[0] - 1; -
48 -
49static inline const char *get(QDBusError::ErrorType code) -
50{ -
51 int intcode = qBound(0, int(code) - int(QDBusError::Other), errorMessages_count); -
52 return errorMessages_string + errorMessages_indices[intcode];
executed: return errorMessages_string + errorMessages_indices[intcode];
Execution Count:219
219
53} -
54 -
55static inline QDBusError::ErrorType get(const char *name) -
56{ -
57 if (!name || !*name)
partially evaluated: !name
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:339
partially evaluated: !*name
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:339
0-339
58 return QDBusError::NoError;
never executed: return QDBusError::NoError;
0
59 for (int i = 0; i < errorMessages_count; ++i)
evaluated: i < errorMessages_count
TRUEFALSE
yes
Evaluation Count:6265
yes
Evaluation Count:15
15-6265
60 if (strcmp(name, errorMessages_string + errorMessages_indices[i]) == 0)
evaluated: strcmp(name, errorMessages_string + errorMessages_indices[i]) == 0
TRUEFALSE
yes
Evaluation Count:324
yes
Evaluation Count:5941
324-5941
61 return QDBusError::ErrorType(i + int(QDBusError::Other));
executed: return QDBusError::ErrorType(i + int(QDBusError::Other));
Execution Count:324
324
62 return QDBusError::Other;
executed: return QDBusError::Other;
Execution Count:15
15
63} -
64QDBusError::QDBusError() -
65 : code(NoError) -
66{ -
67 -
68}
executed: }
Execution Count:3472
3472
69 -
70 -
71 -
72 -
73 -
74 -
75QDBusError::QDBusError(const DBusError *error) -
76 : code(NoError) -
77{ -
78 if (!error || !q_dbus_error_is_set(error))
partially evaluated: !error
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
partially evaluated: !q_dbus_error_is_set(error)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
79 return;
never executed: return;
0
80 -
81 code = ::get(error->name); -
82 msg = QString::fromUtf8(error->message); -
83 nm = QString::fromUtf8(error->name); -
84}
executed: }
Execution Count:17
17
85 -
86 -
87 -
88 -
89 -
90QDBusError::QDBusError(const QDBusMessage &qdmsg) -
91 : code(NoError) -
92{ -
93 if (qdmsg.type() != QDBusMessage::ErrorMessage)
evaluated: qdmsg.type() != QDBusMessage::ErrorMessage
TRUEFALSE
yes
Evaluation Count:1882
yes
Evaluation Count:322
322-1882
94 return;
executed: return;
Execution Count:1882
1882
95 -
96 code = ::get(qdmsg.errorName().toUtf8().constData()); -
97 nm = qdmsg.errorName(); -
98 msg = qdmsg.errorMessage(); -
99}
executed: }
Execution Count:322
322
100 -
101 -
102 -
103 -
104 -
105 -
106QDBusError::QDBusError(ErrorType error, const QString &mess) -
107 : code(error) -
108{ -
109 nm = QLatin1String(::get(error)); -
110 msg = mess; -
111}
executed: }
Execution Count:104
104
112 -
113 -
114 -
115 -
116 -
117QDBusError::QDBusError(const QDBusError &other) -
118 : code(other.code), msg(other.msg), nm(other.nm) -
119{ -
120}
executed: }
Execution Count:92
92
121 -
122 -
123 -
124 -
125 -
126 -
127QDBusError &QDBusError::operator=(const QDBusError &other) -
128{ -
129 code = other.code; -
130 msg = other.msg; -
131 nm = other.nm; -
132 return *this;
executed: return *this;
Execution Count:2406
2406
133} -
134 -
135 -
136 -
137 -
138 -
139 -
140QDBusError &QDBusError::operator=(const QDBusMessage &qdmsg) -
141{ -
142 if (qdmsg.type() == QDBusMessage::ErrorMessage) {
never evaluated: qdmsg.type() == QDBusMessage::ErrorMessage
0
143 code = ::get(qdmsg.errorName().toUtf8().constData()); -
144 nm = qdmsg.errorName(); -
145 msg = qdmsg.errorMessage(); -
146 } else {
never executed: }
0
147 code =NoError; -
148 nm.clear(); -
149 msg.clear(); -
150 }
never executed: }
0
151 return *this;
never executed: return *this;
0
152} -
153QDBusError::ErrorType QDBusError::type() const -
154{ -
155 return code;
executed: return code;
Execution Count:30
30
156} -
157QString QDBusError::name() const -
158{ -
159 return nm;
executed: return nm;
Execution Count:117
117
160} -
161 -
162 -
163 -
164 -
165 -
166 -
167 -
168QString QDBusError::message() const -
169{ -
170 return msg;
executed: return msg;
Execution Count:94
94
171} -
172 -
173 -
174 -
175 -
176 -
177 -
178bool QDBusError::isValid() const -
179{ -
180 return (code != NoError);
executed: return (code != NoError);
Execution Count:1281
1281
181} -
182 -
183 -
184 -
185 -
186 -
187QString QDBusError::errorString(ErrorType error) -
188{ -
189 return QLatin1String(::get(error));
executed: return QLatin1String(::get(error));
Execution Count:115
115
190} -
191 -
192 -
193QDebug operator<<(QDebug dbg, const QDBusError &msg) -
194{ -
195 dbg.nospace() << "QDBusError(" << msg.name() << ", " << msg.message() << ')'; -
196 return dbg.space();
never executed: return dbg.space();
0
197} -
198 -
199 -
200 -
201 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial