1 /************************************************************************
2 **
3 ** @file vvitconverter.h
4 ** @author Roman Telezhynskyi <dismine(at)gmail.com>
5 ** @date 15 7, 2015
6 **
7 ** @brief
8 ** @copyright
9 ** This source code is part of the Valentina project, a pattern making
10 ** program, whose allow create and modeling patterns of clothing.
11 ** Copyright (C) 2015 Valentina project
12 ** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
13 **
14 ** Valentina is free software: you can redistribute it and/or modify
15 ** it under the terms of the GNU General Public License as published by
16 ** the Free Software Foundation, either version 3 of the License, or
17 ** (at your option) any later version.
18 **
19 ** Valentina is distributed in the hope that it will be useful,
20 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ** GNU General Public License for more details.
23 **
24 ** You should have received a copy of the GNU General Public License
25 ** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
26 **
27 *************************************************************************/
28
29 #ifndef VVITCONVERTER_H
30 #define VVITCONVERTER_H
31
32 #include <qcompilerdetection.h>
33 #include <QCoreApplication>
34 #include <QString>
35 #include <QtGlobal>
36
37 #include "vabstractmconverter.h"
38 #include "vabstractconverter.h"
39
40 class QDomElement;
41
42 class VVITConverter : public VAbstractMConverter
43 {
44 Q_DECLARE_TR_FUNCTIONS(VVITConverter)
45 public:
46 explicit VVITConverter(const QString &fileName);
47 virtual ~VVITConverter() Q_DECL_EQ_DEFAULT;
48
49 static const QString MeasurementMaxVerStr;
50 static const QString CurrentSchema;
51 static Q_DECL_CONSTEXPR const int MeasurementMinVer = FORMAT_VERSION(0, 2, 0);
52 static Q_DECL_CONSTEXPR const int MeasurementMaxVer = FORMAT_VERSION(0, 5, 1);
53
54 protected:
55 virtual int MinVer() const override;
56 virtual int MaxVer() const override;
57
58 virtual QString MinVerStr() const override;
59 virtual QString MaxVerStr() const override;
60
61 virtual QString XSDSchema(int ver) const override;
62 virtual void ApplyPatches() override;
63 virtual void DowngradeToCurrentMaxVersion() override;
64 virtual bool IsReadOnly() const override;
65
66 private:
67 Q_DISABLE_COPY(VVITConverter)
68 static const QString MeasurementMinVerStr;
69
70 void AddNewTagsForV0_3_0();
71 QString MUnitV0_2_0();
72 void ConvertMeasurementsToV0_3_0();
73 QDomElement AddMV0_3_0(const QString &name, qreal value);
74 void GenderV0_3_1();
75 void PM_SystemV0_3_2();
76 void ConvertMeasurementsToV0_3_3();
77 void ConverCustomerNameToV0_4_0();
78
79 void ToV0_3_0();
80 void ToV0_3_1();
81 void ToV0_3_2();
82 void ToV0_3_3();
83 void ToV0_4_0();
84 void ToV0_5_0();
85 void ToV0_5_1();
86 };
87
88 //---------------------------------------------------------------------------------------------------------------------
MinVer()89 inline int VVITConverter::MinVer() const
90 {
91 return MeasurementMinVer;
92 }
93
94 //---------------------------------------------------------------------------------------------------------------------
MaxVer()95 inline int VVITConverter::MaxVer() const
96 {
97 return MeasurementMaxVer;
98 }
99
100 //---------------------------------------------------------------------------------------------------------------------
MinVerStr()101 inline QString VVITConverter::MinVerStr() const
102 {
103 return MeasurementMinVerStr;
104 }
105
106 //---------------------------------------------------------------------------------------------------------------------
MaxVerStr()107 inline QString VVITConverter::MaxVerStr() const
108 {
109 return MeasurementMaxVerStr;
110 }
111
112 #endif // VVITCONVERTER_H
113