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 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, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef CLEANUP_ITEM_H
21#define CLEANUP_ITEM_H
22
23#include <drc/drc_item.h>
24
25class PCB_BASE_FRAME;
26
27
44
45class CLEANUP_ITEM : public RC_ITEM
46{
47public:
48 CLEANUP_ITEM( int aErrorCode );
49
53 wxString GetErrorText( int aErrorCode = -1, bool aTranslate = true ) const;
54
55private:
57};
58
59
66{
67public:
68 VECTOR_CLEANUP_ITEMS_PROVIDER( std::vector<std::shared_ptr<CLEANUP_ITEM> >* aList ) :
69 m_sourceVector( aList )
70 {
71 }
72
73 void SetSeverities( int aSeverities ) override
74 {
75 }
76
77 int GetSeverities() const override
78 {
79 return 0;
80 }
81
82 int GetCount( int aSeverity = -1 ) const override
83 {
84 return m_sourceVector->size();
85 }
86
87 std::shared_ptr<RC_ITEM> GetItem( int aIndex ) const override
88 {
89 return m_sourceVector->at( aIndex );
90 }
91
92 std::shared_ptr<CLEANUP_ITEM> GetCleanupItem( int aIndex )
93 {
94 return m_sourceVector->at( aIndex );
95 }
96
97 void DeleteItem( int aIndex, bool aDeep ) override
98 {
99 if( aDeep )
100 {
101 auto item = m_sourceVector->at( aIndex );
102 m_sourceVector->erase( m_sourceVector->begin() + aIndex );
103 }
104 }
105
106private:
107 std::vector<std::shared_ptr<CLEANUP_ITEM> >* m_sourceVector; // owns its CLEANUP_ITEMs
108};
109
110
111
112#endif // CLEANUP_ITEM_H
wxString m_errorMessage
CLEANUP_ITEM(int aErrorCode)
wxString GetErrorText(int aErrorCode=-1, bool aTranslate=true) const
Return the string form of a drc error code.
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:51
RC_ITEM()
Definition rc_item.h:84
std::shared_ptr< CLEANUP_ITEM > GetCleanupItem(int aIndex)
int GetCount(int aSeverity=-1) const override
void SetSeverities(int aSeverities) override
std::shared_ptr< RC_ITEM > GetItem(int aIndex) const override
Retrieve a RC_ITEM by index.
void DeleteItem(int aIndex, bool aDeep) override
Remove (and optionally deletes) the indexed item from the list.
int GetSeverities() const override
VECTOR_CLEANUP_ITEMS_PROVIDER(std::vector< std::shared_ptr< CLEANUP_ITEM > > *aList)
std::vector< std::shared_ptr< CLEANUP_ITEM > > * m_sourceVector
CLEANUP_RC_CODE
@ CLEANUP_TRACK_IN_PAD
@ CLEANUP_NULL_GRAPHIC
@ CLEANUP_DANGLING_VIA
@ CLEANUP_MERGE_TRACKS
@ CLEANUP_DANGLING_TRACK
@ CLEANUP_DUPLICATE_TRACK
@ CLEANUP_MERGE_PAD
@ CLEANUP_ZERO_LENGTH_TRACK
@ CLEANUP_DUPLICATE_GRAPHIC
@ CLEANUP_LINES_TO_RECT
@ CLEANUP_FIRST
@ CLEANUP_SHORTING_VIA
@ CLEANUP_REDUNDANT_VIA
@ CLEANUP_SHORTING_TRACK
@ DRCE_LAST
Definition drc_item.h:121