Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
ui4.cpp
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT!
5
6#include "ui4_p.h"
7
8
10
11using namespace Qt::StringLiterals;
12
13#ifdef QFORMINTERNAL_NAMESPACE
14using namespace QFormInternal;
15#endif
16
17/*******************************************************************************
18** Implementations
19*/
20
21DomUI::~DomUI()
22{
23 delete m_widget;
24 delete m_layoutDefault;
25 delete m_layoutFunction;
26 delete m_customWidgets;
27 delete m_tabStops;
28 delete m_includes;
29 delete m_resources;
30 delete m_connections;
31 delete m_designerdata;
32 delete m_slots;
33 delete m_buttonGroups;
34}
35
36void DomUI::read(QXmlStreamReader &reader)
37{
38 const QXmlStreamAttributes &attributes = reader.attributes();
39 for (const QXmlStreamAttribute &attribute : attributes) {
40 const auto name = attribute.name();
41 if (name == u"version"_s) {
42 setAttributeVersion(attribute.value().toString());
43 continue;
44 }
45 if (name == u"language"_s) {
46 setAttributeLanguage(attribute.value().toString());
47 continue;
48 }
49 if (name == u"displayname"_s) {
50 setAttributeDisplayname(attribute.value().toString());
51 continue;
52 }
53 if (name == u"idbasedtr"_s) {
54 setAttributeIdbasedtr(attribute.value() == u"true"_s);
55 continue;
56 }
57 if (name == u"label"_s) {
58 setAttributeLabel(attribute.value().toString());
59 continue;
60 }
61 if (name == u"connectslotsbyname"_s) {
62 setAttributeConnectslotsbyname(attribute.value() == u"true"_s);
63 continue;
64 }
65 if (name == u"stdsetdef"_s) {
66 setAttributeStdsetdef(attribute.value().toInt());
67 continue;
68 }
69 if (name == u"stdSetDef"_s) {
70 setAttributeStdSetDef(attribute.value().toInt());
71 continue;
72 }
73 reader.raiseError("Unexpected attribute "_L1 + name);
74 }
75
76 while (!reader.hasError()) {
77 switch (reader.readNext()) {
78 case QXmlStreamReader::StartElement : {
79 const auto tag = reader.name();
80 if (!tag.compare(u"author"_s, Qt::CaseInsensitive)) {
81 setElementAuthor(reader.readElementText());
82 continue;
83 }
84 if (!tag.compare(u"comment"_s, Qt::CaseInsensitive)) {
85 setElementComment(reader.readElementText());
86 continue;
87 }
88 if (!tag.compare(u"exportmacro"_s, Qt::CaseInsensitive)) {
89 setElementExportMacro(reader.readElementText());
90 continue;
91 }
92 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
93 setElementClass(reader.readElementText());
94 continue;
95 }
96 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
97 auto *v = new DomWidget();
98 v->read(reader);
99 setElementWidget(v);
100 continue;
101 }
102 if (!tag.compare(u"layoutdefault"_s, Qt::CaseInsensitive)) {
103 auto *v = new DomLayoutDefault();
104 v->read(reader);
105 setElementLayoutDefault(v);
106 continue;
107 }
108 if (!tag.compare(u"layoutfunction"_s, Qt::CaseInsensitive)) {
109 auto *v = new DomLayoutFunction();
110 v->read(reader);
111 setElementLayoutFunction(v);
112 continue;
113 }
114 if (!tag.compare(u"pixmapfunction"_s, Qt::CaseInsensitive)) {
115 setElementPixmapFunction(reader.readElementText());
116 continue;
117 }
118 if (!tag.compare(u"customwidgets"_s, Qt::CaseInsensitive)) {
119 auto *v = new DomCustomWidgets();
120 v->read(reader);
121 setElementCustomWidgets(v);
122 continue;
123 }
124 if (!tag.compare(u"tabstops"_s, Qt::CaseInsensitive)) {
125 auto *v = new DomTabStops();
126 v->read(reader);
127 setElementTabStops(v);
128 continue;
129 }
130 if (!tag.compare(u"images"_s, Qt::CaseInsensitive)) {
131 qWarning("Omitting deprecated element <images>.");
132 reader.skipCurrentElement();
133 continue;
134 }
135 if (!tag.compare(u"includes"_s, Qt::CaseInsensitive)) {
136 auto *v = new DomIncludes();
137 v->read(reader);
138 setElementIncludes(v);
139 continue;
140 }
141 if (!tag.compare(u"resources"_s, Qt::CaseInsensitive)) {
142 auto *v = new DomResources();
143 v->read(reader);
144 setElementResources(v);
145 continue;
146 }
147 if (!tag.compare(u"connections"_s, Qt::CaseInsensitive)) {
148 auto *v = new DomConnections();
149 v->read(reader);
150 setElementConnections(v);
151 continue;
152 }
153 if (!tag.compare(u"designerdata"_s, Qt::CaseInsensitive)) {
154 auto *v = new DomDesignerData();
155 v->read(reader);
156 setElementDesignerdata(v);
157 continue;
158 }
159 if (!tag.compare(u"slots"_s, Qt::CaseInsensitive)) {
160 auto *v = new DomSlots();
161 v->read(reader);
162 setElementSlots(v);
163 continue;
164 }
165 if (!tag.compare(u"buttongroups"_s, Qt::CaseInsensitive)) {
166 auto *v = new DomButtonGroups();
167 v->read(reader);
168 setElementButtonGroups(v);
169 continue;
170 }
171 reader.raiseError("Unexpected element "_L1 + tag);
172 }
173 break;
174 case QXmlStreamReader::EndElement :
175 return;
176 default :
177 break;
178 }
179 }
180}
181
182void DomUI::write(QXmlStreamWriter &writer, const QString &tagName) const
183{
184 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("ui") : tagName.toLower());
185
186 if (hasAttributeVersion())
187 writer.writeAttribute(u"version"_s, attributeVersion());
188
189 if (hasAttributeLanguage())
190 writer.writeAttribute(u"language"_s, attributeLanguage());
191
192 if (hasAttributeDisplayname())
193 writer.writeAttribute(u"displayname"_s, attributeDisplayname());
194
195 if (hasAttributeIdbasedtr())
196 writer.writeAttribute(u"idbasedtr"_s, (attributeIdbasedtr() ? u"true"_s : u"false"_s));
197
198 if (hasAttributeLabel())
199 writer.writeAttribute(u"label"_s, attributeLabel());
200
201 if (hasAttributeConnectslotsbyname())
202 writer.writeAttribute(u"connectslotsbyname"_s, (attributeConnectslotsbyname() ? u"true"_s : u"false"_s));
203
204 if (hasAttributeStdsetdef())
205 writer.writeAttribute(u"stdsetdef"_s, QString::number(attributeStdsetdef()));
206
207 if (hasAttributeStdSetDef())
208 writer.writeAttribute(u"stdsetdef"_s, QString::number(attributeStdSetDef()));
209
210 if (m_children & Author)
211 writer.writeTextElement(u"author"_s, m_author);
212
213 if (m_children & Comment)
214 writer.writeTextElement(u"comment"_s, m_comment);
215
216 if (m_children & ExportMacro)
217 writer.writeTextElement(u"exportmacro"_s, m_exportMacro);
218
219 if (m_children & Class)
220 writer.writeTextElement(u"class"_s, m_class);
221
222 if (m_children & Widget)
223 m_widget->write(writer, u"widget"_s);
224
225 if (m_children & LayoutDefault)
226 m_layoutDefault->write(writer, u"layoutdefault"_s);
227
228 if (m_children & LayoutFunction)
229 m_layoutFunction->write(writer, u"layoutfunction"_s);
230
231 if (m_children & PixmapFunction)
232 writer.writeTextElement(u"pixmapfunction"_s, m_pixmapFunction);
233
234 if (m_children & CustomWidgets)
235 m_customWidgets->write(writer, u"customwidgets"_s);
236
237 if (m_children & TabStops)
238 m_tabStops->write(writer, u"tabstops"_s);
239
240 if (m_children & Includes)
241 m_includes->write(writer, u"includes"_s);
242
243 if (m_children & Resources)
244 m_resources->write(writer, u"resources"_s);
245
246 if (m_children & Connections)
247 m_connections->write(writer, u"connections"_s);
248
249 if (m_children & Designerdata)
250 m_designerdata->write(writer, u"designerdata"_s);
251
252 if (m_children & Slots)
253 m_slots->write(writer, u"slots"_s);
254
255 if (m_children & ButtonGroups)
256 m_buttonGroups->write(writer, u"buttongroups"_s);
257
258 writer.writeEndElement();
259}
260
261void DomUI::setElementAuthor(const QString &a)
262{
263 m_children |= Author;
264 m_author = a;
265}
266
267void DomUI::setElementComment(const QString &a)
268{
269 m_children |= Comment;
270 m_comment = a;
271}
272
273void DomUI::setElementExportMacro(const QString &a)
274{
275 m_children |= ExportMacro;
276 m_exportMacro = a;
277}
278
279void DomUI::setElementClass(const QString &a)
280{
281 m_children |= Class;
282 m_class = a;
283}
284
285DomWidget *DomUI::takeElementWidget()
286{
287 DomWidget *a = m_widget;
288 m_widget = nullptr;
289 m_children ^= Widget;
290 return a;
291}
292
293void DomUI::setElementWidget(DomWidget *a)
294{
295 delete m_widget;
296 m_children |= Widget;
297 m_widget = a;
298}
299
300DomLayoutDefault *DomUI::takeElementLayoutDefault()
301{
302 DomLayoutDefault *a = m_layoutDefault;
303 m_layoutDefault = nullptr;
304 m_children ^= LayoutDefault;
305 return a;
306}
307
308void DomUI::setElementLayoutDefault(DomLayoutDefault *a)
309{
310 delete m_layoutDefault;
311 m_children |= LayoutDefault;
312 m_layoutDefault = a;
313}
314
315DomLayoutFunction *DomUI::takeElementLayoutFunction()
316{
317 DomLayoutFunction *a = m_layoutFunction;
318 m_layoutFunction = nullptr;
319 m_children ^= LayoutFunction;
320 return a;
321}
322
323void DomUI::setElementLayoutFunction(DomLayoutFunction *a)
324{
325 delete m_layoutFunction;
326 m_children |= LayoutFunction;
327 m_layoutFunction = a;
328}
329
330void DomUI::setElementPixmapFunction(const QString &a)
331{
332 m_children |= PixmapFunction;
333 m_pixmapFunction = a;
334}
335
336DomCustomWidgets *DomUI::takeElementCustomWidgets()
337{
338 DomCustomWidgets *a = m_customWidgets;
339 m_customWidgets = nullptr;
340 m_children ^= CustomWidgets;
341 return a;
342}
343
344void DomUI::setElementCustomWidgets(DomCustomWidgets *a)
345{
346 delete m_customWidgets;
347 m_children |= CustomWidgets;
348 m_customWidgets = a;
349}
350
351DomTabStops *DomUI::takeElementTabStops()
352{
353 DomTabStops *a = m_tabStops;
354 m_tabStops = nullptr;
355 m_children ^= TabStops;
356 return a;
357}
358
359void DomUI::setElementTabStops(DomTabStops *a)
360{
361 delete m_tabStops;
362 m_children |= TabStops;
363 m_tabStops = a;
364}
365
366DomIncludes *DomUI::takeElementIncludes()
367{
368 DomIncludes *a = m_includes;
369 m_includes = nullptr;
370 m_children ^= Includes;
371 return a;
372}
373
374void DomUI::setElementIncludes(DomIncludes *a)
375{
376 delete m_includes;
377 m_children |= Includes;
378 m_includes = a;
379}
380
381DomResources *DomUI::takeElementResources()
382{
383 DomResources *a = m_resources;
384 m_resources = nullptr;
385 m_children ^= Resources;
386 return a;
387}
388
389void DomUI::setElementResources(DomResources *a)
390{
391 delete m_resources;
392 m_children |= Resources;
393 m_resources = a;
394}
395
396DomConnections *DomUI::takeElementConnections()
397{
398 DomConnections *a = m_connections;
399 m_connections = nullptr;
400 m_children ^= Connections;
401 return a;
402}
403
404void DomUI::setElementConnections(DomConnections *a)
405{
406 delete m_connections;
407 m_children |= Connections;
408 m_connections = a;
409}
410
411DomDesignerData *DomUI::takeElementDesignerdata()
412{
413 DomDesignerData *a = m_designerdata;
414 m_designerdata = nullptr;
415 m_children ^= Designerdata;
416 return a;
417}
418
419void DomUI::setElementDesignerdata(DomDesignerData *a)
420{
421 delete m_designerdata;
422 m_children |= Designerdata;
423 m_designerdata = a;
424}
425
426DomSlots *DomUI::takeElementSlots()
427{
428 DomSlots *a = m_slots;
429 m_slots = nullptr;
430 m_children ^= Slots;
431 return a;
432}
433
434void DomUI::setElementSlots(DomSlots *a)
435{
436 delete m_slots;
437 m_children |= Slots;
438 m_slots = a;
439}
440
441DomButtonGroups *DomUI::takeElementButtonGroups()
442{
443 DomButtonGroups *a = m_buttonGroups;
444 m_buttonGroups = nullptr;
445 m_children ^= ButtonGroups;
446 return a;
447}
448
449void DomUI::setElementButtonGroups(DomButtonGroups *a)
450{
451 delete m_buttonGroups;
452 m_children |= ButtonGroups;
453 m_buttonGroups = a;
454}
455
456void DomUI::clearElementAuthor()
457{
458 m_children &= ~Author;
459}
460
461void DomUI::clearElementComment()
462{
463 m_children &= ~Comment;
464}
465
466void DomUI::clearElementExportMacro()
467{
468 m_children &= ~ExportMacro;
469}
470
471void DomUI::clearElementClass()
472{
473 m_children &= ~Class;
474}
475
476void DomUI::clearElementWidget()
477{
478 delete m_widget;
479 m_widget = nullptr;
480 m_children &= ~Widget;
481}
482
483void DomUI::clearElementLayoutDefault()
484{
485 delete m_layoutDefault;
486 m_layoutDefault = nullptr;
487 m_children &= ~LayoutDefault;
488}
489
490void DomUI::clearElementLayoutFunction()
491{
492 delete m_layoutFunction;
493 m_layoutFunction = nullptr;
494 m_children &= ~LayoutFunction;
495}
496
497void DomUI::clearElementPixmapFunction()
498{
499 m_children &= ~PixmapFunction;
500}
501
502void DomUI::clearElementCustomWidgets()
503{
504 delete m_customWidgets;
505 m_customWidgets = nullptr;
506 m_children &= ~CustomWidgets;
507}
508
509void DomUI::clearElementTabStops()
510{
511 delete m_tabStops;
512 m_tabStops = nullptr;
513 m_children &= ~TabStops;
514}
515
516void DomUI::clearElementIncludes()
517{
518 delete m_includes;
519 m_includes = nullptr;
520 m_children &= ~Includes;
521}
522
523void DomUI::clearElementResources()
524{
525 delete m_resources;
526 m_resources = nullptr;
527 m_children &= ~Resources;
528}
529
530void DomUI::clearElementConnections()
531{
532 delete m_connections;
533 m_connections = nullptr;
534 m_children &= ~Connections;
535}
536
537void DomUI::clearElementDesignerdata()
538{
539 delete m_designerdata;
540 m_designerdata = nullptr;
541 m_children &= ~Designerdata;
542}
543
544void DomUI::clearElementSlots()
545{
546 delete m_slots;
547 m_slots = nullptr;
548 m_children &= ~Slots;
549}
550
551void DomUI::clearElementButtonGroups()
552{
553 delete m_buttonGroups;
554 m_buttonGroups = nullptr;
555 m_children &= ~ButtonGroups;
556}
557
558DomIncludes::~DomIncludes()
559{
560 qDeleteAll(m_include);
561 m_include.clear();
562}
563
564void DomIncludes::read(QXmlStreamReader &reader)
565{
566 while (!reader.hasError()) {
567 switch (reader.readNext()) {
568 case QXmlStreamReader::StartElement : {
569 const auto tag = reader.name();
570 if (!tag.compare(u"include"_s, Qt::CaseInsensitive)) {
571 auto *v = new DomInclude();
572 v->read(reader);
573 m_include.append(v);
574 continue;
575 }
576 reader.raiseError("Unexpected element "_L1 + tag);
577 }
578 break;
579 case QXmlStreamReader::EndElement :
580 return;
581 default :
582 break;
583 }
584 }
585}
586
587void DomIncludes::write(QXmlStreamWriter &writer, const QString &tagName) const
588{
589 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("includes") : tagName.toLower());
590
591 for (DomInclude *v : m_include)
592 v->write(writer, u"include"_s);
593
594 writer.writeEndElement();
595}
596
597void DomIncludes::setElementInclude(const QList<DomInclude *> &a)
598{
599 m_children |= Include;
600 m_include = a;
601}
602
603DomInclude::~DomInclude() = default;
604
605void DomInclude::read(QXmlStreamReader &reader)
606{
607 const QXmlStreamAttributes &attributes = reader.attributes();
608 for (const QXmlStreamAttribute &attribute : attributes) {
609 const auto name = attribute.name();
610 if (name == u"location"_s) {
611 setAttributeLocation(attribute.value().toString());
612 continue;
613 }
614 if (name == u"impldecl"_s) {
615 setAttributeImpldecl(attribute.value().toString());
616 continue;
617 }
618 reader.raiseError("Unexpected attribute "_L1 + name);
619 }
620
621 while (!reader.hasError()) {
622 switch (reader.readNext()) {
623 case QXmlStreamReader::StartElement : {
624 const auto tag = reader.name();
625 reader.raiseError("Unexpected element "_L1 + tag);
626 }
627 break;
628 case QXmlStreamReader::EndElement :
629 return;
630 case QXmlStreamReader::Characters :
631 if (!reader.isWhitespace())
632 m_text.append(reader.text().toString());
633 break;
634 default :
635 break;
636 }
637 }
638}
639
640void DomInclude::write(QXmlStreamWriter &writer, const QString &tagName) const
641{
642 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("include") : tagName.toLower());
643
644 if (hasAttributeLocation())
645 writer.writeAttribute(u"location"_s, attributeLocation());
646
647 if (hasAttributeImpldecl())
648 writer.writeAttribute(u"impldecl"_s, attributeImpldecl());
649
650 if (!m_text.isEmpty())
651 writer.writeCharacters(m_text);
652
653 writer.writeEndElement();
654}
655
656DomResources::~DomResources()
657{
658 qDeleteAll(m_include);
659 m_include.clear();
660}
661
662void DomResources::read(QXmlStreamReader &reader)
663{
664 const QXmlStreamAttributes &attributes = reader.attributes();
665 for (const QXmlStreamAttribute &attribute : attributes) {
666 const auto name = attribute.name();
667 if (name == u"name"_s) {
668 setAttributeName(attribute.value().toString());
669 continue;
670 }
671 reader.raiseError("Unexpected attribute "_L1 + name);
672 }
673
674 while (!reader.hasError()) {
675 switch (reader.readNext()) {
676 case QXmlStreamReader::StartElement : {
677 const auto tag = reader.name();
678 if (!tag.compare(u"include"_s, Qt::CaseInsensitive)) {
679 auto *v = new DomResource();
680 v->read(reader);
681 m_include.append(v);
682 continue;
683 }
684 reader.raiseError("Unexpected element "_L1 + tag);
685 }
686 break;
687 case QXmlStreamReader::EndElement :
688 return;
689 default :
690 break;
691 }
692 }
693}
694
695void DomResources::write(QXmlStreamWriter &writer, const QString &tagName) const
696{
697 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("resources") : tagName.toLower());
698
699 if (hasAttributeName())
700 writer.writeAttribute(u"name"_s, attributeName());
701
702 for (DomResource *v : m_include)
703 v->write(writer, u"include"_s);
704
705 writer.writeEndElement();
706}
707
708void DomResources::setElementInclude(const QList<DomResource *> &a)
709{
710 m_children |= Include;
711 m_include = a;
712}
713
714DomResource::~DomResource() = default;
715
716void DomResource::read(QXmlStreamReader &reader)
717{
718 const QXmlStreamAttributes &attributes = reader.attributes();
719 for (const QXmlStreamAttribute &attribute : attributes) {
720 const auto name = attribute.name();
721 if (name == u"location"_s) {
722 setAttributeLocation(attribute.value().toString());
723 continue;
724 }
725 reader.raiseError("Unexpected attribute "_L1 + name);
726 }
727
728 while (!reader.hasError()) {
729 switch (reader.readNext()) {
730 case QXmlStreamReader::StartElement : {
731 const auto tag = reader.name();
732 reader.raiseError("Unexpected element "_L1 + tag);
733 }
734 break;
735 case QXmlStreamReader::EndElement :
736 return;
737 default :
738 break;
739 }
740 }
741}
742
743void DomResource::write(QXmlStreamWriter &writer, const QString &tagName) const
744{
745 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("resource") : tagName.toLower());
746
747 if (hasAttributeLocation())
748 writer.writeAttribute(u"location"_s, attributeLocation());
749
750 writer.writeEndElement();
751}
752
753DomActionGroup::~DomActionGroup()
754{
755 qDeleteAll(m_action);
756 m_action.clear();
757 qDeleteAll(m_actionGroup);
758 m_actionGroup.clear();
759 qDeleteAll(m_property);
760 m_property.clear();
761 qDeleteAll(m_attribute);
762 m_attribute.clear();
763}
764
765void DomActionGroup::read(QXmlStreamReader &reader)
766{
767 const QXmlStreamAttributes &attributes = reader.attributes();
768 for (const QXmlStreamAttribute &attribute : attributes) {
769 const auto name = attribute.name();
770 if (name == u"name"_s) {
771 setAttributeName(attribute.value().toString());
772 continue;
773 }
774 reader.raiseError("Unexpected attribute "_L1 + name);
775 }
776
777 while (!reader.hasError()) {
778 switch (reader.readNext()) {
779 case QXmlStreamReader::StartElement : {
780 const auto tag = reader.name();
781 if (!tag.compare(u"action"_s, Qt::CaseInsensitive)) {
782 auto *v = new DomAction();
783 v->read(reader);
784 m_action.append(v);
785 continue;
786 }
787 if (!tag.compare(u"actiongroup"_s, Qt::CaseInsensitive)) {
788 auto *v = new DomActionGroup();
789 v->read(reader);
790 m_actionGroup.append(v);
791 continue;
792 }
793 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
794 auto *v = new DomProperty();
795 v->read(reader);
796 m_property.append(v);
797 continue;
798 }
799 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
800 auto *v = new DomProperty();
801 v->read(reader);
802 m_attribute.append(v);
803 continue;
804 }
805 reader.raiseError("Unexpected element "_L1 + tag);
806 }
807 break;
808 case QXmlStreamReader::EndElement :
809 return;
810 default :
811 break;
812 }
813 }
814}
815
816void DomActionGroup::write(QXmlStreamWriter &writer, const QString &tagName) const
817{
818 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("actiongroup") : tagName.toLower());
819
820 if (hasAttributeName())
821 writer.writeAttribute(u"name"_s, attributeName());
822
823 for (DomAction *v : m_action)
824 v->write(writer, u"action"_s);
825
826 for (DomActionGroup *v : m_actionGroup)
827 v->write(writer, u"actiongroup"_s);
828
829 for (DomProperty *v : m_property)
830 v->write(writer, u"property"_s);
831
832 for (DomProperty *v : m_attribute)
833 v->write(writer, u"attribute"_s);
834
835 writer.writeEndElement();
836}
837
838void DomActionGroup::setElementAction(const QList<DomAction *> &a)
839{
840 m_children |= Action;
841 m_action = a;
842}
843
844void DomActionGroup::setElementActionGroup(const QList<DomActionGroup *> &a)
845{
846 m_children |= ActionGroup;
847 m_actionGroup = a;
848}
849
850void DomActionGroup::setElementProperty(const QList<DomProperty *> &a)
851{
852 m_children |= Property;
853 m_property = a;
854}
855
856void DomActionGroup::setElementAttribute(const QList<DomProperty *> &a)
857{
858 m_children |= Attribute;
859 m_attribute = a;
860}
861
862DomAction::~DomAction()
863{
864 qDeleteAll(m_property);
865 m_property.clear();
866 qDeleteAll(m_attribute);
867 m_attribute.clear();
868}
869
870void DomAction::read(QXmlStreamReader &reader)
871{
872 const QXmlStreamAttributes &attributes = reader.attributes();
873 for (const QXmlStreamAttribute &attribute : attributes) {
874 const auto name = attribute.name();
875 if (name == u"name"_s) {
876 setAttributeName(attribute.value().toString());
877 continue;
878 }
879 if (name == u"menu"_s) {
880 setAttributeMenu(attribute.value().toString());
881 continue;
882 }
883 reader.raiseError("Unexpected attribute "_L1 + name);
884 }
885
886 while (!reader.hasError()) {
887 switch (reader.readNext()) {
888 case QXmlStreamReader::StartElement : {
889 const auto tag = reader.name();
890 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
891 auto *v = new DomProperty();
892 v->read(reader);
893 m_property.append(v);
894 continue;
895 }
896 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
897 auto *v = new DomProperty();
898 v->read(reader);
899 m_attribute.append(v);
900 continue;
901 }
902 reader.raiseError("Unexpected element "_L1 + tag);
903 }
904 break;
905 case QXmlStreamReader::EndElement :
906 return;
907 default :
908 break;
909 }
910 }
911}
912
913void DomAction::write(QXmlStreamWriter &writer, const QString &tagName) const
914{
915 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("action") : tagName.toLower());
916
917 if (hasAttributeName())
918 writer.writeAttribute(u"name"_s, attributeName());
919
920 if (hasAttributeMenu())
921 writer.writeAttribute(u"menu"_s, attributeMenu());
922
923 for (DomProperty *v : m_property)
924 v->write(writer, u"property"_s);
925
926 for (DomProperty *v : m_attribute)
927 v->write(writer, u"attribute"_s);
928
929 writer.writeEndElement();
930}
931
932void DomAction::setElementProperty(const QList<DomProperty *> &a)
933{
934 m_children |= Property;
935 m_property = a;
936}
937
938void DomAction::setElementAttribute(const QList<DomProperty *> &a)
939{
940 m_children |= Attribute;
941 m_attribute = a;
942}
943
944DomActionRef::~DomActionRef() = default;
945
946void DomActionRef::read(QXmlStreamReader &reader)
947{
948 const QXmlStreamAttributes &attributes = reader.attributes();
949 for (const QXmlStreamAttribute &attribute : attributes) {
950 const auto name = attribute.name();
951 if (name == u"name"_s) {
952 setAttributeName(attribute.value().toString());
953 continue;
954 }
955 reader.raiseError("Unexpected attribute "_L1 + name);
956 }
957
958 while (!reader.hasError()) {
959 switch (reader.readNext()) {
960 case QXmlStreamReader::StartElement : {
961 const auto tag = reader.name();
962 reader.raiseError("Unexpected element "_L1 + tag);
963 }
964 break;
965 case QXmlStreamReader::EndElement :
966 return;
967 default :
968 break;
969 }
970 }
971}
972
973void DomActionRef::write(QXmlStreamWriter &writer, const QString &tagName) const
974{
975 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("actionref") : tagName.toLower());
976
977 if (hasAttributeName())
978 writer.writeAttribute(u"name"_s, attributeName());
979
980 writer.writeEndElement();
981}
982
983DomButtonGroup::~DomButtonGroup()
984{
985 qDeleteAll(m_property);
986 m_property.clear();
987 qDeleteAll(m_attribute);
988 m_attribute.clear();
989}
990
991void DomButtonGroup::read(QXmlStreamReader &reader)
992{
993 const QXmlStreamAttributes &attributes = reader.attributes();
994 for (const QXmlStreamAttribute &attribute : attributes) {
995 const auto name = attribute.name();
996 if (name == u"name"_s) {
997 setAttributeName(attribute.value().toString());
998 continue;
999 }
1000 reader.raiseError("Unexpected attribute "_L1 + name);
1001 }
1002
1003 while (!reader.hasError()) {
1004 switch (reader.readNext()) {
1005 case QXmlStreamReader::StartElement : {
1006 const auto tag = reader.name();
1007 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1008 auto *v = new DomProperty();
1009 v->read(reader);
1010 m_property.append(v);
1011 continue;
1012 }
1013 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
1014 auto *v = new DomProperty();
1015 v->read(reader);
1016 m_attribute.append(v);
1017 continue;
1018 }
1019 reader.raiseError("Unexpected element "_L1 + tag);
1020 }
1021 break;
1022 case QXmlStreamReader::EndElement :
1023 return;
1024 default :
1025 break;
1026 }
1027 }
1028}
1029
1030void DomButtonGroup::write(QXmlStreamWriter &writer, const QString &tagName) const
1031{
1032 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("buttongroup") : tagName.toLower());
1033
1034 if (hasAttributeName())
1035 writer.writeAttribute(u"name"_s, attributeName());
1036
1037 for (DomProperty *v : m_property)
1038 v->write(writer, u"property"_s);
1039
1040 for (DomProperty *v : m_attribute)
1041 v->write(writer, u"attribute"_s);
1042
1043 writer.writeEndElement();
1044}
1045
1046void DomButtonGroup::setElementProperty(const QList<DomProperty *> &a)
1047{
1048 m_children |= Property;
1049 m_property = a;
1050}
1051
1052void DomButtonGroup::setElementAttribute(const QList<DomProperty *> &a)
1053{
1054 m_children |= Attribute;
1055 m_attribute = a;
1056}
1057
1058DomButtonGroups::~DomButtonGroups()
1059{
1060 qDeleteAll(m_buttonGroup);
1061 m_buttonGroup.clear();
1062}
1063
1064void DomButtonGroups::read(QXmlStreamReader &reader)
1065{
1066 while (!reader.hasError()) {
1067 switch (reader.readNext()) {
1068 case QXmlStreamReader::StartElement : {
1069 const auto tag = reader.name();
1070 if (!tag.compare(u"buttongroup"_s, Qt::CaseInsensitive)) {
1071 auto *v = new DomButtonGroup();
1072 v->read(reader);
1073 m_buttonGroup.append(v);
1074 continue;
1075 }
1076 reader.raiseError("Unexpected element "_L1 + tag);
1077 }
1078 break;
1079 case QXmlStreamReader::EndElement :
1080 return;
1081 default :
1082 break;
1083 }
1084 }
1085}
1086
1087void DomButtonGroups::write(QXmlStreamWriter &writer, const QString &tagName) const
1088{
1089 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("buttongroups") : tagName.toLower());
1090
1091 for (DomButtonGroup *v : m_buttonGroup)
1092 v->write(writer, u"buttongroup"_s);
1093
1094 writer.writeEndElement();
1095}
1096
1097void DomButtonGroups::setElementButtonGroup(const QList<DomButtonGroup *> &a)
1098{
1099 m_children |= ButtonGroup;
1100 m_buttonGroup = a;
1101}
1102
1103DomCustomWidgets::~DomCustomWidgets()
1104{
1105 qDeleteAll(m_customWidget);
1106 m_customWidget.clear();
1107}
1108
1109void DomCustomWidgets::read(QXmlStreamReader &reader)
1110{
1111 while (!reader.hasError()) {
1112 switch (reader.readNext()) {
1113 case QXmlStreamReader::StartElement : {
1114 const auto tag = reader.name();
1115 if (!tag.compare(u"customwidget"_s, Qt::CaseInsensitive)) {
1116 auto *v = new DomCustomWidget();
1117 v->read(reader);
1118 m_customWidget.append(v);
1119 continue;
1120 }
1121 reader.raiseError("Unexpected element "_L1 + tag);
1122 }
1123 break;
1124 case QXmlStreamReader::EndElement :
1125 return;
1126 default :
1127 break;
1128 }
1129 }
1130}
1131
1132void DomCustomWidgets::write(QXmlStreamWriter &writer, const QString &tagName) const
1133{
1134 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("customwidgets") : tagName.toLower());
1135
1136 for (DomCustomWidget *v : m_customWidget)
1137 v->write(writer, u"customwidget"_s);
1138
1139 writer.writeEndElement();
1140}
1141
1142void DomCustomWidgets::setElementCustomWidget(const QList<DomCustomWidget *> &a)
1143{
1144 m_children |= CustomWidget;
1145 m_customWidget = a;
1146}
1147
1148DomHeader::~DomHeader() = default;
1149
1150void DomHeader::read(QXmlStreamReader &reader)
1151{
1152 const QXmlStreamAttributes &attributes = reader.attributes();
1153 for (const QXmlStreamAttribute &attribute : attributes) {
1154 const auto name = attribute.name();
1155 if (name == u"location"_s) {
1156 setAttributeLocation(attribute.value().toString());
1157 continue;
1158 }
1159 reader.raiseError("Unexpected attribute "_L1 + name);
1160 }
1161
1162 while (!reader.hasError()) {
1163 switch (reader.readNext()) {
1164 case QXmlStreamReader::StartElement : {
1165 const auto tag = reader.name();
1166 reader.raiseError("Unexpected element "_L1 + tag);
1167 }
1168 break;
1169 case QXmlStreamReader::EndElement :
1170 return;
1171 case QXmlStreamReader::Characters :
1172 if (!reader.isWhitespace())
1173 m_text.append(reader.text().toString());
1174 break;
1175 default :
1176 break;
1177 }
1178 }
1179}
1180
1181void DomHeader::write(QXmlStreamWriter &writer, const QString &tagName) const
1182{
1183 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("header") : tagName.toLower());
1184
1185 if (hasAttributeLocation())
1186 writer.writeAttribute(u"location"_s, attributeLocation());
1187
1188 if (!m_text.isEmpty())
1189 writer.writeCharacters(m_text);
1190
1191 writer.writeEndElement();
1192}
1193
1194DomCustomWidget::~DomCustomWidget()
1195{
1196 delete m_header;
1197 delete m_sizeHint;
1198 delete m_slots;
1199 delete m_propertyspecifications;
1200}
1201
1202void DomCustomWidget::read(QXmlStreamReader &reader)
1203{
1204 while (!reader.hasError()) {
1205 switch (reader.readNext()) {
1206 case QXmlStreamReader::StartElement : {
1207 const auto tag = reader.name();
1208 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
1209 setElementClass(reader.readElementText());
1210 continue;
1211 }
1212 if (!tag.compare(u"extends"_s, Qt::CaseInsensitive)) {
1213 setElementExtends(reader.readElementText());
1214 continue;
1215 }
1216 if (!tag.compare(u"header"_s, Qt::CaseInsensitive)) {
1217 auto *v = new DomHeader();
1218 v->read(reader);
1219 setElementHeader(v);
1220 continue;
1221 }
1222 if (!tag.compare(u"sizehint"_s, Qt::CaseInsensitive)) {
1223 auto *v = new DomSize();
1224 v->read(reader);
1225 setElementSizeHint(v);
1226 continue;
1227 }
1228 if (!tag.compare(u"addpagemethod"_s, Qt::CaseInsensitive)) {
1229 setElementAddPageMethod(reader.readElementText());
1230 continue;
1231 }
1232 if (!tag.compare(u"container"_s, Qt::CaseInsensitive)) {
1233 setElementContainer(reader.readElementText().toInt());
1234 continue;
1235 }
1236 if (!tag.compare(u"sizepolicy"_s, Qt::CaseInsensitive)) {
1237 qWarning("Omitting deprecated element <sizepolicy>.");
1238 reader.skipCurrentElement();
1239 continue;
1240 }
1241 if (!tag.compare(u"pixmap"_s, Qt::CaseInsensitive)) {
1242 setElementPixmap(reader.readElementText());
1243 continue;
1244 }
1245 if (!tag.compare(u"script"_s, Qt::CaseInsensitive)) {
1246 qWarning("Omitting deprecated element <script>.");
1247 reader.skipCurrentElement();
1248 continue;
1249 }
1250 if (!tag.compare(u"properties"_s, Qt::CaseInsensitive)) {
1251 qWarning("Omitting deprecated element <properties>.");
1252 reader.skipCurrentElement();
1253 continue;
1254 }
1255 if (!tag.compare(u"slots"_s, Qt::CaseInsensitive)) {
1256 auto *v = new DomSlots();
1257 v->read(reader);
1258 setElementSlots(v);
1259 continue;
1260 }
1261 if (!tag.compare(u"propertyspecifications"_s, Qt::CaseInsensitive)) {
1262 auto *v = new DomPropertySpecifications();
1263 v->read(reader);
1264 setElementPropertyspecifications(v);
1265 continue;
1266 }
1267 reader.raiseError("Unexpected element "_L1 + tag);
1268 }
1269 break;
1270 case QXmlStreamReader::EndElement :
1271 return;
1272 default :
1273 break;
1274 }
1275 }
1276}
1277
1278void DomCustomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const
1279{
1280 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("customwidget") : tagName.toLower());
1281
1282 if (m_children & Class)
1283 writer.writeTextElement(u"class"_s, m_class);
1284
1285 if (m_children & Extends)
1286 writer.writeTextElement(u"extends"_s, m_extends);
1287
1288 if (m_children & Header)
1289 m_header->write(writer, u"header"_s);
1290
1291 if (m_children & SizeHint)
1292 m_sizeHint->write(writer, u"sizehint"_s);
1293
1294 if (m_children & AddPageMethod)
1295 writer.writeTextElement(u"addpagemethod"_s, m_addPageMethod);
1296
1297 if (m_children & Container)
1298 writer.writeTextElement(u"container"_s, QString::number(m_container));
1299
1300 if (m_children & Pixmap)
1301 writer.writeTextElement(u"pixmap"_s, m_pixmap);
1302
1303 if (m_children & Slots)
1304 m_slots->write(writer, u"slots"_s);
1305
1306 if (m_children & Propertyspecifications)
1307 m_propertyspecifications->write(writer, u"propertyspecifications"_s);
1308
1309 writer.writeEndElement();
1310}
1311
1312void DomCustomWidget::setElementClass(const QString &a)
1313{
1314 m_children |= Class;
1315 m_class = a;
1316}
1317
1318void DomCustomWidget::setElementExtends(const QString &a)
1319{
1320 m_children |= Extends;
1321 m_extends = a;
1322}
1323
1324DomHeader *DomCustomWidget::takeElementHeader()
1325{
1326 DomHeader *a = m_header;
1327 m_header = nullptr;
1328 m_children ^= Header;
1329 return a;
1330}
1331
1332void DomCustomWidget::setElementHeader(DomHeader *a)
1333{
1334 delete m_header;
1335 m_children |= Header;
1336 m_header = a;
1337}
1338
1339DomSize *DomCustomWidget::takeElementSizeHint()
1340{
1341 DomSize *a = m_sizeHint;
1342 m_sizeHint = nullptr;
1343 m_children ^= SizeHint;
1344 return a;
1345}
1346
1347void DomCustomWidget::setElementSizeHint(DomSize *a)
1348{
1349 delete m_sizeHint;
1350 m_children |= SizeHint;
1351 m_sizeHint = a;
1352}
1353
1354void DomCustomWidget::setElementAddPageMethod(const QString &a)
1355{
1356 m_children |= AddPageMethod;
1357 m_addPageMethod = a;
1358}
1359
1360void DomCustomWidget::setElementContainer(int a)
1361{
1362 m_children |= Container;
1363 m_container = a;
1364}
1365
1366void DomCustomWidget::setElementPixmap(const QString &a)
1367{
1368 m_children |= Pixmap;
1369 m_pixmap = a;
1370}
1371
1372DomSlots *DomCustomWidget::takeElementSlots()
1373{
1374 DomSlots *a = m_slots;
1375 m_slots = nullptr;
1376 m_children ^= Slots;
1377 return a;
1378}
1379
1380void DomCustomWidget::setElementSlots(DomSlots *a)
1381{
1382 delete m_slots;
1383 m_children |= Slots;
1384 m_slots = a;
1385}
1386
1387DomPropertySpecifications *DomCustomWidget::takeElementPropertyspecifications()
1388{
1389 DomPropertySpecifications *a = m_propertyspecifications;
1390 m_propertyspecifications = nullptr;
1391 m_children ^= Propertyspecifications;
1392 return a;
1393}
1394
1395void DomCustomWidget::setElementPropertyspecifications(DomPropertySpecifications *a)
1396{
1397 delete m_propertyspecifications;
1398 m_children |= Propertyspecifications;
1399 m_propertyspecifications = a;
1400}
1401
1402void DomCustomWidget::clearElementClass()
1403{
1404 m_children &= ~Class;
1405}
1406
1407void DomCustomWidget::clearElementExtends()
1408{
1409 m_children &= ~Extends;
1410}
1411
1412void DomCustomWidget::clearElementHeader()
1413{
1414 delete m_header;
1415 m_header = nullptr;
1416 m_children &= ~Header;
1417}
1418
1419void DomCustomWidget::clearElementSizeHint()
1420{
1421 delete m_sizeHint;
1422 m_sizeHint = nullptr;
1423 m_children &= ~SizeHint;
1424}
1425
1426void DomCustomWidget::clearElementAddPageMethod()
1427{
1428 m_children &= ~AddPageMethod;
1429}
1430
1431void DomCustomWidget::clearElementContainer()
1432{
1433 m_children &= ~Container;
1434}
1435
1436void DomCustomWidget::clearElementPixmap()
1437{
1438 m_children &= ~Pixmap;
1439}
1440
1441void DomCustomWidget::clearElementSlots()
1442{
1443 delete m_slots;
1444 m_slots = nullptr;
1445 m_children &= ~Slots;
1446}
1447
1448void DomCustomWidget::clearElementPropertyspecifications()
1449{
1450 delete m_propertyspecifications;
1451 m_propertyspecifications = nullptr;
1452 m_children &= ~Propertyspecifications;
1453}
1454
1455DomLayoutDefault::~DomLayoutDefault() = default;
1456
1457void DomLayoutDefault::read(QXmlStreamReader &reader)
1458{
1459 const QXmlStreamAttributes &attributes = reader.attributes();
1460 for (const QXmlStreamAttribute &attribute : attributes) {
1461 const auto name = attribute.name();
1462 if (name == u"spacing"_s) {
1463 setAttributeSpacing(attribute.value().toInt());
1464 continue;
1465 }
1466 if (name == u"margin"_s) {
1467 setAttributeMargin(attribute.value().toInt());
1468 continue;
1469 }
1470 reader.raiseError("Unexpected attribute "_L1 + name);
1471 }
1472
1473 while (!reader.hasError()) {
1474 switch (reader.readNext()) {
1475 case QXmlStreamReader::StartElement : {
1476 const auto tag = reader.name();
1477 reader.raiseError("Unexpected element "_L1 + tag);
1478 }
1479 break;
1480 case QXmlStreamReader::EndElement :
1481 return;
1482 default :
1483 break;
1484 }
1485 }
1486}
1487
1488void DomLayoutDefault::write(QXmlStreamWriter &writer, const QString &tagName) const
1489{
1490 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("layoutdefault") : tagName.toLower());
1491
1492 if (hasAttributeSpacing())
1493 writer.writeAttribute(u"spacing"_s, QString::number(attributeSpacing()));
1494
1495 if (hasAttributeMargin())
1496 writer.writeAttribute(u"margin"_s, QString::number(attributeMargin()));
1497
1498 writer.writeEndElement();
1499}
1500
1501DomLayoutFunction::~DomLayoutFunction() = default;
1502
1503void DomLayoutFunction::read(QXmlStreamReader &reader)
1504{
1505 const QXmlStreamAttributes &attributes = reader.attributes();
1506 for (const QXmlStreamAttribute &attribute : attributes) {
1507 const auto name = attribute.name();
1508 if (name == u"spacing"_s) {
1509 setAttributeSpacing(attribute.value().toString());
1510 continue;
1511 }
1512 if (name == u"margin"_s) {
1513 setAttributeMargin(attribute.value().toString());
1514 continue;
1515 }
1516 reader.raiseError("Unexpected attribute "_L1 + name);
1517 }
1518
1519 while (!reader.hasError()) {
1520 switch (reader.readNext()) {
1521 case QXmlStreamReader::StartElement : {
1522 const auto tag = reader.name();
1523 reader.raiseError("Unexpected element "_L1 + tag);
1524 }
1525 break;
1526 case QXmlStreamReader::EndElement :
1527 return;
1528 default :
1529 break;
1530 }
1531 }
1532}
1533
1534void DomLayoutFunction::write(QXmlStreamWriter &writer, const QString &tagName) const
1535{
1536 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("layoutfunction") : tagName.toLower());
1537
1538 if (hasAttributeSpacing())
1539 writer.writeAttribute(u"spacing"_s, attributeSpacing());
1540
1541 if (hasAttributeMargin())
1542 writer.writeAttribute(u"margin"_s, attributeMargin());
1543
1544 writer.writeEndElement();
1545}
1546
1547DomTabStops::~DomTabStops()
1548{
1549 m_tabStop.clear();
1550}
1551
1552void DomTabStops::read(QXmlStreamReader &reader)
1553{
1554 while (!reader.hasError()) {
1555 switch (reader.readNext()) {
1556 case QXmlStreamReader::StartElement : {
1557 const auto tag = reader.name();
1558 if (!tag.compare(u"tabstop"_s, Qt::CaseInsensitive)) {
1559 m_tabStop.append(reader.readElementText());
1560 continue;
1561 }
1562 reader.raiseError("Unexpected element "_L1 + tag);
1563 }
1564 break;
1565 case QXmlStreamReader::EndElement :
1566 return;
1567 default :
1568 break;
1569 }
1570 }
1571}
1572
1573void DomTabStops::write(QXmlStreamWriter &writer, const QString &tagName) const
1574{
1575 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("tabstops") : tagName.toLower());
1576
1577 for (const QString &v : m_tabStop)
1578 writer.writeTextElement(u"tabstop"_s, v);
1579
1580 writer.writeEndElement();
1581}
1582
1583void DomTabStops::setElementTabStop(const QStringList &a)
1584{
1585 m_children |= TabStop;
1586 m_tabStop = a;
1587}
1588
1589DomLayout::~DomLayout()
1590{
1591 qDeleteAll(m_property);
1592 m_property.clear();
1593 qDeleteAll(m_attribute);
1594 m_attribute.clear();
1595 qDeleteAll(m_item);
1596 m_item.clear();
1597}
1598
1599void DomLayout::read(QXmlStreamReader &reader)
1600{
1601 const QXmlStreamAttributes &attributes = reader.attributes();
1602 for (const QXmlStreamAttribute &attribute : attributes) {
1603 const auto name = attribute.name();
1604 if (name == u"class"_s) {
1605 setAttributeClass(attribute.value().toString());
1606 continue;
1607 }
1608 if (name == u"name"_s) {
1609 setAttributeName(attribute.value().toString());
1610 continue;
1611 }
1612 if (name == u"stretch"_s) {
1613 setAttributeStretch(attribute.value().toString());
1614 continue;
1615 }
1616 if (name == u"rowstretch"_s) {
1617 setAttributeRowStretch(attribute.value().toString());
1618 continue;
1619 }
1620 if (name == u"columnstretch"_s) {
1621 setAttributeColumnStretch(attribute.value().toString());
1622 continue;
1623 }
1624 if (name == u"rowminimumheight"_s) {
1625 setAttributeRowMinimumHeight(attribute.value().toString());
1626 continue;
1627 }
1628 if (name == u"columnminimumwidth"_s) {
1629 setAttributeColumnMinimumWidth(attribute.value().toString());
1630 continue;
1631 }
1632 reader.raiseError("Unexpected attribute "_L1 + name);
1633 }
1634
1635 while (!reader.hasError()) {
1636 switch (reader.readNext()) {
1637 case QXmlStreamReader::StartElement : {
1638 const auto tag = reader.name();
1639 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1640 auto *v = new DomProperty();
1641 v->read(reader);
1642 m_property.append(v);
1643 continue;
1644 }
1645 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
1646 auto *v = new DomProperty();
1647 v->read(reader);
1648 m_attribute.append(v);
1649 continue;
1650 }
1651 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
1652 auto *v = new DomLayoutItem();
1653 v->read(reader);
1654 m_item.append(v);
1655 continue;
1656 }
1657 reader.raiseError("Unexpected element "_L1 + tag);
1658 }
1659 break;
1660 case QXmlStreamReader::EndElement :
1661 return;
1662 default :
1663 break;
1664 }
1665 }
1666}
1667
1668void DomLayout::write(QXmlStreamWriter &writer, const QString &tagName) const
1669{
1670 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("layout") : tagName.toLower());
1671
1672 if (hasAttributeClass())
1673 writer.writeAttribute(u"class"_s, attributeClass());
1674
1675 if (hasAttributeName())
1676 writer.writeAttribute(u"name"_s, attributeName());
1677
1678 if (hasAttributeStretch())
1679 writer.writeAttribute(u"stretch"_s, attributeStretch());
1680
1681 if (hasAttributeRowStretch())
1682 writer.writeAttribute(u"rowstretch"_s, attributeRowStretch());
1683
1684 if (hasAttributeColumnStretch())
1685 writer.writeAttribute(u"columnstretch"_s, attributeColumnStretch());
1686
1687 if (hasAttributeRowMinimumHeight())
1688 writer.writeAttribute(u"rowminimumheight"_s, attributeRowMinimumHeight());
1689
1690 if (hasAttributeColumnMinimumWidth())
1691 writer.writeAttribute(u"columnminimumwidth"_s, attributeColumnMinimumWidth());
1692
1693 for (DomProperty *v : m_property)
1694 v->write(writer, u"property"_s);
1695
1696 for (DomProperty *v : m_attribute)
1697 v->write(writer, u"attribute"_s);
1698
1699 for (DomLayoutItem *v : m_item)
1700 v->write(writer, u"item"_s);
1701
1702 writer.writeEndElement();
1703}
1704
1705void DomLayout::setElementProperty(const QList<DomProperty *> &a)
1706{
1707 m_children |= Property;
1708 m_property = a;
1709}
1710
1711void DomLayout::setElementAttribute(const QList<DomProperty *> &a)
1712{
1713 m_children |= Attribute;
1714 m_attribute = a;
1715}
1716
1717void DomLayout::setElementItem(const QList<DomLayoutItem *> &a)
1718{
1719 m_children |= Item;
1720 m_item = a;
1721}
1722
1723DomLayoutItem::~DomLayoutItem()
1724{
1725 delete m_widget;
1726 delete m_layout;
1727 delete m_spacer;
1728}
1729
1730void DomLayoutItem::clear()
1731{
1732 delete m_widget;
1733 delete m_layout;
1734 delete m_spacer;
1735
1736 m_kind = Unknown;
1737
1738 m_widget = nullptr;
1739 m_layout = nullptr;
1740 m_spacer = nullptr;
1741}
1742
1743void DomLayoutItem::read(QXmlStreamReader &reader)
1744{
1745 const QXmlStreamAttributes &attributes = reader.attributes();
1746 for (const QXmlStreamAttribute &attribute : attributes) {
1747 const auto name = attribute.name();
1748 if (name == u"row"_s) {
1749 setAttributeRow(attribute.value().toInt());
1750 continue;
1751 }
1752 if (name == u"column"_s) {
1753 setAttributeColumn(attribute.value().toInt());
1754 continue;
1755 }
1756 if (name == u"rowspan"_s) {
1757 setAttributeRowSpan(attribute.value().toInt());
1758 continue;
1759 }
1760 if (name == u"colspan"_s) {
1761 setAttributeColSpan(attribute.value().toInt());
1762 continue;
1763 }
1764 if (name == u"alignment"_s) {
1765 setAttributeAlignment(attribute.value().toString());
1766 continue;
1767 }
1768 reader.raiseError("Unexpected attribute "_L1 + name);
1769 }
1770
1771 while (!reader.hasError()) {
1772 switch (reader.readNext()) {
1773 case QXmlStreamReader::StartElement : {
1774 const auto tag = reader.name();
1775 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
1776 auto *v = new DomWidget();
1777 v->read(reader);
1778 setElementWidget(v);
1779 continue;
1780 }
1781 if (!tag.compare(u"layout"_s, Qt::CaseInsensitive)) {
1782 auto *v = new DomLayout();
1783 v->read(reader);
1784 setElementLayout(v);
1785 continue;
1786 }
1787 if (!tag.compare(u"spacer"_s, Qt::CaseInsensitive)) {
1788 auto *v = new DomSpacer();
1789 v->read(reader);
1790 setElementSpacer(v);
1791 continue;
1792 }
1793 reader.raiseError("Unexpected element "_L1 + tag);
1794 }
1795 break;
1796 case QXmlStreamReader::EndElement :
1797 return;
1798 default :
1799 break;
1800 }
1801 }
1802}
1803
1804void DomLayoutItem::write(QXmlStreamWriter &writer, const QString &tagName) const
1805{
1806 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("layoutitem") : tagName.toLower());
1807
1808 if (hasAttributeRow())
1809 writer.writeAttribute(u"row"_s, QString::number(attributeRow()));
1810
1811 if (hasAttributeColumn())
1812 writer.writeAttribute(u"column"_s, QString::number(attributeColumn()));
1813
1814 if (hasAttributeRowSpan())
1815 writer.writeAttribute(u"rowspan"_s, QString::number(attributeRowSpan()));
1816
1817 if (hasAttributeColSpan())
1818 writer.writeAttribute(u"colspan"_s, QString::number(attributeColSpan()));
1819
1820 if (hasAttributeAlignment())
1821 writer.writeAttribute(u"alignment"_s, attributeAlignment());
1822
1823 switch (kind()) {
1824 case Widget:
1825 if (m_widget != nullptr)
1826 m_widget->write(writer, u"widget"_s);
1827 break;
1828
1829 case Layout:
1830 if (m_layout != nullptr)
1831 m_layout->write(writer, u"layout"_s);
1832 break;
1833
1834 case Spacer:
1835 if (m_spacer != nullptr)
1836 m_spacer->write(writer, u"spacer"_s);
1837 break;
1838
1839 default:
1840 break;
1841 }
1842 writer.writeEndElement();
1843}
1844
1845DomWidget *DomLayoutItem::takeElementWidget()
1846{
1847 DomWidget *a = m_widget;
1848 m_widget = nullptr;
1849 return a;
1850}
1851
1852void DomLayoutItem::setElementWidget(DomWidget *a)
1853{
1854 clear();
1855 m_kind = Widget;
1856 m_widget = a;
1857}
1858
1859DomLayout *DomLayoutItem::takeElementLayout()
1860{
1861 DomLayout *a = m_layout;
1862 m_layout = nullptr;
1863 return a;
1864}
1865
1866void DomLayoutItem::setElementLayout(DomLayout *a)
1867{
1868 clear();
1869 m_kind = Layout;
1870 m_layout = a;
1871}
1872
1873DomSpacer *DomLayoutItem::takeElementSpacer()
1874{
1875 DomSpacer *a = m_spacer;
1876 m_spacer = nullptr;
1877 return a;
1878}
1879
1880void DomLayoutItem::setElementSpacer(DomSpacer *a)
1881{
1882 clear();
1883 m_kind = Spacer;
1884 m_spacer = a;
1885}
1886
1887DomRow::~DomRow()
1888{
1889 qDeleteAll(m_property);
1890 m_property.clear();
1891}
1892
1893void DomRow::read(QXmlStreamReader &reader)
1894{
1895 while (!reader.hasError()) {
1896 switch (reader.readNext()) {
1897 case QXmlStreamReader::StartElement : {
1898 const auto tag = reader.name();
1899 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1900 auto *v = new DomProperty();
1901 v->read(reader);
1902 m_property.append(v);
1903 continue;
1904 }
1905 reader.raiseError("Unexpected element "_L1 + tag);
1906 }
1907 break;
1908 case QXmlStreamReader::EndElement :
1909 return;
1910 default :
1911 break;
1912 }
1913 }
1914}
1915
1916void DomRow::write(QXmlStreamWriter &writer, const QString &tagName) const
1917{
1918 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("row") : tagName.toLower());
1919
1920 for (DomProperty *v : m_property)
1921 v->write(writer, u"property"_s);
1922
1923 writer.writeEndElement();
1924}
1925
1926void DomRow::setElementProperty(const QList<DomProperty *> &a)
1927{
1928 m_children |= Property;
1929 m_property = a;
1930}
1931
1932DomColumn::~DomColumn()
1933{
1934 qDeleteAll(m_property);
1935 m_property.clear();
1936}
1937
1938void DomColumn::read(QXmlStreamReader &reader)
1939{
1940 while (!reader.hasError()) {
1941 switch (reader.readNext()) {
1942 case QXmlStreamReader::StartElement : {
1943 const auto tag = reader.name();
1944 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
1945 auto *v = new DomProperty();
1946 v->read(reader);
1947 m_property.append(v);
1948 continue;
1949 }
1950 reader.raiseError("Unexpected element "_L1 + tag);
1951 }
1952 break;
1953 case QXmlStreamReader::EndElement :
1954 return;
1955 default :
1956 break;
1957 }
1958 }
1959}
1960
1961void DomColumn::write(QXmlStreamWriter &writer, const QString &tagName) const
1962{
1963 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("column") : tagName.toLower());
1964
1965 for (DomProperty *v : m_property)
1966 v->write(writer, u"property"_s);
1967
1968 writer.writeEndElement();
1969}
1970
1971void DomColumn::setElementProperty(const QList<DomProperty *> &a)
1972{
1973 m_children |= Property;
1974 m_property = a;
1975}
1976
1977DomItem::~DomItem()
1978{
1979 qDeleteAll(m_property);
1980 m_property.clear();
1981 qDeleteAll(m_item);
1982 m_item.clear();
1983}
1984
1985void DomItem::read(QXmlStreamReader &reader)
1986{
1987 const QXmlStreamAttributes &attributes = reader.attributes();
1988 for (const QXmlStreamAttribute &attribute : attributes) {
1989 const auto name = attribute.name();
1990 if (name == u"row"_s) {
1991 setAttributeRow(attribute.value().toInt());
1992 continue;
1993 }
1994 if (name == u"column"_s) {
1995 setAttributeColumn(attribute.value().toInt());
1996 continue;
1997 }
1998 reader.raiseError("Unexpected attribute "_L1 + name);
1999 }
2000
2001 while (!reader.hasError()) {
2002 switch (reader.readNext()) {
2003 case QXmlStreamReader::StartElement : {
2004 const auto tag = reader.name();
2005 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
2006 auto *v = new DomProperty();
2007 v->read(reader);
2008 m_property.append(v);
2009 continue;
2010 }
2011 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
2012 auto *v = new DomItem();
2013 v->read(reader);
2014 m_item.append(v);
2015 continue;
2016 }
2017 reader.raiseError("Unexpected element "_L1 + tag);
2018 }
2019 break;
2020 case QXmlStreamReader::EndElement :
2021 return;
2022 default :
2023 break;
2024 }
2025 }
2026}
2027
2028void DomItem::write(QXmlStreamWriter &writer, const QString &tagName) const
2029{
2030 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("item") : tagName.toLower());
2031
2032 if (hasAttributeRow())
2033 writer.writeAttribute(u"row"_s, QString::number(attributeRow()));
2034
2035 if (hasAttributeColumn())
2036 writer.writeAttribute(u"column"_s, QString::number(attributeColumn()));
2037
2038 for (DomProperty *v : m_property)
2039 v->write(writer, u"property"_s);
2040
2041 for (DomItem *v : m_item)
2042 v->write(writer, u"item"_s);
2043
2044 writer.writeEndElement();
2045}
2046
2047void DomItem::setElementProperty(const QList<DomProperty *> &a)
2048{
2049 m_children |= Property;
2050 m_property = a;
2051}
2052
2053void DomItem::setElementItem(const QList<DomItem *> &a)
2054{
2055 m_children |= Item;
2056 m_item = a;
2057}
2058
2059DomWidget::~DomWidget()
2060{
2061 m_class.clear();
2062 qDeleteAll(m_property);
2063 m_property.clear();
2064 qDeleteAll(m_attribute);
2065 m_attribute.clear();
2066 qDeleteAll(m_row);
2067 m_row.clear();
2068 qDeleteAll(m_column);
2069 m_column.clear();
2070 qDeleteAll(m_item);
2071 m_item.clear();
2072 qDeleteAll(m_layout);
2073 m_layout.clear();
2074 qDeleteAll(m_widget);
2075 m_widget.clear();
2076 qDeleteAll(m_action);
2077 m_action.clear();
2078 qDeleteAll(m_actionGroup);
2079 m_actionGroup.clear();
2080 qDeleteAll(m_addAction);
2081 m_addAction.clear();
2082 m_zOrder.clear();
2083}
2084
2085void DomWidget::read(QXmlStreamReader &reader)
2086{
2087 const QXmlStreamAttributes &attributes = reader.attributes();
2088 for (const QXmlStreamAttribute &attribute : attributes) {
2089 const auto name = attribute.name();
2090 if (name == u"class"_s) {
2091 setAttributeClass(attribute.value().toString());
2092 continue;
2093 }
2094 if (name == u"name"_s) {
2095 setAttributeName(attribute.value().toString());
2096 continue;
2097 }
2098 if (name == u"native"_s) {
2099 setAttributeNative(attribute.value() == u"true"_s);
2100 continue;
2101 }
2102 reader.raiseError("Unexpected attribute "_L1 + name);
2103 }
2104
2105 while (!reader.hasError()) {
2106 switch (reader.readNext()) {
2107 case QXmlStreamReader::StartElement : {
2108 const auto tag = reader.name();
2109 if (!tag.compare(u"class"_s, Qt::CaseInsensitive)) {
2110 m_class.append(reader.readElementText());
2111 continue;
2112 }
2113 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
2114 auto *v = new DomProperty();
2115 v->read(reader);
2116 m_property.append(v);
2117 continue;
2118 }
2119 if (!tag.compare(u"script"_s, Qt::CaseInsensitive)) {
2120 qWarning("Omitting deprecated element <script>.");
2121 reader.skipCurrentElement();
2122 continue;
2123 }
2124 if (!tag.compare(u"widgetdata"_s, Qt::CaseInsensitive)) {
2125 qWarning("Omitting deprecated element <widgetdata>.");
2126 reader.skipCurrentElement();
2127 continue;
2128 }
2129 if (!tag.compare(u"attribute"_s, Qt::CaseInsensitive)) {
2130 auto *v = new DomProperty();
2131 v->read(reader);
2132 m_attribute.append(v);
2133 continue;
2134 }
2135 if (!tag.compare(u"row"_s, Qt::CaseInsensitive)) {
2136 auto *v = new DomRow();
2137 v->read(reader);
2138 m_row.append(v);
2139 continue;
2140 }
2141 if (!tag.compare(u"column"_s, Qt::CaseInsensitive)) {
2142 auto *v = new DomColumn();
2143 v->read(reader);
2144 m_column.append(v);
2145 continue;
2146 }
2147 if (!tag.compare(u"item"_s, Qt::CaseInsensitive)) {
2148 auto *v = new DomItem();
2149 v->read(reader);
2150 m_item.append(v);
2151 continue;
2152 }
2153 if (!tag.compare(u"layout"_s, Qt::CaseInsensitive)) {
2154 auto *v = new DomLayout();
2155 v->read(reader);
2156 m_layout.append(v);
2157 continue;
2158 }
2159 if (!tag.compare(u"widget"_s, Qt::CaseInsensitive)) {
2160 auto *v = new DomWidget();
2161 v->read(reader);
2162 m_widget.append(v);
2163 continue;
2164 }
2165 if (!tag.compare(u"action"_s, Qt::CaseInsensitive)) {
2166 auto *v = new DomAction();
2167 v->read(reader);
2168 m_action.append(v);
2169 continue;
2170 }
2171 if (!tag.compare(u"actiongroup"_s, Qt::CaseInsensitive)) {
2172 auto *v = new DomActionGroup();
2173 v->read(reader);
2174 m_actionGroup.append(v);
2175 continue;
2176 }
2177 if (!tag.compare(u"addaction"_s, Qt::CaseInsensitive)) {
2178 auto *v = new DomActionRef();
2179 v->read(reader);
2180 m_addAction.append(v);
2181 continue;
2182 }
2183 if (!tag.compare(u"zorder"_s, Qt::CaseInsensitive)) {
2184 m_zOrder.append(reader.readElementText());
2185 continue;
2186 }
2187 reader.raiseError("Unexpected element "_L1 + tag);
2188 }
2189 break;
2190 case QXmlStreamReader::EndElement :
2191 return;
2192 default :
2193 break;
2194 }
2195 }
2196}
2197
2198void DomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const
2199{
2200 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("widget") : tagName.toLower());
2201
2202 if (hasAttributeClass())
2203 writer.writeAttribute(u"class"_s, attributeClass());
2204
2205 if (hasAttributeName())
2206 writer.writeAttribute(u"name"_s, attributeName());
2207
2208 if (hasAttributeNative())
2209 writer.writeAttribute(u"native"_s, (attributeNative() ? u"true"_s : u"false"_s));
2210
2211 for (const QString &v : m_class)
2212 writer.writeTextElement(u"class"_s, v);
2213
2214 for (DomProperty *v : m_property)
2215 v->write(writer, u"property"_s);
2216
2217 for (DomProperty *v : m_attribute)
2218 v->write(writer, u"attribute"_s);
2219
2220 for (DomRow *v : m_row)
2221 v->write(writer, u"row"_s);
2222
2223 for (DomColumn *v : m_column)
2224 v->write(writer, u"column"_s);
2225
2226 for (DomItem *v : m_item)
2227 v->write(writer, u"item"_s);
2228
2229 for (DomLayout *v : m_layout)
2230 v->write(writer, u"layout"_s);
2231
2232 for (DomWidget *v : m_widget)
2233 v->write(writer, u"widget"_s);
2234
2235 for (DomAction *v : m_action)
2236 v->write(writer, u"action"_s);
2237
2238 for (DomActionGroup *v : m_actionGroup)
2239 v->write(writer, u"actiongroup"_s);
2240
2241 for (DomActionRef *v : m_addAction)
2242 v->write(writer, u"addaction"_s);
2243
2244 for (const QString &v : m_zOrder)
2245 writer.writeTextElement(u"zorder"_s, v);
2246
2247 writer.writeEndElement();
2248}
2249
2250void DomWidget::setElementClass(const QStringList &a)
2251{
2252 m_children |= Class;
2253 m_class = a;
2254}
2255
2256void DomWidget::setElementProperty(const QList<DomProperty *> &a)
2257{
2258 m_children |= Property;
2259 m_property = a;
2260}
2261
2262void DomWidget::setElementAttribute(const QList<DomProperty *> &a)
2263{
2264 m_children |= Attribute;
2265 m_attribute = a;
2266}
2267
2268void DomWidget::setElementRow(const QList<DomRow *> &a)
2269{
2270 m_children |= Row;
2271 m_row = a;
2272}
2273
2274void DomWidget::setElementColumn(const QList<DomColumn *> &a)
2275{
2276 m_children |= Column;
2277 m_column = a;
2278}
2279
2280void DomWidget::setElementItem(const QList<DomItem *> &a)
2281{
2282 m_children |= Item;
2283 m_item = a;
2284}
2285
2286void DomWidget::setElementLayout(const QList<DomLayout *> &a)
2287{
2288 m_children |= Layout;
2289 m_layout = a;
2290}
2291
2292void DomWidget::setElementWidget(const QList<DomWidget *> &a)
2293{
2294 m_children |= Widget;
2295 m_widget = a;
2296}
2297
2298void DomWidget::setElementAction(const QList<DomAction *> &a)
2299{
2300 m_children |= Action;
2301 m_action = a;
2302}
2303
2304void DomWidget::setElementActionGroup(const QList<DomActionGroup *> &a)
2305{
2306 m_children |= ActionGroup;
2307 m_actionGroup = a;
2308}
2309
2310void DomWidget::setElementAddAction(const QList<DomActionRef *> &a)
2311{
2312 m_children |= AddAction;
2313 m_addAction = a;
2314}
2315
2316void DomWidget::setElementZOrder(const QStringList &a)
2317{
2318 m_children |= ZOrder;
2319 m_zOrder = a;
2320}
2321
2322DomSpacer::~DomSpacer()
2323{
2324 qDeleteAll(m_property);
2325 m_property.clear();
2326}
2327
2328void DomSpacer::read(QXmlStreamReader &reader)
2329{
2330 const QXmlStreamAttributes &attributes = reader.attributes();
2331 for (const QXmlStreamAttribute &attribute : attributes) {
2332 const auto name = attribute.name();
2333 if (name == u"name"_s) {
2334 setAttributeName(attribute.value().toString());
2335 continue;
2336 }
2337 reader.raiseError("Unexpected attribute "_L1 + name);
2338 }
2339
2340 while (!reader.hasError()) {
2341 switch (reader.readNext()) {
2342 case QXmlStreamReader::StartElement : {
2343 const auto tag = reader.name();
2344 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
2345 auto *v = new DomProperty();
2346 v->read(reader);
2347 m_property.append(v);
2348 continue;
2349 }
2350 reader.raiseError("Unexpected element "_L1 + tag);
2351 }
2352 break;
2353 case QXmlStreamReader::EndElement :
2354 return;
2355 default :
2356 break;
2357 }
2358 }
2359}
2360
2361void DomSpacer::write(QXmlStreamWriter &writer, const QString &tagName) const
2362{
2363 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("spacer") : tagName.toLower());
2364
2365 if (hasAttributeName())
2366 writer.writeAttribute(u"name"_s, attributeName());
2367
2368 for (DomProperty *v : m_property)
2369 v->write(writer, u"property"_s);
2370
2371 writer.writeEndElement();
2372}
2373
2374void DomSpacer::setElementProperty(const QList<DomProperty *> &a)
2375{
2376 m_children |= Property;
2377 m_property = a;
2378}
2379
2380DomColor::~DomColor() = default;
2381
2382void DomColor::read(QXmlStreamReader &reader)
2383{
2384 const QXmlStreamAttributes &attributes = reader.attributes();
2385 for (const QXmlStreamAttribute &attribute : attributes) {
2386 const auto name = attribute.name();
2387 if (name == u"alpha"_s) {
2388 setAttributeAlpha(attribute.value().toInt());
2389 continue;
2390 }
2391 reader.raiseError("Unexpected attribute "_L1 + name);
2392 }
2393
2394 while (!reader.hasError()) {
2395 switch (reader.readNext()) {
2396 case QXmlStreamReader::StartElement : {
2397 const auto tag = reader.name();
2398 if (!tag.compare(u"red"_s, Qt::CaseInsensitive)) {
2399 setElementRed(reader.readElementText().toInt());
2400 continue;
2401 }
2402 if (!tag.compare(u"green"_s, Qt::CaseInsensitive)) {
2403 setElementGreen(reader.readElementText().toInt());
2404 continue;
2405 }
2406 if (!tag.compare(u"blue"_s, Qt::CaseInsensitive)) {
2407 setElementBlue(reader.readElementText().toInt());
2408 continue;
2409 }
2410 reader.raiseError("Unexpected element "_L1 + tag);
2411 }
2412 break;
2413 case QXmlStreamReader::EndElement :
2414 return;
2415 default :
2416 break;
2417 }
2418 }
2419}
2420
2421void DomColor::write(QXmlStreamWriter &writer, const QString &tagName) const
2422{
2423 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("color") : tagName.toLower());
2424
2425 if (hasAttributeAlpha())
2426 writer.writeAttribute(u"alpha"_s, QString::number(attributeAlpha()));
2427
2428 if (m_children & Red)
2429 writer.writeTextElement(u"red"_s, QString::number(m_red));
2430
2431 if (m_children & Green)
2432 writer.writeTextElement(u"green"_s, QString::number(m_green));
2433
2434 if (m_children & Blue)
2435 writer.writeTextElement(u"blue"_s, QString::number(m_blue));
2436
2437 writer.writeEndElement();
2438}
2439
2440void DomColor::setElementRed(int a)
2441{
2442 m_children |= Red;
2443 m_red = a;
2444}
2445
2446void DomColor::setElementGreen(int a)
2447{
2448 m_children |= Green;
2449 m_green = a;
2450}
2451
2452void DomColor::setElementBlue(int a)
2453{
2454 m_children |= Blue;
2455 m_blue = a;
2456}
2457
2458void DomColor::clearElementRed()
2459{
2460 m_children &= ~Red;
2461}
2462
2463void DomColor::clearElementGreen()
2464{
2465 m_children &= ~Green;
2466}
2467
2468void DomColor::clearElementBlue()
2469{
2470 m_children &= ~Blue;
2471}
2472
2473DomGradientStop::~DomGradientStop()
2474{
2475 delete m_color;
2476}
2477
2478void DomGradientStop::read(QXmlStreamReader &reader)
2479{
2480 const QXmlStreamAttributes &attributes = reader.attributes();
2481 for (const QXmlStreamAttribute &attribute : attributes) {
2482 const auto name = attribute.name();
2483 if (name == u"position"_s) {
2484 setAttributePosition(attribute.value().toDouble());
2485 continue;
2486 }
2487 reader.raiseError("Unexpected attribute "_L1 + name);
2488 }
2489
2490 while (!reader.hasError()) {
2491 switch (reader.readNext()) {
2492 case QXmlStreamReader::StartElement : {
2493 const auto tag = reader.name();
2494 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
2495 auto *v = new DomColor();
2496 v->read(reader);
2497 setElementColor(v);
2498 continue;
2499 }
2500 reader.raiseError("Unexpected element "_L1 + tag);
2501 }
2502 break;
2503 case QXmlStreamReader::EndElement :
2504 return;
2505 default :
2506 break;
2507 }
2508 }
2509}
2510
2511void DomGradientStop::write(QXmlStreamWriter &writer, const QString &tagName) const
2512{
2513 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("gradientstop") : tagName.toLower());
2514
2515 if (hasAttributePosition())
2516 writer.writeAttribute(u"position"_s, QString::number(attributePosition(), 'f', 15));
2517
2518 if (m_children & Color)
2519 m_color->write(writer, u"color"_s);
2520
2521 writer.writeEndElement();
2522}
2523
2524DomColor *DomGradientStop::takeElementColor()
2525{
2526 DomColor *a = m_color;
2527 m_color = nullptr;
2528 m_children ^= Color;
2529 return a;
2530}
2531
2532void DomGradientStop::setElementColor(DomColor *a)
2533{
2534 delete m_color;
2535 m_children |= Color;
2536 m_color = a;
2537}
2538
2539void DomGradientStop::clearElementColor()
2540{
2541 delete m_color;
2542 m_color = nullptr;
2543 m_children &= ~Color;
2544}
2545
2546DomGradient::~DomGradient()
2547{
2548 qDeleteAll(m_gradientStop);
2549 m_gradientStop.clear();
2550}
2551
2552void DomGradient::read(QXmlStreamReader &reader)
2553{
2554 const QXmlStreamAttributes &attributes = reader.attributes();
2555 for (const QXmlStreamAttribute &attribute : attributes) {
2556 const auto name = attribute.name();
2557 if (name == u"startx"_s) {
2558 setAttributeStartX(attribute.value().toDouble());
2559 continue;
2560 }
2561 if (name == u"starty"_s) {
2562 setAttributeStartY(attribute.value().toDouble());
2563 continue;
2564 }
2565 if (name == u"endx"_s) {
2566 setAttributeEndX(attribute.value().toDouble());
2567 continue;
2568 }
2569 if (name == u"endy"_s) {
2570 setAttributeEndY(attribute.value().toDouble());
2571 continue;
2572 }
2573 if (name == u"centralx"_s) {
2574 setAttributeCentralX(attribute.value().toDouble());
2575 continue;
2576 }
2577 if (name == u"centraly"_s) {
2578 setAttributeCentralY(attribute.value().toDouble());
2579 continue;
2580 }
2581 if (name == u"focalx"_s) {
2582 setAttributeFocalX(attribute.value().toDouble());
2583 continue;
2584 }
2585 if (name == u"focaly"_s) {
2586 setAttributeFocalY(attribute.value().toDouble());
2587 continue;
2588 }
2589 if (name == u"radius"_s) {
2590 setAttributeRadius(attribute.value().toDouble());
2591 continue;
2592 }
2593 if (name == u"angle"_s) {
2594 setAttributeAngle(attribute.value().toDouble());
2595 continue;
2596 }
2597 if (name == u"type"_s) {
2598 setAttributeType(attribute.value().toString());
2599 continue;
2600 }
2601 if (name == u"spread"_s) {
2602 setAttributeSpread(attribute.value().toString());
2603 continue;
2604 }
2605 if (name == u"coordinatemode"_s) {
2606 setAttributeCoordinateMode(attribute.value().toString());
2607 continue;
2608 }
2609 reader.raiseError("Unexpected attribute "_L1 + name);
2610 }
2611
2612 while (!reader.hasError()) {
2613 switch (reader.readNext()) {
2614 case QXmlStreamReader::StartElement : {
2615 const auto tag = reader.name();
2616 if (!tag.compare(u"gradientstop"_s, Qt::CaseInsensitive)) {
2617 auto *v = new DomGradientStop();
2618 v->read(reader);
2619 m_gradientStop.append(v);
2620 continue;
2621 }
2622 reader.raiseError("Unexpected element "_L1 + tag);
2623 }
2624 break;
2625 case QXmlStreamReader::EndElement :
2626 return;
2627 default :
2628 break;
2629 }
2630 }
2631}
2632
2633void DomGradient::write(QXmlStreamWriter &writer, const QString &tagName) const
2634{
2635 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("gradient") : tagName.toLower());
2636
2637 if (hasAttributeStartX())
2638 writer.writeAttribute(u"startx"_s, QString::number(attributeStartX(), 'f', 15));
2639
2640 if (hasAttributeStartY())
2641 writer.writeAttribute(u"starty"_s, QString::number(attributeStartY(), 'f', 15));
2642
2643 if (hasAttributeEndX())
2644 writer.writeAttribute(u"endx"_s, QString::number(attributeEndX(), 'f', 15));
2645
2646 if (hasAttributeEndY())
2647 writer.writeAttribute(u"endy"_s, QString::number(attributeEndY(), 'f', 15));
2648
2649 if (hasAttributeCentralX())
2650 writer.writeAttribute(u"centralx"_s, QString::number(attributeCentralX(), 'f', 15));
2651
2652 if (hasAttributeCentralY())
2653 writer.writeAttribute(u"centraly"_s, QString::number(attributeCentralY(), 'f', 15));
2654
2655 if (hasAttributeFocalX())
2656 writer.writeAttribute(u"focalx"_s, QString::number(attributeFocalX(), 'f', 15));
2657
2658 if (hasAttributeFocalY())
2659 writer.writeAttribute(u"focaly"_s, QString::number(attributeFocalY(), 'f', 15));
2660
2661 if (hasAttributeRadius())
2662 writer.writeAttribute(u"radius"_s, QString::number(attributeRadius(), 'f', 15));
2663
2664 if (hasAttributeAngle())
2665 writer.writeAttribute(u"angle"_s, QString::number(attributeAngle(), 'f', 15));
2666
2667 if (hasAttributeType())
2668 writer.writeAttribute(u"type"_s, attributeType());
2669
2670 if (hasAttributeSpread())
2671 writer.writeAttribute(u"spread"_s, attributeSpread());
2672
2673 if (hasAttributeCoordinateMode())
2674 writer.writeAttribute(u"coordinatemode"_s, attributeCoordinateMode());
2675
2676 for (DomGradientStop *v : m_gradientStop)
2677 v->write(writer, u"gradientstop"_s);
2678
2679 writer.writeEndElement();
2680}
2681
2682void DomGradient::setElementGradientStop(const QList<DomGradientStop *> &a)
2683{
2684 m_children |= GradientStop;
2685 m_gradientStop = a;
2686}
2687
2688DomBrush::~DomBrush()
2689{
2690 delete m_color;
2691 delete m_texture;
2692 delete m_gradient;
2693}
2694
2695void DomBrush::clear()
2696{
2697 delete m_color;
2698 delete m_texture;
2699 delete m_gradient;
2700
2701 m_kind = Unknown;
2702
2703 m_color = nullptr;
2704 m_texture = nullptr;
2705 m_gradient = nullptr;
2706}
2707
2708void DomBrush::read(QXmlStreamReader &reader)
2709{
2710 const QXmlStreamAttributes &attributes = reader.attributes();
2711 for (const QXmlStreamAttribute &attribute : attributes) {
2712 const auto name = attribute.name();
2713 if (name == u"brushstyle"_s) {
2714 setAttributeBrushStyle(attribute.value().toString());
2715 continue;
2716 }
2717 reader.raiseError("Unexpected attribute "_L1 + name);
2718 }
2719
2720 while (!reader.hasError()) {
2721 switch (reader.readNext()) {
2722 case QXmlStreamReader::StartElement : {
2723 const auto tag = reader.name();
2724 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
2725 auto *v = new DomColor();
2726 v->read(reader);
2727 setElementColor(v);
2728 continue;
2729 }
2730 if (!tag.compare(u"texture"_s, Qt::CaseInsensitive)) {
2731 auto *v = new DomProperty();
2732 v->read(reader);
2733 setElementTexture(v);
2734 continue;
2735 }
2736 if (!tag.compare(u"gradient"_s, Qt::CaseInsensitive)) {
2737 auto *v = new DomGradient();
2738 v->read(reader);
2739 setElementGradient(v);
2740 continue;
2741 }
2742 reader.raiseError("Unexpected element "_L1 + tag);
2743 }
2744 break;
2745 case QXmlStreamReader::EndElement :
2746 return;
2747 default :
2748 break;
2749 }
2750 }
2751}
2752
2753void DomBrush::write(QXmlStreamWriter &writer, const QString &tagName) const
2754{
2755 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("brush") : tagName.toLower());
2756
2757 if (hasAttributeBrushStyle())
2758 writer.writeAttribute(u"brushstyle"_s, attributeBrushStyle());
2759
2760 switch (kind()) {
2761 case Color:
2762 if (m_color != nullptr)
2763 m_color->write(writer, u"color"_s);
2764 break;
2765
2766 case Texture:
2767 if (m_texture != nullptr)
2768 m_texture->write(writer, u"texture"_s);
2769 break;
2770
2771 case Gradient:
2772 if (m_gradient != nullptr)
2773 m_gradient->write(writer, u"gradient"_s);
2774 break;
2775
2776 default:
2777 break;
2778 }
2779 writer.writeEndElement();
2780}
2781
2782DomColor *DomBrush::takeElementColor()
2783{
2784 DomColor *a = m_color;
2785 m_color = nullptr;
2786 return a;
2787}
2788
2789void DomBrush::setElementColor(DomColor *a)
2790{
2791 clear();
2792 m_kind = Color;
2793 m_color = a;
2794}
2795
2796DomProperty *DomBrush::takeElementTexture()
2797{
2798 DomProperty *a = m_texture;
2799 m_texture = nullptr;
2800 return a;
2801}
2802
2803void DomBrush::setElementTexture(DomProperty *a)
2804{
2805 clear();
2806 m_kind = Texture;
2807 m_texture = a;
2808}
2809
2810DomGradient *DomBrush::takeElementGradient()
2811{
2812 DomGradient *a = m_gradient;
2813 m_gradient = nullptr;
2814 return a;
2815}
2816
2817void DomBrush::setElementGradient(DomGradient *a)
2818{
2819 clear();
2820 m_kind = Gradient;
2821 m_gradient = a;
2822}
2823
2824DomColorRole::~DomColorRole()
2825{
2826 delete m_brush;
2827}
2828
2829void DomColorRole::read(QXmlStreamReader &reader)
2830{
2831 const QXmlStreamAttributes &attributes = reader.attributes();
2832 for (const QXmlStreamAttribute &attribute : attributes) {
2833 const auto name = attribute.name();
2834 if (name == u"role"_s) {
2835 setAttributeRole(attribute.value().toString());
2836 continue;
2837 }
2838 reader.raiseError("Unexpected attribute "_L1 + name);
2839 }
2840
2841 while (!reader.hasError()) {
2842 switch (reader.readNext()) {
2843 case QXmlStreamReader::StartElement : {
2844 const auto tag = reader.name();
2845 if (!tag.compare(u"brush"_s, Qt::CaseInsensitive)) {
2846 auto *v = new DomBrush();
2847 v->read(reader);
2848 setElementBrush(v);
2849 continue;
2850 }
2851 reader.raiseError("Unexpected element "_L1 + tag);
2852 }
2853 break;
2854 case QXmlStreamReader::EndElement :
2855 return;
2856 default :
2857 break;
2858 }
2859 }
2860}
2861
2862void DomColorRole::write(QXmlStreamWriter &writer, const QString &tagName) const
2863{
2864 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("colorrole") : tagName.toLower());
2865
2866 if (hasAttributeRole())
2867 writer.writeAttribute(u"role"_s, attributeRole());
2868
2869 if (m_children & Brush)
2870 m_brush->write(writer, u"brush"_s);
2871
2872 writer.writeEndElement();
2873}
2874
2875DomBrush *DomColorRole::takeElementBrush()
2876{
2877 DomBrush *a = m_brush;
2878 m_brush = nullptr;
2879 m_children ^= Brush;
2880 return a;
2881}
2882
2883void DomColorRole::setElementBrush(DomBrush *a)
2884{
2885 delete m_brush;
2886 m_children |= Brush;
2887 m_brush = a;
2888}
2889
2890void DomColorRole::clearElementBrush()
2891{
2892 delete m_brush;
2893 m_brush = nullptr;
2894 m_children &= ~Brush;
2895}
2896
2897DomColorGroup::~DomColorGroup()
2898{
2899 qDeleteAll(m_colorRole);
2900 m_colorRole.clear();
2901 qDeleteAll(m_color);
2902 m_color.clear();
2903}
2904
2905void DomColorGroup::read(QXmlStreamReader &reader)
2906{
2907 while (!reader.hasError()) {
2908 switch (reader.readNext()) {
2909 case QXmlStreamReader::StartElement : {
2910 const auto tag = reader.name();
2911 if (!tag.compare(u"colorrole"_s, Qt::CaseInsensitive)) {
2912 auto *v = new DomColorRole();
2913 v->read(reader);
2914 m_colorRole.append(v);
2915 continue;
2916 }
2917 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
2918 auto *v = new DomColor();
2919 v->read(reader);
2920 m_color.append(v);
2921 continue;
2922 }
2923 reader.raiseError("Unexpected element "_L1 + tag);
2924 }
2925 break;
2926 case QXmlStreamReader::EndElement :
2927 return;
2928 default :
2929 break;
2930 }
2931 }
2932}
2933
2934void DomColorGroup::write(QXmlStreamWriter &writer, const QString &tagName) const
2935{
2936 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("colorgroup") : tagName.toLower());
2937
2938 for (DomColorRole *v : m_colorRole)
2939 v->write(writer, u"colorrole"_s);
2940
2941 for (DomColor *v : m_color)
2942 v->write(writer, u"color"_s);
2943
2944 writer.writeEndElement();
2945}
2946
2947void DomColorGroup::setElementColorRole(const QList<DomColorRole *> &a)
2948{
2949 m_children |= ColorRole;
2950 m_colorRole = a;
2951}
2952
2953void DomColorGroup::setElementColor(const QList<DomColor *> &a)
2954{
2955 m_children |= Color;
2956 m_color = a;
2957}
2958
2959DomPalette::~DomPalette()
2960{
2961 delete m_active;
2962 delete m_inactive;
2963 delete m_disabled;
2964}
2965
2966void DomPalette::read(QXmlStreamReader &reader)
2967{
2968 while (!reader.hasError()) {
2969 switch (reader.readNext()) {
2970 case QXmlStreamReader::StartElement : {
2971 const auto tag = reader.name();
2972 if (!tag.compare(u"active"_s, Qt::CaseInsensitive)) {
2973 auto *v = new DomColorGroup();
2974 v->read(reader);
2975 setElementActive(v);
2976 continue;
2977 }
2978 if (!tag.compare(u"inactive"_s, Qt::CaseInsensitive)) {
2979 auto *v = new DomColorGroup();
2980 v->read(reader);
2981 setElementInactive(v);
2982 continue;
2983 }
2984 if (!tag.compare(u"disabled"_s, Qt::CaseInsensitive)) {
2985 auto *v = new DomColorGroup();
2986 v->read(reader);
2987 setElementDisabled(v);
2988 continue;
2989 }
2990 reader.raiseError("Unexpected element "_L1 + tag);
2991 }
2992 break;
2993 case QXmlStreamReader::EndElement :
2994 return;
2995 default :
2996 break;
2997 }
2998 }
2999}
3000
3001void DomPalette::write(QXmlStreamWriter &writer, const QString &tagName) const
3002{
3003 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("palette") : tagName.toLower());
3004
3005 if (m_children & Active)
3006 m_active->write(writer, u"active"_s);
3007
3008 if (m_children & Inactive)
3009 m_inactive->write(writer, u"inactive"_s);
3010
3011 if (m_children & Disabled)
3012 m_disabled->write(writer, u"disabled"_s);
3013
3014 writer.writeEndElement();
3015}
3016
3017DomColorGroup *DomPalette::takeElementActive()
3018{
3019 DomColorGroup *a = m_active;
3020 m_active = nullptr;
3021 m_children ^= Active;
3022 return a;
3023}
3024
3025void DomPalette::setElementActive(DomColorGroup *a)
3026{
3027 delete m_active;
3028 m_children |= Active;
3029 m_active = a;
3030}
3031
3032DomColorGroup *DomPalette::takeElementInactive()
3033{
3034 DomColorGroup *a = m_inactive;
3035 m_inactive = nullptr;
3036 m_children ^= Inactive;
3037 return a;
3038}
3039
3040void DomPalette::setElementInactive(DomColorGroup *a)
3041{
3042 delete m_inactive;
3043 m_children |= Inactive;
3044 m_inactive = a;
3045}
3046
3047DomColorGroup *DomPalette::takeElementDisabled()
3048{
3049 DomColorGroup *a = m_disabled;
3050 m_disabled = nullptr;
3051 m_children ^= Disabled;
3052 return a;
3053}
3054
3055void DomPalette::setElementDisabled(DomColorGroup *a)
3056{
3057 delete m_disabled;
3058 m_children |= Disabled;
3059 m_disabled = a;
3060}
3061
3062void DomPalette::clearElementActive()
3063{
3064 delete m_active;
3065 m_active = nullptr;
3066 m_children &= ~Active;
3067}
3068
3069void DomPalette::clearElementInactive()
3070{
3071 delete m_inactive;
3072 m_inactive = nullptr;
3073 m_children &= ~Inactive;
3074}
3075
3076void DomPalette::clearElementDisabled()
3077{
3078 delete m_disabled;
3079 m_disabled = nullptr;
3080 m_children &= ~Disabled;
3081}
3082
3083DomFont::~DomFont() = default;
3084
3085void DomFont::read(QXmlStreamReader &reader)
3086{
3087 while (!reader.hasError()) {
3088 switch (reader.readNext()) {
3089 case QXmlStreamReader::StartElement : {
3090 const auto tag = reader.name();
3091 if (!tag.compare(u"family"_s, Qt::CaseInsensitive)) {
3092 setElementFamily(reader.readElementText());
3093 continue;
3094 }
3095 if (!tag.compare(u"pointsize"_s, Qt::CaseInsensitive)) {
3096 setElementPointSize(reader.readElementText().toInt());
3097 continue;
3098 }
3099 if (!tag.compare(u"weight"_s, Qt::CaseInsensitive)) {
3100 setElementWeight(reader.readElementText().toInt());
3101 continue;
3102 }
3103 if (!tag.compare(u"italic"_s, Qt::CaseInsensitive)) {
3104 setElementItalic(reader.readElementText() == u"true"_s);
3105 continue;
3106 }
3107 if (!tag.compare(u"bold"_s, Qt::CaseInsensitive)) {
3108 setElementBold(reader.readElementText() == u"true"_s);
3109 continue;
3110 }
3111 if (!tag.compare(u"underline"_s, Qt::CaseInsensitive)) {
3112 setElementUnderline(reader.readElementText() == u"true"_s);
3113 continue;
3114 }
3115 if (!tag.compare(u"strikeout"_s, Qt::CaseInsensitive)) {
3116 setElementStrikeOut(reader.readElementText() == u"true"_s);
3117 continue;
3118 }
3119 if (!tag.compare(u"antialiasing"_s, Qt::CaseInsensitive)) {
3120 setElementAntialiasing(reader.readElementText() == u"true"_s);
3121 continue;
3122 }
3123 if (!tag.compare(u"stylestrategy"_s, Qt::CaseInsensitive)) {
3124 setElementStyleStrategy(reader.readElementText());
3125 continue;
3126 }
3127 if (!tag.compare(u"kerning"_s, Qt::CaseInsensitive)) {
3128 setElementKerning(reader.readElementText() == u"true"_s);
3129 continue;
3130 }
3131 if (!tag.compare(u"hintingpreference"_s, Qt::CaseInsensitive)) {
3132 setElementHintingPreference(reader.readElementText());
3133 continue;
3134 }
3135 if (!tag.compare(u"fontweight"_s, Qt::CaseInsensitive)) {
3136 setElementFontWeight(reader.readElementText());
3137 continue;
3138 }
3139 reader.raiseError("Unexpected element "_L1 + tag);
3140 }
3141 break;
3142 case QXmlStreamReader::EndElement :
3143 return;
3144 default :
3145 break;
3146 }
3147 }
3148}
3149
3150void DomFont::write(QXmlStreamWriter &writer, const QString &tagName) const
3151{
3152 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("font") : tagName.toLower());
3153
3154 if (m_children & Family)
3155 writer.writeTextElement(u"family"_s, m_family);
3156
3157 if (m_children & PointSize)
3158 writer.writeTextElement(u"pointsize"_s, QString::number(m_pointSize));
3159
3160 if (m_children & Weight)
3161 writer.writeTextElement(u"weight"_s, QString::number(m_weight));
3162
3163 if (m_children & Italic)
3164 writer.writeTextElement(u"italic"_s, (m_italic ? u"true"_s : u"false"_s));
3165
3166 if (m_children & Bold)
3167 writer.writeTextElement(u"bold"_s, (m_bold ? u"true"_s : u"false"_s));
3168
3169 if (m_children & Underline)
3170 writer.writeTextElement(u"underline"_s, (m_underline ? u"true"_s : u"false"_s));
3171
3172 if (m_children & StrikeOut)
3173 writer.writeTextElement(u"strikeout"_s, (m_strikeOut ? u"true"_s : u"false"_s));
3174
3175 if (m_children & Antialiasing)
3176 writer.writeTextElement(u"antialiasing"_s, (m_antialiasing ? u"true"_s : u"false"_s));
3177
3178 if (m_children & StyleStrategy)
3179 writer.writeTextElement(u"stylestrategy"_s, m_styleStrategy);
3180
3181 if (m_children & Kerning)
3182 writer.writeTextElement(u"kerning"_s, (m_kerning ? u"true"_s : u"false"_s));
3183
3184 if (m_children & HintingPreference)
3185 writer.writeTextElement(u"hintingpreference"_s, m_hintingPreference);
3186
3187 if (m_children & FontWeight)
3188 writer.writeTextElement(u"fontweight"_s, m_fontWeight);
3189
3190 writer.writeEndElement();
3191}
3192
3193void DomFont::setElementFamily(const QString &a)
3194{
3195 m_children |= Family;
3196 m_family = a;
3197}
3198
3199void DomFont::setElementPointSize(int a)
3200{
3201 m_children |= PointSize;
3202 m_pointSize = a;
3203}
3204
3205void DomFont::setElementWeight(int a)
3206{
3207 m_children |= Weight;
3208 m_weight = a;
3209}
3210
3211void DomFont::setElementItalic(bool a)
3212{
3213 m_children |= Italic;
3214 m_italic = a;
3215}
3216
3217void DomFont::setElementBold(bool a)
3218{
3219 m_children |= Bold;
3220 m_bold = a;
3221}
3222
3223void DomFont::setElementUnderline(bool a)
3224{
3225 m_children |= Underline;
3226 m_underline = a;
3227}
3228
3229void DomFont::setElementStrikeOut(bool a)
3230{
3231 m_children |= StrikeOut;
3232 m_strikeOut = a;
3233}
3234
3235void DomFont::setElementAntialiasing(bool a)
3236{
3237 m_children |= Antialiasing;
3238 m_antialiasing = a;
3239}
3240
3241void DomFont::setElementStyleStrategy(const QString &a)
3242{
3243 m_children |= StyleStrategy;
3244 m_styleStrategy = a;
3245}
3246
3247void DomFont::setElementKerning(bool a)
3248{
3249 m_children |= Kerning;
3250 m_kerning = a;
3251}
3252
3253void DomFont::setElementHintingPreference(const QString &a)
3254{
3255 m_children |= HintingPreference;
3256 m_hintingPreference = a;
3257}
3258
3259void DomFont::setElementFontWeight(const QString &a)
3260{
3261 m_children |= FontWeight;
3262 m_fontWeight = a;
3263}
3264
3265void DomFont::clearElementFamily()
3266{
3267 m_children &= ~Family;
3268}
3269
3270void DomFont::clearElementPointSize()
3271{
3272 m_children &= ~PointSize;
3273}
3274
3275void DomFont::clearElementWeight()
3276{
3277 m_children &= ~Weight;
3278}
3279
3280void DomFont::clearElementItalic()
3281{
3282 m_children &= ~Italic;
3283}
3284
3285void DomFont::clearElementBold()
3286{
3287 m_children &= ~Bold;
3288}
3289
3290void DomFont::clearElementUnderline()
3291{
3292 m_children &= ~Underline;
3293}
3294
3295void DomFont::clearElementStrikeOut()
3296{
3297 m_children &= ~StrikeOut;
3298}
3299
3300void DomFont::clearElementAntialiasing()
3301{
3302 m_children &= ~Antialiasing;
3303}
3304
3305void DomFont::clearElementStyleStrategy()
3306{
3307 m_children &= ~StyleStrategy;
3308}
3309
3310void DomFont::clearElementKerning()
3311{
3312 m_children &= ~Kerning;
3313}
3314
3315void DomFont::clearElementHintingPreference()
3316{
3317 m_children &= ~HintingPreference;
3318}
3319
3320void DomFont::clearElementFontWeight()
3321{
3322 m_children &= ~FontWeight;
3323}
3324
3325DomPoint::~DomPoint() = default;
3326
3327void DomPoint::read(QXmlStreamReader &reader)
3328{
3329 while (!reader.hasError()) {
3330 switch (reader.readNext()) {
3331 case QXmlStreamReader::StartElement : {
3332 const auto tag = reader.name();
3333 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
3334 setElementX(reader.readElementText().toInt());
3335 continue;
3336 }
3337 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
3338 setElementY(reader.readElementText().toInt());
3339 continue;
3340 }
3341 reader.raiseError("Unexpected element "_L1 + tag);
3342 }
3343 break;
3344 case QXmlStreamReader::EndElement :
3345 return;
3346 default :
3347 break;
3348 }
3349 }
3350}
3351
3352void DomPoint::write(QXmlStreamWriter &writer, const QString &tagName) const
3353{
3354 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("point") : tagName.toLower());
3355
3356 if (m_children & X)
3357 writer.writeTextElement(u"x"_s, QString::number(m_x));
3358
3359 if (m_children & Y)
3360 writer.writeTextElement(u"y"_s, QString::number(m_y));
3361
3362 writer.writeEndElement();
3363}
3364
3365void DomPoint::setElementX(int a)
3366{
3367 m_children |= X;
3368 m_x = a;
3369}
3370
3371void DomPoint::setElementY(int a)
3372{
3373 m_children |= Y;
3374 m_y = a;
3375}
3376
3377void DomPoint::clearElementX()
3378{
3379 m_children &= ~X;
3380}
3381
3382void DomPoint::clearElementY()
3383{
3384 m_children &= ~Y;
3385}
3386
3387DomRect::~DomRect() = default;
3388
3389void DomRect::read(QXmlStreamReader &reader)
3390{
3391 while (!reader.hasError()) {
3392 switch (reader.readNext()) {
3393 case QXmlStreamReader::StartElement : {
3394 const auto tag = reader.name();
3395 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
3396 setElementX(reader.readElementText().toInt());
3397 continue;
3398 }
3399 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
3400 setElementY(reader.readElementText().toInt());
3401 continue;
3402 }
3403 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
3404 setElementWidth(reader.readElementText().toInt());
3405 continue;
3406 }
3407 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
3408 setElementHeight(reader.readElementText().toInt());
3409 continue;
3410 }
3411 reader.raiseError("Unexpected element "_L1 + tag);
3412 }
3413 break;
3414 case QXmlStreamReader::EndElement :
3415 return;
3416 default :
3417 break;
3418 }
3419 }
3420}
3421
3422void DomRect::write(QXmlStreamWriter &writer, const QString &tagName) const
3423{
3424 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("rect") : tagName.toLower());
3425
3426 if (m_children & X)
3427 writer.writeTextElement(u"x"_s, QString::number(m_x));
3428
3429 if (m_children & Y)
3430 writer.writeTextElement(u"y"_s, QString::number(m_y));
3431
3432 if (m_children & Width)
3433 writer.writeTextElement(u"width"_s, QString::number(m_width));
3434
3435 if (m_children & Height)
3436 writer.writeTextElement(u"height"_s, QString::number(m_height));
3437
3438 writer.writeEndElement();
3439}
3440
3441void DomRect::setElementX(int a)
3442{
3443 m_children |= X;
3444 m_x = a;
3445}
3446
3447void DomRect::setElementY(int a)
3448{
3449 m_children |= Y;
3450 m_y = a;
3451}
3452
3453void DomRect::setElementWidth(int a)
3454{
3455 m_children |= Width;
3456 m_width = a;
3457}
3458
3459void DomRect::setElementHeight(int a)
3460{
3461 m_children |= Height;
3462 m_height = a;
3463}
3464
3465void DomRect::clearElementX()
3466{
3467 m_children &= ~X;
3468}
3469
3470void DomRect::clearElementY()
3471{
3472 m_children &= ~Y;
3473}
3474
3475void DomRect::clearElementWidth()
3476{
3477 m_children &= ~Width;
3478}
3479
3480void DomRect::clearElementHeight()
3481{
3482 m_children &= ~Height;
3483}
3484
3485DomLocale::~DomLocale() = default;
3486
3487void DomLocale::read(QXmlStreamReader &reader)
3488{
3489 const QXmlStreamAttributes &attributes = reader.attributes();
3490 for (const QXmlStreamAttribute &attribute : attributes) {
3491 const auto name = attribute.name();
3492 if (name == u"language"_s) {
3493 setAttributeLanguage(attribute.value().toString());
3494 continue;
3495 }
3496 if (name == u"country"_s) {
3497 setAttributeCountry(attribute.value().toString());
3498 continue;
3499 }
3500 reader.raiseError("Unexpected attribute "_L1 + name);
3501 }
3502
3503 while (!reader.hasError()) {
3504 switch (reader.readNext()) {
3505 case QXmlStreamReader::StartElement : {
3506 const auto tag = reader.name();
3507 reader.raiseError("Unexpected element "_L1 + tag);
3508 }
3509 break;
3510 case QXmlStreamReader::EndElement :
3511 return;
3512 default :
3513 break;
3514 }
3515 }
3516}
3517
3518void DomLocale::write(QXmlStreamWriter &writer, const QString &tagName) const
3519{
3520 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("locale") : tagName.toLower());
3521
3522 if (hasAttributeLanguage())
3523 writer.writeAttribute(u"language"_s, attributeLanguage());
3524
3525 if (hasAttributeCountry())
3526 writer.writeAttribute(u"country"_s, attributeCountry());
3527
3528 writer.writeEndElement();
3529}
3530
3531DomSizePolicy::~DomSizePolicy() = default;
3532
3533void DomSizePolicy::read(QXmlStreamReader &reader)
3534{
3535 const QXmlStreamAttributes &attributes = reader.attributes();
3536 for (const QXmlStreamAttribute &attribute : attributes) {
3537 const auto name = attribute.name();
3538 if (name == u"hsizetype"_s) {
3539 setAttributeHSizeType(attribute.value().toString());
3540 continue;
3541 }
3542 if (name == u"vsizetype"_s) {
3543 setAttributeVSizeType(attribute.value().toString());
3544 continue;
3545 }
3546 reader.raiseError("Unexpected attribute "_L1 + name);
3547 }
3548
3549 while (!reader.hasError()) {
3550 switch (reader.readNext()) {
3551 case QXmlStreamReader::StartElement : {
3552 const auto tag = reader.name();
3553 if (!tag.compare(u"hsizetype"_s, Qt::CaseInsensitive)) {
3554 setElementHSizeType(reader.readElementText().toInt());
3555 continue;
3556 }
3557 if (!tag.compare(u"vsizetype"_s, Qt::CaseInsensitive)) {
3558 setElementVSizeType(reader.readElementText().toInt());
3559 continue;
3560 }
3561 if (!tag.compare(u"horstretch"_s, Qt::CaseInsensitive)) {
3562 setElementHorStretch(reader.readElementText().toInt());
3563 continue;
3564 }
3565 if (!tag.compare(u"verstretch"_s, Qt::CaseInsensitive)) {
3566 setElementVerStretch(reader.readElementText().toInt());
3567 continue;
3568 }
3569 reader.raiseError("Unexpected element "_L1 + tag);
3570 }
3571 break;
3572 case QXmlStreamReader::EndElement :
3573 return;
3574 default :
3575 break;
3576 }
3577 }
3578}
3579
3580void DomSizePolicy::write(QXmlStreamWriter &writer, const QString &tagName) const
3581{
3582 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("sizepolicy") : tagName.toLower());
3583
3584 if (hasAttributeHSizeType())
3585 writer.writeAttribute(u"hsizetype"_s, attributeHSizeType());
3586
3587 if (hasAttributeVSizeType())
3588 writer.writeAttribute(u"vsizetype"_s, attributeVSizeType());
3589
3590 if (m_children & HSizeType)
3591 writer.writeTextElement(u"hsizetype"_s, QString::number(m_hSizeType));
3592
3593 if (m_children & VSizeType)
3594 writer.writeTextElement(u"vsizetype"_s, QString::number(m_vSizeType));
3595
3596 if (m_children & HorStretch)
3597 writer.writeTextElement(u"horstretch"_s, QString::number(m_horStretch));
3598
3599 if (m_children & VerStretch)
3600 writer.writeTextElement(u"verstretch"_s, QString::number(m_verStretch));
3601
3602 writer.writeEndElement();
3603}
3604
3605void DomSizePolicy::setElementHSizeType(int a)
3606{
3607 m_children |= HSizeType;
3608 m_hSizeType = a;
3609}
3610
3611void DomSizePolicy::setElementVSizeType(int a)
3612{
3613 m_children |= VSizeType;
3614 m_vSizeType = a;
3615}
3616
3617void DomSizePolicy::setElementHorStretch(int a)
3618{
3619 m_children |= HorStretch;
3620 m_horStretch = a;
3621}
3622
3623void DomSizePolicy::setElementVerStretch(int a)
3624{
3625 m_children |= VerStretch;
3626 m_verStretch = a;
3627}
3628
3629void DomSizePolicy::clearElementHSizeType()
3630{
3631 m_children &= ~HSizeType;
3632}
3633
3634void DomSizePolicy::clearElementVSizeType()
3635{
3636 m_children &= ~VSizeType;
3637}
3638
3639void DomSizePolicy::clearElementHorStretch()
3640{
3641 m_children &= ~HorStretch;
3642}
3643
3644void DomSizePolicy::clearElementVerStretch()
3645{
3646 m_children &= ~VerStretch;
3647}
3648
3649DomSize::~DomSize() = default;
3650
3651void DomSize::read(QXmlStreamReader &reader)
3652{
3653 while (!reader.hasError()) {
3654 switch (reader.readNext()) {
3655 case QXmlStreamReader::StartElement : {
3656 const auto tag = reader.name();
3657 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
3658 setElementWidth(reader.readElementText().toInt());
3659 continue;
3660 }
3661 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
3662 setElementHeight(reader.readElementText().toInt());
3663 continue;
3664 }
3665 reader.raiseError("Unexpected element "_L1 + tag);
3666 }
3667 break;
3668 case QXmlStreamReader::EndElement :
3669 return;
3670 default :
3671 break;
3672 }
3673 }
3674}
3675
3676void DomSize::write(QXmlStreamWriter &writer, const QString &tagName) const
3677{
3678 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("size") : tagName.toLower());
3679
3680 if (m_children & Width)
3681 writer.writeTextElement(u"width"_s, QString::number(m_width));
3682
3683 if (m_children & Height)
3684 writer.writeTextElement(u"height"_s, QString::number(m_height));
3685
3686 writer.writeEndElement();
3687}
3688
3689void DomSize::setElementWidth(int a)
3690{
3691 m_children |= Width;
3692 m_width = a;
3693}
3694
3695void DomSize::setElementHeight(int a)
3696{
3697 m_children |= Height;
3698 m_height = a;
3699}
3700
3701void DomSize::clearElementWidth()
3702{
3703 m_children &= ~Width;
3704}
3705
3706void DomSize::clearElementHeight()
3707{
3708 m_children &= ~Height;
3709}
3710
3711DomDate::~DomDate() = default;
3712
3713void DomDate::read(QXmlStreamReader &reader)
3714{
3715 while (!reader.hasError()) {
3716 switch (reader.readNext()) {
3717 case QXmlStreamReader::StartElement : {
3718 const auto tag = reader.name();
3719 if (!tag.compare(u"year"_s, Qt::CaseInsensitive)) {
3720 setElementYear(reader.readElementText().toInt());
3721 continue;
3722 }
3723 if (!tag.compare(u"month"_s, Qt::CaseInsensitive)) {
3724 setElementMonth(reader.readElementText().toInt());
3725 continue;
3726 }
3727 if (!tag.compare(u"day"_s, Qt::CaseInsensitive)) {
3728 setElementDay(reader.readElementText().toInt());
3729 continue;
3730 }
3731 reader.raiseError("Unexpected element "_L1 + tag);
3732 }
3733 break;
3734 case QXmlStreamReader::EndElement :
3735 return;
3736 default :
3737 break;
3738 }
3739 }
3740}
3741
3742void DomDate::write(QXmlStreamWriter &writer, const QString &tagName) const
3743{
3744 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("date") : tagName.toLower());
3745
3746 if (m_children & Year)
3747 writer.writeTextElement(u"year"_s, QString::number(m_year));
3748
3749 if (m_children & Month)
3750 writer.writeTextElement(u"month"_s, QString::number(m_month));
3751
3752 if (m_children & Day)
3753 writer.writeTextElement(u"day"_s, QString::number(m_day));
3754
3755 writer.writeEndElement();
3756}
3757
3758void DomDate::setElementYear(int a)
3759{
3760 m_children |= Year;
3761 m_year = a;
3762}
3763
3764void DomDate::setElementMonth(int a)
3765{
3766 m_children |= Month;
3767 m_month = a;
3768}
3769
3770void DomDate::setElementDay(int a)
3771{
3772 m_children |= Day;
3773 m_day = a;
3774}
3775
3776void DomDate::clearElementYear()
3777{
3778 m_children &= ~Year;
3779}
3780
3781void DomDate::clearElementMonth()
3782{
3783 m_children &= ~Month;
3784}
3785
3786void DomDate::clearElementDay()
3787{
3788 m_children &= ~Day;
3789}
3790
3791DomTime::~DomTime() = default;
3792
3793void DomTime::read(QXmlStreamReader &reader)
3794{
3795 while (!reader.hasError()) {
3796 switch (reader.readNext()) {
3797 case QXmlStreamReader::StartElement : {
3798 const auto tag = reader.name();
3799 if (!tag.compare(u"hour"_s, Qt::CaseInsensitive)) {
3800 setElementHour(reader.readElementText().toInt());
3801 continue;
3802 }
3803 if (!tag.compare(u"minute"_s, Qt::CaseInsensitive)) {
3804 setElementMinute(reader.readElementText().toInt());
3805 continue;
3806 }
3807 if (!tag.compare(u"second"_s, Qt::CaseInsensitive)) {
3808 setElementSecond(reader.readElementText().toInt());
3809 continue;
3810 }
3811 reader.raiseError("Unexpected element "_L1 + tag);
3812 }
3813 break;
3814 case QXmlStreamReader::EndElement :
3815 return;
3816 default :
3817 break;
3818 }
3819 }
3820}
3821
3822void DomTime::write(QXmlStreamWriter &writer, const QString &tagName) const
3823{
3824 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("time") : tagName.toLower());
3825
3826 if (m_children & Hour)
3827 writer.writeTextElement(u"hour"_s, QString::number(m_hour));
3828
3829 if (m_children & Minute)
3830 writer.writeTextElement(u"minute"_s, QString::number(m_minute));
3831
3832 if (m_children & Second)
3833 writer.writeTextElement(u"second"_s, QString::number(m_second));
3834
3835 writer.writeEndElement();
3836}
3837
3838void DomTime::setElementHour(int a)
3839{
3840 m_children |= Hour;
3841 m_hour = a;
3842}
3843
3844void DomTime::setElementMinute(int a)
3845{
3846 m_children |= Minute;
3847 m_minute = a;
3848}
3849
3850void DomTime::setElementSecond(int a)
3851{
3852 m_children |= Second;
3853 m_second = a;
3854}
3855
3856void DomTime::clearElementHour()
3857{
3858 m_children &= ~Hour;
3859}
3860
3861void DomTime::clearElementMinute()
3862{
3863 m_children &= ~Minute;
3864}
3865
3866void DomTime::clearElementSecond()
3867{
3868 m_children &= ~Second;
3869}
3870
3871DomDateTime::~DomDateTime() = default;
3872
3873void DomDateTime::read(QXmlStreamReader &reader)
3874{
3875 while (!reader.hasError()) {
3876 switch (reader.readNext()) {
3877 case QXmlStreamReader::StartElement : {
3878 const auto tag = reader.name();
3879 if (!tag.compare(u"hour"_s, Qt::CaseInsensitive)) {
3880 setElementHour(reader.readElementText().toInt());
3881 continue;
3882 }
3883 if (!tag.compare(u"minute"_s, Qt::CaseInsensitive)) {
3884 setElementMinute(reader.readElementText().toInt());
3885 continue;
3886 }
3887 if (!tag.compare(u"second"_s, Qt::CaseInsensitive)) {
3888 setElementSecond(reader.readElementText().toInt());
3889 continue;
3890 }
3891 if (!tag.compare(u"year"_s, Qt::CaseInsensitive)) {
3892 setElementYear(reader.readElementText().toInt());
3893 continue;
3894 }
3895 if (!tag.compare(u"month"_s, Qt::CaseInsensitive)) {
3896 setElementMonth(reader.readElementText().toInt());
3897 continue;
3898 }
3899 if (!tag.compare(u"day"_s, Qt::CaseInsensitive)) {
3900 setElementDay(reader.readElementText().toInt());
3901 continue;
3902 }
3903 reader.raiseError("Unexpected element "_L1 + tag);
3904 }
3905 break;
3906 case QXmlStreamReader::EndElement :
3907 return;
3908 default :
3909 break;
3910 }
3911 }
3912}
3913
3914void DomDateTime::write(QXmlStreamWriter &writer, const QString &tagName) const
3915{
3916 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("datetime") : tagName.toLower());
3917
3918 if (m_children & Hour)
3919 writer.writeTextElement(u"hour"_s, QString::number(m_hour));
3920
3921 if (m_children & Minute)
3922 writer.writeTextElement(u"minute"_s, QString::number(m_minute));
3923
3924 if (m_children & Second)
3925 writer.writeTextElement(u"second"_s, QString::number(m_second));
3926
3927 if (m_children & Year)
3928 writer.writeTextElement(u"year"_s, QString::number(m_year));
3929
3930 if (m_children & Month)
3931 writer.writeTextElement(u"month"_s, QString::number(m_month));
3932
3933 if (m_children & Day)
3934 writer.writeTextElement(u"day"_s, QString::number(m_day));
3935
3936 writer.writeEndElement();
3937}
3938
3939void DomDateTime::setElementHour(int a)
3940{
3941 m_children |= Hour;
3942 m_hour = a;
3943}
3944
3945void DomDateTime::setElementMinute(int a)
3946{
3947 m_children |= Minute;
3948 m_minute = a;
3949}
3950
3951void DomDateTime::setElementSecond(int a)
3952{
3953 m_children |= Second;
3954 m_second = a;
3955}
3956
3957void DomDateTime::setElementYear(int a)
3958{
3959 m_children |= Year;
3960 m_year = a;
3961}
3962
3963void DomDateTime::setElementMonth(int a)
3964{
3965 m_children |= Month;
3966 m_month = a;
3967}
3968
3969void DomDateTime::setElementDay(int a)
3970{
3971 m_children |= Day;
3972 m_day = a;
3973}
3974
3975void DomDateTime::clearElementHour()
3976{
3977 m_children &= ~Hour;
3978}
3979
3980void DomDateTime::clearElementMinute()
3981{
3982 m_children &= ~Minute;
3983}
3984
3985void DomDateTime::clearElementSecond()
3986{
3987 m_children &= ~Second;
3988}
3989
3990void DomDateTime::clearElementYear()
3991{
3992 m_children &= ~Year;
3993}
3994
3995void DomDateTime::clearElementMonth()
3996{
3997 m_children &= ~Month;
3998}
3999
4000void DomDateTime::clearElementDay()
4001{
4002 m_children &= ~Day;
4003}
4004
4005DomStringList::~DomStringList()
4006{
4007 m_string.clear();
4008}
4009
4010void DomStringList::read(QXmlStreamReader &reader)
4011{
4012 const QXmlStreamAttributes &attributes = reader.attributes();
4013 for (const QXmlStreamAttribute &attribute : attributes) {
4014 const auto name = attribute.name();
4015 if (name == u"notr"_s) {
4016 setAttributeNotr(attribute.value().toString());
4017 continue;
4018 }
4019 if (name == u"comment"_s) {
4020 setAttributeComment(attribute.value().toString());
4021 continue;
4022 }
4023 if (name == u"extracomment"_s) {
4024 setAttributeExtraComment(attribute.value().toString());
4025 continue;
4026 }
4027 if (name == u"id"_s) {
4028 setAttributeId(attribute.value().toString());
4029 continue;
4030 }
4031 reader.raiseError("Unexpected attribute "_L1 + name);
4032 }
4033
4034 while (!reader.hasError()) {
4035 switch (reader.readNext()) {
4036 case QXmlStreamReader::StartElement : {
4037 const auto tag = reader.name();
4038 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
4039 m_string.append(reader.readElementText());
4040 continue;
4041 }
4042 reader.raiseError("Unexpected element "_L1 + tag);
4043 }
4044 break;
4045 case QXmlStreamReader::EndElement :
4046 return;
4047 default :
4048 break;
4049 }
4050 }
4051}
4052
4053void DomStringList::write(QXmlStreamWriter &writer, const QString &tagName) const
4054{
4055 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("stringlist") : tagName.toLower());
4056
4057 if (hasAttributeNotr())
4058 writer.writeAttribute(u"notr"_s, attributeNotr());
4059
4060 if (hasAttributeComment())
4061 writer.writeAttribute(u"comment"_s, attributeComment());
4062
4063 if (hasAttributeExtraComment())
4064 writer.writeAttribute(u"extracomment"_s, attributeExtraComment());
4065
4066 if (hasAttributeId())
4067 writer.writeAttribute(u"id"_s, attributeId());
4068
4069 for (const QString &v : m_string)
4070 writer.writeTextElement(u"string"_s, v);
4071
4072 writer.writeEndElement();
4073}
4074
4075void DomStringList::setElementString(const QStringList &a)
4076{
4077 m_children |= String;
4078 m_string = a;
4079}
4080
4081DomResourcePixmap::~DomResourcePixmap() = default;
4082
4083void DomResourcePixmap::read(QXmlStreamReader &reader)
4084{
4085 const QXmlStreamAttributes &attributes = reader.attributes();
4086 for (const QXmlStreamAttribute &attribute : attributes) {
4087 const auto name = attribute.name();
4088 if (name == u"resource"_s) {
4089 setAttributeResource(attribute.value().toString());
4090 continue;
4091 }
4092 if (name == u"alias"_s) {
4093 setAttributeAlias(attribute.value().toString());
4094 continue;
4095 }
4096 reader.raiseError("Unexpected attribute "_L1 + name);
4097 }
4098
4099 while (!reader.hasError()) {
4100 switch (reader.readNext()) {
4101 case QXmlStreamReader::StartElement : {
4102 const auto tag = reader.name();
4103 reader.raiseError("Unexpected element "_L1 + tag);
4104 }
4105 break;
4106 case QXmlStreamReader::EndElement :
4107 return;
4108 case QXmlStreamReader::Characters :
4109 if (!reader.isWhitespace())
4110 m_text.append(reader.text().toString());
4111 break;
4112 default :
4113 break;
4114 }
4115 }
4116}
4117
4118void DomResourcePixmap::write(QXmlStreamWriter &writer, const QString &tagName) const
4119{
4120 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("resourcepixmap") : tagName.toLower());
4121
4122 if (hasAttributeResource())
4123 writer.writeAttribute(u"resource"_s, attributeResource());
4124
4125 if (hasAttributeAlias())
4126 writer.writeAttribute(u"alias"_s, attributeAlias());
4127
4128 if (!m_text.isEmpty())
4129 writer.writeCharacters(m_text);
4130
4131 writer.writeEndElement();
4132}
4133
4134DomResourceIcon::~DomResourceIcon()
4135{
4136 delete m_normalOff;
4137 delete m_normalOn;
4138 delete m_disabledOff;
4139 delete m_disabledOn;
4140 delete m_activeOff;
4141 delete m_activeOn;
4142 delete m_selectedOff;
4143 delete m_selectedOn;
4144}
4145
4146void DomResourceIcon::read(QXmlStreamReader &reader)
4147{
4148 const QXmlStreamAttributes &attributes = reader.attributes();
4149 for (const QXmlStreamAttribute &attribute : attributes) {
4150 const auto name = attribute.name();
4151 if (name == u"theme"_s) {
4152 setAttributeTheme(attribute.value().toString());
4153 continue;
4154 }
4155 if (name == u"resource"_s) {
4156 setAttributeResource(attribute.value().toString());
4157 continue;
4158 }
4159 reader.raiseError("Unexpected attribute "_L1 + name);
4160 }
4161
4162 while (!reader.hasError()) {
4163 switch (reader.readNext()) {
4164 case QXmlStreamReader::StartElement : {
4165 const auto tag = reader.name();
4166 if (!tag.compare(u"normaloff"_s, Qt::CaseInsensitive)) {
4167 auto *v = new DomResourcePixmap();
4168 v->read(reader);
4169 setElementNormalOff(v);
4170 continue;
4171 }
4172 if (!tag.compare(u"normalon"_s, Qt::CaseInsensitive)) {
4173 auto *v = new DomResourcePixmap();
4174 v->read(reader);
4175 setElementNormalOn(v);
4176 continue;
4177 }
4178 if (!tag.compare(u"disabledoff"_s, Qt::CaseInsensitive)) {
4179 auto *v = new DomResourcePixmap();
4180 v->read(reader);
4181 setElementDisabledOff(v);
4182 continue;
4183 }
4184 if (!tag.compare(u"disabledon"_s, Qt::CaseInsensitive)) {
4185 auto *v = new DomResourcePixmap();
4186 v->read(reader);
4187 setElementDisabledOn(v);
4188 continue;
4189 }
4190 if (!tag.compare(u"activeoff"_s, Qt::CaseInsensitive)) {
4191 auto *v = new DomResourcePixmap();
4192 v->read(reader);
4193 setElementActiveOff(v);
4194 continue;
4195 }
4196 if (!tag.compare(u"activeon"_s, Qt::CaseInsensitive)) {
4197 auto *v = new DomResourcePixmap();
4198 v->read(reader);
4199 setElementActiveOn(v);
4200 continue;
4201 }
4202 if (!tag.compare(u"selectedoff"_s, Qt::CaseInsensitive)) {
4203 auto *v = new DomResourcePixmap();
4204 v->read(reader);
4205 setElementSelectedOff(v);
4206 continue;
4207 }
4208 if (!tag.compare(u"selectedon"_s, Qt::CaseInsensitive)) {
4209 auto *v = new DomResourcePixmap();
4210 v->read(reader);
4211 setElementSelectedOn(v);
4212 continue;
4213 }
4214 reader.raiseError("Unexpected element "_L1 + tag);
4215 }
4216 break;
4217 case QXmlStreamReader::EndElement :
4218 return;
4219 case QXmlStreamReader::Characters :
4220 if (!reader.isWhitespace())
4221 m_text.append(reader.text().toString());
4222 break;
4223 default :
4224 break;
4225 }
4226 }
4227}
4228
4229void DomResourceIcon::write(QXmlStreamWriter &writer, const QString &tagName) const
4230{
4231 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("resourceicon") : tagName.toLower());
4232
4233 if (hasAttributeTheme())
4234 writer.writeAttribute(u"theme"_s, attributeTheme());
4235
4236 if (hasAttributeResource())
4237 writer.writeAttribute(u"resource"_s, attributeResource());
4238
4239 if (m_children & NormalOff)
4240 m_normalOff->write(writer, u"normaloff"_s);
4241
4242 if (m_children & NormalOn)
4243 m_normalOn->write(writer, u"normalon"_s);
4244
4245 if (m_children & DisabledOff)
4246 m_disabledOff->write(writer, u"disabledoff"_s);
4247
4248 if (m_children & DisabledOn)
4249 m_disabledOn->write(writer, u"disabledon"_s);
4250
4251 if (m_children & ActiveOff)
4252 m_activeOff->write(writer, u"activeoff"_s);
4253
4254 if (m_children & ActiveOn)
4255 m_activeOn->write(writer, u"activeon"_s);
4256
4257 if (m_children & SelectedOff)
4258 m_selectedOff->write(writer, u"selectedoff"_s);
4259
4260 if (m_children & SelectedOn)
4261 m_selectedOn->write(writer, u"selectedon"_s);
4262
4263 if (!m_text.isEmpty())
4264 writer.writeCharacters(m_text);
4265
4266 writer.writeEndElement();
4267}
4268
4269DomResourcePixmap *DomResourceIcon::takeElementNormalOff()
4270{
4271 DomResourcePixmap *a = m_normalOff;
4272 m_normalOff = nullptr;
4273 m_children ^= NormalOff;
4274 return a;
4275}
4276
4277void DomResourceIcon::setElementNormalOff(DomResourcePixmap *a)
4278{
4279 delete m_normalOff;
4280 m_children |= NormalOff;
4281 m_normalOff = a;
4282}
4283
4284DomResourcePixmap *DomResourceIcon::takeElementNormalOn()
4285{
4286 DomResourcePixmap *a = m_normalOn;
4287 m_normalOn = nullptr;
4288 m_children ^= NormalOn;
4289 return a;
4290}
4291
4292void DomResourceIcon::setElementNormalOn(DomResourcePixmap *a)
4293{
4294 delete m_normalOn;
4295 m_children |= NormalOn;
4296 m_normalOn = a;
4297}
4298
4299DomResourcePixmap *DomResourceIcon::takeElementDisabledOff()
4300{
4301 DomResourcePixmap *a = m_disabledOff;
4302 m_disabledOff = nullptr;
4303 m_children ^= DisabledOff;
4304 return a;
4305}
4306
4307void DomResourceIcon::setElementDisabledOff(DomResourcePixmap *a)
4308{
4309 delete m_disabledOff;
4310 m_children |= DisabledOff;
4311 m_disabledOff = a;
4312}
4313
4314DomResourcePixmap *DomResourceIcon::takeElementDisabledOn()
4315{
4316 DomResourcePixmap *a = m_disabledOn;
4317 m_disabledOn = nullptr;
4318 m_children ^= DisabledOn;
4319 return a;
4320}
4321
4322void DomResourceIcon::setElementDisabledOn(DomResourcePixmap *a)
4323{
4324 delete m_disabledOn;
4325 m_children |= DisabledOn;
4326 m_disabledOn = a;
4327}
4328
4329DomResourcePixmap *DomResourceIcon::takeElementActiveOff()
4330{
4331 DomResourcePixmap *a = m_activeOff;
4332 m_activeOff = nullptr;
4333 m_children ^= ActiveOff;
4334 return a;
4335}
4336
4337void DomResourceIcon::setElementActiveOff(DomResourcePixmap *a)
4338{
4339 delete m_activeOff;
4340 m_children |= ActiveOff;
4341 m_activeOff = a;
4342}
4343
4344DomResourcePixmap *DomResourceIcon::takeElementActiveOn()
4345{
4346 DomResourcePixmap *a = m_activeOn;
4347 m_activeOn = nullptr;
4348 m_children ^= ActiveOn;
4349 return a;
4350}
4351
4352void DomResourceIcon::setElementActiveOn(DomResourcePixmap *a)
4353{
4354 delete m_activeOn;
4355 m_children |= ActiveOn;
4356 m_activeOn = a;
4357}
4358
4359DomResourcePixmap *DomResourceIcon::takeElementSelectedOff()
4360{
4361 DomResourcePixmap *a = m_selectedOff;
4362 m_selectedOff = nullptr;
4363 m_children ^= SelectedOff;
4364 return a;
4365}
4366
4367void DomResourceIcon::setElementSelectedOff(DomResourcePixmap *a)
4368{
4369 delete m_selectedOff;
4370 m_children |= SelectedOff;
4371 m_selectedOff = a;
4372}
4373
4374DomResourcePixmap *DomResourceIcon::takeElementSelectedOn()
4375{
4376 DomResourcePixmap *a = m_selectedOn;
4377 m_selectedOn = nullptr;
4378 m_children ^= SelectedOn;
4379 return a;
4380}
4381
4382void DomResourceIcon::setElementSelectedOn(DomResourcePixmap *a)
4383{
4384 delete m_selectedOn;
4385 m_children |= SelectedOn;
4386 m_selectedOn = a;
4387}
4388
4389void DomResourceIcon::clearElementNormalOff()
4390{
4391 delete m_normalOff;
4392 m_normalOff = nullptr;
4393 m_children &= ~NormalOff;
4394}
4395
4396void DomResourceIcon::clearElementNormalOn()
4397{
4398 delete m_normalOn;
4399 m_normalOn = nullptr;
4400 m_children &= ~NormalOn;
4401}
4402
4403void DomResourceIcon::clearElementDisabledOff()
4404{
4405 delete m_disabledOff;
4406 m_disabledOff = nullptr;
4407 m_children &= ~DisabledOff;
4408}
4409
4410void DomResourceIcon::clearElementDisabledOn()
4411{
4412 delete m_disabledOn;
4413 m_disabledOn = nullptr;
4414 m_children &= ~DisabledOn;
4415}
4416
4417void DomResourceIcon::clearElementActiveOff()
4418{
4419 delete m_activeOff;
4420 m_activeOff = nullptr;
4421 m_children &= ~ActiveOff;
4422}
4423
4424void DomResourceIcon::clearElementActiveOn()
4425{
4426 delete m_activeOn;
4427 m_activeOn = nullptr;
4428 m_children &= ~ActiveOn;
4429}
4430
4431void DomResourceIcon::clearElementSelectedOff()
4432{
4433 delete m_selectedOff;
4434 m_selectedOff = nullptr;
4435 m_children &= ~SelectedOff;
4436}
4437
4438void DomResourceIcon::clearElementSelectedOn()
4439{
4440 delete m_selectedOn;
4441 m_selectedOn = nullptr;
4442 m_children &= ~SelectedOn;
4443}
4444
4445DomString::~DomString() = default;
4446
4447void DomString::read(QXmlStreamReader &reader)
4448{
4449 const QXmlStreamAttributes &attributes = reader.attributes();
4450 for (const QXmlStreamAttribute &attribute : attributes) {
4451 const auto name = attribute.name();
4452 if (name == u"notr"_s) {
4453 setAttributeNotr(attribute.value().toString());
4454 continue;
4455 }
4456 if (name == u"comment"_s) {
4457 setAttributeComment(attribute.value().toString());
4458 continue;
4459 }
4460 if (name == u"extracomment"_s) {
4461 setAttributeExtraComment(attribute.value().toString());
4462 continue;
4463 }
4464 if (name == u"id"_s) {
4465 setAttributeId(attribute.value().toString());
4466 continue;
4467 }
4468 reader.raiseError("Unexpected attribute "_L1 + name);
4469 }
4470
4471 while (!reader.hasError()) {
4472 switch (reader.readNext()) {
4473 case QXmlStreamReader::StartElement : {
4474 const auto tag = reader.name();
4475 reader.raiseError("Unexpected element "_L1 + tag);
4476 }
4477 break;
4478 case QXmlStreamReader::EndElement :
4479 return;
4480 case QXmlStreamReader::Characters :
4481 if (!reader.isWhitespace())
4482 m_text.append(reader.text().toString());
4483 break;
4484 default :
4485 break;
4486 }
4487 }
4488}
4489
4490void DomString::write(QXmlStreamWriter &writer, const QString &tagName) const
4491{
4492 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("string") : tagName.toLower());
4493
4494 if (hasAttributeNotr())
4495 writer.writeAttribute(u"notr"_s, attributeNotr());
4496
4497 if (hasAttributeComment())
4498 writer.writeAttribute(u"comment"_s, attributeComment());
4499
4500 if (hasAttributeExtraComment())
4501 writer.writeAttribute(u"extracomment"_s, attributeExtraComment());
4502
4503 if (hasAttributeId())
4504 writer.writeAttribute(u"id"_s, attributeId());
4505
4506 if (!m_text.isEmpty())
4507 writer.writeCharacters(m_text);
4508
4509 writer.writeEndElement();
4510}
4511
4512DomPointF::~DomPointF() = default;
4513
4514void DomPointF::read(QXmlStreamReader &reader)
4515{
4516 while (!reader.hasError()) {
4517 switch (reader.readNext()) {
4518 case QXmlStreamReader::StartElement : {
4519 const auto tag = reader.name();
4520 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
4521 setElementX(reader.readElementText().toDouble());
4522 continue;
4523 }
4524 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
4525 setElementY(reader.readElementText().toDouble());
4526 continue;
4527 }
4528 reader.raiseError("Unexpected element "_L1 + tag);
4529 }
4530 break;
4531 case QXmlStreamReader::EndElement :
4532 return;
4533 default :
4534 break;
4535 }
4536 }
4537}
4538
4539void DomPointF::write(QXmlStreamWriter &writer, const QString &tagName) const
4540{
4541 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("pointf") : tagName.toLower());
4542
4543 if (m_children & X)
4544 writer.writeTextElement(u"x"_s, QString::number(m_x, 'f', 15));
4545
4546 if (m_children & Y)
4547 writer.writeTextElement(u"y"_s, QString::number(m_y, 'f', 15));
4548
4549 writer.writeEndElement();
4550}
4551
4552void DomPointF::setElementX(double a)
4553{
4554 m_children |= X;
4555 m_x = a;
4556}
4557
4558void DomPointF::setElementY(double a)
4559{
4560 m_children |= Y;
4561 m_y = a;
4562}
4563
4564void DomPointF::clearElementX()
4565{
4566 m_children &= ~X;
4567}
4568
4569void DomPointF::clearElementY()
4570{
4571 m_children &= ~Y;
4572}
4573
4574DomRectF::~DomRectF() = default;
4575
4576void DomRectF::read(QXmlStreamReader &reader)
4577{
4578 while (!reader.hasError()) {
4579 switch (reader.readNext()) {
4580 case QXmlStreamReader::StartElement : {
4581 const auto tag = reader.name();
4582 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
4583 setElementX(reader.readElementText().toDouble());
4584 continue;
4585 }
4586 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
4587 setElementY(reader.readElementText().toDouble());
4588 continue;
4589 }
4590 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
4591 setElementWidth(reader.readElementText().toDouble());
4592 continue;
4593 }
4594 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
4595 setElementHeight(reader.readElementText().toDouble());
4596 continue;
4597 }
4598 reader.raiseError("Unexpected element "_L1 + tag);
4599 }
4600 break;
4601 case QXmlStreamReader::EndElement :
4602 return;
4603 default :
4604 break;
4605 }
4606 }
4607}
4608
4609void DomRectF::write(QXmlStreamWriter &writer, const QString &tagName) const
4610{
4611 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("rectf") : tagName.toLower());
4612
4613 if (m_children & X)
4614 writer.writeTextElement(u"x"_s, QString::number(m_x, 'f', 15));
4615
4616 if (m_children & Y)
4617 writer.writeTextElement(u"y"_s, QString::number(m_y, 'f', 15));
4618
4619 if (m_children & Width)
4620 writer.writeTextElement(u"width"_s, QString::number(m_width, 'f', 15));
4621
4622 if (m_children & Height)
4623 writer.writeTextElement(u"height"_s, QString::number(m_height, 'f', 15));
4624
4625 writer.writeEndElement();
4626}
4627
4628void DomRectF::setElementX(double a)
4629{
4630 m_children |= X;
4631 m_x = a;
4632}
4633
4634void DomRectF::setElementY(double a)
4635{
4636 m_children |= Y;
4637 m_y = a;
4638}
4639
4640void DomRectF::setElementWidth(double a)
4641{
4642 m_children |= Width;
4643 m_width = a;
4644}
4645
4646void DomRectF::setElementHeight(double a)
4647{
4648 m_children |= Height;
4649 m_height = a;
4650}
4651
4652void DomRectF::clearElementX()
4653{
4654 m_children &= ~X;
4655}
4656
4657void DomRectF::clearElementY()
4658{
4659 m_children &= ~Y;
4660}
4661
4662void DomRectF::clearElementWidth()
4663{
4664 m_children &= ~Width;
4665}
4666
4667void DomRectF::clearElementHeight()
4668{
4669 m_children &= ~Height;
4670}
4671
4672DomSizeF::~DomSizeF() = default;
4673
4674void DomSizeF::read(QXmlStreamReader &reader)
4675{
4676 while (!reader.hasError()) {
4677 switch (reader.readNext()) {
4678 case QXmlStreamReader::StartElement : {
4679 const auto tag = reader.name();
4680 if (!tag.compare(u"width"_s, Qt::CaseInsensitive)) {
4681 setElementWidth(reader.readElementText().toDouble());
4682 continue;
4683 }
4684 if (!tag.compare(u"height"_s, Qt::CaseInsensitive)) {
4685 setElementHeight(reader.readElementText().toDouble());
4686 continue;
4687 }
4688 reader.raiseError("Unexpected element "_L1 + tag);
4689 }
4690 break;
4691 case QXmlStreamReader::EndElement :
4692 return;
4693 default :
4694 break;
4695 }
4696 }
4697}
4698
4699void DomSizeF::write(QXmlStreamWriter &writer, const QString &tagName) const
4700{
4701 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("sizef") : tagName.toLower());
4702
4703 if (m_children & Width)
4704 writer.writeTextElement(u"width"_s, QString::number(m_width, 'f', 15));
4705
4706 if (m_children & Height)
4707 writer.writeTextElement(u"height"_s, QString::number(m_height, 'f', 15));
4708
4709 writer.writeEndElement();
4710}
4711
4712void DomSizeF::setElementWidth(double a)
4713{
4714 m_children |= Width;
4715 m_width = a;
4716}
4717
4718void DomSizeF::setElementHeight(double a)
4719{
4720 m_children |= Height;
4721 m_height = a;
4722}
4723
4724void DomSizeF::clearElementWidth()
4725{
4726 m_children &= ~Width;
4727}
4728
4729void DomSizeF::clearElementHeight()
4730{
4731 m_children &= ~Height;
4732}
4733
4734DomChar::~DomChar() = default;
4735
4736void DomChar::read(QXmlStreamReader &reader)
4737{
4738 while (!reader.hasError()) {
4739 switch (reader.readNext()) {
4740 case QXmlStreamReader::StartElement : {
4741 const auto tag = reader.name();
4742 if (!tag.compare(u"unicode"_s, Qt::CaseInsensitive)) {
4743 setElementUnicode(reader.readElementText().toInt());
4744 continue;
4745 }
4746 reader.raiseError("Unexpected element "_L1 + tag);
4747 }
4748 break;
4749 case QXmlStreamReader::EndElement :
4750 return;
4751 default :
4752 break;
4753 }
4754 }
4755}
4756
4757void DomChar::write(QXmlStreamWriter &writer, const QString &tagName) const
4758{
4759 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("char") : tagName.toLower());
4760
4761 if (m_children & Unicode)
4762 writer.writeTextElement(u"unicode"_s, QString::number(m_unicode));
4763
4764 writer.writeEndElement();
4765}
4766
4767void DomChar::setElementUnicode(int a)
4768{
4769 m_children |= Unicode;
4770 m_unicode = a;
4771}
4772
4773void DomChar::clearElementUnicode()
4774{
4775 m_children &= ~Unicode;
4776}
4777
4778DomUrl::~DomUrl()
4779{
4780 delete m_string;
4781}
4782
4783void DomUrl::read(QXmlStreamReader &reader)
4784{
4785 while (!reader.hasError()) {
4786 switch (reader.readNext()) {
4787 case QXmlStreamReader::StartElement : {
4788 const auto tag = reader.name();
4789 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
4790 auto *v = new DomString();
4791 v->read(reader);
4792 setElementString(v);
4793 continue;
4794 }
4795 reader.raiseError("Unexpected element "_L1 + tag);
4796 }
4797 break;
4798 case QXmlStreamReader::EndElement :
4799 return;
4800 default :
4801 break;
4802 }
4803 }
4804}
4805
4806void DomUrl::write(QXmlStreamWriter &writer, const QString &tagName) const
4807{
4808 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("url") : tagName.toLower());
4809
4810 if (m_children & String)
4811 m_string->write(writer, u"string"_s);
4812
4813 writer.writeEndElement();
4814}
4815
4816DomString *DomUrl::takeElementString()
4817{
4818 DomString *a = m_string;
4819 m_string = nullptr;
4820 m_children ^= String;
4821 return a;
4822}
4823
4824void DomUrl::setElementString(DomString *a)
4825{
4826 delete m_string;
4827 m_children |= String;
4828 m_string = a;
4829}
4830
4831void DomUrl::clearElementString()
4832{
4833 delete m_string;
4834 m_string = nullptr;
4835 m_children &= ~String;
4836}
4837
4838DomProperty::~DomProperty()
4839{
4840 delete m_color;
4841 delete m_font;
4842 delete m_iconSet;
4843 delete m_pixmap;
4844 delete m_palette;
4845 delete m_point;
4846 delete m_rect;
4847 delete m_locale;
4848 delete m_sizePolicy;
4849 delete m_size;
4850 delete m_string;
4851 delete m_stringList;
4852 delete m_date;
4853 delete m_time;
4854 delete m_dateTime;
4855 delete m_pointF;
4856 delete m_rectF;
4857 delete m_sizeF;
4858 delete m_char;
4859 delete m_url;
4860 delete m_brush;
4861}
4862
4863void DomProperty::clear()
4864{
4865 delete m_color;
4866 delete m_font;
4867 delete m_iconSet;
4868 delete m_pixmap;
4869 delete m_palette;
4870 delete m_point;
4871 delete m_rect;
4872 delete m_locale;
4873 delete m_sizePolicy;
4874 delete m_size;
4875 delete m_string;
4876 delete m_stringList;
4877 delete m_date;
4878 delete m_time;
4879 delete m_dateTime;
4880 delete m_pointF;
4881 delete m_rectF;
4882 delete m_sizeF;
4883 delete m_char;
4884 delete m_url;
4885 delete m_brush;
4886
4887 m_kind = Unknown;
4888
4889 m_color = nullptr;
4890 m_cursor = 0;
4891 m_font = nullptr;
4892 m_iconSet = nullptr;
4893 m_pixmap = nullptr;
4894 m_palette = nullptr;
4895 m_point = nullptr;
4896 m_rect = nullptr;
4897 m_locale = nullptr;
4898 m_sizePolicy = nullptr;
4899 m_size = nullptr;
4900 m_string = nullptr;
4901 m_stringList = nullptr;
4902 m_number = 0;
4903 m_float = 0.0;
4904 m_double = 0.0;
4905 m_date = nullptr;
4906 m_time = nullptr;
4907 m_dateTime = nullptr;
4908 m_pointF = nullptr;
4909 m_rectF = nullptr;
4910 m_sizeF = nullptr;
4911 m_longLong = 0;
4912 m_char = nullptr;
4913 m_url = nullptr;
4914 m_UInt = 0;
4915 m_uLongLong = 0;
4916 m_brush = nullptr;
4917}
4918
4919void DomProperty::read(QXmlStreamReader &reader)
4920{
4921 const QXmlStreamAttributes &attributes = reader.attributes();
4922 for (const QXmlStreamAttribute &attribute : attributes) {
4923 const auto name = attribute.name();
4924 if (name == u"name"_s) {
4925 setAttributeName(attribute.value().toString());
4926 continue;
4927 }
4928 if (name == u"stdset"_s) {
4929 setAttributeStdset(attribute.value().toInt());
4930 continue;
4931 }
4932 reader.raiseError("Unexpected attribute "_L1 + name);
4933 }
4934
4935 while (!reader.hasError()) {
4936 switch (reader.readNext()) {
4937 case QXmlStreamReader::StartElement : {
4938 const auto tag = reader.name();
4939 if (!tag.compare(u"bool"_s, Qt::CaseInsensitive)) {
4940 setElementBool(reader.readElementText());
4941 continue;
4942 }
4943 if (!tag.compare(u"color"_s, Qt::CaseInsensitive)) {
4944 auto *v = new DomColor();
4945 v->read(reader);
4946 setElementColor(v);
4947 continue;
4948 }
4949 if (!tag.compare(u"cstring"_s, Qt::CaseInsensitive)) {
4950 setElementCstring(reader.readElementText());
4951 continue;
4952 }
4953 if (!tag.compare(u"cursor"_s, Qt::CaseInsensitive)) {
4954 setElementCursor(reader.readElementText().toInt());
4955 continue;
4956 }
4957 if (!tag.compare(u"cursorshape"_s, Qt::CaseInsensitive)) {
4958 setElementCursorShape(reader.readElementText());
4959 continue;
4960 }
4961 if (!tag.compare(u"enum"_s, Qt::CaseInsensitive)) {
4962 setElementEnum(reader.readElementText());
4963 continue;
4964 }
4965 if (!tag.compare(u"font"_s, Qt::CaseInsensitive)) {
4966 auto *v = new DomFont();
4967 v->read(reader);
4968 setElementFont(v);
4969 continue;
4970 }
4971 if (!tag.compare(u"iconset"_s, Qt::CaseInsensitive)) {
4972 auto *v = new DomResourceIcon();
4973 v->read(reader);
4974 setElementIconSet(v);
4975 continue;
4976 }
4977 if (!tag.compare(u"pixmap"_s, Qt::CaseInsensitive)) {
4978 auto *v = new DomResourcePixmap();
4979 v->read(reader);
4980 setElementPixmap(v);
4981 continue;
4982 }
4983 if (!tag.compare(u"palette"_s, Qt::CaseInsensitive)) {
4984 auto *v = new DomPalette();
4985 v->read(reader);
4986 setElementPalette(v);
4987 continue;
4988 }
4989 if (!tag.compare(u"point"_s, Qt::CaseInsensitive)) {
4990 auto *v = new DomPoint();
4991 v->read(reader);
4992 setElementPoint(v);
4993 continue;
4994 }
4995 if (!tag.compare(u"rect"_s, Qt::CaseInsensitive)) {
4996 auto *v = new DomRect();
4997 v->read(reader);
4998 setElementRect(v);
4999 continue;
5000 }
5001 if (!tag.compare(u"set"_s, Qt::CaseInsensitive)) {
5002 setElementSet(reader.readElementText());
5003 continue;
5004 }
5005 if (!tag.compare(u"locale"_s, Qt::CaseInsensitive)) {
5006 auto *v = new DomLocale();
5007 v->read(reader);
5008 setElementLocale(v);
5009 continue;
5010 }
5011 if (!tag.compare(u"sizepolicy"_s, Qt::CaseInsensitive)) {
5012 auto *v = new DomSizePolicy();
5013 v->read(reader);
5014 setElementSizePolicy(v);
5015 continue;
5016 }
5017 if (!tag.compare(u"size"_s, Qt::CaseInsensitive)) {
5018 auto *v = new DomSize();
5019 v->read(reader);
5020 setElementSize(v);
5021 continue;
5022 }
5023 if (!tag.compare(u"string"_s, Qt::CaseInsensitive)) {
5024 auto *v = new DomString();
5025 v->read(reader);
5026 setElementString(v);
5027 continue;
5028 }
5029 if (!tag.compare(u"stringlist"_s, Qt::CaseInsensitive)) {
5030 auto *v = new DomStringList();
5031 v->read(reader);
5032 setElementStringList(v);
5033 continue;
5034 }
5035 if (!tag.compare(u"number"_s, Qt::CaseInsensitive)) {
5036 setElementNumber(reader.readElementText().toInt());
5037 continue;
5038 }
5039 if (!tag.compare(u"float"_s, Qt::CaseInsensitive)) {
5040 setElementFloat(reader.readElementText().toFloat());
5041 continue;
5042 }
5043 if (!tag.compare(u"double"_s, Qt::CaseInsensitive)) {
5044 setElementDouble(reader.readElementText().toDouble());
5045 continue;
5046 }
5047 if (!tag.compare(u"date"_s, Qt::CaseInsensitive)) {
5048 auto *v = new DomDate();
5049 v->read(reader);
5050 setElementDate(v);
5051 continue;
5052 }
5053 if (!tag.compare(u"time"_s, Qt::CaseInsensitive)) {
5054 auto *v = new DomTime();
5055 v->read(reader);
5056 setElementTime(v);
5057 continue;
5058 }
5059 if (!tag.compare(u"datetime"_s, Qt::CaseInsensitive)) {
5060 auto *v = new DomDateTime();
5061 v->read(reader);
5062 setElementDateTime(v);
5063 continue;
5064 }
5065 if (!tag.compare(u"pointf"_s, Qt::CaseInsensitive)) {
5066 auto *v = new DomPointF();
5067 v->read(reader);
5068 setElementPointF(v);
5069 continue;
5070 }
5071 if (!tag.compare(u"rectf"_s, Qt::CaseInsensitive)) {
5072 auto *v = new DomRectF();
5073 v->read(reader);
5074 setElementRectF(v);
5075 continue;
5076 }
5077 if (!tag.compare(u"sizef"_s, Qt::CaseInsensitive)) {
5078 auto *v = new DomSizeF();
5079 v->read(reader);
5080 setElementSizeF(v);
5081 continue;
5082 }
5083 if (!tag.compare(u"longlong"_s, Qt::CaseInsensitive)) {
5084 setElementLongLong(reader.readElementText().toLongLong());
5085 continue;
5086 }
5087 if (!tag.compare(u"char"_s, Qt::CaseInsensitive)) {
5088 auto *v = new DomChar();
5089 v->read(reader);
5090 setElementChar(v);
5091 continue;
5092 }
5093 if (!tag.compare(u"url"_s, Qt::CaseInsensitive)) {
5094 auto *v = new DomUrl();
5095 v->read(reader);
5096 setElementUrl(v);
5097 continue;
5098 }
5099 if (!tag.compare(u"uint"_s, Qt::CaseInsensitive)) {
5100 setElementUInt(reader.readElementText().toUInt());
5101 continue;
5102 }
5103 if (!tag.compare(u"ulonglong"_s, Qt::CaseInsensitive)) {
5104 setElementULongLong(reader.readElementText().toULongLong());
5105 continue;
5106 }
5107 if (!tag.compare(u"brush"_s, Qt::CaseInsensitive)) {
5108 auto *v = new DomBrush();
5109 v->read(reader);
5110 setElementBrush(v);
5111 continue;
5112 }
5113 reader.raiseError("Unexpected element "_L1 + tag);
5114 }
5115 break;
5116 case QXmlStreamReader::EndElement :
5117 return;
5118 default :
5119 break;
5120 }
5121 }
5122}
5123
5124void DomProperty::write(QXmlStreamWriter &writer, const QString &tagName) const
5125{
5126 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("property") : tagName.toLower());
5127
5128 if (hasAttributeName())
5129 writer.writeAttribute(u"name"_s, attributeName());
5130
5131 if (hasAttributeStdset())
5132 writer.writeAttribute(u"stdset"_s, QString::number(attributeStdset()));
5133
5134 switch (kind()) {
5135 case Bool:
5136 writer.writeTextElement(u"bool"_s, elementBool());
5137 break;
5138
5139 case Color:
5140 if (m_color != nullptr)
5141 m_color->write(writer, u"color"_s);
5142 break;
5143
5144 case Cstring:
5145 writer.writeTextElement(u"cstring"_s, elementCstring());
5146 break;
5147
5148 case Cursor:
5149 writer.writeTextElement(u"cursor"_s, QString::number(elementCursor()));
5150 break;
5151
5152 case CursorShape:
5153 writer.writeTextElement(u"cursorShape"_s, elementCursorShape());
5154 break;
5155
5156 case Enum:
5157 writer.writeTextElement(u"enum"_s, elementEnum());
5158 break;
5159
5160 case Font:
5161 if (m_font != nullptr)
5162 m_font->write(writer, u"font"_s);
5163 break;
5164
5165 case IconSet:
5166 if (m_iconSet != nullptr)
5167 m_iconSet->write(writer, u"iconset"_s);
5168 break;
5169
5170 case Pixmap:
5171 if (m_pixmap != nullptr)
5172 m_pixmap->write(writer, u"pixmap"_s);
5173 break;
5174
5175 case Palette:
5176 if (m_palette != nullptr)
5177 m_palette->write(writer, u"palette"_s);
5178 break;
5179
5180 case Point:
5181 if (m_point != nullptr)
5182 m_point->write(writer, u"point"_s);
5183 break;
5184
5185 case Rect:
5186 if (m_rect != nullptr)
5187 m_rect->write(writer, u"rect"_s);
5188 break;
5189
5190 case Set:
5191 writer.writeTextElement(u"set"_s, elementSet());
5192 break;
5193
5194 case Locale:
5195 if (m_locale != nullptr)
5196 m_locale->write(writer, u"locale"_s);
5197 break;
5198
5199 case SizePolicy:
5200 if (m_sizePolicy != nullptr)
5201 m_sizePolicy->write(writer, u"sizepolicy"_s);
5202 break;
5203
5204 case Size:
5205 if (m_size != nullptr)
5206 m_size->write(writer, u"size"_s);
5207 break;
5208
5209 case String:
5210 if (m_string != nullptr)
5211 m_string->write(writer, u"string"_s);
5212 break;
5213
5214 case StringList:
5215 if (m_stringList != nullptr)
5216 m_stringList->write(writer, u"stringlist"_s);
5217 break;
5218
5219 case Number:
5220 writer.writeTextElement(u"number"_s, QString::number(elementNumber()));
5221 break;
5222
5223 case Float:
5224 writer.writeTextElement(u"float"_s, QString::number(elementFloat(), 'f', 8));
5225 break;
5226
5227 case Double:
5228 writer.writeTextElement(u"double"_s, QString::number(elementDouble(), 'f', 15));
5229 break;
5230
5231 case Date:
5232 if (m_date != nullptr)
5233 m_date->write(writer, u"date"_s);
5234 break;
5235
5236 case Time:
5237 if (m_time != nullptr)
5238 m_time->write(writer, u"time"_s);
5239 break;
5240
5241 case DateTime:
5242 if (m_dateTime != nullptr)
5243 m_dateTime->write(writer, u"datetime"_s);
5244 break;
5245
5246 case PointF:
5247 if (m_pointF != nullptr)
5248 m_pointF->write(writer, u"pointf"_s);
5249 break;
5250
5251 case RectF:
5252 if (m_rectF != nullptr)
5253 m_rectF->write(writer, u"rectf"_s);
5254 break;
5255
5256 case SizeF:
5257 if (m_sizeF != nullptr)
5258 m_sizeF->write(writer, u"sizef"_s);
5259 break;
5260
5261 case LongLong:
5262 writer.writeTextElement(u"longLong"_s, QString::number(elementLongLong()));
5263 break;
5264
5265 case Char:
5266 if (m_char != nullptr)
5267 m_char->write(writer, u"char"_s);
5268 break;
5269
5270 case Url:
5271 if (m_url != nullptr)
5272 m_url->write(writer, u"url"_s);
5273 break;
5274
5275 case UInt:
5276 writer.writeTextElement(u"UInt"_s, QString::number(elementUInt()));
5277 break;
5278
5279 case ULongLong:
5280 writer.writeTextElement(u"uLongLong"_s, QString::number(elementULongLong()));
5281 break;
5282
5283 case Brush:
5284 if (m_brush != nullptr)
5285 m_brush->write(writer, u"brush"_s);
5286 break;
5287
5288 default:
5289 break;
5290 }
5291 writer.writeEndElement();
5292}
5293
5294void DomProperty::setElementBool(const QString &a)
5295{
5296 clear();
5297 m_kind = Bool;
5298 m_bool = a;
5299}
5300
5301DomColor *DomProperty::takeElementColor()
5302{
5303 DomColor *a = m_color;
5304 m_color = nullptr;
5305 return a;
5306}
5307
5308void DomProperty::setElementColor(DomColor *a)
5309{
5310 clear();
5311 m_kind = Color;
5312 m_color = a;
5313}
5314
5315void DomProperty::setElementCstring(const QString &a)
5316{
5317 clear();
5318 m_kind = Cstring;
5319 m_cstring = a;
5320}
5321
5322void DomProperty::setElementCursor(int a)
5323{
5324 clear();
5325 m_kind = Cursor;
5326 m_cursor = a;
5327}
5328
5329void DomProperty::setElementCursorShape(const QString &a)
5330{
5331 clear();
5332 m_kind = CursorShape;
5333 m_cursorShape = a;
5334}
5335
5336void DomProperty::setElementEnum(const QString &a)
5337{
5338 clear();
5339 m_kind = Enum;
5340 m_enum = a;
5341}
5342
5343DomFont *DomProperty::takeElementFont()
5344{
5345 DomFont *a = m_font;
5346 m_font = nullptr;
5347 return a;
5348}
5349
5350void DomProperty::setElementFont(DomFont *a)
5351{
5352 clear();
5353 m_kind = Font;
5354 m_font = a;
5355}
5356
5357DomResourceIcon *DomProperty::takeElementIconSet()
5358{
5359 DomResourceIcon *a = m_iconSet;
5360 m_iconSet = nullptr;
5361 return a;
5362}
5363
5364void DomProperty::setElementIconSet(DomResourceIcon *a)
5365{
5366 clear();
5367 m_kind = IconSet;
5368 m_iconSet = a;
5369}
5370
5371DomResourcePixmap *DomProperty::takeElementPixmap()
5372{
5373 DomResourcePixmap *a = m_pixmap;
5374 m_pixmap = nullptr;
5375 return a;
5376}
5377
5378void DomProperty::setElementPixmap(DomResourcePixmap *a)
5379{
5380 clear();
5381 m_kind = Pixmap;
5382 m_pixmap = a;
5383}
5384
5385DomPalette *DomProperty::takeElementPalette()
5386{
5387 DomPalette *a = m_palette;
5388 m_palette = nullptr;
5389 return a;
5390}
5391
5392void DomProperty::setElementPalette(DomPalette *a)
5393{
5394 clear();
5395 m_kind = Palette;
5396 m_palette = a;
5397}
5398
5399DomPoint *DomProperty::takeElementPoint()
5400{
5401 DomPoint *a = m_point;
5402 m_point = nullptr;
5403 return a;
5404}
5405
5406void DomProperty::setElementPoint(DomPoint *a)
5407{
5408 clear();
5409 m_kind = Point;
5410 m_point = a;
5411}
5412
5413DomRect *DomProperty::takeElementRect()
5414{
5415 DomRect *a = m_rect;
5416 m_rect = nullptr;
5417 return a;
5418}
5419
5420void DomProperty::setElementRect(DomRect *a)
5421{
5422 clear();
5423 m_kind = Rect;
5424 m_rect = a;
5425}
5426
5427void DomProperty::setElementSet(const QString &a)
5428{
5429 clear();
5430 m_kind = Set;
5431 m_set = a;
5432}
5433
5434DomLocale *DomProperty::takeElementLocale()
5435{
5436 DomLocale *a = m_locale;
5437 m_locale = nullptr;
5438 return a;
5439}
5440
5441void DomProperty::setElementLocale(DomLocale *a)
5442{
5443 clear();
5444 m_kind = Locale;
5445 m_locale = a;
5446}
5447
5448DomSizePolicy *DomProperty::takeElementSizePolicy()
5449{
5450 DomSizePolicy *a = m_sizePolicy;
5451 m_sizePolicy = nullptr;
5452 return a;
5453}
5454
5455void DomProperty::setElementSizePolicy(DomSizePolicy *a)
5456{
5457 clear();
5458 m_kind = SizePolicy;
5459 m_sizePolicy = a;
5460}
5461
5462DomSize *DomProperty::takeElementSize()
5463{
5464 DomSize *a = m_size;
5465 m_size = nullptr;
5466 return a;
5467}
5468
5469void DomProperty::setElementSize(DomSize *a)
5470{
5471 clear();
5472 m_kind = Size;
5473 m_size = a;
5474}
5475
5476DomString *DomProperty::takeElementString()
5477{
5478 DomString *a = m_string;
5479 m_string = nullptr;
5480 return a;
5481}
5482
5483void DomProperty::setElementString(DomString *a)
5484{
5485 clear();
5486 m_kind = String;
5487 m_string = a;
5488}
5489
5490DomStringList *DomProperty::takeElementStringList()
5491{
5492 DomStringList *a = m_stringList;
5493 m_stringList = nullptr;
5494 return a;
5495}
5496
5497void DomProperty::setElementStringList(DomStringList *a)
5498{
5499 clear();
5500 m_kind = StringList;
5501 m_stringList = a;
5502}
5503
5504void DomProperty::setElementNumber(int a)
5505{
5506 clear();
5507 m_kind = Number;
5508 m_number = a;
5509}
5510
5511void DomProperty::setElementFloat(float a)
5512{
5513 clear();
5514 m_kind = Float;
5515 m_float = a;
5516}
5517
5518void DomProperty::setElementDouble(double a)
5519{
5520 clear();
5521 m_kind = Double;
5522 m_double = a;
5523}
5524
5525DomDate *DomProperty::takeElementDate()
5526{
5527 DomDate *a = m_date;
5528 m_date = nullptr;
5529 return a;
5530}
5531
5532void DomProperty::setElementDate(DomDate *a)
5533{
5534 clear();
5535 m_kind = Date;
5536 m_date = a;
5537}
5538
5539DomTime *DomProperty::takeElementTime()
5540{
5541 DomTime *a = m_time;
5542 m_time = nullptr;
5543 return a;
5544}
5545
5546void DomProperty::setElementTime(DomTime *a)
5547{
5548 clear();
5549 m_kind = Time;
5550 m_time = a;
5551}
5552
5553DomDateTime *DomProperty::takeElementDateTime()
5554{
5555 DomDateTime *a = m_dateTime;
5556 m_dateTime = nullptr;
5557 return a;
5558}
5559
5560void DomProperty::setElementDateTime(DomDateTime *a)
5561{
5562 clear();
5563 m_kind = DateTime;
5564 m_dateTime = a;
5565}
5566
5567DomPointF *DomProperty::takeElementPointF()
5568{
5569 DomPointF *a = m_pointF;
5570 m_pointF = nullptr;
5571 return a;
5572}
5573
5574void DomProperty::setElementPointF(DomPointF *a)
5575{
5576 clear();
5577 m_kind = PointF;
5578 m_pointF = a;
5579}
5580
5581DomRectF *DomProperty::takeElementRectF()
5582{
5583 DomRectF *a = m_rectF;
5584 m_rectF = nullptr;
5585 return a;
5586}
5587
5588void DomProperty::setElementRectF(DomRectF *a)
5589{
5590 clear();
5591 m_kind = RectF;
5592 m_rectF = a;
5593}
5594
5595DomSizeF *DomProperty::takeElementSizeF()
5596{
5597 DomSizeF *a = m_sizeF;
5598 m_sizeF = nullptr;
5599 return a;
5600}
5601
5602void DomProperty::setElementSizeF(DomSizeF *a)
5603{
5604 clear();
5605 m_kind = SizeF;
5606 m_sizeF = a;
5607}
5608
5609void DomProperty::setElementLongLong(qlonglong a)
5610{
5611 clear();
5612 m_kind = LongLong;
5613 m_longLong = a;
5614}
5615
5616DomChar *DomProperty::takeElementChar()
5617{
5618 DomChar *a = m_char;
5619 m_char = nullptr;
5620 return a;
5621}
5622
5623void DomProperty::setElementChar(DomChar *a)
5624{
5625 clear();
5626 m_kind = Char;
5627 m_char = a;
5628}
5629
5630DomUrl *DomProperty::takeElementUrl()
5631{
5632 DomUrl *a = m_url;
5633 m_url = nullptr;
5634 return a;
5635}
5636
5637void DomProperty::setElementUrl(DomUrl *a)
5638{
5639 clear();
5640 m_kind = Url;
5641 m_url = a;
5642}
5643
5644void DomProperty::setElementUInt(uint a)
5645{
5646 clear();
5647 m_kind = UInt;
5648 m_UInt = a;
5649}
5650
5651void DomProperty::setElementULongLong(qulonglong a)
5652{
5653 clear();
5654 m_kind = ULongLong;
5655 m_uLongLong = a;
5656}
5657
5658DomBrush *DomProperty::takeElementBrush()
5659{
5660 DomBrush *a = m_brush;
5661 m_brush = nullptr;
5662 return a;
5663}
5664
5665void DomProperty::setElementBrush(DomBrush *a)
5666{
5667 clear();
5668 m_kind = Brush;
5669 m_brush = a;
5670}
5671
5672DomConnections::~DomConnections()
5673{
5674 qDeleteAll(m_connection);
5675 m_connection.clear();
5676}
5677
5678void DomConnections::read(QXmlStreamReader &reader)
5679{
5680 while (!reader.hasError()) {
5681 switch (reader.readNext()) {
5682 case QXmlStreamReader::StartElement : {
5683 const auto tag = reader.name();
5684 if (!tag.compare(u"connection"_s, Qt::CaseInsensitive)) {
5685 auto *v = new DomConnection();
5686 v->read(reader);
5687 m_connection.append(v);
5688 continue;
5689 }
5690 reader.raiseError("Unexpected element "_L1 + tag);
5691 }
5692 break;
5693 case QXmlStreamReader::EndElement :
5694 return;
5695 default :
5696 break;
5697 }
5698 }
5699}
5700
5701void DomConnections::write(QXmlStreamWriter &writer, const QString &tagName) const
5702{
5703 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("connections") : tagName.toLower());
5704
5705 for (DomConnection *v : m_connection)
5706 v->write(writer, u"connection"_s);
5707
5708 writer.writeEndElement();
5709}
5710
5711void DomConnections::setElementConnection(const QList<DomConnection *> &a)
5712{
5713 m_children |= Connection;
5714 m_connection = a;
5715}
5716
5717DomConnection::~DomConnection()
5718{
5719 delete m_hints;
5720}
5721
5722void DomConnection::read(QXmlStreamReader &reader)
5723{
5724 while (!reader.hasError()) {
5725 switch (reader.readNext()) {
5726 case QXmlStreamReader::StartElement : {
5727 const auto tag = reader.name();
5728 if (!tag.compare(u"sender"_s, Qt::CaseInsensitive)) {
5729 setElementSender(reader.readElementText());
5730 continue;
5731 }
5732 if (!tag.compare(u"signal"_s, Qt::CaseInsensitive)) {
5733 setElementSignal(reader.readElementText());
5734 continue;
5735 }
5736 if (!tag.compare(u"receiver"_s, Qt::CaseInsensitive)) {
5737 setElementReceiver(reader.readElementText());
5738 continue;
5739 }
5740 if (!tag.compare(u"slot"_s, Qt::CaseInsensitive)) {
5741 setElementSlot(reader.readElementText());
5742 continue;
5743 }
5744 if (!tag.compare(u"hints"_s, Qt::CaseInsensitive)) {
5745 auto *v = new DomConnectionHints();
5746 v->read(reader);
5747 setElementHints(v);
5748 continue;
5749 }
5750 reader.raiseError("Unexpected element "_L1 + tag);
5751 }
5752 break;
5753 case QXmlStreamReader::EndElement :
5754 return;
5755 default :
5756 break;
5757 }
5758 }
5759}
5760
5761void DomConnection::write(QXmlStreamWriter &writer, const QString &tagName) const
5762{
5763 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("connection") : tagName.toLower());
5764
5765 if (m_children & Sender)
5766 writer.writeTextElement(u"sender"_s, m_sender);
5767
5768 if (m_children & Signal)
5769 writer.writeTextElement(u"signal"_s, m_signal);
5770
5771 if (m_children & Receiver)
5772 writer.writeTextElement(u"receiver"_s, m_receiver);
5773
5774 if (m_children & Slot)
5775 writer.writeTextElement(u"slot"_s, m_slot);
5776
5777 if (m_children & Hints)
5778 m_hints->write(writer, u"hints"_s);
5779
5780 writer.writeEndElement();
5781}
5782
5783void DomConnection::setElementSender(const QString &a)
5784{
5785 m_children |= Sender;
5786 m_sender = a;
5787}
5788
5789void DomConnection::setElementSignal(const QString &a)
5790{
5791 m_children |= Signal;
5792 m_signal = a;
5793}
5794
5795void DomConnection::setElementReceiver(const QString &a)
5796{
5797 m_children |= Receiver;
5798 m_receiver = a;
5799}
5800
5801void DomConnection::setElementSlot(const QString &a)
5802{
5803 m_children |= Slot;
5804 m_slot = a;
5805}
5806
5807DomConnectionHints *DomConnection::takeElementHints()
5808{
5809 DomConnectionHints *a = m_hints;
5810 m_hints = nullptr;
5811 m_children ^= Hints;
5812 return a;
5813}
5814
5815void DomConnection::setElementHints(DomConnectionHints *a)
5816{
5817 delete m_hints;
5818 m_children |= Hints;
5819 m_hints = a;
5820}
5821
5822void DomConnection::clearElementSender()
5823{
5824 m_children &= ~Sender;
5825}
5826
5827void DomConnection::clearElementSignal()
5828{
5829 m_children &= ~Signal;
5830}
5831
5832void DomConnection::clearElementReceiver()
5833{
5834 m_children &= ~Receiver;
5835}
5836
5837void DomConnection::clearElementSlot()
5838{
5839 m_children &= ~Slot;
5840}
5841
5842void DomConnection::clearElementHints()
5843{
5844 delete m_hints;
5845 m_hints = nullptr;
5846 m_children &= ~Hints;
5847}
5848
5849DomConnectionHints::~DomConnectionHints()
5850{
5851 qDeleteAll(m_hint);
5852 m_hint.clear();
5853}
5854
5855void DomConnectionHints::read(QXmlStreamReader &reader)
5856{
5857 while (!reader.hasError()) {
5858 switch (reader.readNext()) {
5859 case QXmlStreamReader::StartElement : {
5860 const auto tag = reader.name();
5861 if (!tag.compare(u"hint"_s, Qt::CaseInsensitive)) {
5862 auto *v = new DomConnectionHint();
5863 v->read(reader);
5864 m_hint.append(v);
5865 continue;
5866 }
5867 reader.raiseError("Unexpected element "_L1 + tag);
5868 }
5869 break;
5870 case QXmlStreamReader::EndElement :
5871 return;
5872 default :
5873 break;
5874 }
5875 }
5876}
5877
5878void DomConnectionHints::write(QXmlStreamWriter &writer, const QString &tagName) const
5879{
5880 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("connectionhints") : tagName.toLower());
5881
5882 for (DomConnectionHint *v : m_hint)
5883 v->write(writer, u"hint"_s);
5884
5885 writer.writeEndElement();
5886}
5887
5888void DomConnectionHints::setElementHint(const QList<DomConnectionHint *> &a)
5889{
5890 m_children |= Hint;
5891 m_hint = a;
5892}
5893
5894DomConnectionHint::~DomConnectionHint() = default;
5895
5896void DomConnectionHint::read(QXmlStreamReader &reader)
5897{
5898 const QXmlStreamAttributes &attributes = reader.attributes();
5899 for (const QXmlStreamAttribute &attribute : attributes) {
5900 const auto name = attribute.name();
5901 if (name == u"type"_s) {
5902 setAttributeType(attribute.value().toString());
5903 continue;
5904 }
5905 reader.raiseError("Unexpected attribute "_L1 + name);
5906 }
5907
5908 while (!reader.hasError()) {
5909 switch (reader.readNext()) {
5910 case QXmlStreamReader::StartElement : {
5911 const auto tag = reader.name();
5912 if (!tag.compare(u"x"_s, Qt::CaseInsensitive)) {
5913 setElementX(reader.readElementText().toInt());
5914 continue;
5915 }
5916 if (!tag.compare(u"y"_s, Qt::CaseInsensitive)) {
5917 setElementY(reader.readElementText().toInt());
5918 continue;
5919 }
5920 reader.raiseError("Unexpected element "_L1 + tag);
5921 }
5922 break;
5923 case QXmlStreamReader::EndElement :
5924 return;
5925 default :
5926 break;
5927 }
5928 }
5929}
5930
5931void DomConnectionHint::write(QXmlStreamWriter &writer, const QString &tagName) const
5932{
5933 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("connectionhint") : tagName.toLower());
5934
5935 if (hasAttributeType())
5936 writer.writeAttribute(u"type"_s, attributeType());
5937
5938 if (m_children & X)
5939 writer.writeTextElement(u"x"_s, QString::number(m_x));
5940
5941 if (m_children & Y)
5942 writer.writeTextElement(u"y"_s, QString::number(m_y));
5943
5944 writer.writeEndElement();
5945}
5946
5947void DomConnectionHint::setElementX(int a)
5948{
5949 m_children |= X;
5950 m_x = a;
5951}
5952
5953void DomConnectionHint::setElementY(int a)
5954{
5955 m_children |= Y;
5956 m_y = a;
5957}
5958
5959void DomConnectionHint::clearElementX()
5960{
5961 m_children &= ~X;
5962}
5963
5964void DomConnectionHint::clearElementY()
5965{
5966 m_children &= ~Y;
5967}
5968
5969DomDesignerData::~DomDesignerData()
5970{
5971 qDeleteAll(m_property);
5972 m_property.clear();
5973}
5974
5975void DomDesignerData::read(QXmlStreamReader &reader)
5976{
5977 while (!reader.hasError()) {
5978 switch (reader.readNext()) {
5979 case QXmlStreamReader::StartElement : {
5980 const auto tag = reader.name();
5981 if (!tag.compare(u"property"_s, Qt::CaseInsensitive)) {
5982 auto *v = new DomProperty();
5983 v->read(reader);
5984 m_property.append(v);
5985 continue;
5986 }
5987 reader.raiseError("Unexpected element "_L1 + tag);
5988 }
5989 break;
5990 case QXmlStreamReader::EndElement :
5991 return;
5992 default :
5993 break;
5994 }
5995 }
5996}
5997
5998void DomDesignerData::write(QXmlStreamWriter &writer, const QString &tagName) const
5999{
6000 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("designerdata") : tagName.toLower());
6001
6002 for (DomProperty *v : m_property)
6003 v->write(writer, u"property"_s);
6004
6005 writer.writeEndElement();
6006}
6007
6008void DomDesignerData::setElementProperty(const QList<DomProperty *> &a)
6009{
6010 m_children |= Property;
6011 m_property = a;
6012}
6013
6014DomSlots::~DomSlots()
6015{
6016 m_signal.clear();
6017 m_slot.clear();
6018}
6019
6020void DomSlots::read(QXmlStreamReader &reader)
6021{
6022 while (!reader.hasError()) {
6023 switch (reader.readNext()) {
6024 case QXmlStreamReader::StartElement : {
6025 const auto tag = reader.name();
6026 if (!tag.compare(u"signal"_s, Qt::CaseInsensitive)) {
6027 m_signal.append(reader.readElementText());
6028 continue;
6029 }
6030 if (!tag.compare(u"slot"_s, Qt::CaseInsensitive)) {
6031 m_slot.append(reader.readElementText());
6032 continue;
6033 }
6034 reader.raiseError("Unexpected element "_L1 + tag);
6035 }
6036 break;
6037 case QXmlStreamReader::EndElement :
6038 return;
6039 default :
6040 break;
6041 }
6042 }
6043}
6044
6045void DomSlots::write(QXmlStreamWriter &writer, const QString &tagName) const
6046{
6047 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("slots") : tagName.toLower());
6048
6049 for (const QString &v : m_signal)
6050 writer.writeTextElement(u"signal"_s, v);
6051
6052 for (const QString &v : m_slot)
6053 writer.writeTextElement(u"slot"_s, v);
6054
6055 writer.writeEndElement();
6056}
6057
6058void DomSlots::setElementSignal(const QStringList &a)
6059{
6060 m_children |= Signal;
6061 m_signal = a;
6062}
6063
6064void DomSlots::setElementSlot(const QStringList &a)
6065{
6066 m_children |= Slot;
6067 m_slot = a;
6068}
6069
6070DomPropertySpecifications::~DomPropertySpecifications()
6071{
6072 qDeleteAll(m_tooltip);
6073 m_tooltip.clear();
6074 qDeleteAll(m_stringpropertyspecification);
6075 m_stringpropertyspecification.clear();
6076}
6077
6078void DomPropertySpecifications::read(QXmlStreamReader &reader)
6079{
6080 while (!reader.hasError()) {
6081 switch (reader.readNext()) {
6082 case QXmlStreamReader::StartElement : {
6083 const auto tag = reader.name();
6084 if (!tag.compare(u"tooltip"_s, Qt::CaseInsensitive)) {
6085 auto *v = new DomPropertyToolTip();
6086 v->read(reader);
6087 m_tooltip.append(v);
6088 continue;
6089 }
6090 if (!tag.compare(u"stringpropertyspecification"_s, Qt::CaseInsensitive)) {
6091 auto *v = new DomStringPropertySpecification();
6092 v->read(reader);
6093 m_stringpropertyspecification.append(v);
6094 continue;
6095 }
6096 reader.raiseError("Unexpected element "_L1 + tag);
6097 }
6098 break;
6099 case QXmlStreamReader::EndElement :
6100 return;
6101 default :
6102 break;
6103 }
6104 }
6105}
6106
6107void DomPropertySpecifications::write(QXmlStreamWriter &writer, const QString &tagName) const
6108{
6109 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("propertyspecifications") : tagName.toLower());
6110
6111 for (DomPropertyToolTip *v : m_tooltip)
6112 v->write(writer, u"tooltip"_s);
6113
6114 for (DomStringPropertySpecification *v : m_stringpropertyspecification)
6115 v->write(writer, u"stringpropertyspecification"_s);
6116
6117 writer.writeEndElement();
6118}
6119
6120void DomPropertySpecifications::setElementTooltip(const QList<DomPropertyToolTip *> &a)
6121{
6122 m_children |= Tooltip;
6123 m_tooltip = a;
6124}
6125
6126void DomPropertySpecifications::setElementStringpropertyspecification(const QList<DomStringPropertySpecification *> &a)
6127{
6128 m_children |= Stringpropertyspecification;
6129 m_stringpropertyspecification = a;
6130}
6131
6132DomPropertyToolTip::~DomPropertyToolTip() = default;
6133
6134void DomPropertyToolTip::read(QXmlStreamReader &reader)
6135{
6136 const QXmlStreamAttributes &attributes = reader.attributes();
6137 for (const QXmlStreamAttribute &attribute : attributes) {
6138 const auto name = attribute.name();
6139 if (name == u"name"_s) {
6140 setAttributeName(attribute.value().toString());
6141 continue;
6142 }
6143 reader.raiseError("Unexpected attribute "_L1 + name);
6144 }
6145
6146 while (!reader.hasError()) {
6147 switch (reader.readNext()) {
6148 case QXmlStreamReader::StartElement : {
6149 const auto tag = reader.name();
6150 reader.raiseError("Unexpected element "_L1 + tag);
6151 }
6152 break;
6153 case QXmlStreamReader::EndElement :
6154 return;
6155 default :
6156 break;
6157 }
6158 }
6159}
6160
6161void DomPropertyToolTip::write(QXmlStreamWriter &writer, const QString &tagName) const
6162{
6163 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("propertytooltip") : tagName.toLower());
6164
6165 if (hasAttributeName())
6166 writer.writeAttribute(u"name"_s, attributeName());
6167
6168 writer.writeEndElement();
6169}
6170
6171DomStringPropertySpecification::~DomStringPropertySpecification() = default;
6172
6173void DomStringPropertySpecification::read(QXmlStreamReader &reader)
6174{
6175 const QXmlStreamAttributes &attributes = reader.attributes();
6176 for (const QXmlStreamAttribute &attribute : attributes) {
6177 const auto name = attribute.name();
6178 if (name == u"name"_s) {
6179 setAttributeName(attribute.value().toString());
6180 continue;
6181 }
6182 if (name == u"type"_s) {
6183 setAttributeType(attribute.value().toString());
6184 continue;
6185 }
6186 if (name == u"notr"_s) {
6187 setAttributeNotr(attribute.value().toString());
6188 continue;
6189 }
6190 reader.raiseError("Unexpected attribute "_L1 + name);
6191 }
6192
6193 while (!reader.hasError()) {
6194 switch (reader.readNext()) {
6195 case QXmlStreamReader::StartElement : {
6196 const auto tag = reader.name();
6197 reader.raiseError("Unexpected element "_L1 + tag);
6198 }
6199 break;
6200 case QXmlStreamReader::EndElement :
6201 return;
6202 default :
6203 break;
6204 }
6205 }
6206}
6207
6208void DomStringPropertySpecification::write(QXmlStreamWriter &writer, const QString &tagName) const
6209{
6210 writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("stringpropertyspecification") : tagName.toLower());
6211
6212 if (hasAttributeName())
6213 writer.writeAttribute(u"name"_s, attributeName());
6214
6215 if (hasAttributeType())
6216 writer.writeAttribute(u"type"_s, attributeType());
6217
6218 if (hasAttributeNotr())
6219 writer.writeAttribute(u"notr"_s, attributeNotr());
6220
6221 writer.writeEndElement();
6222}
6223
6224QT_END_NAMESPACE
#define QStringLiteral(str)
Definition qstring.h:1826