KiCad PCB EDA Suite
Loading...
Searching...
No Matches
cleanup_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-2022 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 CLEANUP_ITEM_H
25#define CLEANUP_ITEM_H
26
27#include <drc/drc_item.h>
28
29class PCB_BASE_FRAME;
30
31
47};
48
49class CLEANUP_ITEM : public RC_ITEM
50{
51public:
52 CLEANUP_ITEM( int aErrorCode );
53
57 wxString GetErrorText( int aErrorCode = -1, bool aTranslate = true ) const;
58
59private:
61};
62
63
70{
71public:
72 VECTOR_CLEANUP_ITEMS_PROVIDER( std::vector<std::shared_ptr<CLEANUP_ITEM> >* aList ) :
73 m_sourceVector( aList )
74 {
75 }
76
77 void SetSeverities( int aSeverities ) override
78 {
79 }
80
81 int GetCount( int aSeverity = -1 ) const override
82 {
83 return m_sourceVector->size();
84 }
85
86 std::shared_ptr<RC_ITEM> GetItem( int aIndex ) const override
87 {
88 return m_sourceVector->at( aIndex );
89 }
90
91 std::shared_ptr<CLEANUP_ITEM> GetCleanupItem( int aIndex )
92 {
93 return m_sourceVector->at( aIndex );
94 }
95
96 void DeleteItem( int aIndex, bool aDeep ) override
97 {
98 if( aDeep )
99 {
100 auto item = m_sourceVector->at( aIndex );
101 m_sourceVector->erase( m_sourceVector->begin() + aIndex );
102 }
103 }
104
105private:
106 std::vector<std::shared_ptr<CLEANUP_ITEM> >* m_sourceVector; // owns its CLEANUP_ITEMs
107};
108
109
110
111#endif // CLEANUP_ITEM_H
wxString m_errorMessage
Definition: cleanup_item.h:60
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
Provide an abstract interface of a RC_ITEM* list manager.
Definition: rc_item.h:52
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
Definition: rc_item.h:79
wxString GetErrorText() const
Definition: rc_item.h:166
An implementation of the interface named RC_ITEMS_PROVIDER which uses a vector of pointers to CLEANUP...
Definition: cleanup_item.h:70
std::shared_ptr< CLEANUP_ITEM > GetCleanupItem(int aIndex)
Definition: cleanup_item.h:91
int GetCount(int aSeverity=-1) const override
Definition: cleanup_item.h:81
void SetSeverities(int aSeverities) override
Definition: cleanup_item.h:77
std::shared_ptr< RC_ITEM > GetItem(int aIndex) const override
Retrieve a RC_ITEM by index.
Definition: cleanup_item.h:86
void DeleteItem(int aIndex, bool aDeep) override
Remove (and optionally deletes) the indexed item from the list.
Definition: cleanup_item.h:96
VECTOR_CLEANUP_ITEMS_PROVIDER(std::vector< std::shared_ptr< CLEANUP_ITEM > > *aList)
Definition: cleanup_item.h:72
std::vector< std::shared_ptr< CLEANUP_ITEM > > * m_sourceVector
Definition: cleanup_item.h:106
CLEANUP_RC_CODE
Definition: cleanup_item.h:32
@ CLEANUP_TRACK_IN_PAD
Definition: cleanup_item.h:42
@ CLEANUP_NULL_GRAPHIC
Definition: cleanup_item.h:43
@ CLEANUP_DANGLING_VIA
Definition: cleanup_item.h:40
@ CLEANUP_MERGE_TRACKS
Definition: cleanup_item.h:38
@ CLEANUP_DANGLING_TRACK
Definition: cleanup_item.h:39
@ CLEANUP_DUPLICATE_TRACK
Definition: cleanup_item.h:37
@ CLEANUP_MERGE_PAD
Definition: cleanup_item.h:46
@ CLEANUP_ZERO_LENGTH_TRACK
Definition: cleanup_item.h:41
@ CLEANUP_DUPLICATE_GRAPHIC
Definition: cleanup_item.h:44
@ CLEANUP_LINES_TO_RECT
Definition: cleanup_item.h:45
@ CLEANUP_FIRST
Definition: cleanup_item.h:33
@ CLEANUP_SHORTING_VIA
Definition: cleanup_item.h:35
@ CLEANUP_REDUNDANT_VIA
Definition: cleanup_item.h:36
@ CLEANUP_SHORTING_TRACK
Definition: cleanup_item.h:34
@ DRCE_LAST
Definition: drc_item.h:109