23
23
#include < utility>
24
24
#include < QDebug>
25
25
#include < QFile>
26
+ #include < QLoggingCategory>
27
+ #include < QStringView>
26
28
#include < QXmlStreamReader>
27
29
#include < QtLogging>
28
30
#include < qdebug.h>
29
31
#include < qlogging.h>
30
- #include < QStringView>
31
- #include < QLoggingCategory>
32
32
#include " protocol.h"
33
33
34
34
Q_DECLARE_LOGGING_CATEGORY (generator);
@@ -78,7 +78,8 @@ void ParseContext::startElement(QStringView element_name,
78
78
bool ok = false ;
79
79
version = att.value ().toUInt (&ok);
80
80
if (!ok) {
81
- qCCritical (generator) << " wrong version (" << att.value () << " )" ;
81
+ qCCritical (generator)
82
+ << " wrong version (" << att.value () << " )" ;
82
83
}
83
84
}
84
85
if (att.name () == " type" ) {
@@ -151,8 +152,9 @@ void ParseContext::startElement(QStringView element_name,
151
152
if (!ok) {
152
153
qCCritical (generator) << " invalid integer (" << since << " )" ;
153
154
} else if (version > interface_->version_ ) {
154
- qCCritical (generator) << " since (" << version << " ) larger than version ("
155
- << interface_->version_ << " )" ;
155
+ qCCritical (generator)
156
+ << " since (" << version << " ) larger than version ("
157
+ << interface_->version_ << " )" ;
156
158
}
157
159
} else {
158
160
version = 1 ;
@@ -165,7 +167,8 @@ void ParseContext::startElement(QStringView element_name,
165
167
message_->since_ = version;
166
168
167
169
if (name == " destroy" && !message_->destructor_ ) {
168
- qCCritical (generator) << " destroy request should be destructor type" ;
170
+ qCCritical (generator)
171
+ << " destroy request should be destructor type" ;
169
172
}
170
173
} else if (element_name == " arg" ) {
171
174
if (name.isEmpty ()) {
@@ -187,7 +190,8 @@ void ParseContext::startElement(QStringView element_name,
187
190
break ;
188
191
default :
189
192
if (!interface_name.isEmpty ()) {
190
- qCCritical (generator) << " interface attribute not allowed for type " << type;
193
+ qCCritical (generator)
194
+ << " interface attribute not allowed for type " << type;
191
195
}
192
196
break ;
193
197
}
@@ -198,13 +202,15 @@ void ParseContext::startElement(QStringView element_name,
198
202
} else if (allow_null == " false" ) {
199
203
arg->nullable_ = false ;
200
204
} else {
201
- qCCritical (generator) << " invalid value for allow-null attribute ("
202
- << allow_null << " )" ;
205
+ qCCritical (generator)
206
+ << " invalid value for allow-null attribute (" << allow_null
207
+ << " )" ;
203
208
}
204
209
205
210
if (!arg->isNullableType ()) {
206
- qCCritical (generator) << " allow-null is only valid for objects, strings, "
207
- " and arrays" ;
211
+ qCCritical (generator)
212
+ << " allow-null is only valid for objects, strings, "
213
+ " and arrays" ;
208
214
}
209
215
}
210
216
@@ -223,9 +229,10 @@ void ParseContext::startElement(QStringView element_name,
223
229
} else if (bitfield == " true" ) {
224
230
enumeration_->bitfield_ = true ;
225
231
} else {
226
- qCCritical (generator) << " invalid value (" << bitfield
227
- << " ) for bitfield attribute (only true/false "
228
- " are accepted)" ;
232
+ qCCritical (generator)
233
+ << " invalid value (" << bitfield
234
+ << " ) for bitfield attribute (only true/false "
235
+ " are accepted)" ;
229
236
}
230
237
} else if (element_name == " entry" ) {
231
238
if (name.isEmpty ()) {
@@ -239,33 +246,37 @@ void ParseContext::startElement(QStringView element_name,
239
246
}
240
247
}
241
248
242
- void ParseContext::verifyArguments (Interface *interface,
243
- std::list<Message> *messages,
244
- std::list<Enumeration> * /* enumerations*/ ) const {
249
+ void ParseContext::verifyArguments (
250
+ Interface *interface, std::list<Message> *messages,
251
+ std::list<Enumeration> * /* enumerations*/ ) const {
245
252
for (auto &m : *messages) {
246
253
for (auto &a : m.argList_ ) {
247
254
248
255
if (a.enumerationName_ .isEmpty ()) {
249
256
continue ;
250
257
}
251
258
252
- const auto *e = protocol_->findEnumeration (interface, a.enumerationName_ );
259
+ const auto *e =
260
+ protocol_->findEnumeration (interface, a.enumerationName_ );
253
261
254
262
if (!e) {
255
- qCCritical (generator) << " could not find enumeration " << a.enumerationName_ ;
263
+ qCCritical (generator)
264
+ << " could not find enumeration " << a.enumerationName_ ;
256
265
}
257
266
258
267
switch (a.type_ ) {
259
268
case INT:
260
269
if (e->bitfield_ ) {
261
- qCCritical (generator) << " bitfield-style enum must only be referenced "
262
- " by uint" ;
270
+ qCCritical (generator)
271
+ << " bitfield-style enum must only be referenced "
272
+ " by uint" ;
263
273
}
264
274
break ;
265
275
case UNSIGNED:
266
276
break ;
267
277
default :
268
- qCCritical (generator) << " enumeration-style argument has wrong type" ;
278
+ qCCritical (generator)
279
+ << " enumeration-style argument has wrong type" ;
269
280
}
270
281
}
271
282
}
@@ -290,7 +301,8 @@ void ParseContext::endElement(QStringView name) {
290
301
message_ = nullptr ;
291
302
} else if (name == " enum" ) {
292
303
if (enumeration_->entryList_ .empty ()) {
293
- qCCritical (generator) << " enumeration " << enumeration_->name_ << " was empty" ;
304
+ qCCritical (generator)
305
+ << " enumeration " << enumeration_->name_ << " was empty" ;
294
306
}
295
307
enumeration_ = nullptr ;
296
308
} else if (name == " protocol" ) {
0 commit comments