New pattern format version.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-05-08 15:16:04 +03:00
parent 9286d99a3e
commit db8ef33d79
4 changed files with 1294 additions and 5 deletions

View File

@ -56,6 +56,7 @@
<file>schema/pattern/v0.8.2.xsd</file>
<file>schema/pattern/v0.8.3.xsd</file>
<file>schema/pattern/v0.8.4.xsd</file>
<file>schema/pattern/v0.8.5.xsd</file>
<file>schema/standard_measurements/v0.3.0.xsd</file>
<file>schema/standard_measurements/v0.4.0.xsd</file>
<file>schema/standard_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.4");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.4.xsd");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.5");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.5.xsd");
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -234,7 +234,8 @@ QString VPatternConverter::XSDSchema(int ver) const
std::make_pair(FORMAT_VERSION(0, 8, 1), QStringLiteral("://schema/pattern/v0.8.1.xsd")),
std::make_pair(FORMAT_VERSION(0, 8, 2), QStringLiteral("://schema/pattern/v0.8.2.xsd")),
std::make_pair(FORMAT_VERSION(0, 8, 3), QStringLiteral("://schema/pattern/v0.8.3.xsd")),
std::make_pair(FORMAT_VERSION(0, 8, 4), CurrentSchema)
std::make_pair(FORMAT_VERSION(0, 8, 4), QStringLiteral("://schema/pattern/v0.8.4.xsd")),
std::make_pair(FORMAT_VERSION(0, 8, 5), CurrentSchema)
};
if (schemas.contains(ver))
@ -471,6 +472,10 @@ void VPatternConverter::ApplyPatches()
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 4)), m_convertedFileName);
Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 8, 4)):
ToV0_8_5();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 5)), m_convertedFileName);
Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 8, 5)):
break;
default:
InvalidVersion(m_ver);
@ -488,7 +493,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, 4),
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 5),
"Check attribute readOnly.");
// Possibly in future attribute readOnly will change position etc.
@ -1098,6 +1103,16 @@ void VPatternConverter::ToV0_8_4()
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::ToV0_8_5()
{
// TODO. Delete if minimal supported version is 0.8.5
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FORMAT_VERSION(0, 8, 5),
"Time to refactor the code.");
SetVersion(QStringLiteral("0.8.5"));
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, 4);
static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 5);
protected:
virtual int MinVer() const override;
@ -127,6 +127,7 @@ private:
void ToV0_8_2();
void ToV0_8_3();
void ToV0_8_4();
void ToV0_8_5();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();