KiCad PCB EDA Suite
FOOTPRINT_FILTER Class Reference

Footprint display filter. More...

#include <footprint_filter.h>

Classes

class  ITERATOR
 Inner iterator class returned by begin() and end(). More...
 

Public Member Functions

 FOOTPRINT_FILTER (FOOTPRINT_LIST &aList)
 Construct a filter. More...
 
 FOOTPRINT_FILTER ()
 Construct a filter without assigning a footprint list. More...
 
void SetList (FOOTPRINT_LIST &aList)
 Set the list to filter. More...
 
void ClearFilters ()
 Clear all filter criteria. More...
 
void FilterByLibrary (wxString const &aLibName)
 Add library name to filter criteria. More...
 
void FilterByPinCount (int aPinCount)
 Set a pin count to filter by. More...
 
void FilterByFootprintFilters (wxArrayString const &aFilters)
 Set a list of footprint filters to filter by. More...
 
void FilterByPattern (wxString const &aPattern)
 Add a pattern to filter by name, including wildcards and optionally a colon-delimited library name. More...
 
ITERATOR begin ()
 Get an iterator to the beginning of the filtered view. More...
 
ITERATOR end ()
 Get an iterator to the end of the filtered view. More...
 

Private Types

enum  FP_FILTER_T : int {
  UNFILTERED_FP_LIST = 0, FILTERING_BY_COMPONENT_KEYWORD = 0x0001, FILTERING_BY_PIN_COUNT = 0x0002, FILTERING_BY_LIBRARY = 0x0004,
  FILTERING_BY_NAME = 0x0008
}
 Filter setting constants. More...
 

Private Attributes

FOOTPRINT_LISTm_list
 
wxString m_lib_name
 
wxString m_filter_pattern
 
int m_pin_count
 
int m_filter_type
 
EDA_PATTERN_MATCH_WILDCARD m_filter
 
std::vector< std::unique_ptr< EDA_PATTERN_MATCH > > m_footprint_filters
 

Detailed Description

Footprint display filter.

Takes a list of footprints and filtering settings, and provides an iterable view of the filtered data.

Definition at line 32 of file footprint_filter.h.

Member Enumeration Documentation

enum FOOTPRINT_FILTER::FP_FILTER_T : int
private

Filter setting constants.

The filter type is a bitwise OR of these flags, and only footprints matching all selected filter types are shown.

Enumerator
UNFILTERED_FP_LIST 
FILTERING_BY_COMPONENT_KEYWORD 
FILTERING_BY_PIN_COUNT 
FILTERING_BY_LIBRARY 
FILTERING_BY_NAME 

Definition at line 128 of file footprint_filter.h.

Constructor & Destructor Documentation

FOOTPRINT_FILTER::FOOTPRINT_FILTER ( FOOTPRINT_LIST aList)

Construct a filter.

Parameters
aList- unfiltered list of footprints

Definition at line 161 of file footprint_filter.cpp.

References SetList().

161  : FOOTPRINT_FILTER()
162 {
163  SetList( aList );
164 }
void SetList(FOOTPRINT_LIST &aList)
Set the list to filter.
FOOTPRINT_FILTER()
Construct a filter without assigning a footprint list.
FOOTPRINT_FILTER::FOOTPRINT_FILTER ( )

Construct a filter without assigning a footprint list.

The filter MUST NOT be iterated over until SetList() is called.

Definition at line 167 of file footprint_filter.cpp.

Member Function Documentation

FOOTPRINT_FILTER_IT FOOTPRINT_FILTER::begin ( )

Get an iterator to the beginning of the filtered view.

Definition at line 221 of file footprint_filter.cpp.

222 {
223  return FOOTPRINT_FILTER_IT( *this );
224 }
FOOTPRINT_FILTER::ITERATOR FOOTPRINT_FILTER_IT
void FOOTPRINT_FILTER::ClearFilters ( )

Clear all filter criteria.

Definition at line 179 of file footprint_filter.cpp.

References m_filter_type, and UNFILTERED_FP_LIST.

Referenced by FOOTPRINT_SELECT_WIDGET::ClearFilters().

