From 8e912f524529622b4bbfcbf9c92bd1a368a8c6e2 Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 1 Jun 2014 11:32:39 +0300 Subject: [PATCH] Clang's warnings. --HG-- branch : develop --- src/app/app.pro | 1 - src/app/geometry/vspline.cpp | 115 +++++++++++++++- src/app/geometry/vspline.h | 249 ++++++++++------------------------- src/libs/qmuparser/stable.h | 2 + 4 files changed, 186 insertions(+), 181 deletions(-) diff --git a/src/app/app.pro b/src/app/app.pro index 00bed2a59..762612a05 100644 --- a/src/app/app.pro +++ b/src/app/app.pro @@ -468,7 +468,6 @@ CONFIG(debug, debug|release){ -Wunnamed-type-template-args \ -Wunneeded-internal-declaration \ -Wunneeded-member-function \ --Wunreachable-code \ -Wunsequenced \ -Wunsupported-visibility \ -Wunused \ diff --git a/src/app/geometry/vspline.cpp b/src/app/geometry/vspline.cpp index ad568b37c..b06936f28 100644 --- a/src/app/geometry/vspline.cpp +++ b/src/app/geometry/vspline.cpp @@ -27,16 +27,23 @@ *************************************************************************/ #include "vspline.h" - +#include #include //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief VSpline default constructor + */ VSpline::VSpline() :VGObject(GObject::Spline), p1(VPointF()), p2(QPointF()), p3(QPointF()), p4(VPointF()), angle1(0), angle2(0), kAsm1(1), kAsm2(1), kCurve(1) {} //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief VSpline constructor. + * @param spline spline from which the copy. + */ VSpline::VSpline ( const VSpline & spline ) :VGObject(spline), p1(spline.GetP1 ()), p2(spline.GetP2 ()), p3(spline.GetP3 ()), p4(spline.GetP4 ()), angle1(spline.GetAngle1 ()), angle2(spline.GetAngle2 ()), kAsm1(spline.GetKasm1()), kAsm2(spline.GetKasm2()), @@ -44,6 +51,16 @@ VSpline::VSpline ( const VSpline & spline ) {} //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief VSpline constructor. + * @param p1 first point spline. + * @param p4 last point spline. + * @param angle1 angle from first point to first control point. + * @param angle2 angle from second point to second control point. + * @param kCurve coefficient of curvature spline. + * @param kAsm1 coefficient of length first control line. + * @param kAsm2 coefficient of length second control line. + */ VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve, quint32 idObject, Valentina::Draws mode) :VGObject(GObject::Spline, idObject, mode), p1(p1), p2(QPointF()), p3(QPointF()), p4(p4), angle1(angle1), @@ -73,6 +90,13 @@ VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm } //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief VSpline constructor. + * @param p1 first point spline. + * @param p2 first control point. + * @param p3 second control point. + * @param p4 second point spline. + */ VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject, Valentina::Draws mode) :VGObject(GObject::Spline, idObject, mode), p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), kAsm2(1), kCurve(1) @@ -98,18 +122,32 @@ VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, } //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetLength return length of spline. + * @return length. + */ qreal VSpline::GetLength () const { return LengthBezier ( GetP1().toQPointF(), this->p2, this->p3, GetP4().toQPointF()); } //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief name return spline name. Used for variables. + * @return name. + */ QString VSpline::name() const { return _name; } //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief CrossingSplLine check intersection spline with line. + * @param line line. + * @param intersectionPoint intersection point. + * @return result intersection. + */ // cppcheck-suppress unusedFunction QLineF::IntersectType VSpline::CrossingSplLine ( const QLineF &line, QPointF *intersectionPoint ) const { @@ -176,6 +214,16 @@ qreal VSpline::LengthT(qreal t) const } //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief CutSpline cut spline. GetPointP1() of base spline will return first point for first spline, GetPointP4() + * of base spline will return forth point of second spline. + * @param length length first spline + * @param spl1p2 second point of first spline + * @param spl1p3 third point of first spline + * @param spl2p2 second point of second spline + * @param spl2p3 third point of second spline + * @return point of cutting. This point is forth point of first spline and first point of second spline. + */ QPointF VSpline::CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3 ) const { //Always need return two splines, so we must correct wrong length. @@ -236,12 +284,24 @@ QPointF VSpline::CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPo } //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetPoints return list with spline points. + * @return list of points. + */ QVector VSpline::GetPoints () const { return GetPoints(GetP1().toQPointF(), p2, p3, GetP4().toQPointF()); } //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetPoints return list with spline points. + * @param p1 first spline point. + * @param p2 first control point. + * @param p3 second control point. + * @param p4 last spline point. + * @return list of points. + */ QVector VSpline::GetPoints (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4) { QVector pvector; @@ -263,6 +323,14 @@ QVector VSpline::GetPoints (const QPointF &p1, const QPointF &p2, const } //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief LengthBezier return spline length using 4 spline point. + * @param p1 first spline point + * @param p2 first control point. + * @param p3 second control point. + * @param p4 last spline point. + * @return length. + */ qreal VSpline::LengthBezier ( const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 ) const { QPainterPath splinePath; @@ -276,6 +344,20 @@ qreal VSpline::LengthBezier ( const QPointF &p1, const QPointF &p2, const QPoint } //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief PointBezier_r find spline point using four point of spline. + * @param x1 х coordinate first point. + * @param y1 у coordinate first point. + * @param x2 х coordinate first control point. + * @param y2 у coordinate first control point. + * @param x3 х coordinate second control point. + * @param y3 у coordinate second control point. + * @param x4 х coordinate last point. + * @param y4 у coordinate last point. + * @param level level of recursion. In the begin 0. + * @param px list х coordinat spline points. + * @param py list у coordinat spline points. + */ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4, qint16 level, QVector &px, QVector &py) @@ -555,6 +637,14 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, } //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief CalcSqDistance calculate squared distance. + * @param x1 х coordinate first point. + * @param y1 у coordinate first point. + * @param x2 х coordinate second point. + * @param y2 у coordinate second point. + * @return squared length. + */ qreal VSpline::CalcSqDistance (qreal x1, qreal y1, qreal x2, qreal y2) { qreal dx = x2 - x1; @@ -563,12 +653,19 @@ qreal VSpline::CalcSqDistance (qreal x1, qreal y1, qreal x2, qreal y2) } //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief CreateName create spline name. + */ void VSpline::CreateName() { _name = QString(spl_+"%1_%2").arg(this->GetP1().name(), this->GetP4().name()); } //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetPath return QPainterPath for this spline. + * @return path. + */ QPainterPath VSpline::GetPath() const { QPainterPath splinePath; @@ -589,6 +686,17 @@ QPainterPath VSpline::GetPath() const } //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief SplinePoints return list with spline points. + * @param p1 first spline point. + * @param p4 last spline point. + * @param angle1 angle from first point to first control point. + * @param angle2 angle from second point to second control point. + * @param kAsm1 coefficient of length first control line. + * @param kAsm2 coefficient of length second control line. + * @param kCurve coefficient of curvature spline. + * @return list with spline points. + */ // cppcheck-suppress unusedFunction QVector VSpline::SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve) @@ -608,6 +716,11 @@ QVector VSpline::SplinePoints(const QPointF &p1, const QPointF &p4, qre } //--------------------------------------------------------------------------------------------------------------------- +/** + * @brief operator = assignmeant operator + * @param spl spline + * @return spline + */ VSpline &VSpline::operator =(const VSpline &spline) { VGObject::operator=(spline); diff --git a/src/app/geometry/vspline.h b/src/app/geometry/vspline.h index df47ebaa2..5fb8f1659 100644 --- a/src/app/geometry/vspline.h +++ b/src/app/geometry/vspline.h @@ -46,263 +46,154 @@ class QString; class VSpline :public VGObject { public: - /** - * @brief VSpline default constructor - */ VSpline(); - /** - * @brief VSpline constructor. - * @param spline spline from which the copy. - */ VSpline (const VSpline &spline ); - /** - * @brief VSpline constructor. - * @param p1 first point spline. - * @param p4 last point spline. - * @param angle1 angle from first point to first control point. - * @param angle2 angle from second point to second control point. - * @param kCurve coefficient of curvature spline. - * @param kAsm1 coefficient of length first control line. - * @param kAsm2 coefficient of length second control line. - */ VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve, quint32 idObject = 0, Valentina::Draws mode = Valentina::Calculation); - /** - * @brief VSpline constructor. - * @param p1 first point spline. - * @param p2 first control point. - * @param p3 second control point. - * @param p4 second point spline. - */ VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject = 0, Valentina::Draws mode = Valentina::Calculation); - /** - * @brief GetP1 return first spline point. - * @return first point. - */ - VPointF GetP1 () const {return p1;} - /** - * @brief GetP2 return first control point. - * @return first control point. - */ + VPointF GetP1 () const; QPointF GetP2 () const; - /** - * @brief GetP3 return second control point. - * @return second control point. - */ QPointF GetP3 () const; - /** - * @brief GetP4 return last spline point. - * @return остання точка сплайну. - */ VPointF GetP4 () const; - /** - * @brief GetAngle1 return first angle control line. - * @return angle. - */ qreal GetAngle1 () const; - /** - * @brief GetAngle2 return second angle control line. - * @return angle. - */ qreal GetAngle2() const; - /** - * @brief GetLength return length of spline. - * @return length. - */ qreal GetLength () const; - /** - * @brief name return spline name. Used for variables. - * @return name. - */ QString name () const; - /** - * @brief GetKasm1 return coefficient of length first control line. - * @return coefficient. - */ qreal GetKasm1() const; - /** - * @brief GetKasm2 return coefficient of length second control line. - * @return coefficient. - */ qreal GetKasm2() const; - /** - * @brief GetKcurve return coefficient of curvature spline. - * @return coefficient - */ qreal GetKcurve() const; - /** - * @brief CrossingSplLine check intersection spline with line. - * @param line line. - * @param intersectionPoint intersection point. - * @return result intersection. - */ // cppcheck-suppress unusedFunction QLineF::IntersectType CrossingSplLine(const QLineF &line, QPointF *intersectionPoint ) const; qreal LengthT(qreal t) const; - /** - * @brief CutSpline cut spline. GetPointP1() of base spline will return first point for first spline, GetPointP4() - * of base spline will return forth point of second spline. - * @param length length first spline - * @param spl1p2 second point of first spline - * @param spl1p3 third point of first spline - * @param spl2p2 second point of second spline - * @param spl2p3 third point of second spline - * @return point of cutting. This point is forth point of first spline and first point of second spline. - */ QPointF CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3) const; - /** - * @brief GetPoints return list with spline points. - * @return list of points. - */ QVector GetPoints () const; - /** - * @brief GetPath return QPainterPath for this spline. - * @return path. - */ - QPainterPath GetPath() const; - /** - * @brief SplinePoints return list with spline points. - * @param p1 first spline point. - * @param p4 last spline point. - * @param angle1 angle from first point to first control point. - * @param angle2 angle from second point to second control point. - * @param kAsm1 coefficient of length first control line. - * @param kAsm2 coefficient of length second control line. - * @param kCurve coefficient of curvature spline. - * @return - */ + QPainterPath GetPath() const; // cppcheck-suppress unusedFunction static QVector SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve); - /** - * @brief operator = assignmeant operator - * @param spl spline - * @return spline - */ - VSpline &operator=(const VSpline &spl); + VSpline &operator=(const VSpline &spl); protected: - /** - * @brief GetPoints return list with spline points. - * @param p1 first spline point. - * @param p2 first control point. - * @param p3 second control point. - * @param p4 last spline point. - * @return list of points. - */ static QVector GetPoints (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 ); private: - /** - * @brief p1 first spline point. - */ + /** @brief p1 first spline point. */ VPointF p1; - /** - * @brief p2 first control point. - */ + + /** @brief p2 first control point. */ QPointF p2; - /** - * @brief p3 second control point. - */ + + /** @brief p3 second control point. */ QPointF p3; - /** - * @brief p4 last spline point. - */ + + /** @brief p4 last spline point. */ VPointF p4; - /** - * @brief angle1 first angle control line. - */ + + /** @brief angle1 first angle control line. */ qreal angle1; - /** - * @brief angle2 second angle control line. - */ + + /** @brief angle2 second angle control line. */ qreal angle2; - /** - * @brief kAsm1 coefficient of length first control line. - */ + + /** @brief kAsm1 coefficient of length first control line. */ qreal kAsm1; - /** - * @brief kAsm2 coefficient of length second control line. - */ + + /** @brief kAsm2 coefficient of length second control line. */ qreal kAsm2; - /** - * @brief kCurve coefficient of curvature spline. - */ + + /** @brief kCurve coefficient of curvature spline. */ qreal kCurve; - /** - * @brief LengthBezier return spline length using 4 spline point. - * @param p1 first spline point - * @param p2 first control point. - * @param p3 second control point. - * @param p4 last spline point. - * @return length. - */ qreal LengthBezier (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 ) const; - /** - * @brief PointBezier_r find spline point using four point of spline. - * @param x1 х coordinate first point. - * @param y1 у coordinate first point. - * @param x2 х coordinate first control point. - * @param y2 у coordinate first control point. - * @param x3 х coordinate second control point. - * @param y3 у coordinate second control point. - * @param x4 х coordinate last point. - * @param y4 у coordinate last point. - * @param level level of recursion. In the begin 0. - * @param px list х coordinat spline points. - * @param py list у coordinat spline points. - */ static void PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4, qint16 level, QVector &px, QVector &py); - /** - * @brief CalcSqDistance calculate squared distance. - * @param x1 х coordinate first point. - * @param y1 у coordinate first point. - * @param x2 х coordinate second point. - * @param y2 у coordinate second point. - * @return squared length. - */ static qreal CalcSqDistance ( qreal x1, qreal y1, qreal x2, qreal y2); - /** - * @brief CreateName create spline name. - */ void CreateName(); }; +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetP1 return first spline point. + * @return first point. + */ +inline VPointF VSpline::GetP1() const +{ + return p1; +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetP2 return first control point. + * @return first control point. + */ inline QPointF VSpline::GetP2() const { return p2; } +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetP3 return second control point. + * @return second control point. + */ inline QPointF VSpline::GetP3() const { return p3; } +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetP4 return last spline point. + * @return остання точка сплайну. + */ inline VPointF VSpline::GetP4() const { return p4; } +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetAngle1 return first angle control line. + * @return angle. + */ inline qreal VSpline::GetAngle1() const { return angle1; } +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetAngle2 return second angle control line. + * @return angle. + */ inline qreal VSpline::GetAngle2() const { return angle2; } +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetKasm1 return coefficient of length first control line. + * @return coefficient. + */ inline qreal VSpline::GetKasm1() const { return kAsm1; } +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetKasm2 return coefficient of length second control line. + * @return coefficient. + */ inline qreal VSpline::GetKasm2() const { return kAsm2; } +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetKcurve return coefficient of curvature spline. + * @return coefficient + */ inline qreal VSpline::GetKcurve() const { return kCurve; diff --git a/src/libs/qmuparser/stable.h b/src/libs/qmuparser/stable.h index 824fb3b9d..f40e7a994 100644 --- a/src/libs/qmuparser/stable.h +++ b/src/libs/qmuparser/stable.h @@ -30,7 +30,9 @@ #define STABLE_H /* I like to include this pragma too, so the build log indicates if pre-compiled headers were in use. */ +#ifndef __clang__ #pragma message("Compiling precompiled headers for QmuParser library.\n") +#endif /* Add C includes here */