KiCad PCB EDA Suite
erc_item.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 (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#ifndef ERC_ITEM_H
25#define ERC_ITEM_H
26
27#include <rc_item.h>
28
29
30class ERC_ITEM : public RC_ITEM
31{
32public:
37 static std::shared_ptr<ERC_ITEM> Create( int aErrorCode );
38
39 static std::shared_ptr<ERC_ITEM> Create( const wxString& aErrorKey )
40 {
41 for( const RC_ITEM& item : allItemTypes )
42 {
43 if( aErrorKey == item.GetSettingsKey() )
44 return std::make_shared<ERC_ITEM>( static_cast<const ERC_ITEM&>( item ) );
45 }
46
47 return nullptr;
48 }
49
50 static std::vector<std::reference_wrapper<RC_ITEM>> GetItemsWithSeverities()
51 {
52 return allItemTypes;
53 }
54
55 bool IsSheetSpecific() const { return m_sheetSpecific; }
56 void SetIsSheetSpecific( bool aSpecific = true ) { m_sheetSpecific = aSpecific; }
57
58private:
59 ERC_ITEM( int aErrorCode = 0, const wxString& aTitle = "", const wxString& aSettingsKey = "" )
60 {
61 m_errorCode = aErrorCode;
62 m_errorTitle = aTitle;
63 m_settingsKey = aSettingsKey;
64 m_sheetSpecific = false;
65 }
66
68 static std::vector<std::reference_wrapper<RC_ITEM>> allItemTypes;
69
73
109
112};
113
114
115#endif // ERC_ITEM_H
bool m_sheetSpecific
True if this item is specific to a sheet instance (as opposed to applying to all instances)
Definition: erc_item.h:111
static ERC_ITEM differentUnitValue
Definition: erc_item.h:106
static ERC_ITEM busToBusConflict
Definition: erc_item.h:94
static ERC_ITEM pinTableWarning
Definition: erc_item.h:79
static std::shared_ptr< ERC_ITEM > Create(const wxString &aErrorKey)
Definition: erc_item.h:39
void SetIsSheetSpecific(bool aSpecific=true)
Definition: erc_item.h:56
static ERC_ITEM unresolvedVariable
Definition: erc_item.h:96
static ERC_ITEM duplicateSheetName
Definition: erc_item.h:74
static ERC_ITEM noConnectDangling
Definition: erc_item.h:83
static ERC_ITEM busDefinitionConflict
Definition: erc_item.h:89
static ERC_ITEM libSymbolIssues
Definition: erc_item.h:99
static ERC_ITEM pinNotDriven
Definition: erc_item.h:77
static ERC_ITEM extraUnits
Definition: erc_item.h:101
static ERC_ITEM heading_conflicts
Definition: erc_item.h:71
static std::shared_ptr< ERC_ITEM > Create(int aErrorCode)
Constructs an ERC_ITEM for the given error code.
Definition: erc_item.cpp:227
static ERC_ITEM noConnectConnected
Definition: erc_item.h:82
static ERC_ITEM heading_misc
Definition: erc_item.h:72
static ERC_ITEM endpointOffGrid
Definition: erc_item.h:75
static ERC_ITEM busToNetConflict
Definition: erc_item.h:95
static ERC_ITEM differentUnitFootprint
Definition: erc_item.h:87
static ERC_ITEM hierLabelMismatch
Definition: erc_item.h:81
static ERC_ITEM heading_connections
Definition: erc_item.h:70
static ERC_ITEM missingUnits
Definition: erc_item.h:102
static ERC_ITEM similarLabels
Definition: erc_item.h:86
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:68
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
Definition: erc_item.h:50
static ERC_ITEM globalLabelDangling
Definition: erc_item.h:85
static ERC_ITEM labelDangling
Definition: erc_item.h:84
static ERC_ITEM differentUnitNet
Definition: erc_item.h:88
static ERC_ITEM pinTableError
Definition: erc_item.h:80
static ERC_ITEM netNotBusMember
Definition: erc_item.h:92
static ERC_ITEM wireDangling
Definition: erc_item.h:98
ERC_ITEM(int aErrorCode=0, const wxString &aTitle="", const wxString &aSettingsKey="")
Definition: erc_item.h:59
static ERC_ITEM busLabelSyntax
Definition: erc_item.h:93
static ERC_ITEM powerpinNotDriven
Definition: erc_item.h:78
static ERC_ITEM missingPowerInputPin
Definition: erc_item.h:105
static ERC_ITEM missingBidiPin
Definition: erc_item.h:104
bool IsSheetSpecific() const
Definition: erc_item.h:55
static ERC_ITEM unannotated
Definition: erc_item.h:100
static ERC_ITEM missingInputPin
Definition: erc_item.h:103
static ERC_ITEM netclassConflict
Definition: erc_item.h:91
static ERC_ITEM busEntryNeeded
Definition: erc_item.h:108
static ERC_ITEM simulationModelIssues
Definition: erc_item.h:97
static ERC_ITEM multipleNetNames
Definition: erc_item.h:90
static ERC_ITEM pinNotConnected
Definition: erc_item.h:76
static ERC_ITEM duplicateReference
Definition: erc_item.h:107
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
Definition: rc_item.h:75
wxString m_settingsKey
The key used to describe this type of error in settings.
Definition: rc_item.h:168
int m_errorCode
The error code's numeric value.
Definition: rc_item.h:165
wxString m_errorTitle
The string describing the type of error.
Definition: rc_item.h:167