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