forked from KiCad/kicad-source-mirror
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanup_item.h
122 lines (100 loc) · 3.21 KB
/
cleanup_item.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef CLEANUP_ITEM_H
#define CLEANUP_ITEM_H
#include <drc/drc_item.h>
class PCB_BASE_FRAME;
enum CLEANUP_RC_CODE {
CLEANUP_FIRST = DRCE_LAST + 1,
CLEANUP_CHECKING_ZONE_FILLS = CLEANUP_FIRST,
CLEANUP_SHORTING_TRACK,
CLEANUP_SHORTING_VIA,
CLEANUP_REDUNDANT_VIA,
CLEANUP_DUPLICATE_TRACK,
CLEANUP_MERGE_TRACKS,
CLEANUP_DANGLING_TRACK,
CLEANUP_DANGLING_VIA,
CLEANUP_ZERO_LENGTH_TRACK,
CLEANUP_TRACK_IN_PAD,
CLEANUP_NULL_GRAPHIC,
CLEANUP_DUPLICATE_GRAPHIC,
CLEANUP_LINES_TO_RECT
};
class CLEANUP_ITEM : public RC_ITEM
{
private:
wxString m_errorMessage;
public:
CLEANUP_ITEM( int aErrorCode );
/**
* Function GetErrorText
* returns the string form of a drc error code.
*/
wxString GetErrorText( int aErrorCode = -1, bool aTranslate = true ) const;
};
/**
* VECTOR_CLEANUP_ITEMS_PROVIDER
* is an implementation of the interface named RC_ITEMS_PROVIDER which uses a vector
* of pointers to CLEANUP_ITEMs to fulfill the interface. No ownership is taken of the
* vector.
*/
class VECTOR_CLEANUP_ITEMS_PROVIDER : public RC_ITEMS_PROVIDER
{
std::vector<std::shared_ptr<CLEANUP_ITEM> >* m_sourceVector; // owns its CLEANUP_ITEMs
public:
VECTOR_CLEANUP_ITEMS_PROVIDER( std::vector<std::shared_ptr<CLEANUP_ITEM> >* aList ) :
m_sourceVector( aList )
{
}
void SetSeverities( int aSeverities ) override
{
}
int GetCount( int aSeverity = -1 ) const override
{
return m_sourceVector->size();
}
std::shared_ptr<RC_ITEM> GetItem( int aIndex ) const override
{
return m_sourceVector->at( aIndex );
}
std::shared_ptr<CLEANUP_ITEM> GetCleanupItem( int aIndex )
{
return m_sourceVector->at( aIndex );
}
void DeleteItem( int aIndex, bool aDeep ) override
{
if( aDeep )
{
auto item = m_sourceVector->at( aIndex );
m_sourceVector->erase( m_sourceVector->begin() + aIndex );
}
}
void DeleteAllItems( bool aIncludeExclusions, bool aDeep ) override
{
if( aDeep )
{
m_sourceVector->clear();
}
}
};
#endif // CLEANUP_ITEM_H