Refactoring.

A "constexpr" function should not be declared "inline".
This commit is contained in:
Roman Telezhynskyi 2024-04-17 11:46:37 +03:00
parent 47a589c8d8
commit 8063645cf6
8 changed files with 66 additions and 66 deletions

View File

@ -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

View File

@ -33,7 +33,7 @@
namespace
{
//---------------------------------------------------------------------------------------------------------------------
constexpr inline auto Square(QSizeF size) -> qint64
constexpr auto Square(QSizeF size) -> qint64
{
return static_cast<qint64>(size.width() * size.height());
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -471,25 +471,25 @@ auto QPixmapFromCache(const QString &pixmapPath) -> QPixmap;
void SetItemOverrideCursor(QGraphicsItem *item, const QString &pixmapPath, int hotX = -1, int hotY = -1);
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto MmToPixel(T val) noexcept -> T
template <typename T> constexpr auto MmToPixel(T val) noexcept -> T
{
return (val / 25.4) * PrintDPI;
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto CmToPixel(T val) noexcept -> T
template <typename T> constexpr auto CmToPixel(T val) noexcept -> T
{
return ((val * 10.0) / 25.4) * PrintDPI;
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto InchToPixel(T val) noexcept -> T
template <typename T> 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 <typename T> constexpr inline auto PixelToInch(T pix) -> T
template <typename T> constexpr auto PixelToInch(T pix) -> T
{
return pix / PrintDPI;
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto PixelToMm(T pix) -> T
template <typename T> constexpr auto PixelToMm(T pix) -> T
{
return PixelToInch(pix) * 25.4;
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto PixelToCm(T pix) -> T
template <typename T> 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 <typename T> constexpr inline auto Inch2ToPixel2(T val) -> T
template <typename T> constexpr auto Inch2ToPixel2(T val) -> T
{
return val * (PrintDPI * PrintDPI);
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto Mm2ToPixel2(T val) -> T
template <typename T> constexpr auto Mm2ToPixel2(T val) -> T
{
// There are 0.15500031 square inches in a square centimeter.
return Inch2ToPixel2(val * 0.001550031);
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto Cm2ToPixel2(T val) -> T
template <typename T> 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 <typename T> constexpr inline auto Pixel2ToInch2(T pix) -> T
template <typename T> constexpr auto Pixel2ToInch2(T pix) -> T
{
return pix / (PrintDPI * PrintDPI);
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto Pixel2ToMm2(T pix) -> T
template <typename T> constexpr auto Pixel2ToMm2(T pix) -> T
{
// There are 0.15500031 square inches in a square centimeter.
return Pixel2ToInch2(pix) / 0.001550031;
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> constexpr inline auto Pixel2ToCm2(T pix) -> T
template <typename T> 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);

View File

@ -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);
}

View File

@ -51,7 +51,7 @@
#define M_EULER (0.57721566490153286060)
#endif
template <typename T> constexpr inline auto vRound(T d, int p) -> T
template <typename T> constexpr auto vRound(T d, int p) -> T
{ return p > 0 ? qRound(d * (p * 10.0)) / (p * 10.0) : qRound(d); }
#endif // VMATH_H