KiCad PCB EDA Suite
Loading...
Searching...
No Matches
variant_symbol_utils.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
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU 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, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef VARIANT_SYMBOL_UTILS_H
25#define VARIANT_SYMBOL_UTILS_H
26
27#include <functional>
28#include <vector>
29#include <wx/string.h>
30
31class LIB_ID;
32class LIB_SYMBOL;
33class SCH_PIN;
34
35namespace SCH_CONNECTIVITY
36{
38}
39
40
55
56
60bool VariantSymbolPinsMatch( const SCH_PIN& aBase, const SCH_PIN& aCandidate );
61
62
71
72
77using SYMBOL_COMPAT_FUNC = std::function<std::vector<VARIANT_COMPAT_RESULT>( const LIB_ID& )>;
78
79
93std::vector<VARIANT_COMPAT_RESULT> ValidateVariantSymbolCompatibility( const LIB_SYMBOL& aBase,
94 const LIB_SYMBOL& aCandidate );
95
96// Compare an owned embedded symbol snapshot against a freshly loaded alternate.
97std::vector<VARIANT_COMPAT_RESULT> ValidateVariantSymbolCompatibility(
98 const SCH_CONNECTIVITY::LIBRARY_SYMBOL_FACT& aBase, const LIB_SYMBOL& aCandidate );
99
100#endif // VARIANT_SYMBOL_UTILS_H
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:45
Define a library symbol object.
Definition lib_symbol.h:114
@ NONE
Definition eda_fill.h:42
Value keys and the key session of the schematic connectivity engine.
wxString pinNumber
pin that failed, if applicable
int bodyStyle
body style that failed, if applicable
int unit
unit that failed, if applicable
VARIANT_COMPAT_ERROR error
std::function< std::vector< VARIANT_COMPAT_RESULT >(const LIB_ID &)> SYMBOL_COMPAT_FUNC
Callback that evaluates variant symbol compatibility for a given candidate LIB_ID.
std::vector< VARIANT_COMPAT_RESULT > ValidateVariantSymbolCompatibility(const LIB_SYMBOL &aBase, const LIB_SYMBOL &aCandidate)
Check whether aCandidate can be used as a variant symbol override for aBase.
VARIANT_COMPAT_ERROR
Describes a single pin compatibility problem found when comparing a candidate symbol against a base s...
@ PIN_POSITION_MISMATCH
A matching pin number has a different position in library coordinates.
@ PIN_TYPE_MISMATCH
A matching pin number has a different electrical type.
@ EXTRA_PIN_NUMBER
Candidate has a pin occurrence that is absent from the base.
@ MISSING_BODY_STYLE
Base uses alternate body styles but candidate does not.
@ MISSING_PIN_NUMBER
A base pin number is absent from the candidate for a given unit/body style.
@ INSUFFICIENT_UNITS
Candidate has fewer units than the base.
bool VariantSymbolPinsMatch(const SCH_PIN &aBase, const SCH_PIN &aCandidate)
Check whether two graphical pins occupy the same variant-symbol connection slot.