From 85078691caa2af363eab23337c4b8fb968b27da6 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 1 Feb 2017 14:18:45 +0200 Subject: [PATCH] New version of pattern format. --HG-- branch : feature --- src/libs/ifc/schema.qrc | 1 + src/libs/ifc/schema/pattern/v0.4.1.xsd | 838 +++++++++++++++++++++++++ src/libs/ifc/xml/vpatternconverter.cpp | 22 +- src/libs/ifc/xml/vpatternconverter.h | 5 +- 4 files changed, 861 insertions(+), 5 deletions(-) create mode 100644 src/libs/ifc/schema/pattern/v0.4.1.xsd diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc index aa5a46d40..cd7354cea 100644 --- a/src/libs/ifc/schema.qrc +++ b/src/libs/ifc/schema.qrc @@ -24,6 +24,7 @@ schema/pattern/v0.3.8.xsd schema/pattern/v0.3.9.xsd schema/pattern/v0.4.0.xsd + schema/pattern/v0.4.1.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.4.1.xsd b/src/libs/ifc/schema/pattern/v0.4.1.xsd new file mode 100644 index 000000000..b43477a90 --- /dev/null +++ b/src/libs/ifc/schema/pattern/v0.4.1.xsd @@ -0,0 +1,838 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index f3a4af8c7..7f76ab53b 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -58,8 +58,8 @@ class QDomElement; */ const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0"); -const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.0"); -const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.0.xsd"); +const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.1"); +const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.1.xsd"); //VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!! @@ -197,6 +197,8 @@ QString VPatternConverter::XSDSchema(int ver) const case (0x000309): return QStringLiteral("://schema/pattern/v0.3.9.xsd"); case (0x000400): + return QStringLiteral("://schema/pattern/v0.4.0.xsd"); + case (0x000401): return CurrentSchema; default: InvalidVersion(ver); @@ -304,7 +306,10 @@ void VPatternConverter::ApplyPatches() ValidateXML(XSDSchema(0x000400), fileName); V_FALLTHROUGH case (0x000400): - break; + ToV0_4_1(); + ValidateXML(XSDSchema(0x000401), fileName); + V_FALLTHROUGH + case (0x000401): default: break; } @@ -597,6 +602,17 @@ void VPatternConverter::ToV0_4_0() Save(); } +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::ToV0_4_1() +{ + // TODO. Delete if minimal supported version is 0.4.1 + Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 1), + "Time to refactor the code."); + + SetVersion(QStringLiteral("0.4.1")); + Save(); +} + //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::TagUnitToV0_2_0() { diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index 3341fecaf..8f20790be 100644 --- a/src/libs/ifc/xml/vpatternconverter.h +++ b/src/libs/ifc/xml/vpatternconverter.h @@ -55,10 +55,10 @@ public: // GCC 4.6 doesn't allow constexpr and const together #if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) <= 406 static Q_DECL_CONSTEXPR int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0); - static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 0); + static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 1); #else static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0); - static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 0); + static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 1); #endif protected: @@ -99,6 +99,7 @@ private: void ToV0_3_8(); void ToV0_3_9(); void ToV0_4_0(); + void ToV0_4_1(); void TagUnitToV0_2_0(); void TagIncrementToV0_2_0();