Deprecate multiplication and division of wxPoint2D objects

This doesn't make much sense, so deprecate these operator overloads in
preparation for removing them.
This commit is contained in:
Vadim Zeitlin
2024-06-13 14:02:20 +02:00
parent aefd52caef
commit 457d358ed7
2 changed files with 60 additions and 60 deletions
+60 -52
View File
@@ -61,10 +61,8 @@ public :
inline wxPoint2DInt& operator+=(const wxPoint2DInt& pt);
inline wxPoint2DInt& operator-=(const wxPoint2DInt& pt);
inline wxPoint2DInt& operator*=(const wxPoint2DInt& pt);
inline wxPoint2DInt& operator*=(wxDouble n);
inline wxPoint2DInt& operator*=(wxInt32 n);
inline wxPoint2DInt& operator/=(const wxPoint2DInt& pt);
inline wxPoint2DInt& operator/=(wxDouble n);
inline wxPoint2DInt& operator/=(wxInt32 n);
inline operator wxPoint() const;
@@ -82,11 +80,6 @@ public :
}
friend wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2)
{
return wxPoint2DInt( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y );
}
friend wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt)
{
return wxPoint2DInt( pt.m_x * n , pt.m_y * n );
@@ -109,11 +102,6 @@ public :
static_cast<wxInt32>(pt.m_y * n) );
}
friend wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2)
{
return wxPoint2DInt( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y );
}
friend wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n)
{
return wxPoint2DInt( pt.m_x / n , pt.m_y / n );
@@ -130,6 +118,36 @@ public :
void ReadFrom( wxDataInputStream &stream );
#endif // wxUSE_STREAMS
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("Multiplying points doesn't make sense")
wxPoint2DInt& operator*=(const wxPoint2DInt& pt)
{
m_x *= pt.m_x;
m_y *= pt.m_y;
return *this;
}
wxDEPRECATED_MSG("Multiplying points doesn't make sense")
friend wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2)
{
return wxPoint2DInt( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y );
}
wxDEPRECATED_MSG("Dividing points doesn't make sense")
inline wxPoint2DInt& operator/=(const wxPoint2DInt& pt)
{
m_x /= pt.m_x;
m_y /= pt.m_y;
return *this;
}
wxDEPRECATED_MSG("Dividing points doesn't make sense")
friend wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2)
{
return wxPoint2DInt( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y );
}
#endif // WXWIN_COMPATIBILITY_3_2
wxInt32 m_x = 0;
wxInt32 m_y = 0;
};
@@ -221,13 +239,6 @@ inline wxPoint2DInt& wxPoint2DInt::operator-=(const wxPoint2DInt& pt)
return *this;
}
inline wxPoint2DInt& wxPoint2DInt::operator*=(const wxPoint2DInt& pt)
{
m_x *= pt.m_x;
m_y *= pt.m_y;
return *this;
}
inline wxPoint2DInt& wxPoint2DInt::operator*=(wxDouble n)
{
m_x = wxRound(m_x * n);
@@ -242,13 +253,6 @@ inline wxPoint2DInt& wxPoint2DInt::operator*=(wxInt32 n)
return *this;
}
inline wxPoint2DInt& wxPoint2DInt::operator/=(const wxPoint2DInt& pt)
{
m_x /= pt.m_x;
m_y /= pt.m_y;
return *this;
}
inline wxPoint2DInt& wxPoint2DInt::operator/=(wxDouble n)
{
m_x = wxRound(m_x / n);
@@ -307,10 +311,8 @@ public :
inline wxPoint2DDouble& operator+=(const wxPoint2DDouble& pt);
inline wxPoint2DDouble& operator-=(const wxPoint2DDouble& pt);
inline wxPoint2DDouble& operator*=(const wxPoint2DDouble& pt);
inline wxPoint2DDouble& operator*=(wxDouble n);
inline wxPoint2DDouble& operator*=(wxInt32 n);
inline wxPoint2DDouble& operator/=(const wxPoint2DDouble& pt);
inline wxPoint2DDouble& operator/=(wxDouble n);
inline wxPoint2DDouble& operator/=(wxInt32 n);
@@ -328,11 +330,6 @@ public :
}
friend wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2)
{
return wxPoint2DDouble( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y );
}
friend wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt)
{
return wxPoint2DDouble( pt.m_x * n , pt.m_y * n );
@@ -353,11 +350,6 @@ public :
return wxPoint2DDouble( pt.m_x * n , pt.m_y * n );
}
friend wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2)
{
return wxPoint2DDouble( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y );
}
friend wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n)
{
return wxPoint2DDouble( pt.m_x / n , pt.m_y / n );
@@ -368,6 +360,36 @@ public :
return wxPoint2DDouble( pt.m_x / n , pt.m_y / n );
}
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("Multiplying points doesn't make sense")
inline wxPoint2DDouble& operator*=(const wxPoint2DDouble& pt)
{
m_x *= pt.m_x;
m_y *= pt.m_y;
return *this;
}
wxDEPRECATED_MSG("Multiplying points doesn't make sense")
friend wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2)
{
return wxPoint2DDouble( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y );
}
wxDEPRECATED_MSG("Dividing points doesn't make sense")
inline wxPoint2DDouble& operator/=(const wxPoint2DDouble& pt)
{
m_x /= pt.m_x;
m_y /= pt.m_y;
return *this;
}
wxDEPRECATED_MSG("Dividing points doesn't make sense")
friend wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2)
{
return wxPoint2DDouble( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y );
}
#endif // WXWIN_COMPATIBILITY_3_2
wxDouble m_x = 0.0;
wxDouble m_y = 0.0;
};
@@ -446,13 +468,6 @@ inline wxPoint2DDouble& wxPoint2DDouble::operator-=(const wxPoint2DDouble& pt)
return *this;
}
inline wxPoint2DDouble& wxPoint2DDouble::operator*=(const wxPoint2DDouble& pt)
{
m_x *= pt.m_x;
m_y *= pt.m_y;
return *this;
}
inline wxPoint2DDouble& wxPoint2DDouble::operator*=(wxDouble n)
{
m_x *= n;
@@ -467,13 +482,6 @@ inline wxPoint2DDouble& wxPoint2DDouble::operator*=(wxInt32 n)
return *this;
}
inline wxPoint2DDouble& wxPoint2DDouble::operator/=(const wxPoint2DDouble& pt)
{
m_x /= pt.m_x;
m_y /= pt.m_y;
return *this;
}
inline wxPoint2DDouble& wxPoint2DDouble::operator/=(wxDouble n)
{
m_x /= n;
-8
View File
@@ -46,10 +46,8 @@ public :
wxPoint2DInt& operator=(const wxPoint2DInt& pt);
wxPoint2DInt& operator+=(const wxPoint2DInt& pt);
wxPoint2DInt& operator-=(const wxPoint2DInt& pt);
wxPoint2DInt& operator*=(const wxPoint2DInt& pt);
wxPoint2DInt& operator*=(wxDouble n);
wxPoint2DInt& operator*=(wxInt32 n);
wxPoint2DInt& operator/=(const wxPoint2DInt& pt);
wxPoint2DInt& operator/=(wxDouble n);
wxPoint2DInt& operator/=(wxInt32 n);
operator wxPoint() const;
@@ -62,12 +60,10 @@ public :
wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2);
wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2);
wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2);
wxPoint2DInt operator*(wxDouble n , const wxPoint2DInt& pt);
wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt);
wxPoint2DInt operator*(const wxPoint2DInt& pt , wxDouble n);
wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n);
wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2);
wxPoint2DInt operator/(const wxPoint2DInt& pt , wxDouble n);
wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n);
@@ -105,10 +101,8 @@ public :
wxPoint2DDouble& operator=(const wxPoint2DDouble& pt);
wxPoint2DDouble& operator+=(const wxPoint2DDouble& pt);
wxPoint2DDouble& operator-=(const wxPoint2DDouble& pt);
wxPoint2DDouble& operator*=(const wxPoint2DDouble& pt);
wxPoint2DDouble& operator*=(wxDouble n);
wxPoint2DDouble& operator*=(wxInt32 n);
wxPoint2DDouble& operator/=(const wxPoint2DDouble& pt);
wxPoint2DDouble& operator/=(wxDouble n);
wxPoint2DDouble& operator/=(wxInt32 n);
@@ -121,12 +115,10 @@ public :
wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2);
wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2);
wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2);
wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt);
wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt);
wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n);
wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n);
wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2);
wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n);
wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n);