Make wxFindReplaceData argument const

This commit is contained in:
Dominik Wernberger 2020-12-20 19:27:51 +01:00 committed by Seth Hillbrand
parent bb2881a5ab
commit ec0af24f13
18 changed files with 29 additions and 29 deletions

View File

@ -129,7 +129,7 @@ wxString EDA_ITEM::GetSelectMenuText( EDA_UNITS aUnits ) const
} }
bool EDA_ITEM::Matches( const wxString& aText, wxFindReplaceData& aSearchData ) bool EDA_ITEM::Matches( const wxString& aText, const wxFindReplaceData& aSearchData ) const
{ {
wxString text = aText; wxString text = aText;
wxString searchText = aSearchData.GetFindString(); wxString searchText = aSearchData.GetFindString();
@ -156,7 +156,7 @@ bool EDA_ITEM::Matches( const wxString& aText, wxFindReplaceData& aSearchData )
} }
bool EDA_ITEM::Replace( wxFindReplaceData& aSearchData, wxString& aText ) bool EDA_ITEM::Replace( const wxFindReplaceData& aSearchData, wxString& aText )
{ {
wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper(); wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();

View File

@ -175,7 +175,7 @@ int EDA_TEXT::GetEffectiveTextPenWidth( int aDefaultWidth ) const
} }
bool EDA_TEXT::Replace( wxFindReplaceData& aSearchData ) bool EDA_TEXT::Replace( const wxFindReplaceData& aSearchData )
{ {
bool retval = EDA_ITEM::Replace( aSearchData, m_text ); bool retval = EDA_ITEM::Replace( aSearchData, m_text );
m_shown_text = UnescapeString( m_text ); m_shown_text = UnescapeString( m_text );

View File

@ -1478,7 +1478,7 @@ void SCH_COMPONENT::Rotate( wxPoint aPosition )
} }
bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) bool SCH_COMPONENT::Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const
{ {
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) ); wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );

View File

@ -592,7 +592,7 @@ public:
void MirrorX( int aXaxis_position ) override; void MirrorX( int aXaxis_position ) override;
void Rotate( wxPoint aPosition ) override; void Rotate( wxPoint aPosition ) override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override; bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override;
void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ) override; void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ) override;

View File

@ -324,7 +324,7 @@ bool SCH_FIELD::IsVoid() const
} }
bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) bool SCH_FIELD::Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const
{ {
wxString text = GetShownText(); wxString text = GetShownText();
int flags = aSearchData.GetFlags(); int flags = aSearchData.GetFlags();
@ -391,7 +391,7 @@ bool SCH_FIELD::IsReplaceable() const
} }
bool SCH_FIELD::Replace( wxFindReplaceData& aSearchData, void* aAuxData ) bool SCH_FIELD::Replace( const wxFindReplaceData& aSearchData, void* aAuxData )
{ {
bool isReplaced = false; bool isReplaced = false;

View File

@ -181,9 +181,9 @@ public:
{ {
} }
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override; bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override;
bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override; bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;

View File

@ -148,7 +148,7 @@ void SCH_MARKER::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset
} }
bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) bool SCH_MARKER::Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const
{ {
return SCH_ITEM::Matches( m_rcItem->GetErrorMessage(), aSearchData ); return SCH_ITEM::Matches( m_rcItem->GetErrorMessage(), aSearchData );
} }

View File

@ -90,7 +90,7 @@ public:
* @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
* @return True if the DRC main or auxiliary text matches the search criteria. * @return True if the DRC main or auxiliary text matches the search criteria.
*/ */
bool Matches( wxFindReplaceData& aSearchData, void* aAuxDat ) override; bool Matches( const wxFindReplaceData& aSearchData, void* aAuxDat ) const override;
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;

View File

