KiCad PCB EDA Suite
Loading...
Searching...
No Matches
footprint_filter.h
Go to the documentation of this file.
1
/*
2
* This program source code file is part of KiCad, a free EDA CAD application.
3
*
4
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5
*
6
* This program is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License as published by the
8
* Free Software Foundation, either version 3 of the License, or (at your
9
* option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <https://www.gnu.org/licenses/>.
18
*/
19
20
#ifndef FOOTPRINT_FILTER_H
21
#define FOOTPRINT_FILTER_H
22
23
#include <boost/iterator/iterator_facade.hpp>
24
#include <
eda_pattern_match.h
>
25
#include <
footprint_info.h
>
26
#include <wx/arrstr.h>
27
28
41
bool
FootprintFilterMatchesName
(
const
EDA_PATTERN_MATCH
& aFilter,
const
wxString& aLibNickname,
42
const
wxString& aFootprintName );
43
44
49
class
FOOTPRINT_FILTER
50
{
51
public
:
57
FOOTPRINT_FILTER
(
FOOTPRINT_LIST
& aList );
58
63
FOOTPRINT_FILTER
();
64
68
void
SetList
(
FOOTPRINT_LIST
& aList );
69
73
void
ClearFilters
();
74
78
void
FilterByLibrary
(
const
wxString& aLibName );
79
83
void
FilterByPinCount
(
int
aPinCount );
84
88
void
FilterByFootprintFilters
(
const
wxArrayString& aFilters );
89
94
void
FilterByTextPattern
(
const
wxString& aPattern );
95
99
class
ITERATOR
100
:
public
boost::iterator_facade<ITERATOR, FOOTPRINT_INFO, boost::forward_traversal_tag>
101
{
102
public
:
103
ITERATOR
();
104
ITERATOR
(
const
ITERATOR
& aOther );
105
ITERATOR
(
FOOTPRINT_FILTER
& aFilter );
106
107
private
:
108
friend
class
boost::iterator_core_access
;
109
friend
class
FOOTPRINT_FILTER
;
110
111
void
increment
();
112
bool
equal
(
const
ITERATOR
& aOther )
const
;
113
FOOTPRINT_INFO
&
dereference
()
const
;
114
115
size_t
m_pos
;
116
FOOTPRINT_FILTER
*
m_filter
;
117
121
bool
FootprintFilterMatch
(
FOOTPRINT_INFO
& aItem );
122
126
bool
PinCountMatch
(
FOOTPRINT_INFO
& aItem );
127
};
128
132
ITERATOR
begin
();
133
138
ITERATOR
end
();
139
140
private
:
145
enum
FP_FILTER_T
:
int
146
{
147
UNFILTERED_FP_LIST
= 0,
148
FILTERING_BY_COMPONENT_FP_FILTER
= 0x0001,
149
FILTERING_BY_PIN_COUNT
= 0x0002,
150
FILTERING_BY_LIBRARY
= 0x0004,
151
FILTERING_BY_TEXT_PATTERN
= 0x0008
152
};
153
154
FOOTPRINT_LIST
*
m_list
;
155
156
wxString
m_lib_name
;
157
wxString
m_filter_pattern
;
158
int
m_pin_count
;
159
int
m_filter_type
;
160
161
std::vector<std::unique_ptr<EDA_COMBINED_MATCHER>>
m_pattern_filters
;
162
std::vector<std::unique_ptr<EDA_PATTERN_MATCH>>
m_footprint_filters
;
163
};
164
165
#endif
// FOOTPRINT_FILTER_H
EDA_PATTERN_MATCH
Interface for a pattern matcher for which there are several implementations.
Definition
eda_pattern_match.h:67
FOOTPRINT_FILTER::ITERATOR
Inner iterator class returned by begin() and end().
Definition
footprint_filter.h:101
FOOTPRINT_FILTER::ITERATOR::PinCountMatch
bool PinCountMatch(FOOTPRINT_INFO &aItem)
Check if the stored component matches an item by pin count.
Definition
footprint_filter.cpp:157
FOOTPRINT_FILTER::ITERATOR::dereference
FOOTPRINT_INFO & dereference() const
Definition
footprint_filter.cpp:117
FOOTPRINT_FILTER::ITERATOR::equal
bool equal(const ITERATOR &aOther) const
Definition
footprint_filter.cpp:110
FOOTPRINT_FILTER::ITERATOR::m_filter
FOOTPRINT_FILTER * m_filter
Definition
footprint_filter.h:116
FOOTPRINT_FILTER::ITERATOR::m_pos
size_t m_pos
Definition
footprint_filter.h:115
FOOTPRINT_FILTER::ITERATOR::FootprintFilterMatch
bool FootprintFilterMatch(FOOTPRINT_INFO &aItem)
Check if the stored component matches an item by footprint filter.
Definition
footprint_filter.cpp:142
FOOTPRINT_FILTER::ITERATOR::FOOTPRINT_FILTER
friend class FOOTPRINT_FILTER
Definition
footprint_filter.h:109
FOOTPRINT_FILTER::ITERATOR::ITERATOR
ITERATOR()
Definition
footprint_filter.cpp:28
FOOTPRINT_FILTER::ITERATOR::iterator_core_access
friend class boost::iterator_core_access
Definition
footprint_filter.h:108
FOOTPRINT_FILTER::ITERATOR::increment
void increment()
Definition
footprint_filter.cpp:50
FOOTPRINT_FILTER::FOOTPRINT_FILTER
FOOTPRINT_FILTER(FOOTPRINT_LIST &aList)
Construct a filter.
Definition
footprint_filter.cpp:163
FOOTPRINT_FILTER::FOOTPRINT_FILTER
FOOTPRINT_FILTER()
Construct a filter without assigning a footprint list.
Definition
footprint_filter.cpp:170
FOOTPRINT_FILTER::m_pin_count
int m_pin_count
Definition
footprint_filter.h:158
FOOTPRINT_FILTER::m_list
FOOTPRINT_LIST * m_list
Definition
footprint_filter.h:154
FOOTPRINT_FILTER::SetList
void SetList(FOOTPRINT_LIST &aList)
Set the list to filter.
Definition
footprint_filter.cpp:178
FOOTPRINT_FILTER::FilterByPinCount
void FilterByPinCount(int aPinCount)
Set a pin count to filter by.
Definition
footprint_filter.cpp:197
FOOTPRINT_FILTER::begin
ITERATOR begin()
Get an iterator to the beginning of the filtered view.
Definition
footprint_filter.cpp:234
FOOTPRINT_FILTER::m_filter_pattern
wxString m_filter_pattern
Definition
footprint_filter.h:157
FOOTPRINT_FILTER::m_filter_type
int m_filter_type
Definition
footprint_filter.h:159
FOOTPRINT_FILTER::m_lib_name
wxString m_lib_name
Definition
footprint_filter.h:156
FOOTPRINT_FILTER::FilterByTextPattern
void FilterByTextPattern(const wxString &aPattern)
Add a pattern to filter by name, including wildcards and optionally a colon-delimited library name.
Definition
footprint_filter.cpp:218
FOOTPRINT_FILTER::ClearFilters
void ClearFilters()
Clear all filter criteria.
Definition
footprint_filter.cpp:184
FOOTPRINT_FILTER::FilterByLibrary
void FilterByLibrary(const wxString &aLibName)
Add library name to filter criteria.
Definition
footprint_filter.cpp:190
FOOTPRINT_FILTER::end
ITERATOR end()
Get an iterator to the end of the filtered view.
Definition
footprint_filter.cpp:240
FOOTPRINT_FILTER::m_pattern_filters
std::vector< std::unique_ptr< EDA_COMBINED_MATCHER > > m_pattern_filters
Definition
footprint_filter.h:161
FOOTPRINT_FILTER::m_footprint_filters
std::vector< std::unique_ptr< EDA_PATTERN_MATCH > > m_footprint_filters
Definition
footprint_filter.h:162
FOOTPRINT_FILTER::FP_FILTER_T
FP_FILTER_T
Filter setting constants.
Definition
footprint_filter.h:146
FOOTPRINT_FILTER::UNFILTERED_FP_LIST
@ UNFILTERED_FP_LIST
Definition
footprint_filter.h:147
FOOTPRINT_FILTER::FILTERING_BY_LIBRARY
@ FILTERING_BY_LIBRARY
Definition
footprint_filter.h:150
FOOTPRINT_FILTER::FILTERING_BY_PIN_COUNT
@ FILTERING_BY_PIN_COUNT
Definition
footprint_filter.h:149
FOOTPRINT_FILTER::FILTERING_BY_TEXT_PATTERN
@ FILTERING_BY_TEXT_PATTERN
Definition
footprint_filter.h:151
FOOTPRINT_FILTER::FILTERING_BY_COMPONENT_FP_FILTER
@ FILTERING_BY_COMPONENT_FP_FILTER
Definition
footprint_filter.h:148
FOOTPRINT_FILTER::FilterByFootprintFilters
void FilterByFootprintFilters(const wxArrayString &aFilters)
Set a list of footprint filters to filter by.
Definition
footprint_filter.cpp:204
FOOTPRINT_INFO
Helper class to handle the list of footprints available in libraries.
Definition
footprint_info.h:50
FOOTPRINT_LIST
A list of FOOTPRINT_INFO objects, along with a list of IO_ERROR objects or PARSE_ERRORs that were thr...
Definition
footprint_info.h:162
eda_pattern_match.h
Abstract pattern-matching tool and implementations.
FootprintFilterMatchesName
bool FootprintFilterMatchesName(const EDA_PATTERN_MATCH &aFilter, const wxString &aLibNickname, const wxString &aFootprintName)
Whether a given footprint matches a specified filter.
Definition
footprint_filter.cpp:126
footprint_info.h
src
include
footprint_filter.h
Generated on Tue Oct 27 2026 00:06:27 for KiCad PCB EDA Suite by
1.13.2