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

source code of qttools/src/designer/src/lib/uilib/ui4.cpp