Skip to content

Commit

Permalink
refactor: schema 0.8.0 is now 0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Onetchou committed Aug 17, 2024
1 parent 5781036 commit 5a6980f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/libs/ifc/schema.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@
<file>schema/multi_size_measurements/v0.4.5.xsd</file>
<file>schema/pattern/v0.6.9.xsd</file>
<file>schema/pattern/v0.7.0.xsd</file>
<file>schema/pattern/v0.8.0.xsd</file>
<file>schema/pattern/v0.7.1.xsd</file>
</qresource>
</RCC>
File renamed without changes.
24 changes: 12 additions & 12 deletions src/libs/ifc/xml/vpatternconverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ Q_LOGGING_CATEGORY(PatternConverter, "patternConverter")
*/

const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.0");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.0.xsd");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.7.1");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.7.1.xsd");

//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
Expand Down Expand Up @@ -349,8 +349,8 @@ QString VPatternConverter::getSchema(int ver) const
return QStringLiteral("://schema/pattern/v0.6.9.xsd");;
case (0x000700):
return QStringLiteral("://schema/pattern/v0.7.0.xsd");;
case (0x000800):
qCDebug(PatternConverter, "Current schema - ://schema/pattern/v0.8.0.xsd");
case (0x000701):
qCDebug(PatternConverter, "Current schema - ://schema/pattern/v0.7.1.xsd");
return CurrentSchema;
default:
InvalidVersion(ver);
Expand Down Expand Up @@ -541,10 +541,10 @@ void VPatternConverter::applyPatches()
ValidateXML(getSchema(0x000700), m_convertedFileName);
V_FALLTHROUGH
case (0x000700):
toVersion0_8_0();
ValidateXML(getSchema(0x000800), m_convertedFileName);
toVersion0_7_1();
ValidateXML(getSchema(0x000701), m_convertedFileName);
V_FALLTHROUGH
case (0x000800):
case (0x000701):
break;
default:
InvalidVersion(m_ver);
Expand All @@ -563,7 +563,7 @@ void VPatternConverter::downgradeToCurrentMaxVersion()
bool VPatternConverter::isReadOnly() const
{
// Check if attribute readOnly was not changed in file format
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 8, 0),
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 7, 1),
"Check attribute readOnly.");

// Possibly in future attribute readOnly will change position etc.
Expand Down Expand Up @@ -1400,12 +1400,12 @@ void VPatternConverter::toVersion0_7_0()
}

//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::toVersion0_8_0()
void VPatternConverter::toVersion0_7_1()
{
// TODO. Delete if minimal supported version is 0.8.0
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 8, 0),
// TODO. Delete if minimal supported version is 0.7.1
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 7, 1),
"Time to refactor the code.");
setVersion(QStringLiteral("0.8.0"));
setVersion(QStringLiteral("0.7.1"));
Save();
}

Expand Down
4 changes: 2 additions & 2 deletions src/libs/ifc/xml/vpatternconverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class VPatternConverter : public VAbstractConverter
static const QString PatternMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 8, 0);
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 7, 1);

protected:
virtual int minVer() const override;
Expand Down Expand Up @@ -143,7 +143,7 @@ class VPatternConverter : public VAbstractConverter
void toVersion0_6_8();
void toVersion0_6_9();
void toVersion0_7_0();
void toVersion0_8_0();
void toVersion0_7_1();


void TagUnitToV0_2_0();
Expand Down

0 comments on commit 5a6980f

Please sign in to comment.