Updated multisize file format version.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-03-10 11:39:20 +02:00
parent 3e1cde0719
commit 77a3845374
5 changed files with 203 additions and 5 deletions

View File

@ -32,6 +32,7 @@
<file>schema/standard_measurements/v0.4.1.xsd</file>
<file>schema/standard_measurements/v0.4.2.xsd</file>
<file>schema/standard_measurements/v0.4.3.xsd</file>
<file>schema/standard_measurements/v0.4.4.xsd</file>
<file>schema/individual_measurements/v0.2.0.xsd</file>
<file>schema/individual_measurements/v0.3.0.xsd</file>
<file>schema/individual_measurements/v0.3.1.xsd</file>

View File

@ -0,0 +1,178 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="vst">
<xs:complexType>
<xs:sequence>
<xs:element name="version" type="formatVersion"/>
<xs:element name="read-only" type="xs:boolean"/>
<xs:element name="notes" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="unit" type="units"/>
<xs:element name="pm_system" type="psCode"/>
<xs:element name="size">
<xs:complexType>
<xs:attribute name="base" type="baseSize" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="height">
<xs:complexType>
<xs:attribute name="base" type="baseHeight" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="body-measurements">
<xs:complexType>
<xs:sequence>
<xs:element name="m" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="shortName" use="required"/>
<xs:attribute name="base" type="xs:double" use="required"/>
<xs:attribute name="height_increase" type="xs:double" use="required"/>
<xs:attribute name="size_increase" type="xs:double" use="required"/>
<xs:attribute name="full_name" type="xs:string"/>
<xs:attribute name="description" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="measurementName">
<xs:selector xpath="body-measurements/m"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="^([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\-()+=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\-()+=?:;\&quot;]){0,}$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">
<xs:restriction base="xs:string">
<xs:enumeration value="mm"/>
<xs:enumeration value="cm"/>
<xs:enumeration value="inch"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="formatVersion">
<xs:restriction base="xs:string">
<xs:pattern value="^(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="psCode">
<xs:restriction base="xs:string">
<xs:pattern value="^^(([0-9]|[1-4][0-9]|5[0-4])|998)$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="baseHeight">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="50"/>
<xs:enumeration value="56"/>
<xs:enumeration value="62"/>
<xs:enumeration value="68"/>
<xs:enumeration value="74"/>
<xs:enumeration value="80"/>
<xs:enumeration value="86"/>
<xs:enumeration value="92"/>
<xs:enumeration value="98"/>
<xs:enumeration value="104"/>
<xs:enumeration value="110"/>
<xs:enumeration value="116"/>
<xs:enumeration value="122"/>
<xs:enumeration value="128"/>
<xs:enumeration value="134"/>
<xs:enumeration value="140"/>
<xs:enumeration value="146"/>
<xs:enumeration value="152"/>
<xs:enumeration value="158"/>
<xs:enumeration value="164"/>
<xs:enumeration value="170"/>
<xs:enumeration value="176"/>
<xs:enumeration value="182"/>
<xs:enumeration value="188"/>
<xs:enumeration value="194"/>
<xs:enumeration value="200"/>
<xs:enumeration value="500"/>
<xs:enumeration value="560"/>
<xs:enumeration value="620"/>
<xs:enumeration value="680"/>
<xs:enumeration value="740"/>
<xs:enumeration value="800"/>
<xs:enumeration value="860"/>
<xs:enumeration value="920"/>
<xs:enumeration value="980"/>
<xs:enumeration value="1040"/>
<xs:enumeration value="1100"/>
<xs:enumeration value="1160"/>
<xs:enumeration value="1220"/>
<xs:enumeration value="1280"/>
<xs:enumeration value="1340"/>
<xs:enumeration value="1400"/>
<xs:enumeration value="1460"/>
<xs:enumeration value="1520"/>
<xs:enumeration value="1580"/>
<xs:enumeration value="1640"/>
<xs:enumeration value="1700"/>
<xs:enumeration value="1760"/>
<xs:enumeration value="1820"/>
<xs:enumeration value="1880"/>
<xs:enumeration value="1940"/>
<xs:enumeration value="2000"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="baseSize">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="22"/>
<xs:enumeration value="24"/>
<xs:enumeration value="26"/>
<xs:enumeration value="28"/>
<xs:enumeration value="30"/>
<xs:enumeration value="32"/>
<xs:enumeration value="34"/>
<xs:enumeration value="36"/>
<xs:enumeration value="38"/>
<xs:enumeration value="40"/>
<xs:enumeration value="42"/>
<xs:enumeration value="44"/>
<xs:enumeration value="46"/>
<xs:enumeration value="48"/>
<xs:enumeration value="50"/>
<xs:enumeration value="52"/>
<xs:enumeration value="54"/>
<xs:enumeration value="56"/>
<xs:enumeration value="58"/>
<xs:enumeration value="60"/>
<xs:enumeration value="62"/>
<xs:enumeration value="64"/>
<xs:enumeration value="66"/>
<xs:enumeration value="68"/>
<xs:enumeration value="70"/>
<xs:enumeration value="72"/>
<xs:enumeration value="220"/>
<xs:enumeration value="240"/>
<xs:enumeration value="260"/>
<xs:enumeration value="280"/>
<xs:enumeration value="300"/>
<xs:enumeration value="320"/>
<xs:enumeration value="340"/>
<xs:enumeration value="360"/>
<xs:enumeration value="380"/>
<xs:enumeration value="400"/>
<xs:enumeration value="420"/>
<xs:enumeration value="440"/>
<xs:enumeration value="460"/>
<xs:enumeration value="480"/>
<xs:enumeration value="500"/>
<xs:enumeration value="520"/>
<xs:enumeration value="540"/>
<xs:enumeration value="560"/>
<xs:enumeration value="580"/>
<xs:enumeration value="600"/>
<xs:enumeration value="620"/>
<xs:enumeration value="640"/>
<xs:enumeration value="660"/>
<xs:enumeration value="680"/>
<xs:enumeration value="700"/>
<xs:enumeration value="720"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@ -103,6 +103,7 @@ private:
void ToV0_4_0();
void ToV0_4_1();
void ToV0_4_2();
void ToV0_4_3();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();

