From 89698a727b145210dd10a3202a960b709d5406b4 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Sun, 2 Feb 2020 18:52:19 +0100 Subject: [PATCH] Removed const modifier for returned non-reference types --- include/class_board_item.h | 4 +++- include/origin_viewitem.h | 2 +- pcbnew/class_board.cpp | 2 +- pcbnew/class_board.h | 2 +- pcbnew/class_dimension.cpp | 2 +- pcbnew/class_dimension.h | 4 ++-- pcbnew/class_drawsegment.cpp | 8 ++++---- pcbnew/class_drawsegment.h | 8 +------- pcbnew/class_edge_mod.cpp | 2 +- pcbnew/class_edge_mod.h | 2 +- pcbnew/class_marker_pcb.h | 2 +- pcbnew/class_module.h | 2 +- pcbnew/class_pcb_target.h | 2 +- pcbnew/class_pcb_text.h | 2 +- pcbnew/class_text_mod.h | 2 +- pcbnew/class_track.h | 2 +- pcbnew/class_zone.cpp | 2 +- pcbnew/class_zone.h | 2 +- pcbnew/exporters/gendrill_Excellon_writer.h | 2 +- pcbnew/exporters/gendrill_file_writer_base.h | 2 +- pcbnew/netinfo.h | 2 +- 21 files changed, 27 insertions(+), 31 deletions(-) diff --git a/include/class_board_item.h b/include/class_board_item.h index 1c34eb0deb..0747c142b6 100644 --- a/include/class_board_item.h +++ b/include/class_board_item.h @@ -98,6 +98,8 @@ public: // Do not create a copy constructor & operator=. // The ones generated by the compiler are adequate. + virtual wxPoint GetPosition() const = 0; + /** * Function GetCenter() * @@ -106,7 +108,7 @@ public: * * @return centre point of the item */ - virtual const wxPoint GetCenter() const { return GetPosition(); } + virtual wxPoint GetCenter() const { return GetPosition(); } virtual void SetPosition( const wxPoint& aPos ) = 0; diff --git a/include/origin_viewitem.h b/include/origin_viewitem.h index 87393df676..cf96ab8f47 100644 --- a/include/origin_viewitem.h +++ b/include/origin_viewitem.h @@ -103,7 +103,7 @@ public: m_position = VECTOR2D( aPosition ); } - inline const wxPoint GetPosition() const override + inline wxPoint GetPosition() const override { return wxPoint( m_position.x, m_position.y ); } diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 001401a5a5..c7ad9410de 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -224,7 +224,7 @@ void BOARD::ClearProject() } -const wxPoint BOARD::GetPosition() const +wxPoint BOARD::GetPosition() const { return ZeroOffset; } diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 9b07ef4138..b5cef73ca0 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -305,7 +305,7 @@ public: BOARD(); ~BOARD(); - const wxPoint GetPosition() const override; + wxPoint GetPosition() const override; void SetPosition( const wxPoint& aPos ) override; bool IsEmpty() const diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index 47ac131860..faf3b5a34e 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -61,7 +61,7 @@ void DIMENSION::SetPosition( const wxPoint& aPos ) } -const wxPoint DIMENSION::GetPosition() const +wxPoint DIMENSION::GetPosition() const { return m_Text.GetTextPos(); } diff --git a/pcbnew/class_dimension.h b/pcbnew/class_dimension.h index 3725022f2c..64384e7c24 100644 --- a/pcbnew/class_dimension.h +++ b/pcbnew/class_dimension.h @@ -106,9 +106,9 @@ public: int GetValue() const { return m_Value; } - const wxPoint GetPosition() const override; + wxPoint GetPosition() const override; - void SetPosition( const wxPoint& aPos ) override; + void SetPosition( const wxPoint& aPos ) override; void SetTextSize( const wxSize& aTextSize ) { diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index 828539f675..8ae645c0b9 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -63,7 +63,7 @@ void DRAWSEGMENT::SetPosition( const wxPoint& aPos ) } -const wxPoint DRAWSEGMENT::GetPosition() const +wxPoint DRAWSEGMENT::GetPosition() const { if( m_Shape == S_POLYGON ) return (wxPoint) m_Poly.CVertex( 0 ); @@ -302,7 +302,7 @@ void DRAWSEGMENT::RebuildBezierToSegmentsPointsList( int aMinSegLen ) } -const wxPoint DRAWSEGMENT::GetCenter() const +wxPoint DRAWSEGMENT::GetCenter() const { wxPoint c; @@ -333,7 +333,7 @@ const wxPoint DRAWSEGMENT::GetCenter() const } -const wxPoint DRAWSEGMENT::GetArcEnd() const +wxPoint DRAWSEGMENT::GetArcEnd() const { wxPoint endPoint( m_End ); // start of arc @@ -355,7 +355,7 @@ const wxPoint DRAWSEGMENT::GetArcEnd() const } -const wxPoint DRAWSEGMENT::GetArcMid() const +wxPoint DRAWSEGMENT::GetArcMid() const { wxPoint endPoint( m_End ); diff --git a/pcbnew/class_drawsegment.h b/pcbnew/class_drawsegment.h index a6c8a21a13..6f42f41a3d 100644 --- a/pcbnew/class_drawsegment.h +++ b/pcbnew/class_drawsegment.h @@ -122,7 +122,7 @@ public: const wxPoint& GetBezControl2() const { return m_BezierC2; } void SetPosition( const wxPoint& aPos ) override; - const wxPoint GetPosition() const override; + wxPoint GetPosition() const override; /** * Function GetStart @@ -150,7 +150,6 @@ public: const wxPoint& GetArcStart() const { return m_End; } const wxPoint GetArcEnd() const; const wxPoint GetArcMid() const; - void GetRectCorners( std::vector* pts ) const; /** * function GetArcAngleStart() @@ -182,11 +181,6 @@ public: */ void SetCenter( const wxPoint& aCenterPoint ) { m_Start = aCenterPoint; } - const wxPoint GetFocusPosition() const override - { - return GetCenter(); - } - /** * Function GetParentModule * returns a pointer to the parent module, or NULL if DRAWSEGMENT does not diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index 568442eae3..816bc1e993 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -207,7 +207,7 @@ bool EDGE_MODULE::IsParentFlipped() const return false; } -void EDGE_MODULE::Mirror( wxPoint aCentre, bool aMirrorAroundXAxis ) +void EDGE_MODULE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis ) { // Mirror an edge of the footprint. the layer is not modified // This is a footprint shape modification. diff --git a/pcbnew/class_edge_mod.h b/pcbnew/class_edge_mod.h index e80a530994..5484e6f109 100644 --- a/pcbnew/class_edge_mod.h +++ b/pcbnew/class_edge_mod.h @@ -85,7 +85,7 @@ public: * This is a footprint shape modification. * (should be only called by a footprint editing function) */ - void Mirror( const wxPoint aCentre, bool aMirrorAroundXAxis ); + void Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis ); /** * Rotate an edge of the footprint. diff --git a/pcbnew/class_marker_pcb.h b/pcbnew/class_marker_pcb.h index 2e37e5f2c5..9329fd5afd 100644 --- a/pcbnew/class_marker_pcb.h +++ b/pcbnew/class_marker_pcb.h @@ -68,7 +68,7 @@ public: void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; - const wxPoint GetPosition() const override { return m_Pos; } + wxPoint GetPosition() const override { return m_Pos; } void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; } bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 3b257dd3c9..6fa4cfa3e7 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -203,7 +203,7 @@ public: void SetPosition( const wxPoint& aPos ) override; - const wxPoint GetPosition() const override { return m_Pos; } + wxPoint GetPosition() const override { return m_Pos; } void SetOrientation( double newangle ); diff --git a/pcbnew/class_pcb_target.h b/pcbnew/class_pcb_target.h index 3882317377..868b0a5ee7 100644 --- a/pcbnew/class_pcb_target.h +++ b/pcbnew/class_pcb_target.h @@ -63,7 +63,7 @@ public: } void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; } - const wxPoint GetPosition() const override { return m_Pos; } + wxPoint GetPosition() const override { return m_Pos; } void SetShape( int aShape ) { m_Shape = aShape; } int GetShape() const { return m_Shape; } diff --git a/pcbnew/class_pcb_text.h b/pcbnew/class_pcb_text.h index dc9a1667bd..5924d7b20a 100644 --- a/pcbnew/class_pcb_text.h +++ b/pcbnew/class_pcb_text.h @@ -74,7 +74,7 @@ public: return BOARD_ITEM::Matches( GetShownText(), aSearchData ); } - virtual const wxPoint GetPosition() const override + virtual wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); } diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index 22e7ba540d..8b3df9e9d6 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -93,7 +93,7 @@ public: return BOARD_ITEM::Matches( GetShownText(), aSearchData ); } - virtual const wxPoint GetPosition() const override + virtual wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); } diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 6b6a401570..26c14b0a3f 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -105,7 +105,7 @@ public: void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; void SetPosition( const wxPoint& aPos ) override { m_Start = aPos; } - const wxPoint GetPosition() const override { return m_Start; } + wxPoint GetPosition() const override { return m_Start; } const wxPoint GetFocusPosition() const override { return ( m_Start + m_End ) / 2; } void SetWidth( int aWidth ) { m_Width = aWidth; } diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index e7a07e0fb6..e8431151e5 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -227,7 +227,7 @@ bool ZONE_CONTAINER::UnFill() } -const wxPoint ZONE_CONTAINER::GetPosition() const +wxPoint ZONE_CONTAINER::GetPosition() const { return (wxPoint) GetCornerPosition( 0 ); } diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 7e8a35e6b2..b169f0fa67 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -85,7 +85,7 @@ public: /** * @return a wxPoint, position of the first point of the outline */ - const wxPoint GetPosition() const override; + wxPoint GetPosition() const override; void SetPosition( const wxPoint& aPos ) override {} /** diff --git a/pcbnew/exporters/gendrill_Excellon_writer.h b/pcbnew/exporters/gendrill_Excellon_writer.h index d7145d9dbe..0497484109 100644 --- a/pcbnew/exporters/gendrill_Excellon_writer.h +++ b/pcbnew/exporters/gendrill_Excellon_writer.h @@ -62,7 +62,7 @@ public: * Return the plot offset (usually the position * of the auxiliary axis */ - const wxPoint GetOffset() { return m_offset; } + wxPoint GetOffset() { return m_offset; } /** * diff --git a/pcbnew/exporters/gendrill_file_writer_base.h b/pcbnew/exporters/gendrill_file_writer_base.h index ff3a72f216..de3a461522 100644 --- a/pcbnew/exporters/gendrill_file_writer_base.h +++ b/pcbnew/exporters/gendrill_file_writer_base.h @@ -179,7 +179,7 @@ public: * Return the plot offset (usually the position * of the auxiliary axis */ - const wxPoint GetOffset() { return m_offset; } + wxPoint GetOffset() { return m_offset; } /** * Sets the page info used to plot drill maps diff --git a/pcbnew/netinfo.h b/pcbnew/netinfo.h index 4731b7a245..fdeb8a8d66 100644 --- a/pcbnew/netinfo.h +++ b/pcbnew/netinfo.h @@ -103,7 +103,7 @@ public: } #endif - const wxPoint GetPosition() const override + wxPoint GetPosition() const override { static wxPoint dummy(0, 0); return dummy;