1 /************************************************************************
2  **
3  **  @file   vrawsapoint.h
4  **  @author Roman Telezhynskyi <dismine(at)gmail.com>
5  **  @date   31 10, 2019
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) 2019 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 #ifndef VRAWSAPOINT_H
29 #define VRAWSAPOINT_H
30 
31 #include <QPointF>
32 
33 #include "../vmisc/diagnostic.h"
34 #include "../vmisc/def.h"
35 
36 QT_WARNING_PUSH
37 QT_WARNING_DISABLE_GCC("-Weffc++")
38 QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
39 
40 class VRawSAPoint : public QPointF
41 {
42 public:
43     Q_DECL_CONSTEXPR VRawSAPoint();
44     Q_DECL_CONSTEXPR VRawSAPoint(qreal xpos, qreal ypos);
45     // cppcheck-suppress noExplicitConstructor
46     Q_DECL_CONSTEXPR VRawSAPoint(QPointF p);
47     Q_DECL_CONSTEXPR VRawSAPoint(QPointF p, bool loopPoint);
48 
49     Q_DECL_CONSTEXPR bool LoopPoint() const;
50     Q_DECL_RELAXED_CONSTEXPR void SetLoopPoint(bool loopPoint);
51 
52     QJsonObject toJson() const;
53 
54 private:
55     bool m_loopPoint{false};
56 };
57 
58 Q_DECLARE_METATYPE(VRawSAPoint)
59 Q_DECLARE_TYPEINFO(VRawSAPoint, Q_MOVABLE_TYPE);
60 
61 //---------------------------------------------------------------------------------------------------------------------
VRawSAPoint()62 Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint()
63 {}
64 
65 //---------------------------------------------------------------------------------------------------------------------
VRawSAPoint(qreal xpos,qreal ypos)66 Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint(qreal xpos, qreal ypos)
67     : QPointF(xpos, ypos)
68 {}
69 
70 //---------------------------------------------------------------------------------------------------------------------
71 // cppcheck-suppress passedByValue
VRawSAPoint(QPointF p)72 Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint(QPointF p)
73     : QPointF(p)
74 {}
75 
76 //---------------------------------------------------------------------------------------------------------------------
77 // cppcheck-suppress passedByValue
VRawSAPoint(QPointF p,bool loopPoint)78 Q_DECL_CONSTEXPR inline VRawSAPoint::VRawSAPoint(QPointF p, bool loopPoint)
79     : QPointF(p),
80       m_loopPoint(loopPoint)
81 {}
82 
83 //---------------------------------------------------------------------------------------------------------------------
LoopPoint()84 Q_DECL_CONSTEXPR inline bool VRawSAPoint::LoopPoint() const
85 {
86     return m_loopPoint;
87 }
88 
89 //---------------------------------------------------------------------------------------------------------------------
SetLoopPoint(bool loopPoint)90 Q_DECL_RELAXED_CONSTEXPR inline void VRawSAPoint::SetLoopPoint(bool loopPoint)
91 {
92     m_loopPoint = loopPoint;
93 }
94 
95 QT_WARNING_POP
96 
97 #endif // VRAWSAPOINT_H
98