From 2110bb2730292839864b6512cce72006d0ce0296 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 18 Oct 2020 18:00:05 -0700 Subject: [PATCH] Remove some unnecessary ctor/operator= definitions --- include/wx/geometry.h | 49 +++--------------------------------- include/wx/osx/core/colour.h | 2 -- src/common/geometry.cpp | 9 ------- src/osx/core/colour.cpp | 7 ------ 4 files changed, 3 insertions(+), 64 deletions(-) diff --git a/include/wx/geometry.h b/include/wx/geometry.h index 95347c355a..7865fb0cd0 100644 --- a/include/wx/geometry.h +++ b/include/wx/geometry.h @@ -38,8 +38,8 @@ class WXDLLIMPEXP_CORE wxPoint2DInt public : inline wxPoint2DInt(); inline wxPoint2DInt( wxInt32 x , wxInt32 y ); - inline wxPoint2DInt( const wxPoint2DInt &pt ); inline wxPoint2DInt( const wxPoint &pt ); + // default copy ctor and copy-assign operator are OK // noops for this class, just return the coords inline void GetFloor( wxInt32 *x , wxInt32 *y ) const; @@ -60,7 +60,6 @@ public : // the reflection of this point inline wxPoint2DInt operator-(); - inline wxPoint2DInt& operator=(const wxPoint2DInt& pt); inline wxPoint2DInt& operator+=(const wxPoint2DInt& pt); inline wxPoint2DInt& operator-=(const wxPoint2DInt& pt); inline wxPoint2DInt& operator*=(const wxPoint2DInt& pt); @@ -105,12 +104,6 @@ inline wxPoint2DInt::wxPoint2DInt( wxInt32 x , wxInt32 y ) m_y = y; } -inline wxPoint2DInt::wxPoint2DInt( const wxPoint2DInt &pt ) -{ - m_x = pt.m_x; - m_y = pt.m_y; -} - inline wxPoint2DInt::wxPoint2DInt( const wxPoint &pt ) { m_x = pt.x; @@ -179,16 +172,6 @@ inline wxPoint2DInt wxPoint2DInt::operator-() return wxPoint2DInt( -m_x, -m_y); } -inline wxPoint2DInt& wxPoint2DInt::operator=(const wxPoint2DInt& pt) -{ - if (this != &pt) - { - m_x = pt.m_x; - m_y = pt.m_y; - } - return *this; -} - inline wxPoint2DInt& wxPoint2DInt::operator+=(const wxPoint2DInt& pt) { m_x = m_x + pt.m_x; @@ -288,11 +271,11 @@ class WXDLLIMPEXP_CORE wxPoint2DDouble public : inline wxPoint2DDouble(); inline wxPoint2DDouble( wxDouble x , wxDouble y ); - inline wxPoint2DDouble( const wxPoint2DDouble &pt ); wxPoint2DDouble( const wxPoint2DInt &pt ) { m_x = (wxDouble) pt.m_x ; m_y = (wxDouble) pt.m_y ; } wxPoint2DDouble( const wxPoint &pt ) { m_x = (wxDouble) pt.x ; m_y = (wxDouble) pt.y ; } + // default copy ctor and copy-assign operator are OK // two different conversions to integers, floor and rounding inline void GetFloor( wxInt32 *x , wxInt32 *y ) const; @@ -313,7 +296,6 @@ public : // the reflection of this point inline wxPoint2DDouble operator-(); - inline wxPoint2DDouble& operator=(const wxPoint2DDouble& pt); inline wxPoint2DDouble& operator+=(const wxPoint2DDouble& pt); inline wxPoint2DDouble& operator-=(const wxPoint2DDouble& pt); inline wxPoint2DDouble& operator*=(const wxPoint2DDouble& pt); @@ -353,12 +335,6 @@ inline wxPoint2DDouble::wxPoint2DDouble( wxDouble x , wxDouble y ) m_y = y; } -inline wxPoint2DDouble::wxPoint2DDouble( const wxPoint2DDouble &pt ) -{ - m_x = pt.m_x; - m_y = pt.m_y; -} - inline void wxPoint2DDouble::GetFloor( wxInt32 *x , wxInt32 *y ) const { *x = (wxInt32) floor( m_x ); @@ -413,16 +389,6 @@ inline wxPoint2DDouble wxPoint2DDouble::operator-() return wxPoint2DDouble( -m_x, -m_y); } -inline wxPoint2DDouble& wxPoint2DDouble::operator=(const wxPoint2DDouble& pt) -{ - if (this != &pt) - { - m_x = pt.m_x; - m_y = pt.m_y; - } - return *this; -} - inline wxPoint2DDouble& wxPoint2DDouble::operator+=(const wxPoint2DDouble& pt) { m_x = m_x + pt.m_x; @@ -654,7 +620,7 @@ public: wxRect2DInt(wxInt32 x, wxInt32 y, wxInt32 w, wxInt32 h) { m_x = x; m_y = y; m_width = w; m_height = h; } wxRect2DInt(const wxPoint2DInt& topLeft, const wxPoint2DInt& bottomRight); inline wxRect2DInt(const wxPoint2DInt& pos, const wxSize& size); - inline wxRect2DInt(const wxRect2DInt& rect); + // default copy ctor and copy-assign operator are OK // single attribute accessors @@ -731,7 +697,6 @@ public: { m_x *= ((wxInt32)num)/((wxInt32)denum); m_y *= ((wxInt32)num)/((wxInt32)denum); m_width *= ((wxInt32)num)/((wxInt32)denum); m_height *= ((wxInt32)num)/((wxInt32)denum);} - wxRect2DInt& operator = (const wxRect2DInt& rect); bool operator == (const wxRect2DInt& rect) const; bool operator != (const wxRect2DInt& rect) const; @@ -746,14 +711,6 @@ public: wxInt32 m_height; }; -inline wxRect2DInt::wxRect2DInt( const wxRect2DInt &r ) -{ - m_x = r.m_x; - m_y = r.m_y; - m_width = r.m_width; - m_height = r.m_height; -} - inline wxRect2DInt::wxRect2DInt( const wxPoint2DInt &a , const wxPoint2DInt &b) { m_x = wxMin( a.m_x , b.m_x ); diff --git a/include/wx/osx/core/colour.h b/include/wx/osx/core/colour.h index c8e0bde26e..6d2f37c902 100644 --- a/include/wx/osx/core/colour.h +++ b/include/wx/osx/core/colour.h @@ -36,8 +36,6 @@ public: virtual bool IsSolid() const wxOVERRIDE; - wxColour& operator=(const wxColour& col); - // comparison bool operator == (const wxColour& colour) const; bool operator != (const wxColour& colour) const { return !(*this == colour); } diff --git a/src/common/geometry.cpp b/src/common/geometry.cpp index 54136da69a..324e4f0302 100644 --- a/src/common/geometry.cpp +++ b/src/common/geometry.cpp @@ -322,15 +322,6 @@ void wxRect2DInt::ConstrainTo( const wxRect2DInt &rect ) SetTop( rect.GetTop() ); } -wxRect2DInt& wxRect2DInt::operator=( const wxRect2DInt &r ) -{ - m_x = r.m_x; - m_y = r.m_y; - m_width = r.m_width; - m_height = r.m_height; - return *this; -} - #if wxUSE_STREAMS void wxRect2DInt::WriteTo( wxDataOutputStream &stream ) const { diff --git a/src/osx/core/colour.cpp b/src/osx/core/colour.cpp index 46ceffae2b..f3ecd7c624 100644 --- a/src/osx/core/colour.cpp +++ b/src/osx/core/colour.cpp @@ -235,13 +235,6 @@ void wxColour::InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType m_refData = new wxCGColorRefData(components); } -wxColour& wxColour::operator=(const wxColour& col) -{ - wxObject::operator=(col); - - return *this; -} - bool wxColour::operator==(const wxColour& other) const { if (m_refData == other.m_refData)