KiCad PCB EDA Suite
Loading...
Searching...
No Matches
FP_FILTER_MATCHER Class Reference

Supplies the footprints matching a symbol's footprint filter patterns. More...

Public Member Functions

 FP_FILTER_MATCHER (KIWAY &aKiway)
 
FOOTPRINT_MATCH_RESULT GetMatches (const std::vector< wxString > &aPatterns)
 Return the case-insensitively sorted, de-duplicated union of the footprints matching any of the given patterns.
 
void PruneCache (const std::vector< wxString > &aPatterns)
 Drop the cached results for the patterns that are not in aPatterns.
 

Private Member Functions

FOOTPRINT_MATCH_RESULT fetchMatches (const wxString &aPattern)
 Return the matches for a single pattern, querying the libraries when it is not cached yet.
 

Private Attributes

KIWAY & m_kiway
 
std::map< wxString, FOOTPRINT_MATCH_RESULT > m_cache
 

Static Private Attributes

static constexpr int MAX_MATCH_RESULTS = 500
 

Detailed Description

Supplies the footprints matching a symbol's footprint filter patterns.

Queries are made one pattern at a time through the pcbnew kiface and the result for each pattern is cached, so editing one filter re-queries only that filter (and backspacing doesn't trigger a new query for patterns that are already cached).

Definition at line 59 of file panel_footprint_filters.cpp.

Constructor & Destructor Documentation

◆ FP_FILTER_MATCHER()

FP_FILTER_MATCHER::FP_FILTER_MATCHER ( KIWAY & aKiway)
inlineexplicit

Definition at line 62 of file panel_footprint_filters.cpp.

References m_kiway.

Member Function Documentation

◆ fetchMatches()

FOOTPRINT_MATCH_RESULT FP_FILTER_MATCHER::fetchMatches ( const wxString & aPattern)
inlineprivate

Return the matches for a single pattern, querying the libraries when it is not cached yet.

Matching is case-insensitive, so patterns differing only in case share an entry.

Definition at line 131 of file panel_footprint_filters.cpp.

References m_cache, m_kiway, FOOTPRINT_MATCH_QUERY::m_MaxResults, FOOTPRINT_MATCH_QUERY::m_Patterns, MAX_MATCH_RESULTS, QueryMatchingFootprints(), and result.

Referenced by GetMatches().

◆ GetMatches()

FOOTPRINT_MATCH_RESULT FP_FILTER_MATCHER::GetMatches ( const std::vector< wxString > & aPatterns)
inline

Return the case-insensitively sorted, de-duplicated union of the footprints matching any of the given patterns.

Definition at line 71 of file panel_footprint_filters.cpp.

References fetchMatches(), FOOTPRINT_MATCH_RESULT::m_IsLimited, FOOTPRINT_MATCH_RESULT::m_MatchingNames, FOOTPRINT_MATCH_RESULT::m_Success, and result.

◆ PruneCache()

void FP_FILTER_MATCHER::PruneCache ( const std::vector< wxString > & aPatterns)
inline

Drop the cached results for the patterns that are not in aPatterns.

The filter list is the only place a pattern can persist, so dropping the rest keeps the cache bounded. A pattern from a live-preview edit never reaches the list, so it is dropped here once the edit is done.

Definition at line 112 of file panel_footprint_filters.cpp.

References m_cache.

Member Data Documentation

◆ m_cache

std::map<wxString, FOOTPRINT_MATCH_RESULT> FP_FILTER_MATCHER::m_cache
private

Definition at line 157 of file panel_footprint_filters.cpp.

Referenced by fetchMatches(), and PruneCache().

◆ m_kiway

KIWAY& FP_FILTER_MATCHER::m_kiway
private

Definition at line 156 of file panel_footprint_filters.cpp.

Referenced by fetchMatches(), and FP_FILTER_MATCHER().

◆ MAX_MATCH_RESULTS

int FP_FILTER_MATCHER::MAX_MATCH_RESULTS = 500
staticconstexprprivate

Definition at line 154 of file panel_footprint_filters.cpp.

Referenced by fetchMatches().


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