New pattern format version.

This commit is contained in:
Roman Telezhynskyi 2020-11-04 13:31:43 +02:00
parent fd5c10c9a8
commit 37722788bb
4 changed files with 1104 additions and 5 deletions

View File

@ -61,6 +61,7 @@
<file>schema/pattern/v0.8.7.xsd</file> <file>schema/pattern/v0.8.7.xsd</file>
<file>schema/pattern/v0.8.8.xsd</file> <file>schema/pattern/v0.8.8.xsd</file>
<file>schema/pattern/v0.8.9.xsd</file> <file>schema/pattern/v0.8.9.xsd</file>
<file>schema/pattern/v0.8.10.xsd</file>
<file>schema/multisize_measurements/v0.3.0.xsd</file> <file>schema/multisize_measurements/v0.3.0.xsd</file>
<file>schema/multisize_measurements/v0.4.0.xsd</file> <file>schema/multisize_measurements/v0.4.0.xsd</file>
<file>schema/multisize_measurements/v0.4.1.xsd</file> <file>schema/multisize_measurements/v0.4.1.xsd</file>

File diff suppressed because it is too large Load Diff

View File

@ -59,8 +59,8 @@ class QDomElement;
*/ */
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.4"); const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.4");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.9"); const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.10");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.9.xsd"); const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.10.xsd");
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== 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, 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, 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, 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)) if (schemas.contains(ver))
@ -496,6 +497,10 @@ void VPatternConverter::ApplyPatches()
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 9))); ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 9)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 8, 9)): 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; break;
default: default:
InvalidVersion(m_ver); InvalidVersion(m_ver);
@ -513,7 +518,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
bool VPatternConverter::IsReadOnly() const bool VPatternConverter::IsReadOnly() const
{ {
// Check if attribute readOnly was not changed in file format // 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."); "Check attribute readOnly.");
// Possibly in future attribute readOnly will change position etc. // Possibly in future attribute readOnly will change position etc.
@ -1174,6 +1179,16 @@ void VPatternConverter::ToV0_8_9()
Save(); 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() void VPatternConverter::TagUnitToV0_2_0()
{ {

View File

@ -53,7 +53,7 @@ public:
static const QString PatternMaxVerStr; static const QString PatternMaxVerStr;
static const QString CurrentSchema; static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const int PatternMinVer = FORMAT_VERSION(0, 1, 4); 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: protected:
virtual int MinVer() const override; virtual int MinVer() const override;
@ -132,6 +132,7 @@ private:
void ToV0_8_7(); void ToV0_8_7();
void ToV0_8_8(); void ToV0_8_8();
void ToV0_8_9(); void ToV0_8_9();
void ToV0_8_10();
void TagUnitToV0_2_0(); void TagUnitToV0_2_0();
void TagIncrementToV0_2_0(); void TagIncrementToV0_2_0();