From 8063645cf6be81192580040f464d9582b39f8080 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 17 Apr 2024 11:46:37 +0300 Subject: [PATCH] Refactoring. A "constexpr" function should not be declared "inline". --- src/libs/vhpgl/vhpglengine.cpp | 2 +- src/libs/vlayout/vbestsquare.cpp | 2 +- src/libs/vlayout/vlayoutpoint.h | 12 +++---- src/libs/vlayout/vrawsapoint.h | 18 +++++----- src/libs/vlayout/vsapoint.h | 56 ++++++++++++++++---------------- src/libs/vmisc/def.h | 36 ++++++++++---------- src/libs/vmisc/projectversion.h | 4 +-- src/libs/vmisc/vmath.h | 2 +- 8 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/libs/vhpgl/vhpglengine.cpp b/src/libs/vhpgl/vhpglengine.cpp index 2d36b5a4e..e4259387f 100644 --- a/src/libs/vhpgl/vhpglengine.cpp +++ b/src/libs/vhpgl/vhpglengine.cpp @@ -72,7 +72,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, mCI, ("CI"_L1)) // NOLINT circle QT_WARNING_POP //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto ConvertPixels(qreal pix) -> qreal +constexpr auto ConvertPixels(qreal pix) -> qreal { // Default plating measurement in the HP-GL(HP-GL/2) graphics mode is 1/1016"(0.025mm). // 40 plotter units = 1 mm diff --git a/src/libs/vlayout/vbestsquare.cpp b/src/libs/vlayout/vbestsquare.cpp index 5dc2eb0cf..fa43d3dd6 100644 --- a/src/libs/vlayout/vbestsquare.cpp +++ b/src/libs/vlayout/vbestsquare.cpp @@ -33,7 +33,7 @@ namespace { //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto Square(QSizeF size) -> qint64 +constexpr auto Square(QSizeF size) -> qint64 { return static_cast(size.width() * size.height()); } diff --git a/src/libs/vlayout/vlayoutpoint.h b/src/libs/vlayout/vlayoutpoint.h index fdf660929..fb3dec79b 100644 --- a/src/libs/vlayout/vlayoutpoint.h +++ b/src/libs/vlayout/vlayoutpoint.h @@ -104,37 +104,37 @@ auto operator>>(QDataStream &, VLayoutPoint &) -> QDataStream &; #endif //--------------------------------------------------------------------------------------------------------------------- -constexpr inline VLayoutPoint::VLayoutPoint(qreal xpos, qreal ypos) +constexpr VLayoutPoint::VLayoutPoint(qreal xpos, qreal ypos) : QPointF(xpos, ypos) { } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline VLayoutPoint::VLayoutPoint(QPointF p) +constexpr VLayoutPoint::VLayoutPoint(QPointF p) : QPointF(p) { } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VLayoutPoint::TurnPoint() const -> bool +constexpr auto VLayoutPoint::TurnPoint() const -> bool { return m_turnPoint; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline void VLayoutPoint::SetTurnPoint(bool newTurnPoint) +constexpr void VLayoutPoint::SetTurnPoint(bool newTurnPoint) { m_turnPoint = newTurnPoint; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VLayoutPoint::CurvePoint() const -> bool +constexpr auto VLayoutPoint::CurvePoint() const -> bool { return m_curvePoint; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline void VLayoutPoint::SetCurvePoint(bool newCurvePoint) +constexpr void VLayoutPoint::SetCurvePoint(bool newCurvePoint) { m_curvePoint = newCurvePoint; } diff --git a/src/libs/vlayout/vrawsapoint.h b/src/libs/vlayout/vrawsapoint.h index e8cba7291..23587f1f9 100644 --- a/src/libs/vlayout/vrawsapoint.h +++ b/src/libs/vlayout/vrawsapoint.h @@ -65,25 +65,25 @@ Q_DECLARE_METATYPE(VRawSAPoint) // NOLINT Q_DECLARE_TYPEINFO(VRawSAPoint, Q_MOVABLE_TYPE); // NOLINT //--------------------------------------------------------------------------------------------------------------------- -constexpr inline VRawSAPoint::VRawSAPoint(qreal xpos, qreal ypos) +constexpr VRawSAPoint::VRawSAPoint(qreal xpos, qreal ypos) : VLayoutPoint(xpos, ypos) { } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline VRawSAPoint::VRawSAPoint(QPointF p) +constexpr VRawSAPoint::VRawSAPoint(QPointF p) : VLayoutPoint(p) { } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline VRawSAPoint::VRawSAPoint(const VLayoutPoint &p) +constexpr VRawSAPoint::VRawSAPoint(const VLayoutPoint &p) : VLayoutPoint(p) { } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline VRawSAPoint::VRawSAPoint(QPointF p, bool curvePoint, bool turnPoint) +constexpr VRawSAPoint::VRawSAPoint(QPointF p, bool curvePoint, bool turnPoint) : VLayoutPoint(p) { SetCurvePoint(curvePoint); @@ -91,7 +91,7 @@ constexpr inline VRawSAPoint::VRawSAPoint(QPointF p, bool curvePoint, bool turnP } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline VRawSAPoint::VRawSAPoint(QPointF p, bool curvePoint, bool turnPoint, bool loopPoint) +constexpr VRawSAPoint::VRawSAPoint(QPointF p, bool curvePoint, bool turnPoint, bool loopPoint) : VLayoutPoint(p), m_loopPoint(loopPoint) { @@ -100,25 +100,25 @@ constexpr inline VRawSAPoint::VRawSAPoint(QPointF p, bool curvePoint, bool turnP } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VRawSAPoint::LoopPoint() const -> bool +constexpr auto VRawSAPoint::LoopPoint() const -> bool { return m_loopPoint; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline void VRawSAPoint::SetLoopPoint(bool loopPoint) +constexpr void VRawSAPoint::SetLoopPoint(bool loopPoint) { m_loopPoint = loopPoint; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VRawSAPoint::Primary() const -> bool +constexpr auto VRawSAPoint::Primary() const -> bool { return m_primary; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline void VRawSAPoint::SetPrimary(bool primary) +constexpr void VRawSAPoint::SetPrimary(bool primary) { m_primary = primary; } diff --git a/src/libs/vlayout/vsapoint.h b/src/libs/vlayout/vsapoint.h index ff871d4c4..0c53520c3 100644 --- a/src/libs/vlayout/vsapoint.h +++ b/src/libs/vlayout/vsapoint.h @@ -110,36 +110,36 @@ Q_DECLARE_METATYPE(VSAPoint) // NOLINT Q_DECLARE_TYPEINFO(VSAPoint, Q_MOVABLE_TYPE); // NOLINT //--------------------------------------------------------------------------------------------------------------------- -constexpr inline VSAPoint::VSAPoint() noexcept // NOLINT(hicpp-use-equals-default) +constexpr VSAPoint::VSAPoint() noexcept // NOLINT(hicpp-use-equals-default) { } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline VSAPoint::VSAPoint(qreal xpos, qreal ypos) +constexpr VSAPoint::VSAPoint(qreal xpos, qreal ypos) : VLayoutPoint(xpos, ypos) { } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline VSAPoint::VSAPoint(QPointF p) +constexpr VSAPoint::VSAPoint(QPointF p) : VLayoutPoint(p) { } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline VSAPoint::VSAPoint(const VLayoutPoint &p) +constexpr VSAPoint::VSAPoint(const VLayoutPoint &p) : VLayoutPoint(p) { } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VSAPoint::GetSABefore() const -> qreal +constexpr auto VSAPoint::GetSABefore() const -> qreal { return m_before; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VSAPoint::GetSABefore(qreal width) const -> qreal +constexpr auto VSAPoint::GetSABefore(qreal width) const -> qreal { if (m_before < 0) { @@ -149,19 +149,19 @@ constexpr inline auto VSAPoint::GetSABefore(qreal width) const -> qreal } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline void VSAPoint::SetSABefore(qreal value) +constexpr void VSAPoint::SetSABefore(qreal value) { value < 0 ? m_before = -1 : m_before = value; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VSAPoint::GetSAAfter() const -> qreal +constexpr auto VSAPoint::GetSAAfter() const -> qreal { return m_after; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VSAPoint::GetSAAfter(qreal width) const -> qreal +constexpr auto VSAPoint::GetSAAfter(qreal width) const -> qreal { if (m_after < 0) { @@ -171,103 +171,103 @@ constexpr inline auto VSAPoint::GetSAAfter(qreal width) const -> qreal } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline void VSAPoint::SetSAAfter(qreal value) +constexpr void VSAPoint::SetSAAfter(qreal value) { value < 0 ? m_after = -1 : m_after = value; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VSAPoint::GetAngleType() const -> PieceNodeAngle +constexpr auto VSAPoint::GetAngleType() const -> PieceNodeAngle { return m_angle; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline void VSAPoint::SetAngleType(PieceNodeAngle value) +constexpr void VSAPoint::SetAngleType(PieceNodeAngle value) { m_angle = value; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VSAPoint::IsManualPasskmarkLength() const -> bool +constexpr auto VSAPoint::IsManualPasskmarkLength() const -> bool { return m_manualPassmarkLength; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VSAPoint::IsManualPasskmarkWidth() const -> bool +constexpr auto VSAPoint::IsManualPasskmarkWidth() const -> bool { return m_manualPassmarkWidth; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VSAPoint::IsManualPasskmarkAngle() const -> bool +constexpr auto VSAPoint::IsManualPasskmarkAngle() const -> bool { return m_manualPassmarkAngle; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline void VSAPoint::SetManualPasskmarkLength(bool value) +constexpr void VSAPoint::SetManualPasskmarkLength(bool value) { m_manualPassmarkLength = value; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline void VSAPoint::SetManualPasskmarkWidth(bool value) +constexpr void VSAPoint::SetManualPasskmarkWidth(bool value) { m_manualPassmarkWidth = value; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline void VSAPoint::SetManualPasskmarkAngle(bool value) +constexpr void VSAPoint::SetManualPasskmarkAngle(bool value) { m_manualPassmarkAngle = value; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VSAPoint::GetPasskmarkLength() const -> qreal +constexpr auto VSAPoint::GetPasskmarkLength() const -> qreal { return m_passmarkLength; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VSAPoint::GetPasskmarkWidth() const -> qreal +constexpr auto VSAPoint::GetPasskmarkWidth() const -> qreal { return m_passmarkWidth; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VSAPoint::GetPasskmarkAngle() const -> qreal +constexpr auto VSAPoint::GetPasskmarkAngle() const -> qreal { return m_passmarkAngle; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline void VSAPoint::SetPasskmarkLength(qreal value) +constexpr void VSAPoint::SetPasskmarkLength(qreal value) { m_passmarkLength = value; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline void VSAPoint::SetPasskmarkWidth(qreal value) +constexpr void VSAPoint::SetPasskmarkWidth(qreal value) { m_passmarkWidth = value; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline void VSAPoint::SetPasskmarkAngle(qreal value) +constexpr void VSAPoint::SetPasskmarkAngle(qreal value) { m_passmarkAngle = value; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VSAPoint::MaxLocalSA(qreal width) const -> qreal +constexpr auto VSAPoint::MaxLocalSA(qreal width) const -> qreal { return qMax(GetSAAfter(width), GetSABefore(width)); } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VSAPoint::PassmarkLength(qreal width) const -> qreal +constexpr auto VSAPoint::PassmarkLength(qreal width) const -> qreal { if (not m_manualPassmarkLength) { @@ -280,13 +280,13 @@ constexpr inline auto VSAPoint::PassmarkLength(qreal width) const -> qreal } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto VSAPoint::IsPassmarkClockwiseOpening() const -> bool +constexpr auto VSAPoint::IsPassmarkClockwiseOpening() const -> bool { return m_passmarkClockwiseOpening; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline void VSAPoint::SetPassmarkClockwiseOpening(bool clockwise) +constexpr void VSAPoint::SetPassmarkClockwiseOpening(bool clockwise) { m_passmarkClockwiseOpening = clockwise; } diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index a0fca1c60..a45aff6b7 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -471,25 +471,25 @@ auto QPixmapFromCache(const QString &pixmapPath) -> QPixmap; void SetItemOverrideCursor(QGraphicsItem *item, const QString &pixmapPath, int hotX = -1, int hotY = -1); //--------------------------------------------------------------------------------------------------------------------- -template constexpr inline auto MmToPixel(T val) noexcept -> T +template constexpr auto MmToPixel(T val) noexcept -> T { return (val / 25.4) * PrintDPI; } //--------------------------------------------------------------------------------------------------------------------- -template constexpr inline auto CmToPixel(T val) noexcept -> T +template constexpr auto CmToPixel(T val) noexcept -> T { return ((val * 10.0) / 25.4) * PrintDPI; } //--------------------------------------------------------------------------------------------------------------------- -template constexpr inline auto InchToPixel(T val) noexcept -> T +template constexpr auto InchToPixel(T val) noexcept -> T { return val * PrintDPI; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto ToPixel(double val, const Unit &unit) noexcept -> double +constexpr auto ToPixel(double val, const Unit &unit) noexcept -> double { switch (unit) { @@ -508,25 +508,25 @@ constexpr inline auto ToPixel(double val, const Unit &unit) noexcept -> double } //--------------------------------------------------------------------------------------------------------------------- -template constexpr inline auto PixelToInch(T pix) -> T +template constexpr auto PixelToInch(T pix) -> T { return pix / PrintDPI; } //--------------------------------------------------------------------------------------------------------------------- -template constexpr inline auto PixelToMm(T pix) -> T +template constexpr auto PixelToMm(T pix) -> T { return PixelToInch(pix) * 25.4; } //--------------------------------------------------------------------------------------------------------------------- -template constexpr inline auto PixelToCm(T pix) -> T +template constexpr auto PixelToCm(T pix) -> T { return PixelToInch(pix) * 2.54; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto FromPixel(double pix, const Unit &unit) -> double +constexpr auto FromPixel(double pix, const Unit &unit) -> double { switch (unit) { @@ -545,27 +545,27 @@ constexpr inline auto FromPixel(double pix, const Unit &unit) -> double } //--------------------------------------------------------------------------------------------------------------------- -template constexpr inline auto Inch2ToPixel2(T val) -> T +template constexpr auto Inch2ToPixel2(T val) -> T { return val * (PrintDPI * PrintDPI); } //--------------------------------------------------------------------------------------------------------------------- -template constexpr inline auto Mm2ToPixel2(T val) -> T +template constexpr auto Mm2ToPixel2(T val) -> T { // There are 0.15500031 square inches in a square centimeter. return Inch2ToPixel2(val * 0.001550031); } //--------------------------------------------------------------------------------------------------------------------- -template constexpr inline auto Cm2ToPixel2(T val) -> T +template constexpr auto Cm2ToPixel2(T val) -> T { // There are 0.15500031 square inches in a square centimeter. return Inch2ToPixel2(val * 0.15500031); } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto ToPixel2(double val, const Unit &unit) -> double +constexpr auto ToPixel2(double val, const Unit &unit) -> double { switch (unit) { @@ -584,27 +584,27 @@ constexpr inline auto ToPixel2(double val, const Unit &unit) -> double } //--------------------------------------------------------------------------------------------------------------------- -template constexpr inline auto Pixel2ToInch2(T pix) -> T +template constexpr auto Pixel2ToInch2(T pix) -> T { return pix / (PrintDPI * PrintDPI); } //--------------------------------------------------------------------------------------------------------------------- -template constexpr inline auto Pixel2ToMm2(T pix) -> T +template constexpr auto Pixel2ToMm2(T pix) -> T { // There are 0.15500031 square inches in a square centimeter. return Pixel2ToInch2(pix) / 0.001550031; } //--------------------------------------------------------------------------------------------------------------------- -template constexpr inline auto Pixel2ToCm2(T pix) -> T +template constexpr auto Pixel2ToCm2(T pix) -> T { // There are 0.15500031 square inches in a square centimeter. return Pixel2ToInch2(pix) / 0.15500031; } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto FromPixel2(double pix, const Unit &unit) -> double +constexpr auto FromPixel2(double pix, const Unit &unit) -> double { switch (unit) { @@ -623,7 +623,7 @@ constexpr inline auto FromPixel2(double pix, const Unit &unit) -> double } //--------------------------------------------------------------------------------------------------------------------- -constexpr inline auto UnitConvertor(qreal value, const Unit &from, const Unit &to) -> qreal +constexpr auto UnitConvertor(qreal value, const Unit &from, const Unit &to) -> qreal { switch (from) { @@ -698,7 +698,7 @@ constexpr inline auto UnitConvertor(qreal value, const Unit &from, const Unit &t * @brief UnitConvertor Converts the values of the given margin from given unit to the new unit. * returns a new instand of QMarginsF. */ -constexpr inline auto UnitConvertor(const QMarginsF &margins, const Unit &from, const Unit &to) +constexpr auto UnitConvertor(const QMarginsF &margins, const Unit &from, const Unit &to) -> QMarginsF { const qreal left = UnitConvertor(margins.left(), from, to); diff --git a/src/libs/vmisc/projectversion.h b/src/libs/vmisc/projectversion.h index d1dd939b6..58f394083 100644 --- a/src/libs/vmisc/projectversion.h +++ b/src/libs/vmisc/projectversion.h @@ -37,12 +37,12 @@ constexpr unsigned DEBUG_VERSION = 52; auto AppVersionStr() -> const QString &; -constexpr inline auto FormatVersion(unsigned major, unsigned minor, unsigned patch) -> unsigned +constexpr auto FormatVersion(unsigned major, unsigned minor, unsigned patch) -> unsigned { return ((major << 16u) | (minor << 8u) | patch); } -constexpr inline auto AppVersion() -> unsigned +constexpr auto AppVersion() -> unsigned { return FormatVersion(MAJOR_VERSION, MINOR_VERSION, DEBUG_VERSION); } diff --git a/src/libs/vmisc/vmath.h b/src/libs/vmisc/vmath.h index cc4b90b3e..0656fbc58 100644 --- a/src/libs/vmisc/vmath.h +++ b/src/libs/vmisc/vmath.h @@ -51,7 +51,7 @@ #define M_EULER (0.57721566490153286060) #endif -template constexpr inline auto vRound(T d, int p) -> T +template constexpr auto vRound(T d, int p) -> T { return p > 0 ? qRound(d * (p * 10.0)) / (p * 10.0) : qRound(d); } #endif // VMATH_H