@@ -35,8 +35,9 @@ Q_DECLARE_LOGGING_CATEGORY(generator);
35
35
36
36
#define XML_BUFFER_SIZE 4096
37
37
38
- ParseContext::ParseContext (Protocol *protocol, const QString &filename)
39
- : protocol_(protocol) {
38
+ ParseContext::ParseContext (Protocol *protocol, const QString &filename,
39
+ bool main)
40
+ : protocol_(protocol), main_(main) {
40
41
41
42
if (filename.isEmpty ()) {
42
43
@@ -124,7 +125,7 @@ void ParseContext::startElement(QStringView element_name,
124
125
qCCritical (generator) << " no interface version given" ;
125
126
}
126
127
127
- protocol_->interfaces_ .emplace_back (loc_, name, version);
128
+ protocol_->interfaces_ .emplace_back (loc_, name, version, main_ );
128
129
interface_ = &protocol_->interfaces_ .back ();
129
130
} else if (element_name == " request" || element_name == " event" ) {
130
131
if (name.empty ()) {
@@ -137,11 +138,11 @@ void ParseContext::startElement(QStringView element_name,
137
138
} else {
138
139
messageList = &interface_->eventsList_ ;
139
140
}
140
- messageList->emplace_back (loc_, name);
141
+ messageList->emplace_back (name);
141
142
message_ = &messageList->back ();
142
143
143
144
if (type == " destructor" ) {
144
- message_->destructor_ = 1 ;
145
+ message_->destructor_ = true ;
145
146
}
146
147
147
148
if (!since.isEmpty ()) {
@@ -235,25 +236,6 @@ void ParseContext::startElement(QStringView element_name,
235
236
entry = &enumeration_->entryList_ .back ();
236
237
237
238
entry->summary_ = summary.toString ();
238
- } else if (element_name == " description" ) {
239
- if (summary.isEmpty ()) {
240
- qCCritical (generator) << " description without summary" ;
241
- }
242
-
243
- std::unique_ptr<Description> description =
244
- std::make_unique<Description>();
245
- description_ = description.get ();
246
- description->summary = summary.toString ();
247
-
248
- if (message_) {
249
- message_->description_ = std::move (description);
250
- } else if (enumeration_) {
251
- enumeration_->description_ = std::move (description);
252
- } else if (interface_) {
253
- interface_->description_ = std::move (description);
254
- } else {
255
- protocol_->description_ = std::move (description);
256
- }
257
239
}
258
240
}
259
241
@@ -293,8 +275,17 @@ void ParseContext::endElement(QStringView name) {
293
275
if (name == " copyright" ) {
294
276
protocol_->copyright_ = characterData_;
295
277
} else if (name == " description" ) {
296
- description_->text = characterData_;
297
- description_ = nullptr ;
278
+ Description description;
279
+ description.text = characterData_;
280
+ if (message_) {
281
+ message_->description_ = std::move (description);
282
+ } else if (enumeration_) {
283
+ enumeration_->description_ = std::move (description);
284
+ } else if (interface_) {
285
+ interface_->description_ = std::move (description);
286
+ } else {
287
+ protocol_->description_ = std::move (description);
288
+ }
298
289
} else if (name == " request" || name == " event" ) {
299
290
message_ = nullptr ;
300
291
} else if (name == " enum" ) {
0 commit comments