From 6c04b2e7cab53eca418ebc632d5b19e2e743518a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 25 Nov 2016 13:19:38 +0200 Subject: [PATCH] Remove attribute "typeObject" since 0.4.0. --HG-- branch : feature --- src/libs/ifc/schema/pattern/v0.4.0.xsd | 3 --- src/libs/ifc/xml/vpatternconverter.cpp | 32 ++++++++++++++++++++++++++ src/libs/ifc/xml/vpatternconverter.h | 1 + 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/libs/ifc/schema/pattern/v0.4.0.xsd b/src/libs/ifc/schema/pattern/v0.4.0.xsd index 40b3dc2f5..055575a49 100644 --- a/src/libs/ifc/schema/pattern/v0.4.0.xsd +++ b/src/libs/ifc/schema/pattern/v0.4.0.xsd @@ -280,7 +280,6 @@ - @@ -291,7 +290,6 @@ - @@ -301,7 +299,6 @@ - diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index 11bc090fd..0e02b69e0 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -130,6 +130,7 @@ const QString strMy = QStringLiteral("my"); const QString strForbidFlipping = QStringLiteral("forbidFlipping"); const QString strInLayout = QStringLiteral("inLayout"); const QString strSeamAllowance = QStringLiteral("seamAllowance"); +const QString strTypeObject = QStringLiteral("typeObject"); //--------------------------------------------------------------------------------------------------------------------- VPatternConverter::VPatternConverter(const QString &fileName) @@ -575,6 +576,7 @@ void VPatternConverter::ToV0_4_0() "Time to refactor the code."); SetVersion(QStringLiteral("0.4.0")); + TagRemoveAttributeTypeObjectInV0_4_0(); TagDetailToV0_4_0(); Save(); } @@ -1681,6 +1683,36 @@ void VPatternConverter::FixSubPaths(int i, quint32 id, quint32 baseCurve) } } +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::TagRemoveAttributeTypeObjectInV0_4_0() +{ + // TODO. Delete if minimal supported version is 0.4.0 + Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 0), + "Time to refactor the code."); + + const QDomNodeList list = elementsByTagName(strModeling); + for (int i = 0; i < list.size(); ++i) + { + QDomElement modeling = list.at(i).toElement(); + if (not modeling.isNull()) + { + QDomNode domNode = modeling.firstChild(); + while (not domNode.isNull()) + { + QDomElement domElement = domNode.toElement(); + if (not domElement.isNull()) + { + if (domElement.hasAttribute(strTypeObject)) + { + domElement.removeAttribute(strTypeObject); + } + } + domNode = domNode.nextSibling(); + } + } + } +} + //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::TagDetailToV0_4_0() { diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index 483d8782b..95a979451 100644 --- a/src/libs/ifc/xml/vpatternconverter.h +++ b/src/libs/ifc/xml/vpatternconverter.h @@ -134,6 +134,7 @@ private: void FixCutPoint(); void FixSubPaths(int i, quint32 id, quint32 baseCurve); + void TagRemoveAttributeTypeObjectInV0_4_0(); void TagDetailToV0_4_0(); };