From 5cc2abaa2b2a7f875cedd5bc673cb628204745f1 Mon Sep 17 00:00:00 2001 From: John Beard Date: Sun, 22 Jan 2017 04:19:46 +0800 Subject: [PATCH] Tidy consts for class D_PAD Some accessors should be const: * IsFlipped * GetRoundRectRadiusRatio Returning a objects by value as const in these cases is not helpful, as all it does is prevent the caller moving from the return value, it just forces a copy. Some of thse functions come from base class overrides, those haven't been changed. * ShapePos * GetPadName * GetPackedPadName --- pcbnew/class_pad.cpp | 6 +++--- pcbnew/class_pad.h | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index cab53dbda6..d4822f71f9 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -120,7 +120,7 @@ LSET D_PAD::UnplatedHoleMask() return saved; } -bool D_PAD::IsFlipped() +bool D_PAD::IsFlipped() const { if( GetParent() && GetParent()->GetLayer() == B_Cu ) return true; @@ -363,7 +363,7 @@ void D_PAD::AppendConfigs( PARAM_CFG_ARRAY* aResult ) // Returns the position of the pad. -const wxPoint D_PAD::ShapePos() const +wxPoint D_PAD::ShapePos() const { if( m_Offset.x == 0 && m_Offset.y == 0 ) return m_Pos; @@ -378,7 +378,7 @@ const wxPoint D_PAD::ShapePos() const } -const wxString D_PAD::GetPadName() const +wxString D_PAD::GetPadName() const { wxString name; diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index c4689630fb..6072fec054 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -111,7 +111,7 @@ public: * @return true if the pad has a footprint parent flipped * (on the back/bottom layer) */ - bool IsFlipped(); + bool IsFlipped() const; /** * Set the pad name (sometimes called pad number, although @@ -124,7 +124,7 @@ public: * @return the pad name * the pad name is limited to 4 ASCII chars */ - const wxString GetPadName() const; + wxString GetPadName() const; /** * @return the pad name in a wxUint32 which is possible @@ -132,7 +132,7 @@ public: * The packed pad name should be used only to compare 2 * pad names, not to try to print this name */ - const wxUint32 GetPackedPadName() const { return m_NumPadName; } + wxUint32 GetPackedPadName() const { return m_NumPadName; } /** * Function IncrementPadName @@ -430,7 +430,7 @@ public: return m_boundingRadius; } - const wxPoint ShapePos() const; + wxPoint ShapePos() const; /** * has meaning only for rounded rect pads @@ -439,7 +439,7 @@ public: * Cannot be > 0.5 * the normalized IPC-7351C value is 0.25 */ - double GetRoundRectRadiusRatio() + double GetRoundRectRadiusRatio() const { return m_padRoundRectRadiusScale; }