Seamly2D
Code documentation
vvitconverter.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 vvitconverter.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 VVITCONVERTER_H
53 #define VVITCONVERTER_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(VVITConverter)
68 public:
69  explicit VVITConverter(const QString &fileName);
70  virtual ~VVITConverter() 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, 2, 0);
77  static Q_DECL_CONSTEXPR int MeasurementMaxVer = CONVERTER_VERSION_CHECK(0, 3, 3);
78 #else
79  static Q_DECL_CONSTEXPR const int MeasurementMinVer = CONVERTER_VERSION_CHECK(0, 2, 0);
80  static Q_DECL_CONSTEXPR const int MeasurementMaxVer = CONVERTER_VERSION_CHECK(0, 3, 3);
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(VVITConverter)
97  static const QString MeasurementMinVerStr;
98 
99  void AddNewTagsForV0_3_0();
100  QString MUnitV0_2_0();
102  QDomElement AddMV0_3_0(const QString &name, qreal value);
103  void GenderV0_3_1();
104  void PM_SystemV0_3_2();
106 
107  void ToV0_3_0();
108  void ToV0_3_1();
109  void ToV0_3_2();
110  void ToV0_3_3();
111 };
112 
113 //---------------------------------------------------------------------------------------------------------------------
114 inline int VVITConverter::MinVer() const
115 {
116  return MeasurementMinVer;
117 }
118 
119 //---------------------------------------------------------------------------------------------------------------------
120 inline int VVITConverter::MaxVer() const
121 {
122  return MeasurementMaxVer;
123 }
124 
125 //---------------------------------------------------------------------------------------------------------------------
126 inline QString VVITConverter::MinVerStr() const
127 {
128  return MeasurementMinVerStr;
129 }
130 
131 //---------------------------------------------------------------------------------------------------------------------
132 inline QString VVITConverter::MaxVerStr() const
133 {
134  return MeasurementMaxVerStr;
135 }
136 
137 #endif // VVITCONVERTER_H
virtual void DowngradeToCurrentMaxVersion() Q_DECL_OVERRIDE
static Q_DECL_CONSTEXPR const int MeasurementMinVer
Definition: vvitconverter.h:79
virtual ~VVITConverter() Q_DECL_EQ_DEFAULT
virtual int MinVer() const Q_DECL_OVERRIDE
void ConvertMeasurementsToV0_3_3()
virtual int MaxVer() const Q_DECL_OVERRIDE
virtual void ApplyPatches() Q_DECL_OVERRIDE
void AddNewTagsForV0_3_0()
static const QString MeasurementMaxVerStr
Definition: vvitconverter.h:72
QString MUnitV0_2_0()
virtual QString MinVerStr() const Q_DECL_OVERRIDE
void PM_SystemV0_3_2()
virtual QString MaxVerStr() const Q_DECL_OVERRIDE
void ConvertMeasurementsToV0_3_0()
QDomElement AddMV0_3_0(const QString &name, qreal value)
virtual QString XSDSchema(int ver) const Q_DECL_OVERRIDE
VVITConverter(const QString &fileName)
virtual bool IsReadOnly() const Q_DECL_OVERRIDE
static const QString CurrentSchema
Definition: vvitconverter.h:73
static Q_DECL_CONSTEXPR const int MeasurementMaxVer
Definition: vvitconverter.h:80
static const QString MeasurementMinVerStr
Definition: vvitconverter.h:97
#define CONVERTER_VERSION_CHECK(major, minor, patch)