@ -115,7 +115,7 @@ int SCH_PIN::GetLength() const
} }
bool SCH_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxDat ) bool SCH_PIN::Matches( const wxFindReplaceData& aSearchData, void* aAuxDat ) const
{ {
if( !( aSearchData.GetFlags() & FR_SEARCH_ALL_PINS ) ) if( !( aSearchData.GetFlags() & FR_SEARCH_ALL_PINS ) )
return false; return false;
@ -125,7 +125,7 @@ bool SCH_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxDat )
} }
bool SCH_PIN::Replace( wxFindReplaceData& aSearchData, void* aAuxData ) bool SCH_PIN::Replace( const wxFindReplaceData& aSearchData, void* aAuxData )
{ {
bool isReplaced = false; bool isReplaced = false;

View File

@ -101,9 +101,9 @@ public:
/// Returns the pin's position in global coordinates /// Returns the pin's position in global coordinates
wxPoint GetTransformedPosition() const; wxPoint GetTransformedPosition() const;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override; bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override;
bool Replace( wxFindReplaceData& aSearchData, void* aAuxData ) override; bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData ) override;
/* /*
* While many of these are currently simply covers for the equivalent LIB_PIN methods, * While many of these are currently simply covers for the equivalent LIB_PIN methods,

View File

@ -789,7 +789,7 @@ void SCH_SHEET::Resize( const wxSize& aSize )
} }
bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) bool SCH_SHEET::Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const
{ {
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) ); wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );

View File

@ -183,12 +183,12 @@ public:
void MirrorY( int aYaxis_position ) override; void MirrorY( int aYaxis_position ) override;
void Rotate( wxPoint aPosition ) override; void Rotate( wxPoint aPosition ) override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override
{ {
return SCH_ITEM::Matches( GetText(), aSearchData ); return SCH_ITEM::Matches( GetText(), aSearchData );
} }
bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override
{ {
return EDA_TEXT::Replace( aSearchData ); return EDA_TEXT::Replace( aSearchData );
} }
@ -525,7 +525,7 @@ public:
void MirrorX( int aXaxis_position ) override; void MirrorX( int aXaxis_position ) override;
void Rotate( wxPoint aPosition ) override; void Rotate( wxPoint aPosition ) override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override; bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override;
bool IsReplaceable() const override { return true; } bool IsReplaceable() const override { return true; }

View File

@ -283,12 +283,12 @@ public:
virtual void Rotate90( bool aClockwise ); virtual void Rotate90( bool aClockwise );
virtual void MirrorSpinStyle( bool aLeftRight ); virtual void MirrorSpinStyle( bool aLeftRight );
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override
{ {
return SCH_ITEM::Matches( GetText(), aSearchData ); return SCH_ITEM::Matches( GetText(), aSearchData );
} }
bool Replace( wxFindReplaceData& aSearchData, void* aAuxData ) override bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData ) override
{ {
return EDA_TEXT::Replace( aSearchData ); return EDA_TEXT::Replace( aSearchData );
} }

View File

@ -410,7 +410,7 @@ public:
* @param aAuxData A pointer to optional data required for the search or NULL if not used. * @param aAuxData A pointer to optional data required for the search or NULL if not used.
* @return True if the item's text matches the search criteria in \a aSearchData. * @return True if the item's text matches the search criteria in \a aSearchData.
*/ */
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) virtual bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const
{ {
return false; return false;
} }
@ -424,7 +424,7 @@ public:
* @param aText A reference to a wxString object containing the text to be replaced. * @param aText A reference to a wxString object containing the text to be replaced.
* @return True if \a aText was modified, otherwise false. * @return True if \a aText was modified, otherwise false.
*/ */
static bool Replace( wxFindReplaceData& aSearchData, wxString& aText ); static bool Replace( const wxFindReplaceData& aSearchData, wxString& aText );
/** /**
* Perform a text replace using the find and replace criteria in \a aSearchData * Perform a text replace using the find and replace criteria in \a aSearchData
@ -437,7 +437,7 @@ public:
* @param aAuxData A pointer to optional data required for the search or NULL if not used. * @param aAuxData A pointer to optional data required for the search or NULL if not used.
* @return True if the item text was modified, otherwise false. * @return True if the item text was modified, otherwise false.
*/ */
virtual bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = nullptr ) virtual bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData = nullptr )
{ {
return false; return false;
} }
@ -517,7 +517,7 @@ protected:
* @param aSearchData The criteria to search against. * @param aSearchData The criteria to search against.
* @return True if \a aText matches the search criteria in \a aSearchData. * @return True if \a aText matches the search criteria in \a aSearchData.
*/ */
bool Matches( const wxString& aText, wxFindReplaceData& aSearchData ); bool Matches( const wxString& aText, const wxFindReplaceData& aSearchData ) const;
public: public:
const KIID m_Uuid; const KIID m_Uuid;

View File

@ -237,7 +237,7 @@ public:
* search and replace criteria. * search and replace criteria.
* @return True if the text item was modified, otherwise false. * @return True if the text item was modified, otherwise false.
*/ */
bool Replace( wxFindReplaceData& aSearchData ); bool Replace( const wxFindReplaceData& aSearchData );
bool IsDefaultFormatting() const; bool IsDefaultFormatting() const;

View File

@ -78,7 +78,7 @@ public:
return false; return false;
} }
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override
{ {
return BOARD_ITEM::Matches( GetShownText(), aSearchData ); return BOARD_ITEM::Matches( GetShownText(), aSearchData );
} }

View File

@ -83,7 +83,7 @@ public:
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override
{ {
return BOARD_ITEM::Matches( m_rcItem->GetErrorMessage(), aSearchData ); return BOARD_ITEM::Matches( m_rcItem->GetErrorMessage(), aSearchData );
} }

View File

@ -64,7 +64,7 @@ public:
wxString GetShownText( int aDepth = 0 ) const override; wxString GetShownText( int aDepth = 0 ) const override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override
{ {
return BOARD_ITEM::Matches( GetShownText(), aSearchData ); return BOARD_ITEM::Matches( GetShownText(), aSearchData );
} }