From 33b780f3c45b3ada098793dee88b59c95063da16 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 30 Nov 2018 17:47:29 +0200 Subject: [PATCH] Update pattern format version. Reservation fields for future use. --HG-- branch : develop --- src/libs/ifc/schema.qrc | 1 + src/libs/ifc/schema/pattern/v0.7.13.xsd | 1083 +++++++++++++++++++++++ src/libs/ifc/xml/vpatternconverter.cpp | 23 +- src/libs/ifc/xml/vpatternconverter.h | 3 +- 4 files changed, 1105 insertions(+), 5 deletions(-) create mode 100644 src/libs/ifc/schema/pattern/v0.7.13.xsd diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc index 0b3940e43..794927d11 100644 --- a/src/libs/ifc/schema.qrc +++ b/src/libs/ifc/schema.qrc @@ -50,6 +50,7 @@ schema/pattern/v0.7.10.xsd schema/pattern/v0.7.11.xsd schema/pattern/v0.7.12.xsd + schema/pattern/v0.7.13.xsd schema/standard_measurements/v0.3.0.xsd schema/standard_measurements/v0.4.0.xsd schema/standard_measurements/v0.4.1.xsd diff --git a/src/libs/ifc/schema/pattern/v0.7.13.xsd b/src/libs/ifc/schema/pattern/v0.7.13.xsd new file mode 100644 index 000000000..91b97c31b --- /dev/null +++ b/src/libs/ifc/schema/pattern/v0.7.13.xsd @@ -0,0 +1,1083 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index ec2ac8df0..02951a01f 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.7.12"); -const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.7.12.xsd"); +const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.7.13"); +const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.7.13.xsd"); //VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!! @@ -228,7 +228,8 @@ QString VPatternConverter::XSDSchema(int ver) const std::make_pair(FORMAT_VERSION(0, 7, 9), QStringLiteral("://schema/pattern/v0.7.9.xsd")), std::make_pair(FORMAT_VERSION(0, 7, 10), QStringLiteral("://schema/pattern/v0.7.10.xsd")), std::make_pair(FORMAT_VERSION(0, 7, 11), QStringLiteral("://schema/pattern/v0.7.11.xsd")), - std::make_pair(FORMAT_VERSION(0, 7, 12), CurrentSchema) + std::make_pair(FORMAT_VERSION(0, 7, 12), QStringLiteral("://schema/pattern/v0.7.12.xsd")), + std::make_pair(FORMAT_VERSION(0, 7, 13), CurrentSchema) }; if (schemas.contains(ver)) @@ -443,6 +444,10 @@ void VPatternConverter::ApplyPatches() ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 12)), m_convertedFileName); V_FALLTHROUGH case (FORMAT_VERSION(0, 7, 12)): + ToV0_7_13(); + ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 13)), m_convertedFileName); + V_FALLTHROUGH + case (FORMAT_VERSION(0, 7, 13)): break; default: InvalidVersion(m_ver); @@ -460,7 +465,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, 7, 12), + Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 7, 13), "Check attribute readOnly."); // Possibly in future attribute readOnly will change position etc. @@ -1010,6 +1015,16 @@ void VPatternConverter::ToV0_7_12() Save(); } +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::ToV0_7_13() +{ + // TODO. Delete if minimal supported version is 0.7.13 + Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FORMAT_VERSION(0, 7, 13), + "Time to refactor the code."); + SetVersion(QStringLiteral("0.7.13")); + Save(); +} + //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::TagUnitToV0_2_0() { diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index cdf024b28..8fc6f4e86 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, 7, 12); + static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 7, 13); protected: virtual int MinVer() const override; @@ -121,6 +121,7 @@ private: void ToV0_7_10(); void ToV0_7_11(); void ToV0_7_12(); + void ToV0_7_13(); void TagUnitToV0_2_0(); void TagIncrementToV0_2_0();