KiCad PCB EDA Suite
erc_item.cpp
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 (C) 2020 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 
25 #include <fctsys.h>
26 #include "wx/html/m_templ.h"
27 #include "wx/html/styleparams.h"
28 #include <erc.h>
29 #include <erc_item.h>
30 #include <i18n_utility.h>
31 
32 
33 // These, being statically-defined, require specialized I18N handling. We continue to
34 // use the _() macro so that string harvesting by the I18N framework doesn't have to be
35 // specialized, but we don't translate on initialization and instead do it in the getters.
36 
37 #undef _
38 #define _(s) s
39 
41  _( "Duplicate sheet names within a given sheet" ),
42  wxT( "duplicate_sheet_names" ) );
43 
45  _( "Pin not connected" ),
46  wxT( "pin_not_connected" ) );
47 
49  _( "Pin connected to other pins, but not driven by any pin" ),
50  wxT( "pin_not_driven" ) );
51 
53  _( "Conflict problem between pins" ),
54  wxT( "pin_to_pin" ) );
55 
57  _( "Conflict problem between pins" ),
58  wxT( "pin_to_pin" ) );
59 
61  _( "Mismatch between hierarchical labels and pins sheets" ),
62  wxT( "hier_label_mismatch" ) );
63 
65  _( "A pin with a \"no connection\" flag is connected" ),
66  wxT( "no_connect_connected" ) );
67 
69  _( "Unconnected \"no connection\" flag" ),
70  wxT( "no_connect_dangling" ) );
71 
73  _( "Label not connected anywhere else in the schematic" ),
74  wxT( "label_dangling" ) );
75 
77  _( "Global label not connected anywhere else in the schematic" ),
78  wxT( "global_label_dangling" ) );
79 
81  _( "Labels are similar (lower/upper case difference only)"),
82  wxT( "similar_labels" ) );
83 
85  _( "Different footprint assigned in another unit of the same component" ),
86  wxT( "different_unit_footprint" ) );
87 
89  _( "Different net assigned to a shared pin in another unit of the same component" ),
90  wxT( "different_unit_net" ) );
91 
93  _( "Conflict between bus alias definitions across schematic sheets" ),
94  wxT( "bus_definition_conflict" ) );
95 
97  _( "More than one name given to this bus or net" ),
98  wxT( "multiple_net_names" ) );
99 
101  _( "Net is graphically connected to a bus but not a bus member" ),
102  wxT( "net_not_bus_member" ) );
103 
105  _( "Label attached to bus item does not describe a bus" ),
106  wxT( "bus_label_syntax" ) );
107 
109  _( "Buses are graphically connected but share no bus members" ),
110  wxT( "bus_to_bus_conflict" ) );
111 
113  _( "Invalid connection between bus and net items" ),
114  wxT( "bus_to_net_conflict" ) );
115 
117  _( "Unresolved text variable" ),
118  wxT( "unresolved_variable" ) );
119 
120 std::vector<std::reference_wrapper<RC_ITEM>> ERC_ITEM::allItemTypes( {
140  } );
141 
142 
143 
144 ERC_ITEM* ERC_ITEM::Create( int aErrorCode )
145 {
146  switch( aErrorCode )
147  {
149  return new ERC_ITEM( duplicateSheetName );
150 
152  return new ERC_ITEM( pinNotConnected );
153 
154  case ERCE_PIN_NOT_DRIVEN:
155  return new ERC_ITEM( pinNotDriven );
156 
158  return new ERC_ITEM( pinTableWarning );
159 
161  return new ERC_ITEM( pinTableError );
162 
164  return new ERC_ITEM( hierLabelMismatch );
165 
167  return new ERC_ITEM( noConnectConnected );
168 
170  return new ERC_ITEM( noConnectDangling );
171 
173  return new ERC_ITEM( labelDangling );
174 
175  case ERCE_SIMILAR_LABELS:
176  return new ERC_ITEM( similarLabels );
177 
179  return new ERC_ITEM( differentUnitFootprint );
180 
182  return new ERC_ITEM( differentUnitNet );
183 
185  return new ERC_ITEM( busDefinitionConflict );
186 
188  return new ERC_ITEM( multipleNetNames );
189 
191  return new ERC_ITEM( netNotBusMember );
192 
194  return new ERC_ITEM( busLabelSyntax );
195 
197  return new ERC_ITEM( busToBusConflict );
198 
200  return new ERC_ITEM( busToNetConflict );
201 
202  case ERCE_GLOBLABEL:
203  return new ERC_ITEM( globalLabelDangling );
204 
206  return new ERC_ITEM( unresolvedVariable );
207 
208  case ERCE_UNSPECIFIED:
209  default:
210  wxFAIL_MSG( "Unknown ERC error code" );
211  return nullptr;
212  }
213 }
static ERC_ITEM busToNetConflict
Definition: erc_item.h:73
static ERC_ITEM pinTableError
Definition: erc_item.h:59
static ERC_ITEM noConnectConnected
Definition: erc_item.h:61
static ERC_ITEM differentUnitNet
Definition: erc_item.h:67
static ERC_ITEM busLabelSyntax
Definition: erc_item.h:71
#define _(s)
Definition: erc_item.cpp:38
static ERC_ITEM similarLabels
Definition: erc_item.h:65
static ERC_ITEM multipleNetNames
Definition: erc_item.h:69
static ERC_ITEM labelDangling
Definition: erc_item.h:63
static ERC_ITEM noConnectDangling
Definition: erc_item.h:62
static ERC_ITEM pinTableWarning
Definition: erc_item.h:58
static ERC_ITEM unresolvedVariable
Definition: erc_item.h:74
static ERC_ITEM pinNotDriven
Definition: erc_item.h:57
Some functions to handle hotkeys in KiCad.
static ERC_ITEM duplicateSheetName
Definition: erc_item.h:55
static ERC_ITEM * Create(int aErrorCode)
Constructs an ERC_ITEM for the given error code.
Definition: erc_item.cpp:144
static ERC_ITEM busDefinitionConflict
Definition: erc_item.h:68
static ERC_ITEM netNotBusMember
Definition: erc_item.h:70
static std::vector< std::reference_wrapper< RC_ITEM > > allItemTypes
A list of all ERC_ITEM types which are valid error codes.
Definition: erc_item.h:53
static ERC_ITEM pinNotConnected
Definition: erc_item.h:56
static ERC_ITEM differentUnitFootprint
Definition: erc_item.h:66
static ERC_ITEM busToBusConflict
Definition: erc_item.h:72
static ERC_ITEM hierLabelMismatch
Definition: erc_item.h:60
static ERC_ITEM globalLabelDangling
Definition: erc_item.h:64
ERC_ITEM(int aErrorCode=0, const wxString &aTitle="", const wxString &aSettingsKey="")
Definition: erc_item.h:45