FOOTPRINT_FILTER_IT FOOTPRINT_FILTER::end ( )

Get an iterator to the end of the filtered view.

The end iterator is invalid and may not be dereferenced, only compared against.

Definition at line 227 of file footprint_filter.cpp.

References FOOTPRINT_LIST::GetCount(), m_list, and FOOTPRINT_FILTER::ITERATOR::m_pos.

228 {
229  FOOTPRINT_FILTER_IT end_it( *this );
230  end_it.m_pos = m_list->GetCount();
231  return end_it;
232 }
unsigned GetCount() const
FOOTPRINT_LIST * m_list
Inner iterator class returned by begin() and end().
void FOOTPRINT_FILTER::FilterByFootprintFilters ( wxArrayString const &  aFilters)

Set a list of footprint filters to filter by.

Definition at line 199 of file footprint_filter.cpp.

References FILTERING_BY_COMPONENT_KEYWORD, m_filter_type, and m_footprint_filters.

Referenced by FOOTPRINT_SELECT_WIDGET::FilterByFootprintFilters(), and FOOTPRINTS_LISTBOX::SetFootprints().

200 {
201  m_footprint_filters.clear();
202 
203  for( auto const& each_pattern : aFilters )
204  {
205  m_footprint_filters.push_back( std::make_unique<EDA_PATTERN_MATCH_WILDCARD>() );
206  m_footprint_filters.back()->SetPattern( each_pattern.Lower() );
207  }
208 
210 }
std::vector< std::unique_ptr< EDA_PATTERN_MATCH > > m_footprint_filters
void FOOTPRINT_FILTER::FilterByLibrary ( wxString const &  aLibName)

Add library name to filter criteria.

Definition at line 185 of file footprint_filter.cpp.

References FILTERING_BY_LIBRARY, m_filter_type, and m_lib_name.

Referenced by FOOTPRINTS_LISTBOX::SetFootprints().

void FOOTPRINT_FILTER::FilterByPattern ( wxString const &  aPattern)

Add a pattern to filter by name, including wildcards and optionally a colon-delimited library name.

Definition at line 213 of file footprint_filter.cpp.

References FILTERING_BY_NAME, m_filter, m_filter_pattern, m_filter_type, and EDA_PATTERN_MATCH_WILDCARD::SetPattern().

Referenced by FOOTPRINTS_LISTBOX::SetFootprints().

214 {
215  m_filter_pattern = aPattern;
216  m_filter.SetPattern( aPattern.Lower() );
218 }
virtual bool SetPattern(const wxString &aPattern) override
Set the pattern against which candidates will be matched.
EDA_PATTERN_MATCH_WILDCARD m_filter
void FOOTPRINT_FILTER::FilterByPinCount ( int  aPinCount)
void FOOTPRINT_FILTER::SetList ( FOOTPRINT_LIST aList)

Set the list to filter.

Definition at line 173 of file footprint_filter.cpp.

References m_list.

Referenced by FOOTPRINT_FILTER(), and FOOTPRINT_SELECT_WIDGET::OnProgressTimer().

174 {
175  m_list = &aList;
176 }
FOOTPRINT_LIST * m_list

Member Data Documentation

wxString FOOTPRINT_FILTER::m_filter_pattern
private

Definition at line 140 of file footprint_filter.h.

Referenced by FilterByPattern().

int FOOTPRINT_FILTER::m_filter_type
private
std::vector<std::unique_ptr<EDA_PATTERN_MATCH> > FOOTPRINT_FILTER::m_footprint_filters
private

Definition at line 145 of file footprint_filter.h.

Referenced by FilterByFootprintFilters().

wxString FOOTPRINT_FILTER::m_lib_name
private

Definition at line 139 of file footprint_filter.h.

Referenced by FilterByLibrary().

FOOTPRINT_LIST* FOOTPRINT_FILTER::m_list
private

Definition at line 137 of file footprint_filter.h.

Referenced by FOOTPRINT_FILTER::ITERATOR::dereference(), end(), and SetList().

int FOOTPRINT_FILTER::m_pin_count
private

Definition at line 141 of file footprint_filter.h.

Referenced by FilterByPinCount().


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