View File

@ -54,8 +54,8 @@
*/
const QString VVSTConverter::MeasurementMinVerStr = QStringLiteral("0.3.0");
const QString VVSTConverter::MeasurementMaxVerStr = QStringLiteral("0.4.3");
const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/standard_measurements/v0.4.3.xsd");
const QString VVSTConverter::MeasurementMaxVerStr = QStringLiteral("0.4.4");
const QString VVSTConverter::CurrentSchema = QStringLiteral("://schema/standard_measurements/v0.4.4.xsd");
//VVSTConverter::MeasurementMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VVSTConverter::MeasurementMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@ -87,6 +87,8 @@ QString VVSTConverter::XSDSchema(int ver) const
case (0x000402):
return QStringLiteral("://schema/standard_measurements/v0.4.2.xsd");
case (0x000403):
return QStringLiteral("://schema/standard_measurements/v0.4.3.xsd");
case (0x000404):
return CurrentSchema;
default:
InvalidVersion(ver);
@ -116,6 +118,10 @@ void VVSTConverter::ApplyPatches()
ValidateXML(XSDSchema(0x000403), m_convertedFileName);
V_FALLTHROUGH
case (0x000403):
ToV0_4_4();
ValidateXML(XSDSchema(0x000404), m_convertedFileName);
V_FALLTHROUGH
case (0x000404):
break;
default:
InvalidVersion(m_ver);
@ -134,7 +140,7 @@ void VVSTConverter::DowngradeToCurrentMaxVersion()
bool VVSTConverter::IsReadOnly() const
{
// Check if attribute read-only was not changed in file format
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMaxVer == CONVERTER_VERSION_CHECK(0, 4, 3),
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMaxVer == CONVERTER_VERSION_CHECK(0, 4, 4),
"Check attribute read-only.");
// Possibly in future attribute read-only will change position etc.
@ -363,3 +369,14 @@ void VVSTConverter::ToV0_4_3()
SetVersion(QStringLiteral("0.4.3"));
Save();
}
//---------------------------------------------------------------------------------------------------------------------
void VVSTConverter::ToV0_4_4()
{
// TODO. Delete if minimal supported version is 0.4.4
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < CONVERTER_VERSION_CHECK(0, 4, 4),
"Time to refactor the code.");
SetVersion(QStringLiteral("0.4.4"));
Save();
}

View File

@ -51,10 +51,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 MeasurementMinVer = CONVERTER_VERSION_CHECK(0, 3, 0);
static Q_DECL_CONSTEXPR int MeasurementMaxVer = CONVERTER_VERSION_CHECK(0, 4, 3);
static Q_DECL_CONSTEXPR int MeasurementMaxVer = CONVERTER_VERSION_CHECK(0, 4, 4);
#else
static Q_DECL_CONSTEXPR const int MeasurementMinVer = CONVERTER_VERSION_CHECK(0, 3, 0);
static Q_DECL_CONSTEXPR const int MeasurementMaxVer = CONVERTER_VERSION_CHECK(0, 4, 3);
static Q_DECL_CONSTEXPR const int MeasurementMaxVer = CONVERTER_VERSION_CHECK(0, 4, 4);
#endif
protected:
@ -84,6 +84,7 @@ private:
void ToV0_4_1();
void ToV0_4_2();
void ToV0_4_3();
void ToV0_4_4();
};
//---------------------------------------------------------------------------------------------------------------------