Seamly2D
Code documentation
vvstconverter.h
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * Copyright (C) 2017 Seamly, LLC *
4  * *
5  * https://github.com/fashionfreedom/seamly2d *
6  * *
7  ***************************************************************************
8  **
9  ** Seamly2D is free software: you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation, either version 3 of the License, or
12  ** (at your option) any later version.
13  **
14  ** Seamly2D is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** You should have received a copy of the GNU General Public License
20  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
21  **
22  **************************************************************************
23 
24  ************************************************************************
25  **
26  ** @file vmeasurementconverter.h
27  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
28  ** @date 15 7, 2015
29  **
30  ** @brief
31  ** @copyright
32  ** This source code is part of the Valentine project, a pattern making
33  ** program, whose allow create and modeling patterns of clothing.
34  ** Copyright (C) 2015 Seamly2D project
35  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
36  **
37  ** Seamly2D is free software: you can redistribute it and/or modify
38  ** it under the terms of the GNU General Public License as published by
39  ** the Free Software Foundation, either version 3 of the License, or
40  ** (at your option) any later version.
41  **
42  ** Seamly2D is distributed in the hope that it will be useful,
43  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
44  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45  ** GNU General Public License for more details.
46  **
47  ** You should have received a copy of the GNU General Public License
48  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
49  **
50  *************************************************************************/
51 
52 #ifndef VMEASUREMENTCONVERTER_H
53 #define VMEASUREMENTCONVERTER_H
54 
55 #include <qcompilerdetection.h>
56 #include <QCoreApplication>
57 #include <QString>
58 #include <QtGlobal>
59 
60 #include "vabstractmconverter.h"
61 #include "vabstractconverter.h"
62 
63 class QDomElement;
64 
66 {
67  Q_DECLARE_TR_FUNCTIONS(VVSTConverter)
68 public:
69  explicit VVSTConverter(const QString &fileName);
70  virtual ~VVSTConverter() Q_DECL_EQ_DEFAULT;
71 
72  static const QString MeasurementMaxVerStr;
73  static const QString CurrentSchema;
74 // GCC 4.6 doesn't allow constexpr and const together
75 #if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) <= 406
76  static Q_DECL_CONSTEXPR int MeasurementMinVer = CONVERTER_VERSION_CHECK(0, 3, 0);
77  static Q_DECL_CONSTEXPR int MeasurementMaxVer = CONVERTER_VERSION_CHECK(0, 4, 4);
78 #else
79  static Q_DECL_CONSTEXPR const int MeasurementMinVer = CONVERTER_VERSION_CHECK(0, 3, 0);
80  static Q_DECL_CONSTEXPR const int MeasurementMaxVer = CONVERTER_VERSION_CHECK(0, 4, 4);
81 #endif
82 
83 protected:
84  virtual int MinVer() const Q_DECL_OVERRIDE;
85  virtual int MaxVer() const Q_DECL_OVERRIDE;
86 
87  virtual QString MinVerStr() const Q_DECL_OVERRIDE;
88  virtual QString MaxVerStr() const Q_DECL_OVERRIDE;
89 
90  virtual QString XSDSchema(int ver) const Q_DECL_OVERRIDE;
91  virtual void ApplyPatches() Q_DECL_OVERRIDE;
92  virtual void DowngradeToCurrentMaxVersion() Q_DECL_OVERRIDE;
93  virtual bool IsReadOnly() const Q_DECL_OVERRIDE;
94 
95 private:
96  Q_DISABLE_COPY(VVSTConverter)
97  static const QString MeasurementMinVerStr;
98 
99  void AddNewTagsForV0_4_0();
100  void RemoveTagsForV0_4_0();
102  QDomElement AddMV0_4_0(const QString &name, qreal value, qreal sizeIncrease, qreal heightIncrease);
103  void PM_SystemV0_4_1();
105 
106  void ToV0_4_0();
107  void ToV0_4_1();
108  void ToV0_4_2();
109  void ToV0_4_3();
110  void ToV0_4_4();
111 };
112 
113 //---------------------------------------------------------------------------------------------------------------------
114 inline int VVSTConverter::MinVer() const
115 {
116  return MeasurementMinVer;
117 }
118 
119 //---------------------------------------------------------------------------------------------------------------------
120 inline int VVSTConverter::MaxVer() const
121 {
122  return MeasurementMaxVer;
123 }
124 
125 //---------------------------------------------------------------------------------------------------------------------
126 inline QString VVSTConverter::MinVerStr() const
127 {
128  return MeasurementMinVerStr;
129 }
130 
131 //---------------------------------------------------------------------------------------------------------------------
132 inline QString VVSTConverter::MaxVerStr() const
133 {
134  return MeasurementMaxVerStr;
135 }
136 
137 #endif // VMEASUREMENTCONVERTER_H
static const QString MeasurementMaxVerStr
Definition: vvstconverter.h:72
virtual QString MinVerStr() const Q_DECL_OVERRIDE
static Q_DECL_CONSTEXPR const int MeasurementMaxVer
Definition: vvstconverter.h:80
virtual int MinVer() const Q_DECL_OVERRIDE
virtual QString MaxVerStr() const Q_DECL_OVERRIDE
virtual void DowngradeToCurrentMaxVersion() Q_DECL_OVERRIDE
static Q_DECL_CONSTEXPR const int MeasurementMinVer
Definition: vvstconverter.h:79
virtual ~VVSTConverter() Q_DECL_EQ_DEFAULT
virtual bool IsReadOnly() const Q_DECL_OVERRIDE
void PM_SystemV0_4_1()
static const QString CurrentSchema
Definition: vvstconverter.h:73
QDomElement AddMV0_4_0(const QString &name, qreal value, qreal sizeIncrease, qreal heightIncrease)
virtual int MaxVer() const Q_DECL_OVERRIDE
VVSTConverter(const QString &fileName)
void ConvertMeasurementsToV0_4_0()
void RemoveTagsForV0_4_0()
void AddNewTagsForV0_4_0()
void ConvertMeasurementsToV0_4_2()
virtual void ApplyPatches() Q_DECL_OVERRIDE
static const QString MeasurementMinVerStr
Definition: vvstconverter.h:97
virtual QString XSDSchema(int ver) const Q_DECL_OVERRIDE
#define CONVERTER_VERSION_CHECK(major, minor, patch)