New pattern format version.

This commit is contained in:
Roman Telezhynskyi 2020-10-27 18:25:03 +02:00
parent b820107b4d
commit fe8552cec1
4 changed files with 1101 additions and 5 deletions

View File

@ -60,6 +60,7 @@
<file>schema/pattern/v0.8.6.xsd</file>
<file>schema/pattern/v0.8.7.xsd</file>
<file>schema/pattern/v0.8.8.xsd</file>
<file>schema/pattern/v0.8.9.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.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::PatternMaxVerStr = QStringLiteral("0.8.8");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.8.xsd");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.9");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.9.xsd");
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -238,7 +238,8 @@ QString VPatternConverter::XSDSchema(int ver) const
std::make_pair(FORMAT_VERSION(0, 8, 5), QStringLiteral("://schema/pattern/v0.8.5.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, 8), CurrentSchema)
std::make_pair(FORMAT_VERSION(0, 8, 8), QStringLiteral("://schema/pattern/v0.8.8.xsd")),
std::make_pair(FORMAT_VERSION(0, 8, 9), CurrentSchema)
};
if (schemas.contains(ver))
@ -491,6 +492,10 @@ void VPatternConverter::ApplyPatches()
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 8)));
Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 8, 8)):
ToV0_8_9();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 9)));
Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 8, 9)):
break;
default:
InvalidVersion(m_ver);
@ -508,7 +513,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, 8),
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 9),
"Check attribute readOnly.");
// Possibly in future attribute readOnly will change position etc.
@ -1159,6 +1164,16 @@ void VPatternConverter::ToV0_8_8()
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::ToV0_8_9()
{
// TODO. Delete if minimal supported version is 0.8.9
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FORMAT_VERSION(0, 8, 9),
"Time to refactor the code.");
SetVersion(QStringLiteral("0.8.9"));
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::TagUnitToV0_2_0()
{

View File

@ -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, 8);
static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 9);
protected:
virtual int MinVer() const override;
@ -131,6 +131,7 @@ private:
void ToV0_8_6();
void ToV0_8_7();
void ToV0_8_8();
void ToV0_8_9();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();