KiCad PCB EDA Suite
EDA_PATTERN_MATCH_SUBSTR Class Reference

#include <eda_pattern_match.h>

Inheritance diagram for EDA_PATTERN_MATCH_SUBSTR:
EDA_PATTERN_MATCH

Public Member Functions

virtual bool SetPattern (const wxString &aPattern) override
 Set the pattern against which candidates will be matched. More...
 
virtual wxString const & GetPattern () const override
 Return the pattern passed to SetPattern(). More...
 
virtual FIND_RESULT Find (const wxString &aCandidate) const override
 Return the location and possibly length of a match iff a given candidate string matches the set pattern. More...
 

Protected Attributes

wxString m_pattern
 

Detailed Description

Definition at line 87 of file eda_pattern_match.h.

Member Function Documentation

◆ Find()

EDA_PATTERN_MATCH::FIND_RESULT EDA_PATTERN_MATCH_SUBSTR::Find ( const wxString &  aCandidate) const
overridevirtual

Return the location and possibly length of a match iff a given candidate string matches the set pattern.

Otherwise, return an invalid FIND_RESULT.

Implements EDA_PATTERN_MATCH.

Definition at line 44 of file eda_pattern_match.cpp.

45{
46 int loc = aCandidate.Find( m_pattern );
47
48 if( loc == wxNOT_FOUND )
49 return {};
50 else
51 return { loc, static_cast<int>( m_pattern.size() ) };
52}

References m_pattern.

◆ GetPattern()

wxString const & EDA_PATTERN_MATCH_SUBSTR::GetPattern ( ) const
overridevirtual

Return the pattern passed to SetPattern().

Implements EDA_PATTERN_MATCH.

Definition at line 38 of file eda_pattern_match.cpp.

39{
40 return m_pattern;
41}

References m_pattern.

◆ SetPattern()

bool EDA_PATTERN_MATCH_SUBSTR::SetPattern ( const wxString &  aPattern)
overridevirtual

Set the pattern against which candidates will be matched.

If the pattern can not be processed, returns false.

Implements EDA_PATTERN_MATCH.

Definition at line 31 of file eda_pattern_match.cpp.

32{
33 m_pattern = aPattern;
34 return true;
35}

References m_pattern.

Member Data Documentation

◆ m_pattern

wxString EDA_PATTERN_MATCH_SUBSTR::m_pattern
protected

Definition at line 95 of file eda_pattern_match.h.

Referenced by Find(), GetPattern(), and SetPattern().


The documentation for this class was generated from the following files: