diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2017-05-05 10:46:36 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2017-06-16 06:51:30 +0000 |
commit | 753c744b23abfecad6463890dfdf6e97c7eeaa5c (patch) | |
tree | ae9b589ae9e93f1d34ea21dbd8069d0eb11f7713 /src/designer/src/lib | |
parent | 7323bff4811c07b3a22b5630d7afbfb2d8118ec1 (diff) | |
download | qttools-753c744b23abfecad6463890dfdf6e97c7eeaa5c.tar.gz |
Simplify DomUI classes
Generate text/setText methods only for "mixed" elements,
other elements don't use this API.
Remove unused DomScript, DomImages, DomImage, DomImageData,
DomProperties, DomPropertyData, DomSizePolicyData, DomWidgetData.
Use default constructors and in-class initialization.
Format newlines.
Change-Id: Ic91c797de68710cabc36db1e99bdf82332107ebc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/designer/src/lib')
-rw-r--r-- | src/designer/src/lib/shared/qsimpleresource.cpp | 29 | ||||
-rw-r--r-- | src/designer/src/lib/shared/qsimpleresource_p.h | 6 | ||||
-rw-r--r-- | src/designer/src/lib/uilib/ui4.cpp | 1645 | ||||
-rw-r--r-- | src/designer/src/lib/uilib/ui4_p.h | 1209 |
4 files changed, 432 insertions, 2457 deletions
diff --git a/src/designer/src/lib/shared/qsimpleresource.cpp b/src/designer/src/lib/shared/qsimpleresource.cpp index 7d8dc82d5..95210559c 100644 --- a/src/designer/src/lib/shared/qsimpleresource.cpp +++ b/src/designer/src/lib/shared/qsimpleresource.cpp @@ -78,35 +78,6 @@ DomBrush *QSimpleResource::saveBrush(const QBrush &brush) return QAbstractFormBuilder::saveBrush(brush); } -DomScript *QSimpleResource::createScript(const QString &script, ScriptSource source) -{ - if (script.isEmpty()) - return 0; - DomScript *domScript = new DomScript(); - switch (source) { - case ScriptExtension: - domScript->setAttributeSource(QStringLiteral("extension")); - break; - case ScriptDesigner: - domScript->setAttributeSource(QStringLiteral("designer")); - break; - case ScriptCustomWidgetPlugin: - domScript->setAttributeSource(QStringLiteral("customwidgetplugin")); - break; - } - domScript->setAttributeLanguage(QStringLiteral("Qt Script")); - domScript->setText(script); - return domScript; -} - -// Add a script to a list of DomScripts unless empty -void QSimpleResource::addScript(const QString &script, ScriptSource source, DomScripts &domScripts) -{ - if (DomScript *domScript = createScript(script, source)) { - domScripts += domScript; - } -} - void QSimpleResource::addExtensionDataToDOM(QAbstractFormBuilder * /* afb */, QDesignerFormEditorInterface *core, DomWidget *ui_widget, QWidget *widget) diff --git a/src/designer/src/lib/shared/qsimpleresource_p.h b/src/designer/src/lib/shared/qsimpleresource_p.h index 191754560..8bd5d5f0d 100644 --- a/src/designer/src/lib/shared/qsimpleresource_p.h +++ b/src/designer/src/lib/shared/qsimpleresource_p.h @@ -47,7 +47,6 @@ QT_BEGIN_NAMESPACE -class DomScript; class DomCustomWidgets; class DomCustomWidget; class DomSlots; @@ -88,11 +87,6 @@ public: const DomCustomWidgets *dom_custom_widgets); protected: - enum ScriptSource { ScriptDesigner, ScriptExtension, ScriptCustomWidgetPlugin }; - static DomScript*createScript(const QString &script, ScriptSource source); - typedef QList<DomScript*> DomScripts; - static void addScript(const QString &script, ScriptSource source, DomScripts &domScripts); - static bool addFakeMethods(const DomSlots *domSlots, QStringList &fakeSlots, QStringList &fakeSignals); private: diff --git a/src/designer/src/lib/uilib/ui4.cpp b/src/designer/src/lib/uilib/ui4.cpp index 259fc0a8a..3ec4153fb 100644 --- a/src/designer/src/lib/uilib/ui4.cpp +++ b/src/designer/src/lib/uilib/ui4.cpp @@ -51,30 +51,6 @@ using namespace QFormInternal; ** Implementations */ -DomUI::DomUI() -{ - m_children = 0; - m_has_attr_version = false; - m_has_attr_language = false; - m_has_attr_displayname = false; - m_has_attr_stdsetdef = false; - m_attr_stdsetdef = 0; - m_has_attr_stdSetDef = false; - m_attr_stdSetDef = 0; - m_widget = 0; - m_layoutDefault = 0; - m_layoutFunction = 0; - m_customWidgets = 0; - m_tabStops = 0; - m_images = 0; - m_includes = 0; - m_resources = 0; - m_connections = 0; - m_designerdata = 0; - m_slots = 0; - m_buttonGroups = 0; -} - DomUI::~DomUI() { delete m_widget; @@ -82,7 +58,6 @@ DomUI::~DomUI() delete m_layoutFunction; delete m_customWidgets; delete m_tabStops; - delete m_images; delete m_includes; delete m_resources; delete m_connections; @@ -173,12 +148,6 @@ void DomUI::read(QXmlStreamReader &reader) setElementTabStops(v); continue; } - if (!tag.compare(QLatin1String("images"), Qt::CaseInsensitive)) { - DomImages *v = new DomImages(); - v->read(reader); - setElementImages(v); - continue; - } if (!tag.compare(QLatin1String("includes"), Qt::CaseInsensitive)) { DomIncludes *v = new DomIncludes(); v->read(reader); @@ -220,10 +189,6 @@ void DomUI::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -279,9 +244,6 @@ void DomUI::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & TabStops) m_tabStops->write(writer, QStringLiteral("tabstops")); - if (m_children & Images) - m_images->write(writer, QStringLiteral("images")); - if (m_children & Includes) m_includes->write(writer, QStringLiteral("includes")); @@ -300,9 +262,6 @@ void DomUI::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & ButtonGroups) m_buttonGroups->write(writer, QStringLiteral("buttongroups")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -411,21 +370,6 @@ void DomUI::setElementTabStops(DomTabStops *a) m_tabStops = a; } -DomImages *DomUI::takeElementImages() -{ - DomImages *a = m_images; - m_images = 0; - m_children ^= Images; - return a; -} - -void DomUI::setElementImages(DomImages *a) -{ - delete m_images; - m_children |= Images; - m_images = a; -} - DomIncludes *DomUI::takeElementIncludes() { DomIncludes *a = m_includes; @@ -576,13 +520,6 @@ void DomUI::clearElementTabStops() m_children &= ~TabStops; } -void DomUI::clearElementImages() -{ - delete m_images; - m_images = 0; - m_children &= ~Images; -} - void DomUI::clearElementIncludes() { delete m_includes; @@ -625,11 +562,6 @@ void DomUI::clearElementButtonGroups() m_children &= ~ButtonGroups; } -DomIncludes::DomIncludes() -{ - m_children = 0; -} - DomIncludes::~DomIncludes() { qDeleteAll(m_include); @@ -653,10 +585,6 @@ void DomIncludes::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -670,9 +598,6 @@ void DomIncludes::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomInclude *v : m_include) v->write(writer, QStringLiteral("include")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -682,13 +607,6 @@ void DomIncludes::setElementInclude(const QVector<DomInclude *> &a) m_include = a; } -DomInclude::DomInclude() -{ - m_has_attr_location = false; - m_has_attr_impldecl = false; - m_text.clear(); -} - DomInclude::~DomInclude() { } @@ -744,12 +662,6 @@ void DomInclude::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -DomResources::DomResources() -{ - m_children = 0; - m_has_attr_name = false; -} - DomResources::~DomResources() { qDeleteAll(m_include); @@ -783,10 +695,6 @@ void DomResources::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -803,9 +711,6 @@ void DomResources::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomResource *v : m_include) v->write(writer, QStringLiteral("include")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -815,11 +720,6 @@ void DomResources::setElementInclude(const QVector<DomResource *> &a) m_include = a; } -DomResource::DomResource() -{ - m_has_attr_location = false; -} - DomResource::~DomResource() { } @@ -845,10 +745,6 @@ void DomResource::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -862,18 +758,9 @@ void DomResource::write(QXmlStreamWriter &writer, const QString &tagName) const if (hasAttributeLocation()) writer.writeAttribute(QStringLiteral("location"), attributeLocation()); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } -DomActionGroup::DomActionGroup() -{ - m_children = 0; - m_has_attr_name = false; -} - DomActionGroup::~DomActionGroup() { qDeleteAll(m_action); @@ -931,10 +818,6 @@ void DomActionGroup::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -960,9 +843,6 @@ void DomActionGroup::write(QXmlStreamWriter &writer, const QString &tagName) con for (DomProperty *v : m_attribute) v->write(writer, QStringLiteral("attribute")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -990,13 +870,6 @@ void DomActionGroup::setElementAttribute(const QList<DomProperty *> &a) m_attribute = a; } -DomAction::DomAction() -{ - m_children = 0; - m_has_attr_name = false; - m_has_attr_menu = false; -} - DomAction::~DomAction() { qDeleteAll(m_property); @@ -1042,10 +915,6 @@ void DomAction::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -1068,9 +937,6 @@ void DomAction::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomProperty *v : m_attribute) v->write(writer, QStringLiteral("attribute")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -1086,11 +952,6 @@ void DomAction::setElementAttribute(const QList<DomProperty *> &a) m_attribute = a; } -DomActionRef::DomActionRef() -{ - m_has_attr_name = false; -} - DomActionRef::~DomActionRef() { } @@ -1116,10 +977,6 @@ void DomActionRef::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -1133,18 +990,9 @@ void DomActionRef::write(QXmlStreamWriter &writer, const QString &tagName) const if (hasAttributeName()) writer.writeAttribute(QStringLiteral("name"), attributeName()); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } -DomButtonGroup::DomButtonGroup() -{ - m_children = 0; - m_has_attr_name = false; -} - DomButtonGroup::~DomButtonGroup() { qDeleteAll(m_property); @@ -1186,10 +1034,6 @@ void DomButtonGroup::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -1209,9 +1053,6 @@ void DomButtonGroup::write(QXmlStreamWriter &writer, const QString &tagName) con for (DomProperty *v : m_attribute) v->write(writer, QStringLiteral("attribute")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -1227,11 +1068,6 @@ void DomButtonGroup::setElementAttribute(const QList<DomProperty *> &a) m_attribute = a; } -DomButtonGroups::DomButtonGroups() -{ - m_children = 0; -} - DomButtonGroups::~DomButtonGroups() { qDeleteAll(m_buttonGroup); @@ -1255,10 +1091,6 @@ void DomButtonGroups::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -1272,9 +1104,6 @@ void DomButtonGroups::write(QXmlStreamWriter &writer, const QString &tagName) co for (DomButtonGroup *v : m_buttonGroup) v->write(writer, QStringLiteral("buttongroup")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -1284,218 +1113,6 @@ void DomButtonGroups::setElementButtonGroup(const QVector<DomButtonGroup *> &a) m_buttonGroup = a; } -DomImages::DomImages() -{ - m_children = 0; -} - -DomImages::~DomImages() -{ - qDeleteAll(m_image); - m_image.clear(); -} - -void DomImages::read(QXmlStreamReader &reader) -{ - while (!reader.hasError()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); - if (!tag.compare(QLatin1String("image"), Qt::CaseInsensitive)) { - DomImage *v = new DomImage(); - v->read(reader); - m_image.append(v); - continue; - } - reader.raiseError(QLatin1String("Unexpected element ") + tag); - } - break; - case QXmlStreamReader::EndElement : - return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; - default : - break; - } - } -} - -void DomImages::write(QXmlStreamWriter &writer, const QString &tagName) const -{ - writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("images") : tagName.toLower()); - - for (DomImage *v : m_image) - v->write(writer, QStringLiteral("image")); - - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - - writer.writeEndElement(); -} - -void DomImages::setElementImage(const QVector<DomImage *> &a) -{ - m_children |= Image; - m_image = a; -} - -DomImage::DomImage() -{ - m_children = 0; - m_has_attr_name = false; - m_data = 0; -} - -DomImage::~DomImage() -{ - delete m_data; -} - -void DomImage::read(QXmlStreamReader &reader) -{ - const QXmlStreamAttributes &attributes = reader.attributes(); - for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); - if (name == QLatin1String("name")) { - setAttributeName(attribute.value().toString()); - continue; - } - reader.raiseError(QLatin1String("Unexpected attribute ") + name); - } - - while (!reader.hasError()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); - if (!tag.compare(QLatin1String("data"), Qt::CaseInsensitive)) { - DomImageData *v = new DomImageData(); - v->read(reader); - setElementData(v); - continue; - } - reader.raiseError(QLatin1String("Unexpected element ") + tag); - } - break; - case QXmlStreamReader::EndElement : - return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; - default : - break; - } - } -} - -void DomImage::write(QXmlStreamWriter &writer, const QString &tagName) const -{ - writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("image") : tagName.toLower()); - - if (hasAttributeName()) - writer.writeAttribute(QStringLiteral("name"), attributeName()); - - if (m_children & Data) - m_data->write(writer, QStringLiteral("data")); - - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - - writer.writeEndElement(); -} - -DomImageData *DomImage::takeElementData() -{ - DomImageData *a = m_data; - m_data = 0; - m_children ^= Data; - return a; -} - -void DomImage::setElementData(DomImageData *a) -{ - delete m_data; - m_children |= Data; - m_data = a; -} - -void DomImage::clearElementData() -{ - delete m_data; - m_data = 0; - m_children &= ~Data; -} - -DomImageData::DomImageData() -{ - m_has_attr_format = false; - m_has_attr_length = false; - m_attr_length = 0; - m_text.clear(); -} - -DomImageData::~DomImageData() -{ -} - -void DomImageData::read(QXmlStreamReader &reader) -{ - const QXmlStreamAttributes &attributes = reader.attributes(); - for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); - if (name == QLatin1String("format")) { - setAttributeFormat(attribute.value().toString()); - continue; - } - if (name == QLatin1String("length")) { - setAttributeLength(attribute.value().toInt()); - continue; - } - reader.raiseError(QLatin1String("Unexpected attribute ") + name); - } - - while (!reader.hasError()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); - } - break; - case QXmlStreamReader::EndElement : - return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; - default : - break; - } - } -} - -void DomImageData::write(QXmlStreamWriter &writer, const QString &tagName) const -{ - writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("imagedata") : tagName.toLower()); - - if (hasAttributeFormat()) - writer.writeAttribute(QStringLiteral("format"), attributeFormat()); - - if (hasAttributeLength()) - writer.writeAttribute(QStringLiteral("length"), QString::number(attributeLength())); - - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - - writer.writeEndElement(); -} - -DomCustomWidgets::DomCustomWidgets() -{ - m_children = 0; -} - DomCustomWidgets::~DomCustomWidgets() { qDeleteAll(m_customWidget); @@ -1519,10 +1136,6 @@ void DomCustomWidgets::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -1536,9 +1149,6 @@ void DomCustomWidgets::write(QXmlStreamWriter &writer, const QString &tagName) c for (DomCustomWidget *v : m_customWidget) v->write(writer, QStringLiteral("customwidget")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -1548,12 +1158,6 @@ void DomCustomWidgets::setElementCustomWidget(const QVector<DomCustomWidget *> & m_customWidget = a; } -DomHeader::DomHeader() -{ - m_has_attr_location = false; - m_text.clear(); -} - DomHeader::~DomHeader() { } @@ -1602,26 +1206,10 @@ void DomHeader::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -DomCustomWidget::DomCustomWidget() -{ - m_children = 0; - m_header = 0; - m_sizeHint = 0; - m_container = 0; - m_sizePolicy = 0; - m_script = 0; - m_properties = 0; - m_slots = 0; - m_propertyspecifications = 0; -} - DomCustomWidget::~DomCustomWidget() { delete m_header; delete m_sizeHint; - delete m_sizePolicy; - delete m_script; - delete m_properties; delete m_slots; delete m_propertyspecifications; } @@ -1660,28 +1248,10 @@ void DomCustomWidget::read(QXmlStreamReader &reader) setElementContainer(reader.readElementText().toInt()); continue; } - if (!tag.compare(QLatin1String("sizepolicy"), Qt::CaseInsensitive)) { - DomSizePolicyData *v = new DomSizePolicyData(); - v->read(reader); - setElementSizePolicy(v); - continue; - } if (!tag.compare(QLatin1String("pixmap"), Qt::CaseInsensitive)) { setElementPixmap(reader.readElementText()); continue; } - if (!tag.compare(QLatin1String("script"), Qt::CaseInsensitive)) { - DomScript *v = new DomScript(); - v->read(reader); - setElementScript(v); - continue; - } - if (!tag.compare(QLatin1String("properties"), Qt::CaseInsensitive)) { - DomProperties *v = new DomProperties(); - v->read(reader); - setElementProperties(v); - continue; - } if (!tag.compare(QLatin1String("slots"), Qt::CaseInsensitive)) { DomSlots *v = new DomSlots(); v->read(reader); @@ -1699,10 +1269,6 @@ void DomCustomWidget::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -1731,27 +1297,15 @@ void DomCustomWidget::write(QXmlStreamWriter &writer, const QString &tagName) co if (m_children & Container) writer.writeTextElement(QStringLiteral("container"), QString::number(m_container)); - if (m_children & SizePolicy) - m_sizePolicy->write(writer, QStringLiteral("sizepolicy")); - if (m_children & Pixmap) writer.writeTextElement(QStringLiteral("pixmap"), m_pixmap); - if (m_children & Script) - m_script->write(writer, QStringLiteral("script")); - - if (m_children & Properties) - m_properties->write(writer, QStringLiteral("properties")); - if (m_children & Slots) m_slots->write(writer, QStringLiteral("slots")); if (m_children & Propertyspecifications) m_propertyspecifications->write(writer, QStringLiteral("propertyspecifications")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -1809,57 +1363,12 @@ void DomCustomWidget::setElementContainer(int a) m_container = a; } -DomSizePolicyData *DomCustomWidget::takeElementSizePolicy() -{ - DomSizePolicyData *a = m_sizePolicy; - m_sizePolicy = 0; - m_children ^= SizePolicy; - return a; -} - -void DomCustomWidget::setElementSizePolicy(DomSizePolicyData *a) -{ - delete m_sizePolicy; - m_children |= SizePolicy; - m_sizePolicy = a; -} - void DomCustomWidget::setElementPixmap(const QString &a) { m_children |= Pixmap; m_pixmap = a; } -DomScript *DomCustomWidget::takeElementScript() -{ - DomScript *a = m_script; - m_script = 0; - m_children ^= Script; - return a; -} - -void DomCustomWidget::setElementScript(DomScript *a) -{ - delete m_script; - m_children |= Script; - m_script = a; -} - -DomProperties *DomCustomWidget::takeElementProperties() -{ - DomProperties *a = m_properties; - m_properties = 0; - m_children ^= Properties; - return a; -} - -void DomCustomWidget::setElementProperties(DomProperties *a) -{ - delete m_properties; - m_children |= Properties; - m_properties = a; -} - DomSlots *DomCustomWidget::takeElementSlots() { DomSlots *a = m_slots; @@ -1924,32 +1433,11 @@ void DomCustomWidget::clearElementContainer() m_children &= ~Container; } -void DomCustomWidget::clearElementSizePolicy() -{ - delete m_sizePolicy; - m_sizePolicy = 0; - m_children &= ~SizePolicy; -} - void DomCustomWidget::clearElementPixmap() { m_children &= ~Pixmap; } -void DomCustomWidget::clearElementScript() -{ - delete m_script; - m_script = 0; - m_children &= ~Script; -} - -void DomCustomWidget::clearElementProperties() -{ - delete m_properties; - m_properties = 0; - m_children &= ~Properties; -} - void DomCustomWidget::clearElementSlots() { delete m_slots; @@ -1964,202 +1452,6 @@ void DomCustomWidget::clearElementPropertyspecifications() m_children &= ~Propertyspecifications; } -DomProperties::DomProperties() -{ - m_children = 0; -} - -DomProperties::~DomProperties() -{ - qDeleteAll(m_property); - m_property.clear(); -} - -void DomProperties::read(QXmlStreamReader &reader) -{ - while (!reader.hasError()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); - if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) { - DomPropertyData *v = new DomPropertyData(); - v->read(reader); - m_property.append(v); - continue; - } - reader.raiseError(QLatin1String("Unexpected element ") + tag); - } - break; - case QXmlStreamReader::EndElement : - return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; - default : - break; - } - } -} - -void DomProperties::write(QXmlStreamWriter &writer, const QString &tagName) const -{ - writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("properties") : tagName.toLower()); - - for (DomPropertyData *v : m_property) - v->write(writer, QStringLiteral("property")); - - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - - writer.writeEndElement(); -} - -void DomProperties::setElementProperty(const QVector<DomPropertyData *> &a) -{ - m_children |= Property; - m_property = a; -} - -DomPropertyData::DomPropertyData() -{ - m_has_attr_type = false; -} - -DomPropertyData::~DomPropertyData() -{ -} - -void DomPropertyData::read(QXmlStreamReader &reader) -{ - const QXmlStreamAttributes &attributes = reader.attributes(); - for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); - if (name == QLatin1String("type")) { - setAttributeType(attribute.value().toString()); - continue; - } - reader.raiseError(QLatin1String("Unexpected attribute ") + name); - } - - while (!reader.hasError()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); - } - break; - case QXmlStreamReader::EndElement : - return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; - default : - break; - } - } -} - -void DomPropertyData::write(QXmlStreamWriter &writer, const QString &tagName) const -{ - writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("propertydata") : tagName.toLower()); - - if (hasAttributeType()) - writer.writeAttribute(QStringLiteral("type"), attributeType()); - - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - - writer.writeEndElement(); -} - -DomSizePolicyData::DomSizePolicyData() -{ - m_children = 0; - m_horData = 0; - m_verData = 0; -} - -DomSizePolicyData::~DomSizePolicyData() -{ -} - -void DomSizePolicyData::read(QXmlStreamReader &reader) -{ - while (!reader.hasError()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); - if (!tag.compare(QLatin1String("hordata"), Qt::CaseInsensitive)) { - setElementHorData(reader.readElementText().toInt()); - continue; - } - if (!tag.compare(QLatin1String("verdata"), Qt::CaseInsensitive)) { - setElementVerData(reader.readElementText().toInt()); - continue; - } - reader.raiseError(QLatin1String("Unexpected element ") + tag); - } - break; - case QXmlStreamReader::EndElement : - return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; - default : - break; - } - } -} - -void DomSizePolicyData::write(QXmlStreamWriter &writer, const QString &tagName) const -{ - writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("sizepolicydata") : tagName.toLower()); - - if (m_children & HorData) - writer.writeTextElement(QStringLiteral("hordata"), QString::number(m_horData)); - - if (m_children & VerData) - writer.writeTextElement(QStringLiteral("verdata"), QString::number(m_verData)); - - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - - writer.writeEndElement(); -} - -void DomSizePolicyData::setElementHorData(int a) -{ - m_children |= HorData; - m_horData = a; -} - -void DomSizePolicyData::setElementVerData(int a) -{ - m_children |= VerData; - m_verData = a; -} - -void DomSizePolicyData::clearElementHorData() -{ - m_children &= ~HorData; -} - -void DomSizePolicyData::clearElementVerData() -{ - m_children &= ~VerData; -} - -DomLayoutDefault::DomLayoutDefault() -{ - m_has_attr_spacing = false; - m_attr_spacing = 0; - m_has_attr_margin = false; - m_attr_margin = 0; -} - DomLayoutDefault::~DomLayoutDefault() { } @@ -2189,10 +1481,6 @@ void DomLayoutDefault::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -2209,18 +1497,9 @@ void DomLayoutDefault::write(QXmlStreamWriter &writer, const QString &tagName) c if (hasAttributeMargin()) writer.writeAttribute(QStringLiteral("margin"), QString::number(attributeMargin())); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } -DomLayoutFunction::DomLayoutFunction() -{ - m_has_attr_spacing = false; - m_has_attr_margin = false; -} - DomLayoutFunction::~DomLayoutFunction() { } @@ -2250,10 +1529,6 @@ void DomLayoutFunction::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -2270,17 +1545,9 @@ void DomLayoutFunction::write(QXmlStreamWriter &writer, const QString &tagName) if (hasAttributeMargin()) writer.writeAttribute(QStringLiteral("margin"), attributeMargin()); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } -DomTabStops::DomTabStops() -{ - m_children = 0; -} - DomTabStops::~DomTabStops() { m_tabStop.clear(); @@ -2301,10 +1568,6 @@ void DomTabStops::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -2318,9 +1581,6 @@ void DomTabStops::write(QXmlStreamWriter &writer, const QString &tagName) const for (const QString &v : m_tabStop) writer.writeTextElement(QStringLiteral("tabstop"), v); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -2330,18 +1590,6 @@ void DomTabStops::setElementTabStop(const QStringList &a) m_tabStop = a; } -DomLayout::DomLayout() -{ - m_children = 0; - m_has_attr_class = false; - m_has_attr_name = false; - m_has_attr_stretch = false; - m_has_attr_rowStretch = false; - m_has_attr_columnStretch = false; - m_has_attr_rowMinimumHeight = false; - m_has_attr_columnMinimumWidth = false; -} - DomLayout::~DomLayout() { qDeleteAll(m_property); @@ -2415,10 +1663,6 @@ void DomLayout::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -2459,9 +1703,6 @@ void DomLayout::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomLayoutItem *v : m_item) v->write(writer, QStringLiteral("item")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -2483,42 +1724,24 @@ void DomLayout::setElementItem(const QVector<DomLayoutItem *> &a) m_item = a; } -void DomLayoutItem::clear() +DomLayoutItem::~DomLayoutItem() { delete m_widget; delete m_layout; delete m_spacer; - - m_kind = Unknown; - - m_widget = 0; - m_layout = 0; - m_spacer = 0; -} - -DomLayoutItem::DomLayoutItem() -{ - m_kind = Unknown; - - m_has_attr_row = false; - m_attr_row = 0; - m_has_attr_column = false; - m_attr_column = 0; - m_has_attr_rowSpan = false; - m_attr_rowSpan = 0; - m_has_attr_colSpan = false; - m_attr_colSpan = 0; - m_has_attr_alignment = false; - m_widget = 0; - m_layout = 0; - m_spacer = 0; } -DomLayoutItem::~DomLayoutItem() +void DomLayoutItem::clear() { delete m_widget; delete m_layout; delete m_spacer; + + m_kind = Unknown; + + m_widget = nullptr; + m_layout = nullptr; + m_spacer = nullptr; } void DomLayoutItem::read(QXmlStreamReader &reader) @@ -2576,10 +1799,6 @@ void DomLayoutItem::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -2627,9 +1846,6 @@ void DomLayoutItem::write(QXmlStreamWriter &writer, const QString &tagName) cons default: break; } - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -2675,11 +1891,6 @@ void DomLayoutItem::setElementSpacer(DomSpacer *a) m_spacer = a; } -DomRow::DomRow() -{ - m_children = 0; -} - DomRow::~DomRow() { qDeleteAll(m_property); @@ -2703,10 +1914,6 @@ void DomRow::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -2720,9 +1927,6 @@ void DomRow::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomProperty *v : m_property) v->write(writer, QStringLiteral("property")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -2732,11 +1936,6 @@ void DomRow::setElementProperty(const QList<DomProperty *> &a) m_property = a; } -DomColumn::DomColumn() -{ - m_children = 0; -} - DomColumn::~DomColumn() { qDeleteAll(m_property); @@ -2760,10 +1959,6 @@ void DomColumn::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -2777,9 +1972,6 @@ void DomColumn::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomProperty *v : m_property) v->write(writer, QStringLiteral("property")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -2789,15 +1981,6 @@ void DomColumn::setElementProperty(const QList<DomProperty *> &a) m_property = a; } -DomItem::DomItem() -{ - m_children = 0; - m_has_attr_row = false; - m_attr_row = 0; - m_has_attr_column = false; - m_attr_column = 0; -} - DomItem::~DomItem() { qDeleteAll(m_property); @@ -2843,10 +2026,6 @@ void DomItem::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -2869,9 +2048,6 @@ void DomItem::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomItem *v : m_item) v->write(writer, QStringLiteral("item")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -2887,24 +2063,11 @@ void DomItem::setElementItem(const QVector<DomItem *> &a) m_item = a; } -DomWidget::DomWidget() -{ - m_children = 0; - m_has_attr_class = false; - m_has_attr_name = false; - m_has_attr_native = false; - m_attr_native = false; -} - DomWidget::~DomWidget() { m_class.clear(); qDeleteAll(m_property); m_property.clear(); - qDeleteAll(m_script); - m_script.clear(); - qDeleteAll(m_widgetData); - m_widgetData.clear(); qDeleteAll(m_attribute); m_attribute.clear(); qDeleteAll(m_row); @@ -2960,18 +2123,6 @@ void DomWidget::read(QXmlStreamReader &reader) m_property.append(v); continue; } - if (!tag.compare(QLatin1String("script"), Qt::CaseInsensitive)) { - DomScript *v = new DomScript(); - v->read(reader); - m_script.append(v); - continue; - } - if (!tag.compare(QLatin1String("widgetdata"), Qt::CaseInsensitive)) { - DomWidgetData *v = new DomWidgetData(); - v->read(reader); - m_widgetData.append(v); - continue; - } if (!tag.compare(QLatin1String("attribute"), Qt::CaseInsensitive)) { DomProperty *v = new DomProperty(); v->read(reader); @@ -3035,10 +2186,6 @@ void DomWidget::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -3064,12 +2211,6 @@ void DomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomProperty *v : m_property) v->write(writer, QStringLiteral("property")); - for (DomScript *v : m_script) - v->write(writer, QStringLiteral("script")); - - for (DomWidgetData *v : m_widgetData) - v->write(writer, QStringLiteral("widgetdata")); - for (DomProperty *v : m_attribute) v->write(writer, QStringLiteral("attribute")); @@ -3100,9 +2241,6 @@ void DomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const for (const QString &v : m_zOrder) writer.writeTextElement(QStringLiteral("zorder"), v); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -3118,18 +2256,6 @@ void DomWidget::setElementProperty(const QList<DomProperty *> &a) m_property = a; } -void DomWidget::setElementScript(const QVector<DomScript *> &a) -{ - m_children |= Script; - m_script = a; -} - -void DomWidget::setElementWidgetData(const QVector<DomWidgetData *> &a) -{ - m_children |= WidgetData; - m_widgetData = a; -} - void DomWidget::setElementAttribute(const QList<DomProperty *> &a) { m_children |= Attribute; @@ -3190,12 +2316,6 @@ void DomWidget::setElementZOrder(const QStringList &a) m_zOrder = a; } -DomSpacer::DomSpacer() -{ - m_children = 0; - m_has_attr_name = false; -} - DomSpacer::~DomSpacer() { qDeleteAll(m_property); @@ -3229,10 +2349,6 @@ void DomSpacer::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -3249,9 +2365,6 @@ void DomSpacer::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomProperty *v : m_property) v->write(writer, QStringLiteral("property")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -3261,16 +2374,6 @@ void DomSpacer::setElementProperty(const QList<DomProperty *> &a) m_property = a; } -DomColor::DomColor() -{ - m_children = 0; - m_has_attr_alpha = false; - m_attr_alpha = 0; - m_red = 0; - m_green = 0; - m_blue = 0; -} - DomColor::~DomColor() { } @@ -3308,10 +2411,6 @@ void DomColor::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -3334,9 +2433,6 @@ void DomColor::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Blue) writer.writeTextElement(QStringLiteral("blue"), QString::number(m_blue)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -3373,14 +2469,6 @@ void DomColor::clearElementBlue() m_children &= ~Blue; } -DomGradientStop::DomGradientStop() -{ - m_children = 0; - m_has_attr_position = false; - m_attr_position = 0.0; - m_color = 0; -} - DomGradientStop::~DomGradientStop() { delete m_color; @@ -3413,10 +2501,6 @@ void DomGradientStop::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -3433,9 +2517,6 @@ void DomGradientStop::write(QXmlStreamWriter &writer, const QString &tagName) co if (m_children & Color) m_color->write(writer, QStringLiteral("color")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -3461,34 +2542,6 @@ void DomGradientStop::clearElementColor() m_children &= ~Color; } -DomGradient::DomGradient() -{ - m_children = 0; - m_has_attr_startX = false; - m_attr_startX = 0.0; - m_has_attr_startY = false; - m_attr_startY = 0.0; - m_has_attr_endX = false; - m_attr_endX = 0.0; - m_has_attr_endY = false; - m_attr_endY = 0.0; - m_has_attr_centralX = false; - m_attr_centralX = 0.0; - m_has_attr_centralY = false; - m_attr_centralY = 0.0; - m_has_attr_focalX = false; - m_attr_focalX = 0.0; - m_has_attr_focalY = false; - m_attr_focalY = 0.0; - m_has_attr_radius = false; - m_attr_radius = 0.0; - m_has_attr_angle = false; - m_attr_angle = 0.0; - m_has_attr_type = false; - m_has_attr_spread = false; - m_has_attr_coordinateMode = false; -} - DomGradient::~DomGradient() { qDeleteAll(m_gradientStop); @@ -3570,10 +2623,6 @@ void DomGradient::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -3626,9 +2675,6 @@ void DomGradient::write(QXmlStreamWriter &writer, const QString &tagName) const for (DomGradientStop *v : m_gradientStop) v->write(writer, QStringLiteral("gradientstop")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -3638,34 +2684,24 @@ void DomGradient::setElementGradientStop(const QVector<DomGradientStop *> &a) m_gradientStop = a; } -void DomBrush::clear() +DomBrush::~DomBrush() { delete m_color; delete m_texture; delete m_gradient; - - m_kind = Unknown; - - m_color = 0; - m_texture = 0; - m_gradient = 0; } -DomBrush::DomBrush() -{ - m_kind = Unknown; - - m_has_attr_brushStyle = false; - m_color = 0; - m_texture = 0; - m_gradient = 0; -} - -DomBrush::~DomBrush() +void DomBrush::clear() { delete m_color; delete m_texture; delete m_gradient; + + m_kind = Unknown; + + m_color = nullptr; + m_texture = nullptr; + m_gradient = nullptr; } void DomBrush::read(QXmlStreamReader &reader) @@ -3707,10 +2743,6 @@ void DomBrush::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -3746,9 +2778,6 @@ void DomBrush::write(QXmlStreamWriter &writer, const QString &tagName) const default: break; } - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -3794,13 +2823,6 @@ void DomBrush::setElementGradient(DomGradient *a) m_gradient = a; } -DomColorRole::DomColorRole() -{ - m_children = 0; - m_has_attr_role = false; - m_brush = 0; -} - DomColorRole::~DomColorRole() { delete m_brush; @@ -3833,10 +2855,6 @@ void DomColorRole::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -3853,9 +2871,6 @@ void DomColorRole::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Brush) m_brush->write(writer, QStringLiteral("brush")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -3881,11 +2896,6 @@ void DomColorRole::clearElementBrush() m_children &= ~Brush; } -DomColorGroup::DomColorGroup() -{ - m_children = 0; -} - DomColorGroup::~DomColorGroup() { qDeleteAll(m_colorRole); @@ -3917,10 +2927,6 @@ void DomColorGroup::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -3937,9 +2943,6 @@ void DomColorGroup::write(QXmlStreamWriter &writer, const QString &tagName) cons for (DomColor *v : m_color) v->write(writer, QStringLiteral("color")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -3955,14 +2958,6 @@ void DomColorGroup::setElementColor(const QVector<DomColor *> &a) m_color = a; } -DomPalette::DomPalette() -{ - m_children = 0; - m_active = 0; - m_inactive = 0; - m_disabled = 0; -} - DomPalette::~DomPalette() { delete m_active; @@ -3999,10 +2994,6 @@ void DomPalette::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4022,9 +3013,6 @@ void DomPalette::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Disabled) m_disabled->write(writer, QStringLiteral("disabled")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -4094,19 +3082,6 @@ void DomPalette::clearElementDisabled() m_children &= ~Disabled; } -DomFont::DomFont() -{ - m_children = 0; - m_pointSize = 0; - m_weight = 0; - m_italic = false; - m_bold = false; - m_underline = false; - m_strikeOut = false; - m_antialiasing = false; - m_kerning = false; -} - DomFont::~DomFont() { } @@ -4162,10 +3137,6 @@ void DomFont::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4206,9 +3177,6 @@ void DomFont::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Kerning) writer.writeTextElement(QStringLiteral("kerning"), (m_kerning ? QLatin1String("true") : QLatin1String("false"))); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -4322,13 +3290,6 @@ void DomFont::clearElementKerning() m_children &= ~Kerning; } -DomPoint::DomPoint() -{ - m_children = 0; - m_x = 0; - m_y = 0; -} - DomPoint::~DomPoint() { } @@ -4352,10 +3313,6 @@ void DomPoint::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4372,9 +3329,6 @@ void DomPoint::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Y) writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -4400,15 +3354,6 @@ void DomPoint::clearElementY() m_children &= ~Y; } -DomRect::DomRect() -{ - m_children = 0; - m_x = 0; - m_y = 0; - m_width = 0; - m_height = 0; -} - DomRect::~DomRect() { } @@ -4440,10 +3385,6 @@ void DomRect::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4466,9 +3407,6 @@ void DomRect::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Height) writer.writeTextElement(QStringLiteral("height"), QString::number(m_height)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -4516,12 +3454,6 @@ void DomRect::clearElementHeight() m_children &= ~Height; } -DomLocale::DomLocale() -{ - m_has_attr_language = false; - m_has_attr_country = false; -} - DomLocale::~DomLocale() { } @@ -4551,10 +3483,6 @@ void DomLocale::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4571,23 +3499,9 @@ void DomLocale::write(QXmlStreamWriter &writer, const QString &tagName) const if (hasAttributeCountry()) writer.writeAttribute(QStringLiteral("country"), attributeCountry()); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } -DomSizePolicy::DomSizePolicy() -{ - m_children = 0; - m_has_attr_hSizeType = false; - m_has_attr_vSizeType = false; - m_hSizeType = 0; - m_vSizeType = 0; - m_horStretch = 0; - m_verStretch = 0; -} - DomSizePolicy::~DomSizePolicy() { } @@ -4633,10 +3547,6 @@ void DomSizePolicy::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4665,9 +3575,6 @@ void DomSizePolicy::write(QXmlStreamWriter &writer, const QString &tagName) cons if (m_children & VerStretch) writer.writeTextElement(QStringLiteral("verstretch"), QString::number(m_verStretch)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -4715,13 +3622,6 @@ void DomSizePolicy::clearElementVerStretch() m_children &= ~VerStretch; } -DomSize::DomSize() -{ - m_children = 0; - m_width = 0; - m_height = 0; -} - DomSize::~DomSize() { } @@ -4745,10 +3645,6 @@ void DomSize::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4765,9 +3661,6 @@ void DomSize::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Height) writer.writeTextElement(QStringLiteral("height"), QString::number(m_height)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -4793,14 +3686,6 @@ void DomSize::clearElementHeight() m_children &= ~Height; } -DomDate::DomDate() -{ - m_children = 0; - m_year = 0; - m_month = 0; - m_day = 0; -} - DomDate::~DomDate() { } @@ -4828,10 +3713,6 @@ void DomDate::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4851,9 +3732,6 @@ void DomDate::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Day) writer.writeTextElement(QStringLiteral("day"), QString::number(m_day)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -4890,14 +3768,6 @@ void DomDate::clearElementDay() m_children &= ~Day; } -DomTime::DomTime() -{ - m_children = 0; - m_hour = 0; - m_minute = 0; - m_second = 0; -} - DomTime::~DomTime() { } @@ -4925,10 +3795,6 @@ void DomTime::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -4948,9 +3814,6 @@ void DomTime::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Second) writer.writeTextElement(QStringLiteral("second"), QString::number(m_second)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -4987,17 +3850,6 @@ void DomTime::clearElementSecond() m_children &= ~Second; } -DomDateTime::DomDateTime() -{ - m_children = 0; - m_hour = 0; - m_minute = 0; - m_second = 0; - m_year = 0; - m_month = 0; - m_day = 0; -} - DomDateTime::~DomDateTime() { } @@ -5037,10 +3889,6 @@ void DomDateTime::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -5069,9 +3917,6 @@ void DomDateTime::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Day) writer.writeTextElement(QStringLiteral("day"), QString::number(m_day)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -5141,14 +3986,6 @@ void DomDateTime::clearElementDay() m_children &= ~Day; } -DomStringList::DomStringList() -{ - m_children = 0; - m_has_attr_notr = false; - m_has_attr_comment = false; - m_has_attr_extraComment = false; -} - DomStringList::~DomStringList() { m_string.clear(); @@ -5187,10 +4024,6 @@ void DomStringList::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -5213,9 +4046,6 @@ void DomStringList::write(QXmlStreamWriter &writer, const QString &tagName) cons for (const QString &v : m_string) writer.writeTextElement(QStringLiteral("string"), v); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -5225,13 +4055,6 @@ void DomStringList::setElementString(const QStringList &a) m_string = a; } -DomResourcePixmap::DomResourcePixmap() -{ - m_has_attr_resource = false; - m_has_attr_alias = false; - m_text.clear(); -} - DomResourcePixmap::~DomResourcePixmap() { } @@ -5287,22 +4110,6 @@ void DomResourcePixmap::write(QXmlStreamWriter &writer, const QString &tagName) writer.writeEndElement(); } -DomResourceIcon::DomResourceIcon() -{ - m_children = 0; - m_has_attr_theme = false; - m_has_attr_resource = false; - m_text.clear(); - m_normalOff = 0; - m_normalOn = 0; - m_disabledOff = 0; - m_disabledOn = 0; - m_activeOff = 0; - m_activeOn = 0; - m_selectedOff = 0; - m_selectedOn = 0; -} - DomResourceIcon::~DomResourceIcon() { delete m_normalOff; @@ -5614,14 +4421,6 @@ void DomResourceIcon::clearElementSelectedOn() m_children &= ~SelectedOn; } -DomString::DomString() -{ - m_has_attr_notr = false; - m_has_attr_comment = false; - m_has_attr_extraComment = false; - m_text.clear(); -} - DomString::~DomString() { } @@ -5684,13 +4483,6 @@ void DomString::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -DomPointF::DomPointF() -{ - m_children = 0; - m_x = 0; - m_y = 0; -} - DomPointF::~DomPointF() { } @@ -5714,10 +4506,6 @@ void DomPointF::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -5734,9 +4522,6 @@ void DomPointF::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Y) writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y, 'f', 15)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -5762,15 +4547,6 @@ void DomPointF::clearElementY() m_children &= ~Y; } -DomRectF::DomRectF() -{ - m_children = 0; - m_x = 0; - m_y = 0; - m_width = 0; - m_height = 0; -} - DomRectF::~DomRectF() { } @@ -5802,10 +4578,6 @@ void DomRectF::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -5828,9 +4600,6 @@ void DomRectF::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Height) writer.writeTextElement(QStringLiteral("height"), QString::number(m_height, 'f', 15)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -5878,13 +4647,6 @@ void DomRectF::clearElementHeight() m_children &= ~Height; } -DomSizeF::DomSizeF() -{ - m_children = 0; - m_width = 0; - m_height = 0; -} - DomSizeF::~DomSizeF() { } @@ -5908,10 +4670,6 @@ void DomSizeF::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -5928,9 +4686,6 @@ void DomSizeF::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Height) writer.writeTextElement(QStringLiteral("height"), QString::number(m_height, 'f', 15)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -5956,12 +4711,6 @@ void DomSizeF::clearElementHeight() m_children &= ~Height; } -DomChar::DomChar() -{ - m_children = 0; - m_unicode = 0; -} - DomChar::~DomChar() { } @@ -5981,10 +4730,6 @@ void DomChar::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -5998,9 +4743,6 @@ void DomChar::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & Unicode) writer.writeTextElement(QStringLiteral("unicode"), QString::number(m_unicode)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -6015,12 +4757,6 @@ void DomChar::clearElementUnicode() m_children &= ~Unicode; } -DomUrl::DomUrl() -{ - m_children = 0; - m_string = 0; -} - DomUrl::~DomUrl() { delete m_string; @@ -6043,10 +4779,6 @@ void DomUrl::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -6060,9 +4792,6 @@ void DomUrl::write(QXmlStreamWriter &writer, const QString &tagName) const if (m_children & String) m_string->write(writer, QStringLiteral("string")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -6088,7 +4817,7 @@ void DomUrl::clearElementString() m_children &= ~String; } -void DomProperty::clear() +DomProperty::~DomProperty() { delete m_color; delete m_font; @@ -6111,77 +4840,9 @@ void DomProperty::clear() delete m_char; delete m_url; delete m_brush; - - m_kind = Unknown; - - m_color = 0; - m_cursor = 0; - m_font = 0; - m_iconSet = 0; - m_pixmap = 0; - m_palette = 0; - m_point = 0; - m_rect = 0; - m_locale = 0; - m_sizePolicy = 0; - m_size = 0; - m_string = 0; - m_stringList = 0; - m_number = 0; - m_float = 0.0; - m_double = 0; - m_date = 0; - m_time = 0; - m_dateTime = 0; - m_pointF = 0; - m_rectF = 0; - m_sizeF = 0; - m_longLong = 0; - m_char = 0; - m_url = 0; - m_UInt = 0; - m_uLongLong = 0; - m_brush = 0; -} - -DomProperty::DomProperty() -{ - m_kind = Unknown; - - m_has_attr_name = false; - m_has_attr_stdset = false; - m_attr_stdset = 0; - m_color = 0; - m_cursor = 0; - m_font = 0; - m_iconSet = 0; - m_pixmap = 0; - m_palette = 0; - m_point = 0; - m_rect = 0; - m_locale = 0; - m_sizePolicy = 0; - m_size = 0; - m_string = 0; - m_stringList = 0; - m_number = 0; - m_float = 0.0; - m_double = 0; - m_date = 0; - m_time = 0; - m_dateTime = 0; - m_pointF = 0; - m_rectF = 0; - m_sizeF = 0; - m_longLong = 0; - m_char = 0; - m_url = 0; - m_UInt = 0; - m_uLongLong = 0; - m_brush = 0; } -DomProperty::~DomProperty() +void DomProperty::clear() { delete m_color; delete m_font; @@ -6204,6 +4865,37 @@ DomProperty::~DomProperty() delete m_char; delete m_url; delete m_brush; + + m_kind = Unknown; + + m_color = nullptr; + m_cursor = 0; + m_font = nullptr; + m_iconSet = nullptr; + m_pixmap = nullptr; + m_palette = nullptr; + m_point = nullptr; + m_rect = nullptr; + m_locale = nullptr; + m_sizePolicy = nullptr; + m_size = nullptr; + m_string = nullptr; + m_stringList = nullptr; + m_number = 0; + m_float = 0.0; + m_double = 0.0; + m_date = nullptr; + m_time = nullptr; + m_dateTime = nullptr; + m_pointF = nullptr; + m_rectF = nullptr; + m_sizeF = nullptr; + m_longLong = 0; + m_char = nullptr; + m_url = nullptr; + m_UInt = 0; + m_uLongLong = 0; + m_brush = nullptr; } void DomProperty::read(QXmlStreamReader &reader) @@ -6405,10 +5097,6 @@ void DomProperty::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -6603,9 +5291,6 @@ void DomProperty::write(QXmlStreamWriter &writer, const QString &tagName) const default: break; } - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -6987,11 +5672,6 @@ void DomProperty::setElementBrush(DomBrush *a) m_brush = a; } -DomConnections::DomConnections() -{ - m_children = 0; -} - DomConnections::~DomConnections() { qDeleteAll(m_connection); @@ -7015,10 +5695,6 @@ void DomConnections::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7032,9 +5708,6 @@ void DomConnections::write(QXmlStreamWriter &writer, const QString &tagName) con for (DomConnection *v : m_connection) v->write(writer, QStringLiteral("connection")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -7044,12 +5717,6 @@ void DomConnections::setElementConnection(const QVector<DomConnection *> &a) m_connection = a; } -DomConnection::DomConnection() -{ - m_children = 0; - m_hints = 0; -} - DomConnection::~DomConnection() { delete m_hints; @@ -7088,10 +5755,6 @@ void DomConnection::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7117,9 +5780,6 @@ void DomConnection::write(QXmlStreamWriter &writer, const QString &tagName) cons if (m_children & Hints) m_hints->write(writer, QStringLiteral("hints")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -7189,11 +5849,6 @@ void DomConnection::clearElementHints() m_children &= ~Hints; } -DomConnectionHints::DomConnectionHints() -{ - m_children = 0; -} - DomConnectionHints::~DomConnectionHints() { qDeleteAll(m_hint); @@ -7217,10 +5872,6 @@ void DomConnectionHints::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7234,9 +5885,6 @@ void DomConnectionHints::write(QXmlStreamWriter &writer, const QString &tagName) for (DomConnectionHint *v : m_hint) v->write(writer, QStringLiteral("hint")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -7246,14 +5894,6 @@ void DomConnectionHints::setElementHint(const QVector<DomConnectionHint *> &a) m_hint = a; } -DomConnectionHint::DomConnectionHint() -{ - m_children = 0; - m_has_attr_type = false; - m_x = 0; - m_y = 0; -} - DomConnectionHint::~DomConnectionHint() { } @@ -7287,10 +5927,6 @@ void DomConnectionHint::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7310,9 +5946,6 @@ void DomConnectionHint::write(QXmlStreamWriter &writer, const QString &tagName) if (m_children & Y) writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y)); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -7338,129 +5971,6 @@ void DomConnectionHint::clearElementY() m_children &= ~Y; } -DomScript::DomScript() -{ - m_has_attr_source = false; - m_has_attr_language = false; -} - -DomScript::~DomScript() -{ -} - -void DomScript::read(QXmlStreamReader &reader) -{ - const QXmlStreamAttributes &attributes = reader.attributes(); - for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); - if (name == QLatin1String("source")) { - setAttributeSource(attribute.value().toString()); - continue; - } - if (name == QLatin1String("language")) { - setAttributeLanguage(attribute.value().toString()); - continue; - } - reader.raiseError(QLatin1String("Unexpected attribute ") + name); - } - - while (!reader.hasError()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); - reader.raiseError(QLatin1String("Unexpected element ") + tag); - } - break; - case QXmlStreamReader::EndElement : - return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; - default : - break; - } - } -} - -void DomScript::write(QXmlStreamWriter &writer, const QString &tagName) const -{ - writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("script") : tagName.toLower()); - - if (hasAttributeSource()) - writer.writeAttribute(QStringLiteral("source"), attributeSource()); - - if (hasAttributeLanguage()) - writer.writeAttribute(QStringLiteral("language"), attributeLanguage()); - - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - - writer.writeEndElement(); -} - -DomWidgetData::DomWidgetData() -{ - m_children = 0; -} - -DomWidgetData::~DomWidgetData() -{ - qDeleteAll(m_property); - m_property.clear(); -} - -void DomWidgetData::read(QXmlStreamReader &reader) -{ - while (!reader.hasError()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); - if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) { - DomProperty *v = new DomProperty(); - v->read(reader); - m_property.append(v); - continue; - } - reader.raiseError(QLatin1String("Unexpected element ") + tag); - } - break; - case QXmlStreamReader::EndElement : - return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; - default : - break; - } - } -} - -void DomWidgetData::write(QXmlStreamWriter &writer, const QString &tagName) const -{ - writer.writeStartElement(tagName.isEmpty() ? QStringLiteral("widgetdata") : tagName.toLower()); - - for (DomProperty *v : m_property) - v->write(writer, QStringLiteral("property")); - - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - - writer.writeEndElement(); -} - -void DomWidgetData::setElementProperty(const QList<DomProperty *> &a) -{ - m_children |= Property; - m_property = a; -} - -DomDesignerData::DomDesignerData() -{ - m_children = 0; -} - DomDesignerData::~DomDesignerData() { qDeleteAll(m_property); @@ -7484,10 +5994,6 @@ void DomDesignerData::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7501,9 +6007,6 @@ void DomDesignerData::write(QXmlStreamWriter &writer, const QString &tagName) co for (DomProperty *v : m_property) v->write(writer, QStringLiteral("property")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -7513,11 +6016,6 @@ void DomDesignerData::setElementProperty(const QList<DomProperty *> &a) m_property = a; } -DomSlots::DomSlots() -{ - m_children = 0; -} - DomSlots::~DomSlots() { m_signal.clear(); @@ -7543,10 +6041,6 @@ void DomSlots::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7563,9 +6057,6 @@ void DomSlots::write(QXmlStreamWriter &writer, const QString &tagName) const for (const QString &v : m_slot) writer.writeTextElement(QStringLiteral("slot"), v); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -7581,11 +6072,6 @@ void DomSlots::setElementSlot(const QStringList &a) m_slot = a; } -DomPropertySpecifications::DomPropertySpecifications() -{ - m_children = 0; -} - DomPropertySpecifications::~DomPropertySpecifications() { qDeleteAll(m_tooltip); @@ -7617,10 +6103,6 @@ void DomPropertySpecifications::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7637,9 +6119,6 @@ void DomPropertySpecifications::write(QXmlStreamWriter &writer, const QString &t for (DomStringPropertySpecification *v : m_stringpropertyspecification) v->write(writer, QStringLiteral("stringpropertyspecification")); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } @@ -7655,11 +6134,6 @@ void DomPropertySpecifications::setElementStringpropertyspecification(const QVec m_stringpropertyspecification = a; } -DomPropertyToolTip::DomPropertyToolTip() -{ - m_has_attr_name = false; -} - DomPropertyToolTip::~DomPropertyToolTip() { } @@ -7685,10 +6159,6 @@ void DomPropertyToolTip::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7702,19 +6172,9 @@ void DomPropertyToolTip::write(QXmlStreamWriter &writer, const QString &tagName) if (hasAttributeName()) writer.writeAttribute(QStringLiteral("name"), attributeName()); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } -DomStringPropertySpecification::DomStringPropertySpecification() -{ - m_has_attr_name = false; - m_has_attr_type = false; - m_has_attr_notr = false; -} - DomStringPropertySpecification::~DomStringPropertySpecification() { } @@ -7748,10 +6208,6 @@ void DomStringPropertySpecification::read(QXmlStreamReader &reader) break; case QXmlStreamReader::EndElement : return; - case QXmlStreamReader::Characters : - if (!reader.isWhitespace()) - m_text.append(reader.text().toString()); - break; default : break; } @@ -7771,9 +6227,6 @@ void DomStringPropertySpecification::write(QXmlStreamWriter &writer, const QStri if (hasAttributeNotr()) writer.writeAttribute(QStringLiteral("notr"), attributeNotr()); - if (!m_text.isEmpty()) - writer.writeCharacters(m_text); - writer.writeEndElement(); } diff --git a/src/designer/src/lib/uilib/ui4_p.h b/src/designer/src/lib/uilib/ui4_p.h index aa4c898a1..e1fd2fb8e 100644 --- a/src/designer/src/lib/uilib/ui4_p.h +++ b/src/designer/src/lib/uilib/ui4_p.h @@ -97,15 +97,9 @@ class DomAction; class DomActionRef; class DomButtonGroup; class DomButtonGroups; -class DomImages; -class DomImage; -class DomImageData; class DomCustomWidgets; class DomHeader; class DomCustomWidget; -class DomProperties; -class DomPropertyData; -class DomSizePolicyData; class DomLayoutDefault; class DomLayoutFunction; class DomTabStops; @@ -146,8 +140,6 @@ class DomConnections; class DomConnection; class DomConnectionHints; class DomConnectionHint; -class DomScript; -class DomWidgetData; class DomDesignerData; class DomSlots; class DomPropertySpecifications; @@ -161,13 +153,11 @@ class DomStringPropertySpecification; class QDESIGNER_UILIB_EXPORT DomUI { Q_DISABLE_COPY(DomUI) public: - DomUI(); + DomUI() = default; ~DomUI(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeVersion() const { return m_has_attr_version; } @@ -251,12 +241,6 @@ public: inline bool hasElementTabStops() const { return m_children & TabStops; } void clearElementTabStops(); - inline DomImages *elementImages() const { return m_images; } - DomImages *takeElementImages(); - void setElementImages(DomImages *a); - inline bool hasElementImages() const { return m_children & Images; } - void clearElementImages(); - inline DomIncludes *elementIncludes() const { return m_includes; } DomIncludes *takeElementIncludes(); void setElementIncludes(DomIncludes *a); @@ -294,43 +278,41 @@ public: void clearElementButtonGroups(); private: - QString m_text; - // attribute data QString m_attr_version; - bool m_has_attr_version; + bool m_has_attr_version = false; QString m_attr_language; - bool m_has_attr_language; + bool m_has_attr_language = false; QString m_attr_displayname; - bool m_has_attr_displayname; + bool m_has_attr_displayname = false; - int m_attr_stdsetdef; - bool m_has_attr_stdsetdef; + int m_attr_stdsetdef = 0; + bool m_has_attr_stdsetdef = false; - int m_attr_stdSetDef; - bool m_has_attr_stdSetDef; + int m_attr_stdSetDef = 0; + bool m_has_attr_stdSetDef = false; // child element data - uint m_children; + uint m_children = 0; QString m_author; QString m_comment; QString m_exportMacro; QString m_class; - DomWidget *m_widget; - DomLayoutDefault *m_layoutDefault; - DomLayoutFunction *m_layoutFunction; + DomWidget *m_widget = nullptr; + DomLayoutDefault *m_layoutDefault = nullptr; + DomLayoutFunction *m_layoutFunction = nullptr; QString m_pixmapFunction; - DomCustomWidgets *m_customWidgets; - DomTabStops *m_tabStops; - DomImages *m_images; - DomIncludes *m_includes; - DomResources *m_resources; - DomConnections *m_connections; - DomDesignerData *m_designerdata; - DomSlots *m_slots; - DomButtonGroups *m_buttonGroups; + DomCustomWidgets *m_customWidgets = nullptr; + DomTabStops *m_tabStops = nullptr; + DomIncludes *m_includes = nullptr; + DomResources *m_resources = nullptr; + DomConnections *m_connections = nullptr; + DomDesignerData *m_designerdata = nullptr; + DomSlots *m_slots = nullptr; + DomButtonGroups *m_buttonGroups = nullptr; + enum Child { Author = 1, Comment = 2, @@ -342,37 +324,34 @@ private: PixmapFunction = 128, CustomWidgets = 256, TabStops = 512, - Images = 1024, - Includes = 2048, - Resources = 4096, - Connections = 8192, - Designerdata = 16384, - Slots = 32768, - ButtonGroups = 65536 + Includes = 1024, + Resources = 2048, + Connections = 4096, + Designerdata = 8192, + Slots = 16384, + ButtonGroups = 32768 }; }; class QDESIGNER_UILIB_EXPORT DomIncludes { Q_DISABLE_COPY(DomIncludes) public: - DomIncludes(); + DomIncludes() = default; ~DomIncludes(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QVector<DomInclude *> elementInclude() const { return m_include; } void setElementInclude(const QVector<DomInclude *> &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QVector<DomInclude *> m_include; + enum Child { Include = 1 }; @@ -381,11 +360,12 @@ private: class QDESIGNER_UILIB_EXPORT DomInclude { Q_DISABLE_COPY(DomInclude) public: - DomInclude(); + DomInclude() = default; ~DomInclude(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; + inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -405,23 +385,20 @@ private: // attribute data QString m_attr_location; - bool m_has_attr_location; + bool m_has_attr_location = false; QString m_attr_impldecl; - bool m_has_attr_impldecl; - + bool m_has_attr_impldecl = false; }; class QDESIGNER_UILIB_EXPORT DomResources { Q_DISABLE_COPY(DomResources) public: - DomResources(); + DomResources() = default; ~DomResources(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -434,15 +411,14 @@ public: void setElementInclude(const QVector<DomResource *> &a); private: - QString m_text; - // attribute data QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; // child element data - uint m_children; + uint m_children = 0; QVector<DomResource *> m_include; + enum Child { Include = 1 }; @@ -451,13 +427,11 @@ private: class QDESIGNER_UILIB_EXPORT DomResource { Q_DISABLE_COPY(DomResource) public: - DomResource(); + DomResource() = default; ~DomResource(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeLocation() const { return m_has_attr_location; } @@ -466,24 +440,19 @@ public: inline void clearAttributeLocation() { m_has_attr_location = false; } private: - QString m_text; - // attribute data QString m_attr_location; - bool m_has_attr_location; - + bool m_has_attr_location = false; }; class QDESIGNER_UILIB_EXPORT DomActionGroup { Q_DISABLE_COPY(DomActionGroup) public: - DomActionGroup(); + DomActionGroup() = default; ~DomActionGroup(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -505,18 +474,17 @@ public: void setElementAttribute(const QList<DomProperty *> &a); private: - QString m_text; - // attribute data QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; // child element data - uint m_children; + uint m_children = 0; QVector<DomAction *> m_action; QVector<DomActionGroup *> m_actionGroup; QList<DomProperty*> m_property; QList<DomProperty*> m_attribute; + enum Child { Action = 1, ActionGroup = 2, @@ -528,13 +496,11 @@ private: class QDESIGNER_UILIB_EXPORT DomAction { Q_DISABLE_COPY(DomAction) public: - DomAction(); + DomAction() = default; ~DomAction(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -555,19 +521,18 @@ public: void setElementAttribute(const QList<DomProperty *> &a); private: - QString m_text; - // attribute data QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; QString m_attr_menu; - bool m_has_attr_menu; + bool m_has_attr_menu = false; // child element data - uint m_children; + uint m_children = 0; QList<DomProperty*> m_property; QList<DomProperty*> m_attribute; + enum Child { Property = 1, Attribute = 2 @@ -577,13 +542,11 @@ private: class QDESIGNER_UILIB_EXPORT DomActionRef { Q_DISABLE_COPY(DomActionRef) public: - DomActionRef(); + DomActionRef() = default; ~DomActionRef(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -592,24 +555,19 @@ public: inline void clearAttributeName() { m_has_attr_name = false; } private: - QString m_text; - // attribute data QString m_attr_name; - bool m_has_attr_name; - + bool m_has_attr_name = false; }; class QDESIGNER_UILIB_EXPORT DomButtonGroup { Q_DISABLE_COPY(DomButtonGroup) public: - DomButtonGroup(); + DomButtonGroup() = default; ~DomButtonGroup(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -625,16 +583,15 @@ public: void setElementAttribute(const QList<DomProperty *> &a); private: - QString m_text; - // attribute data QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; // child element data - uint m_children; + uint m_children = 0; QList<DomProperty*> m_property; QList<DomProperty*> m_attribute; + enum Child { Property = 1, Attribute = 2 @@ -644,149 +601,46 @@ private: class QDESIGNER_UILIB_EXPORT DomButtonGroups { Q_DISABLE_COPY(DomButtonGroups) public: - DomButtonGroups(); + DomButtonGroups() = default; ~DomButtonGroups(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QVector<DomButtonGroup *> elementButtonGroup() const { return m_buttonGroup; } void setElementButtonGroup(const QVector<DomButtonGroup *> &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QVector<DomButtonGroup *> m_buttonGroup; - enum Child { - ButtonGroup = 1 - }; -}; - -class QDESIGNER_UILIB_EXPORT DomImages { - Q_DISABLE_COPY(DomImages) -public: - DomImages(); - ~DomImages(); - - void read(QXmlStreamReader &reader); - void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } - - // child element accessors - inline QVector<DomImage *> elementImage() const { return m_image; } - void setElementImage(const QVector<DomImage *> &a); - -private: - QString m_text; - - // child element data - uint m_children; - QVector<DomImage *> m_image; - enum Child { - Image = 1 - }; -}; - -class QDESIGNER_UILIB_EXPORT DomImage { - Q_DISABLE_COPY(DomImage) -public: - DomImage(); - ~DomImage(); - - void read(QXmlStreamReader &reader); - void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } - - // attribute accessors - inline bool hasAttributeName() const { return m_has_attr_name; } - inline QString attributeName() const { return m_attr_name; } - inline void setAttributeName(const QString &a) { m_attr_name = a; m_has_attr_name = true; } - inline void clearAttributeName() { m_has_attr_name = false; } - - // child element accessors - inline DomImageData *elementData() const { return m_data; } - DomImageData *takeElementData(); - void setElementData(DomImageData *a); - inline bool hasElementData() const { return m_children & Data; } - void clearElementData(); -private: - QString m_text; - - // attribute data - QString m_attr_name; - bool m_has_attr_name; - - // child element data - uint m_children; - DomImageData *m_data; enum Child { - Data = 1 + ButtonGroup = 1 }; }; -class QDESIGNER_UILIB_EXPORT DomImageData { - Q_DISABLE_COPY(DomImageData) -public: - DomImageData(); - ~DomImageData(); - - void read(QXmlStreamReader &reader); - void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } - - // attribute accessors - inline bool hasAttributeFormat() const { return m_has_attr_format; } - inline QString attributeFormat() const { return m_attr_format; } - inline void setAttributeFormat(const QString &a) { m_attr_format = a; m_has_attr_format = true; } - inline void clearAttributeFormat() { m_has_attr_format = false; } - - inline bool hasAttributeLength() const { return m_has_attr_length; } - inline int attributeLength() const { return m_attr_length; } - inline void setAttributeLength(int a) { m_attr_length = a; m_has_attr_length = true; } - inline void clearAttributeLength() { m_has_attr_length = false; } - -private: - QString m_text; - - // attribute data - QString m_attr_format; - bool m_has_attr_format; - - int m_attr_length; - bool m_has_attr_length; - -}; - class QDESIGNER_UILIB_EXPORT DomCustomWidgets { Q_DISABLE_COPY(DomCustomWidgets) public: - DomCustomWidgets(); + DomCustomWidgets() = default; ~DomCustomWidgets(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QVector<DomCustomWidget *> elementCustomWidget() const { return m_customWidget; } void setElementCustomWidget(const QVector<DomCustomWidget *> &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QVector<DomCustomWidget *> m_customWidget; + enum Child { CustomWidget = 1 }; @@ -795,11 +649,12 @@ private: class QDESIGNER_UILIB_EXPORT DomHeader { Q_DISABLE_COPY(DomHeader) public: - DomHeader(); + DomHeader() = default; ~DomHeader(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; + inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -814,20 +669,17 @@ private: // attribute data QString m_attr_location; - bool m_has_attr_location; - + bool m_has_attr_location = false; }; class QDESIGNER_UILIB_EXPORT DomCustomWidget { Q_DISABLE_COPY(DomCustomWidget) public: - DomCustomWidget(); + DomCustomWidget() = default; ~DomCustomWidget(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QString elementClass() const { return m_class; } @@ -862,29 +714,11 @@ public: inline bool hasElementContainer() const { return m_children & Container; } void clearElementContainer(); - inline DomSizePolicyData *elementSizePolicy() const { return m_sizePolicy; } - DomSizePolicyData *takeElementSizePolicy(); - void setElementSizePolicy(DomSizePolicyData *a); - inline bool hasElementSizePolicy() const { return m_children & SizePolicy; } - void clearElementSizePolicy(); - inline QString elementPixmap() const { return m_pixmap; } void setElementPixmap(const QString &a); inline bool hasElementPixmap() const { return m_children & Pixmap; } void clearElementPixmap(); - inline DomScript *elementScript() const { return m_script; } - DomScript *takeElementScript(); - void setElementScript(DomScript *a); - inline bool hasElementScript() const { return m_children & Script; } - void clearElementScript(); - - inline DomProperties *elementProperties() const { return m_properties; } - DomProperties *takeElementProperties(); - void setElementProperties(DomProperties *a); - inline bool hasElementProperties() const { return m_children & Properties; } - void clearElementProperties(); - inline DomSlots *elementSlots() const { return m_slots; } DomSlots *takeElementSlots(); void setElementSlots(DomSlots *a); @@ -898,22 +732,19 @@ public: void clearElementPropertyspecifications(); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QString m_class; QString m_extends; - DomHeader *m_header; - DomSize *m_sizeHint; + DomHeader *m_header = nullptr; + DomSize *m_sizeHint = nullptr; QString m_addPageMethod; - int m_container; - DomSizePolicyData *m_sizePolicy; + int m_container = 0; QString m_pixmap; - DomScript *m_script; - DomProperties *m_properties; - DomSlots *m_slots; - DomPropertySpecifications *m_propertyspecifications; + DomSlots *m_slots = nullptr; + DomPropertySpecifications *m_propertyspecifications = nullptr; + enum Child { Class = 1, Extends = 2, @@ -921,112 +752,20 @@ private: SizeHint = 8, AddPageMethod = 16, Container = 32, - SizePolicy = 64, - Pixmap = 128, - Script = 256, - Properties = 512, - Slots = 1024, - Propertyspecifications = 2048 - }; -}; - -class QDESIGNER_UILIB_EXPORT DomProperties { - Q_DISABLE_COPY(DomProperties) -public: - DomProperties(); - ~DomProperties(); - - void read(QXmlStreamReader &reader); - void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } - - // child element accessors - inline QVector<DomPropertyData *> elementProperty() const { return m_property; } - void setElementProperty(const QVector<DomPropertyData *> &a); - -private: - QString m_text; - - // child element data - uint m_children; - QVector<DomPropertyData *> m_property; - enum Child { - Property = 1 - }; -}; - -class QDESIGNER_UILIB_EXPORT DomPropertyData { - Q_DISABLE_COPY(DomPropertyData) -public: - DomPropertyData(); - ~DomPropertyData(); - - void read(QXmlStreamReader &reader); - void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } - - // attribute accessors - inline bool hasAttributeType() const { return m_has_attr_type; } - inline QString attributeType() const { return m_attr_type; } - inline void setAttributeType(const QString &a) { m_attr_type = a; m_has_attr_type = true; } - inline void clearAttributeType() { m_has_attr_type = false; } - -private: - QString m_text; - - // attribute data - QString m_attr_type; - bool m_has_attr_type; - -}; - -class QDESIGNER_UILIB_EXPORT DomSizePolicyData { - Q_DISABLE_COPY(DomSizePolicyData) -public: - DomSizePolicyData(); - ~DomSizePolicyData(); - - void read(QXmlStreamReader &reader); - void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } - - // child element accessors - inline int elementHorData() const { return m_horData; } - void setElementHorData(int a); - inline bool hasElementHorData() const { return m_children & HorData; } - void clearElementHorData(); - - inline int elementVerData() const { return m_verData; } - void setElementVerData(int a); - inline bool hasElementVerData() const { return m_children & VerData; } - void clearElementVerData(); - -private: - QString m_text; - - // child element data - uint m_children; - int m_horData; - int m_verData; - enum Child { - HorData = 1, - VerData = 2 + Pixmap = 64, + Slots = 128, + Propertyspecifications = 256 }; }; class QDESIGNER_UILIB_EXPORT DomLayoutDefault { Q_DISABLE_COPY(DomLayoutDefault) public: - DomLayoutDefault(); + DomLayoutDefault() = default; ~DomLayoutDefault(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeSpacing() const { return m_has_attr_spacing; } @@ -1040,27 +779,22 @@ public: inline void clearAttributeMargin() { m_has_attr_margin = false; } private: - QString m_text; - // attribute data - int m_attr_spacing; - bool m_has_attr_spacing; - - int m_attr_margin; - bool m_has_attr_margin; + int m_attr_spacing = 0; + bool m_has_attr_spacing = false; + int m_attr_margin = 0; + bool m_has_attr_margin = false; }; class QDESIGNER_UILIB_EXPORT DomLayoutFunction { Q_DISABLE_COPY(DomLayoutFunction) public: - DomLayoutFunction(); + DomLayoutFunction() = default; ~DomLayoutFunction(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeSpacing() const { return m_has_attr_spacing; } @@ -1074,38 +808,33 @@ public: inline void clearAttributeMargin() { m_has_attr_margin = false; } private: - QString m_text; - // attribute data QString m_attr_spacing; - bool m_has_attr_spacing; + bool m_has_attr_spacing = false; QString m_attr_margin; - bool m_has_attr_margin; - + bool m_has_attr_margin = false; }; class QDESIGNER_UILIB_EXPORT DomTabStops { Q_DISABLE_COPY(DomTabStops) public: - DomTabStops(); + DomTabStops() = default; ~DomTabStops(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QStringList elementTabStop() const { return m_tabStop; } void setElementTabStop(const QStringList &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QStringList m_tabStop; + enum Child { TabStop = 1 }; @@ -1114,13 +843,11 @@ private: class QDESIGNER_UILIB_EXPORT DomLayout { Q_DISABLE_COPY(DomLayout) public: - DomLayout(); + DomLayout() = default; ~DomLayout(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeClass() const { return m_has_attr_class; } @@ -1169,35 +896,34 @@ public: void setElementItem(const QVector<DomLayoutItem *> &a); private: - QString m_text; - // attribute data QString m_attr_class; - bool m_has_attr_class; + bool m_has_attr_class = false; QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; QString m_attr_stretch; - bool m_has_attr_stretch; + bool m_has_attr_stretch = false; QString m_attr_rowStretch; - bool m_has_attr_rowStretch; + bool m_has_attr_rowStretch = false; QString m_attr_columnStretch; - bool m_has_attr_columnStretch; + bool m_has_attr_columnStretch = false; QString m_attr_rowMinimumHeight; - bool m_has_attr_rowMinimumHeight; + bool m_has_attr_rowMinimumHeight = false; QString m_attr_columnMinimumWidth; - bool m_has_attr_columnMinimumWidth; + bool m_has_attr_columnMinimumWidth = false; // child element data - uint m_children; + uint m_children = 0; QList<DomProperty*> m_property; QList<DomProperty*> m_attribute; QVector<DomLayoutItem *> m_item; + enum Child { Property = 1, Attribute = 2, @@ -1208,13 +934,11 @@ private: class QDESIGNER_UILIB_EXPORT DomLayoutItem { Q_DISABLE_COPY(DomLayoutItem) public: - DomLayoutItem(); + DomLayoutItem() = default; ~DomLayoutItem(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeRow() const { return m_has_attr_row; } @@ -1259,54 +983,50 @@ public: void setElementSpacer(DomSpacer *a); private: - QString m_text; - void clear(); // attribute data - int m_attr_row; - bool m_has_attr_row; + int m_attr_row = 0; + bool m_has_attr_row = false; - int m_attr_column; - bool m_has_attr_column; + int m_attr_column = 0; + bool m_has_attr_column = false; - int m_attr_rowSpan; - bool m_has_attr_rowSpan; + int m_attr_rowSpan = 0; + bool m_has_attr_rowSpan = false; - int m_attr_colSpan; - bool m_has_attr_colSpan; + int m_attr_colSpan = 0; + bool m_has_attr_colSpan = false; QString m_attr_alignment; - bool m_has_attr_alignment; + bool m_has_attr_alignment = false; // child element data - Kind m_kind; - DomWidget *m_widget; - DomLayout *m_layout; - DomSpacer *m_spacer; + Kind m_kind = Unknown; + DomWidget *m_widget = nullptr; + DomLayout *m_layout = nullptr; + DomSpacer *m_spacer = nullptr; }; class QDESIGNER_UILIB_EXPORT DomRow { Q_DISABLE_COPY(DomRow) public: - DomRow(); + DomRow() = default; ~DomRow(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QList<DomProperty*> elementProperty() const { return m_property; } void setElementProperty(const QList<DomProperty *> &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QList<DomProperty*> m_property; + enum Child { Property = 1 }; @@ -1315,24 +1035,22 @@ private: class QDESIGNER_UILIB_EXPORT DomColumn { Q_DISABLE_COPY(DomColumn) public: - DomColumn(); + DomColumn() = default; ~DomColumn(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QList<DomProperty*> elementProperty() const { return m_property; } void setElementProperty(const QList<DomProperty *> &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QList<DomProperty*> m_property; + enum Child { Property = 1 }; @@ -1341,13 +1059,11 @@ private: class QDESIGNER_UILIB_EXPORT DomItem { Q_DISABLE_COPY(DomItem) public: - DomItem(); + DomItem() = default; ~DomItem(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeRow() const { return m_has_attr_row; } @@ -1368,19 +1084,18 @@ public: void setElementItem(const QVector<DomItem *> &a); private: - QString m_text; - // attribute data - int m_attr_row; - bool m_has_attr_row; + int m_attr_row = 0; + bool m_has_attr_row = false; - int m_attr_column; - bool m_has_attr_column; + int m_attr_column = 0; + bool m_has_attr_column = false; // child element data - uint m_children; + uint m_children = 0; QList<DomProperty*> m_property; QVector<DomItem *> m_item; + enum Child { Property = 1, Item = 2 @@ -1390,13 +1105,11 @@ private: class QDESIGNER_UILIB_EXPORT DomWidget { Q_DISABLE_COPY(DomWidget) public: - DomWidget(); + DomWidget() = default; ~DomWidget(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeClass() const { return m_has_attr_class; } @@ -1421,12 +1134,6 @@ public: inline QList<DomProperty*> elementProperty() const { return m_property; } void setElementProperty(const QList<DomProperty *> &a); - inline QVector<DomScript *> elementScript() const { return m_script; } - void setElementScript(const QVector<DomScript *> &a); - - inline QVector<DomWidgetData *> elementWidgetData() const { return m_widgetData; } - void setElementWidgetData(const QVector<DomWidgetData *> &a); - inline QList<DomProperty*> elementAttribute() const { return m_attribute; } void setElementAttribute(const QList<DomProperty *> &a); @@ -1458,24 +1165,20 @@ public: void setElementZOrder(const QStringList &a); private: - QString m_text; - // attribute data QString m_attr_class; - bool m_has_attr_class; + bool m_has_attr_class = false; QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; - bool m_attr_native; - bool m_has_attr_native; + bool m_attr_native = false; + bool m_has_attr_native = false; // child element data - uint m_children; + uint m_children = 0; QStringList m_class; QList<DomProperty*> m_property; - QVector<DomScript *> m_script; - QVector<DomWidgetData *> m_widgetData; QList<DomProperty*> m_attribute; QVector<DomRow *> m_row; QVector<DomColumn *> m_column; @@ -1486,34 +1189,31 @@ private: QVector<DomActionGroup *> m_actionGroup; QVector<DomActionRef *> m_addAction; QStringList m_zOrder; + enum Child { Class = 1, Property = 2, - Script = 4, - WidgetData = 8, - Attribute = 16, - Row = 32, - Column = 64, - Item = 128, - Layout = 256, - Widget = 512, - Action = 1024, - ActionGroup = 2048, - AddAction = 4096, - ZOrder = 8192 + Attribute = 4, + Row = 8, + Column = 16, + Item = 32, + Layout = 64, + Widget = 128, + Action = 256, + ActionGroup = 512, + AddAction = 1024, + ZOrder = 2048 }; }; class QDESIGNER_UILIB_EXPORT DomSpacer { Q_DISABLE_COPY(DomSpacer) public: - DomSpacer(); + DomSpacer() = default; ~DomSpacer(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -1526,15 +1226,14 @@ public: void setElementProperty(const QList<DomProperty *> &a); private: - QString m_text; - // attribute data QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; // child element data - uint m_children; + uint m_children = 0; QList<DomProperty*> m_property; + enum Child { Property = 1 }; @@ -1543,13 +1242,11 @@ private: class QDESIGNER_UILIB_EXPORT DomColor { Q_DISABLE_COPY(DomColor) public: - DomColor(); + DomColor() = default; ~DomColor(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeAlpha() const { return m_has_attr_alpha; } @@ -1574,17 +1271,16 @@ public: void clearElementBlue(); private: - QString m_text; - // attribute data - int m_attr_alpha; - bool m_has_attr_alpha; + int m_attr_alpha = 0; + bool m_has_attr_alpha = false; // child element data - uint m_children; - int m_red; - int m_green; - int m_blue; + uint m_children = 0; + int m_red = 0; + int m_green = 0; + int m_blue = 0; + enum Child { Red = 1, Green = 2, @@ -1595,13 +1291,11 @@ private: class QDESIGNER_UILIB_EXPORT DomGradientStop { Q_DISABLE_COPY(DomGradientStop) public: - DomGradientStop(); + DomGradientStop() = default; ~DomGradientStop(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributePosition() const { return m_has_attr_position; } @@ -1617,15 +1311,14 @@ public: void clearElementColor(); private: - QString m_text; - // attribute data - double m_attr_position; - bool m_has_attr_position; + double m_attr_position = 0.0; + bool m_has_attr_position = false; // child element data - uint m_children; - DomColor *m_color; + uint m_children = 0; + DomColor *m_color = nullptr; + enum Child { Color = 1 }; @@ -1634,13 +1327,11 @@ private: class QDESIGNER_UILIB_EXPORT DomGradient { Q_DISABLE_COPY(DomGradient) public: - DomGradient(); + DomGradient() = default; ~DomGradient(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeStartX() const { return m_has_attr_startX; } @@ -1713,51 +1404,50 @@ public: void setElementGradientStop(const QVector<DomGradientStop *> &a); private: - QString m_text; - // attribute data - double m_attr_startX; - bool m_has_attr_startX; + double m_attr_startX = 0.0; + bool m_has_attr_startX = false; - double m_attr_startY; - bool m_has_attr_startY; + double m_attr_startY = 0.0; + bool m_has_attr_startY = false; - double m_attr_endX; - bool m_has_attr_endX; + double m_attr_endX = 0.0; + bool m_has_attr_endX = false; - double m_attr_endY; - bool m_has_attr_endY; + double m_attr_endY = 0.0; + bool m_has_attr_endY = false; - double m_attr_centralX; - bool m_has_attr_centralX; + double m_attr_centralX = 0.0; + bool m_has_attr_centralX = false; - double m_attr_centralY; - bool m_has_attr_centralY; + double m_attr_centralY = 0.0; + bool m_has_attr_centralY = false; - double m_attr_focalX; - bool m_has_attr_focalX; + double m_attr_focalX = 0.0; + bool m_has_attr_focalX = false; - double m_attr_focalY; - bool m_has_attr_focalY; + double m_attr_focalY = 0.0; + bool m_has_attr_focalY = false; - double m_attr_radius; - bool m_has_attr_radius; + double m_attr_radius = 0.0; + bool m_has_attr_radius = false; - double m_attr_angle; - bool m_has_attr_angle; + double m_attr_angle = 0.0; + bool m_has_attr_angle = false; QString m_attr_type; - bool m_has_attr_type; + bool m_has_attr_type = false; QString m_attr_spread; - bool m_has_attr_spread; + bool m_has_attr_spread = false; QString m_attr_coordinateMode; - bool m_has_attr_coordinateMode; + bool m_has_attr_coordinateMode = false; // child element data - uint m_children; + uint m_children = 0; QVector<DomGradientStop *> m_gradientStop; + enum Child { GradientStop = 1 }; @@ -1766,13 +1456,11 @@ private: class QDESIGNER_UILIB_EXPORT DomBrush { Q_DISABLE_COPY(DomBrush) public: - DomBrush(); + DomBrush() = default; ~DomBrush(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeBrushStyle() const { return m_has_attr_brushStyle; } @@ -1797,31 +1485,27 @@ public: void setElementGradient(DomGradient *a); private: - QString m_text; - void clear(); // attribute data QString m_attr_brushStyle; - bool m_has_attr_brushStyle; + bool m_has_attr_brushStyle = false; // child element data - Kind m_kind; - DomColor *m_color; - DomProperty *m_texture; - DomGradient *m_gradient; + Kind m_kind = Unknown; + DomColor *m_color = nullptr; + DomProperty *m_texture = nullptr; + DomGradient *m_gradient = nullptr; }; class QDESIGNER_UILIB_EXPORT DomColorRole { Q_DISABLE_COPY(DomColorRole) public: - DomColorRole(); + DomColorRole() = default; ~DomColorRole(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeRole() const { return m_has_attr_role; } @@ -1837,15 +1521,14 @@ public: void clearElementBrush(); private: - QString m_text; - // attribute data QString m_attr_role; - bool m_has_attr_role; + bool m_has_attr_role = false; // child element data - uint m_children; - DomBrush *m_brush; + uint m_children = 0; + DomBrush *m_brush = nullptr; + enum Child { Brush = 1 }; @@ -1854,13 +1537,11 @@ private: class QDESIGNER_UILIB_EXPORT DomColorGroup { Q_DISABLE_COPY(DomColorGroup) public: - DomColorGroup(); + DomColorGroup() = default; ~DomColorGroup(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QVector<DomColorRole *> elementColorRole() const { return m_colorRole; } @@ -1870,12 +1551,12 @@ public: void setElementColor(const QVector<DomColor *> &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QVector<DomColorRole *> m_colorRole; QVector<DomColor *> m_color; + enum Child { ColorRole = 1, Color = 2 @@ -1885,13 +1566,11 @@ private: class QDESIGNER_UILIB_EXPORT DomPalette { Q_DISABLE_COPY(DomPalette) public: - DomPalette(); + DomPalette() = default; ~DomPalette(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline DomColorGroup *elementActive() const { return m_active; } @@ -1913,13 +1592,13 @@ public: void clearElementDisabled(); private: - QString m_text; // child element data - uint m_children; - DomColorGroup *m_active; - DomColorGroup *m_inactive; - DomColorGroup *m_disabled; + uint m_children = 0; + DomColorGroup *m_active = nullptr; + DomColorGroup *m_inactive = nullptr; + DomColorGroup *m_disabled = nullptr; + enum Child { Active = 1, Inactive = 2, @@ -1930,13 +1609,11 @@ private: class QDESIGNER_UILIB_EXPORT DomFont { Q_DISABLE_COPY(DomFont) public: - DomFont(); + DomFont() = default; ~DomFont(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QString elementFamily() const { return m_family; } @@ -1990,20 +1667,20 @@ public: void clearElementKerning(); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QString m_family; - int m_pointSize; - int m_weight; - bool m_italic; - bool m_bold; - bool m_underline; - bool m_strikeOut; - bool m_antialiasing; + int m_pointSize = 0; + int m_weight = 0; + bool m_italic = false; + bool m_bold = false; + bool m_underline = false; + bool m_strikeOut = false; + bool m_antialiasing = false; QString m_styleStrategy; - bool m_kerning; + bool m_kerning = false; + enum Child { Family = 1, PointSize = 2, @@ -2021,13 +1698,11 @@ private: class QDESIGNER_UILIB_EXPORT DomPoint { Q_DISABLE_COPY(DomPoint) public: - DomPoint(); + DomPoint() = default; ~DomPoint(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline int elementX() const { return m_x; } @@ -2041,12 +1716,12 @@ public: void clearElementY(); private: - QString m_text; // child element data - uint m_children; - int m_x; - int m_y; + uint m_children = 0; + int m_x = 0; + int m_y = 0; + enum Child { X = 1, Y = 2 @@ -2056,13 +1731,11 @@ private: class QDESIGNER_UILIB_EXPORT DomRect { Q_DISABLE_COPY(DomRect) public: - DomRect(); + DomRect() = default; ~DomRect(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline int elementX() const { return m_x; } @@ -2086,14 +1759,14 @@ public: void clearElementHeight(); private: - QString m_text; // child element data - uint m_children; - int m_x; - int m_y; - int m_width; - int m_height; + uint m_children = 0; + int m_x = 0; + int m_y = 0; + int m_width = 0; + int m_height = 0; + enum Child { X = 1, Y = 2, @@ -2105,13 +1778,11 @@ private: class QDESIGNER_UILIB_EXPORT DomLocale { Q_DISABLE_COPY(DomLocale) public: - DomLocale(); + DomLocale() = default; ~DomLocale(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeLanguage() const { return m_has_attr_language; } @@ -2125,27 +1796,22 @@ public: inline void clearAttributeCountry() { m_has_attr_country = false; } private: - QString m_text; - // attribute data QString m_attr_language; - bool m_has_attr_language; + bool m_has_attr_language = false; QString m_attr_country; - bool m_has_attr_country; - + bool m_has_attr_country = false; }; class QDESIGNER_UILIB_EXPORT DomSizePolicy { Q_DISABLE_COPY(DomSizePolicy) public: - DomSizePolicy(); + DomSizePolicy() = default; ~DomSizePolicy(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeHSizeType() const { return m_has_attr_hSizeType; } @@ -2180,21 +1846,20 @@ public: void clearElementVerStretch(); private: - QString m_text; - // attribute data QString m_attr_hSizeType; - bool m_has_attr_hSizeType; + bool m_has_attr_hSizeType = false; QString m_attr_vSizeType; - bool m_has_attr_vSizeType; + bool m_has_attr_vSizeType = false; // child element data - uint m_children; - int m_hSizeType; - int m_vSizeType; - int m_horStretch; - int m_verStretch; + uint m_children = 0; + int m_hSizeType = 0; + int m_vSizeType = 0; + int m_horStretch = 0; + int m_verStretch = 0; + enum Child { HSizeType = 1, VSizeType = 2, @@ -2206,13 +1871,11 @@ private: class QDESIGNER_UILIB_EXPORT DomSize { Q_DISABLE_COPY(DomSize) public: - DomSize(); + DomSize() = default; ~DomSize(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline int elementWidth() const { return m_width; } @@ -2226,12 +1889,12 @@ public: void clearElementHeight(); private: - QString m_text; // child element data - uint m_children; - int m_width; - int m_height; + uint m_children = 0; + int m_width = 0; + int m_height = 0; + enum Child { Width = 1, Height = 2 @@ -2241,13 +1904,11 @@ private: class QDESIGNER_UILIB_EXPORT DomDate { Q_DISABLE_COPY(DomDate) public: - DomDate(); + DomDate() = default; ~DomDate(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline int elementYear() const { return m_year; } @@ -2266,13 +1927,13 @@ public: void clearElementDay(); private: - QString m_text; // child element data - uint m_children; - int m_year; - int m_month; - int m_day; + uint m_children = 0; + int m_year = 0; + int m_month = 0; + int m_day = 0; + enum Child { Year = 1, Month = 2, @@ -2283,13 +1944,11 @@ private: class QDESIGNER_UILIB_EXPORT DomTime { Q_DISABLE_COPY(DomTime) public: - DomTime(); + DomTime() = default; ~DomTime(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline int elementHour() const { return m_hour; } @@ -2308,13 +1967,13 @@ public: void clearElementSecond(); private: - QString m_text; // child element data - uint m_children; - int m_hour; - int m_minute; - int m_second; + uint m_children = 0; + int m_hour = 0; + int m_minute = 0; + int m_second = 0; + enum Child { Hour = 1, Minute = 2, @@ -2325,13 +1984,11 @@ private: class QDESIGNER_UILIB_EXPORT DomDateTime { Q_DISABLE_COPY(DomDateTime) public: - DomDateTime(); + DomDateTime() = default; ~DomDateTime(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline int elementHour() const { return m_hour; } @@ -2365,16 +2022,16 @@ public: void clearElementDay(); private: - QString m_text; // child element data - uint m_children; - int m_hour; - int m_minute; - int m_second; - int m_year; - int m_month; - int m_day; + uint m_children = 0; + int m_hour = 0; + int m_minute = 0; + int m_second = 0; + int m_year = 0; + int m_month = 0; + int m_day = 0; + enum Child { Hour = 1, Minute = 2, @@ -2388,13 +2045,11 @@ private: class QDESIGNER_UILIB_EXPORT DomStringList { Q_DISABLE_COPY(DomStringList) public: - DomStringList(); + DomStringList() = default; ~DomStringList(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeNotr() const { return m_has_attr_notr; } @@ -2417,21 +2072,20 @@ public: void setElementString(const QStringList &a); private: - QString m_text; - // attribute data QString m_attr_notr; - bool m_has_attr_notr; + bool m_has_attr_notr = false; QString m_attr_comment; - bool m_has_attr_comment; + bool m_has_attr_comment = false; QString m_attr_extraComment; - bool m_has_attr_extraComment; + bool m_has_attr_extraComment = false; // child element data - uint m_children; + uint m_children = 0; QStringList m_string; + enum Child { String = 1 }; @@ -2440,11 +2094,12 @@ private: class QDESIGNER_UILIB_EXPORT DomResourcePixmap { Q_DISABLE_COPY(DomResourcePixmap) public: - DomResourcePixmap(); + DomResourcePixmap() = default; ~DomResourcePixmap(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; + inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2464,21 +2119,21 @@ private: // attribute data QString m_attr_resource; - bool m_has_attr_resource; + bool m_has_attr_resource = false; QString m_attr_alias; - bool m_has_attr_alias; - + bool m_has_attr_alias = false; }; class QDESIGNER_UILIB_EXPORT DomResourceIcon { Q_DISABLE_COPY(DomResourceIcon) public: - DomResourceIcon(); + DomResourceIcon() = default; ~DomResourceIcon(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; + inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2547,21 +2202,22 @@ private: // attribute data QString m_attr_theme; - bool m_has_attr_theme; + bool m_has_attr_theme = false; QString m_attr_resource; - bool m_has_attr_resource; + bool m_has_attr_resource = false; // child element data - uint m_children; - DomResourcePixmap *m_normalOff; - DomResourcePixmap *m_normalOn; - DomResourcePixmap *m_disabledOff; - DomResourcePixmap *m_disabledOn; - DomResourcePixmap *m_activeOff; - DomResourcePixmap *m_activeOn; - DomResourcePixmap *m_selectedOff; - DomResourcePixmap *m_selectedOn; + uint m_children = 0; + DomResourcePixmap *m_normalOff = nullptr; + DomResourcePixmap *m_normalOn = nullptr; + DomResourcePixmap *m_disabledOff = nullptr; + DomResourcePixmap *m_disabledOn = nullptr; + DomResourcePixmap *m_activeOff = nullptr; + DomResourcePixmap *m_activeOn = nullptr; + DomResourcePixmap *m_selectedOff = nullptr; + DomResourcePixmap *m_selectedOn = nullptr; + enum Child { NormalOff = 1, NormalOn = 2, @@ -2577,11 +2233,12 @@ private: class QDESIGNER_UILIB_EXPORT DomString { Q_DISABLE_COPY(DomString) public: - DomString(); + DomString() = default; ~DomString(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; + inline QString text() const { return m_text; } inline void setText(const QString &s) { m_text = s; } @@ -2606,26 +2263,23 @@ private: // attribute data QString m_attr_notr; - bool m_has_attr_notr; + bool m_has_attr_notr = false; QString m_attr_comment; - bool m_has_attr_comment; + bool m_has_attr_comment = false; QString m_attr_extraComment; - bool m_has_attr_extraComment; - + bool m_has_attr_extraComment = false; }; class QDESIGNER_UILIB_EXPORT DomPointF { Q_DISABLE_COPY(DomPointF) public: - DomPointF(); + DomPointF() = default; ~DomPointF(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline double elementX() const { return m_x; } @@ -2639,12 +2293,12 @@ public: void clearElementY(); private: - QString m_text; // child element data - uint m_children; - double m_x; - double m_y; + uint m_children = 0; + double m_x = 0.0; + double m_y = 0.0; + enum Child { X = 1, Y = 2 @@ -2654,13 +2308,11 @@ private: class QDESIGNER_UILIB_EXPORT DomRectF { Q_DISABLE_COPY(DomRectF) public: - DomRectF(); + DomRectF() = default; ~DomRectF(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline double elementX() const { return m_x; } @@ -2684,14 +2336,14 @@ public: void clearElementHeight(); private: - QString m_text; // child element data - uint m_children; - double m_x; - double m_y; - double m_width; - double m_height; + uint m_children = 0; + double m_x = 0.0; + double m_y = 0.0; + double m_width = 0.0; + double m_height = 0.0; + enum Child { X = 1, Y = 2, @@ -2703,13 +2355,11 @@ private: class QDESIGNER_UILIB_EXPORT DomSizeF { Q_DISABLE_COPY(DomSizeF) public: - DomSizeF(); + DomSizeF() = default; ~DomSizeF(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline double elementWidth() const { return m_width; } @@ -2723,12 +2373,12 @@ public: void clearElementHeight(); private: - QString m_text; // child element data - uint m_children; - double m_width; - double m_height; + uint m_children = 0; + double m_width = 0.0; + double m_height = 0.0; + enum Child { Width = 1, Height = 2 @@ -2738,13 +2388,11 @@ private: class QDESIGNER_UILIB_EXPORT DomChar { Q_DISABLE_COPY(DomChar) public: - DomChar(); + DomChar() = default; ~DomChar(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline int elementUnicode() const { return m_unicode; } @@ -2753,11 +2401,11 @@ public: void clearElementUnicode(); private: - QString m_text; // child element data - uint m_children; - int m_unicode; + uint m_children = 0; + int m_unicode = 0; + enum Child { Unicode = 1 }; @@ -2766,13 +2414,11 @@ private: class QDESIGNER_UILIB_EXPORT DomUrl { Q_DISABLE_COPY(DomUrl) public: - DomUrl(); + DomUrl() = default; ~DomUrl(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline DomString *elementString() const { return m_string; } @@ -2782,11 +2428,11 @@ public: void clearElementString(); private: - QString m_text; // child element data - uint m_children; - DomString *m_string; + uint m_children = 0; + DomString *m_string = nullptr; + enum Child { String = 1 }; @@ -2795,13 +2441,11 @@ private: class QDESIGNER_UILIB_EXPORT DomProperty { Q_DISABLE_COPY(DomProperty) public: - DomProperty(); + DomProperty() = default; ~DomProperty(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -2939,75 +2583,71 @@ public: void setElementBrush(DomBrush *a); private: - QString m_text; - void clear(); // attribute data QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; - int m_attr_stdset; - bool m_has_attr_stdset; + int m_attr_stdset = 0; + bool m_has_attr_stdset = false; // child element data - Kind m_kind; + Kind m_kind = Unknown; QString m_bool; - DomColor *m_color; + DomColor *m_color = nullptr; QString m_cstring; - int m_cursor; + int m_cursor = 0; QString m_cursorShape; QString m_enum; - DomFont *m_font; - DomResourceIcon *m_iconSet; - DomResourcePixmap *m_pixmap; - DomPalette *m_palette; - DomPoint *m_point; - DomRect *m_rect; + DomFont *m_font = nullptr; + DomResourceIcon *m_iconSet = nullptr; + DomResourcePixmap *m_pixmap = nullptr; + DomPalette *m_palette = nullptr; + DomPoint *m_point = nullptr; + DomRect *m_rect = nullptr; QString m_set; - DomLocale *m_locale; - DomSizePolicy *m_sizePolicy; - DomSize *m_size; - DomString *m_string; - DomStringList *m_stringList; - int m_number; - float m_float; - double m_double; - DomDate *m_date; - DomTime *m_time; - DomDateTime *m_dateTime; - DomPointF *m_pointF; - DomRectF *m_rectF; - DomSizeF *m_sizeF; - qlonglong m_longLong; - DomChar *m_char; - DomUrl *m_url; - uint m_UInt; - qulonglong m_uLongLong; - DomBrush *m_brush; + DomLocale *m_locale = nullptr; + DomSizePolicy *m_sizePolicy = nullptr; + DomSize *m_size = nullptr; + DomString *m_string = nullptr; + DomStringList *m_stringList = nullptr; + int m_number = 0; + float m_float = 0.0; + double m_double = 0.0; + DomDate *m_date = nullptr; + DomTime *m_time = nullptr; + DomDateTime *m_dateTime = nullptr; + DomPointF *m_pointF = nullptr; + DomRectF *m_rectF = nullptr; + DomSizeF *m_sizeF = nullptr; + qlonglong m_longLong = 0; + DomChar *m_char = nullptr; + DomUrl *m_url = nullptr; + uint m_UInt = 0; + qulonglong m_uLongLong = 0; + DomBrush *m_brush = nullptr; }; class QDESIGNER_UILIB_EXPORT DomConnections { Q_DISABLE_COPY(DomConnections) public: - DomConnections(); + DomConnections() = default; ~DomConnections(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QVector<DomConnection *> elementConnection() const { return m_connection; } void setElementConnection(const QVector<DomConnection *> &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QVector<DomConnection *> m_connection; + enum Child { Connection = 1 }; @@ -3016,13 +2656,11 @@ private: class QDESIGNER_UILIB_EXPORT DomConnection { Q_DISABLE_COPY(DomConnection) public: - DomConnection(); + DomConnection() = default; ~DomConnection(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QString elementSender() const { return m_sender; } @@ -3052,15 +2690,15 @@ public: void clearElementHints(); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QString m_sender; QString m_signal; QString m_receiver; QString m_slot; - DomConnectionHints *m_hints; + DomConnectionHints *m_hints = nullptr; + enum Child { Sender = 1, Signal = 2, @@ -3073,24 +2711,22 @@ private: class QDESIGNER_UILIB_EXPORT DomConnectionHints { Q_DISABLE_COPY(DomConnectionHints) public: - DomConnectionHints(); + DomConnectionHints() = default; ~DomConnectionHints(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QVector<DomConnectionHint *> elementHint() const { return m_hint; } void setElementHint(const QVector<DomConnectionHint *> &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QVector<DomConnectionHint *> m_hint; + enum Child { Hint = 1 }; @@ -3099,13 +2735,11 @@ private: class QDESIGNER_UILIB_EXPORT DomConnectionHint { Q_DISABLE_COPY(DomConnectionHint) public: - DomConnectionHint(); + DomConnectionHint() = default; ~DomConnectionHint(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeType() const { return m_has_attr_type; } @@ -3125,103 +2759,40 @@ public: void clearElementY(); private: - QString m_text; - // attribute data QString m_attr_type; - bool m_has_attr_type; + bool m_has_attr_type = false; // child element data - uint m_children; - int m_x; - int m_y; + uint m_children = 0; + int m_x = 0; + int m_y = 0; + enum Child { X = 1, Y = 2 }; }; -class QDESIGNER_UILIB_EXPORT DomScript { - Q_DISABLE_COPY(DomScript) -public: - DomScript(); - ~DomScript(); - - void read(QXmlStreamReader &reader); - void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } - - // attribute accessors - inline bool hasAttributeSource() const { return m_has_attr_source; } - inline QString attributeSource() const { return m_attr_source; } - inline void setAttributeSource(const QString &a) { m_attr_source = a; m_has_attr_source = true; } - inline void clearAttributeSource() { m_has_attr_source = false; } - - inline bool hasAttributeLanguage() const { return m_has_attr_language; } - inline QString attributeLanguage() const { return m_attr_language; } - inline void setAttributeLanguage(const QString &a) { m_attr_language = a; m_has_attr_language = true; } - inline void clearAttributeLanguage() { m_has_attr_language = false; } - -private: - QString m_text; - - // attribute data - QString m_attr_source; - bool m_has_attr_source; - - QString m_attr_language; - bool m_has_attr_language; - -}; - -class QDESIGNER_UILIB_EXPORT DomWidgetData { - Q_DISABLE_COPY(DomWidgetData) -public: - DomWidgetData(); - ~DomWidgetData(); - - void read(QXmlStreamReader &reader); - void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } - - // child element accessors - inline QList<DomProperty*> elementProperty() const { return m_property; } - void setElementProperty(const QList<DomProperty *> &a); - -private: - QString m_text; - - // child element data - uint m_children; - QList<DomProperty*> m_property; - enum Child { - Property = 1 - }; -}; - class QDESIGNER_UILIB_EXPORT DomDesignerData { Q_DISABLE_COPY(DomDesignerData) public: - DomDesignerData(); + DomDesignerData() = default; ~DomDesignerData(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QList<DomProperty*> elementProperty() const { return m_property; } void setElementProperty(const QList<DomProperty *> &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QList<DomProperty*> m_property; + enum Child { Property = 1 }; @@ -3230,13 +2801,11 @@ private: class QDESIGNER_UILIB_EXPORT DomSlots { Q_DISABLE_COPY(DomSlots) public: - DomSlots(); + DomSlots() = default; ~DomSlots(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QStringList elementSignal() const { return m_signal; } @@ -3246,12 +2815,12 @@ public: void setElementSlot(const QStringList &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QStringList m_signal; QStringList m_slot; + enum Child { Signal = 1, Slot = 2 @@ -3261,13 +2830,11 @@ private: class QDESIGNER_UILIB_EXPORT DomPropertySpecifications { Q_DISABLE_COPY(DomPropertySpecifications) public: - DomPropertySpecifications(); + DomPropertySpecifications() = default; ~DomPropertySpecifications(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // child element accessors inline QVector<DomPropertyToolTip *> elementTooltip() const { return m_tooltip; } @@ -3277,12 +2844,12 @@ public: void setElementStringpropertyspecification(const QVector<DomStringPropertySpecification *> &a); private: - QString m_text; // child element data - uint m_children; + uint m_children = 0; QVector<DomPropertyToolTip *> m_tooltip; QVector<DomStringPropertySpecification *> m_stringpropertyspecification; + enum Child { Tooltip = 1, Stringpropertyspecification = 2 @@ -3292,13 +2859,11 @@ private: class QDESIGNER_UILIB_EXPORT DomPropertyToolTip { Q_DISABLE_COPY(DomPropertyToolTip) public: - DomPropertyToolTip(); + DomPropertyToolTip() = default; ~DomPropertyToolTip(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -3307,24 +2872,19 @@ public: inline void clearAttributeName() { m_has_attr_name = false; } private: - QString m_text; - // attribute data QString m_attr_name; - bool m_has_attr_name; - + bool m_has_attr_name = false; }; class QDESIGNER_UILIB_EXPORT DomStringPropertySpecification { Q_DISABLE_COPY(DomStringPropertySpecification) public: - DomStringPropertySpecification(); + DomStringPropertySpecification() = default; ~DomStringPropertySpecification(); void read(QXmlStreamReader &reader); void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; - inline QString text() const { return m_text; } - inline void setText(const QString &s) { m_text = s; } // attribute accessors inline bool hasAttributeName() const { return m_has_attr_name; } @@ -3343,18 +2903,15 @@ public: inline void clearAttributeNotr() { m_has_attr_notr = false; } private: - QString m_text; - // attribute data QString m_attr_name; - bool m_has_attr_name; + bool m_has_attr_name = false; QString m_attr_type; - bool m_has_attr_type; + bool m_has_attr_type = false; QString m_attr_notr; - bool m_has_attr_notr; - + bool m_has_attr_notr = false; }; |