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