From 37722788bb773193e935cb66404f6f1cd5dfd146 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 4 Nov 2020 13:31:43 +0200 Subject: [PATCH] New pattern format version. --- src/libs/ifc/schema.qrc | 1 + src/libs/ifc/schema/pattern/v0.8.10.xsd | 1082 +++++++++++++++++++++++ src/libs/ifc/xml/vpatternconverter.cpp | 23 +- src/libs/ifc/xml/vpatternconverter.h | 3 +- 4 files changed, 1104 insertions(+), 5 deletions(-) create mode 100644 src/libs/ifc/schema/pattern/v0.8.10.xsd diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc index c775ca329..62bba0903 100644 --- a/src/libs/ifc/schema.qrc +++ b/src/libs/ifc/schema.qrc @@ -61,6 +61,7 @@ schema/pattern/v0.8.7.xsd schema/pattern/v0.8.8.xsd schema/pattern/v0.8.9.xsd + schema/pattern/v0.8.10.xsd schema/multisize_measurements/v0.3.0.xsd schema/multisize_measurements/v0.4.0.xsd schema/multisize_measurements/v0.4.1.xsd diff --git a/src/libs/ifc/schema/pattern/v0.8.10.xsd b/src/libs/ifc/schema/pattern/v0.8.10.xsd new file mode 100644 index 000000000..e5b2295ef --- /dev/null +++ b/src/libs/ifc/schema/pattern/v0.8.10.xsd @@ -0,0 +1,1082 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index a3521fd6a..7316ab6dc 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -59,8 +59,8 @@ class QDomElement; */ const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.4"); -const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.9"); -const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.9.xsd"); +const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.10"); +const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.10.xsd"); //VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!! @@ -239,7 +239,8 @@ QString VPatternConverter::XSDSchema(int ver) const std::make_pair(FORMAT_VERSION(0, 8, 6), QStringLiteral("://schema/pattern/v0.8.6.xsd")), std::make_pair(FORMAT_VERSION(0, 8, 7), QStringLiteral("://schema/pattern/v0.8.7.xsd")), std::make_pair(FORMAT_VERSION(0, 8, 8), QStringLiteral("://schema/pattern/v0.8.8.xsd")), - std::make_pair(FORMAT_VERSION(0, 8, 9), CurrentSchema) + std::make_pair(FORMAT_VERSION(0, 8, 9), QStringLiteral("://schema/pattern/v0.8.9.xsd")), + std::make_pair(FORMAT_VERSION(0, 8, 10), CurrentSchema) }; if (schemas.contains(ver)) @@ -496,6 +497,10 @@ void VPatternConverter::ApplyPatches() ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 9))); Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 8, 9)): + ToV0_8_10(); + ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 10))); + Q_FALLTHROUGH(); + case (FORMAT_VERSION(0, 8, 10)): break; default: InvalidVersion(m_ver); @@ -513,7 +518,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion() bool VPatternConverter::IsReadOnly() const { // Check if attribute readOnly was not changed in file format - Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 9), + Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 10), "Check attribute readOnly."); // Possibly in future attribute readOnly will change position etc. @@ -1174,6 +1179,16 @@ void VPatternConverter::ToV0_8_9() Save(); } +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::ToV0_8_10() +{ + // TODO. Delete if minimal supported version is 0.8.10 + Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FORMAT_VERSION(0, 8, 10), + "Time to refactor the code."); + SetVersion(QStringLiteral("0.8.10")); + Save(); +} + //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::TagUnitToV0_2_0() { diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index b973fc7c9..6fea9583b 100644 --- a/src/libs/ifc/xml/vpatternconverter.h +++ b/src/libs/ifc/xml/vpatternconverter.h @@ -53,7 +53,7 @@ public: static const QString PatternMaxVerStr; static const QString CurrentSchema; static Q_DECL_CONSTEXPR const int PatternMinVer = FORMAT_VERSION(0, 1, 4); - static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 9); + static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 10); protected: virtual int MinVer() const override; @@ -132,6 +132,7 @@ private: void ToV0_8_7(); void ToV0_8_8(); void ToV0_8_9(); + void ToV0_8_10(); void TagUnitToV0_2_0(); void TagIncrementToV0_2_0();