KiCad PCB EDA Suite
RATSNEST_DRC_ITEMS_PROVIDER Class Reference

RATSNEST_DRC_ITEMS_PROVIDER. More...

#include <drc_provider.h>

Inheritance diagram for RATSNEST_DRC_ITEMS_PROVIDER:
VECTOR_DRC_ITEMS_PROVIDER RC_ITEMS_PROVIDER

Public Member Functions

 RATSNEST_DRC_ITEMS_PROVIDER (PCB_BASE_FRAME *aFrame, std::vector< DRC_ITEM * > *aList)
 
void SetSeverities (int aSeverities) override
 
int GetCount (int aSeverity=-1) override
 
DRC_ITEMGetItem (int aIndex) override
 Function GetItem retrieves a RC_ITEM by index. More...
 
void DeleteItem (int aIndex, bool aDeep) override
 Function DeleteItem removes (and optionally deletes) the indexed item from the list. More...
 
void DeleteAllItems () override
 Function DeleteAllItems removes and deletes all the items in the list. More...
 

Detailed Description

RATSNEST_DRC_ITEMS_PROVIDER.

Definition at line 273 of file drc_provider.h.

Constructor & Destructor Documentation

◆ RATSNEST_DRC_ITEMS_PROVIDER()

RATSNEST_DRC_ITEMS_PROVIDER::RATSNEST_DRC_ITEMS_PROVIDER ( PCB_BASE_FRAME aFrame,
std::vector< DRC_ITEM * > *  aList 
)
inline

Definition at line 279 of file drc_provider.h.

279  :
280  VECTOR_DRC_ITEMS_PROVIDER( aFrame, aList )
281  { }
VECTOR_DRC_ITEMS_PROVIDER(PCB_BASE_FRAME *aFrame, std::vector< DRC_ITEM * > *aList)
Definition: drc_provider.h:186

Member Function Documentation

◆ DeleteAllItems()

void VECTOR_DRC_ITEMS_PROVIDER::DeleteAllItems ( )
inlineoverridevirtualinherited

Function DeleteAllItems removes and deletes all the items in the list.

Implements RC_ITEMS_PROVIDER.

Definition at line 255 of file drc_provider.h.

256  {
257  if( m_sourceVector )
258  {
259  for( DRC_ITEM* item : *m_sourceVector )
260  delete item;
261 
262  m_sourceVector->clear();
263  }
264 
265  m_filteredVector.clear(); // no ownership of DRC_ITEM pointers
266  }
std::vector< DRC_ITEM * > m_filteredVector
Definition: drc_provider.h:182
std::vector< DRC_ITEM * > * m_sourceVector
Definition: drc_provider.h:179

References VECTOR_DRC_ITEMS_PROVIDER::m_filteredVector, and VECTOR_DRC_ITEMS_PROVIDER::m_sourceVector.

◆ DeleteItem()

void VECTOR_DRC_ITEMS_PROVIDER::DeleteItem ( int  aIndex,
bool  aDeep 
)
inlineoverridevirtualinherited

Function DeleteItem removes (and optionally deletes) the indexed item from the list.

Parameters
aDeepIf true, the source item should be deleted as well as its entry in the list.

Implements RC_ITEMS_PROVIDER.

Definition at line 236 of file drc_provider.h.

237  {
238  DRC_ITEM* item = m_filteredVector[aIndex];
239  m_filteredVector.erase( m_filteredVector.begin() + aIndex );
240 
241  if( aDeep )
242  {
243  for( size_t i = 0; i < m_sourceVector->size(); ++i )
244  {
245  if( m_sourceVector->at( i ) == item )
246  {
247  delete item;
248  m_sourceVector->erase( m_sourceVector->begin() + i );
249  break;
250  }
251  }
252  }
253  }
std::vector< DRC_ITEM * > m_filteredVector
Definition: drc_provider.h:182
std::vector< DRC_ITEM * > * m_sourceVector
Definition: drc_provider.h:179

References VECTOR_DRC_ITEMS_PROVIDER::m_filteredVector, and VECTOR_DRC_ITEMS_PROVIDER::m_sourceVector.

◆ GetCount()

int VECTOR_DRC_ITEMS_PROVIDER::GetCount ( int  aSeverity = -1)
inlineoverridevirtualinherited

Implements RC_ITEMS_PROVIDER.

Definition at line 211 of file drc_provider.h.

212  {
213  if( aSeverity < 0 )
214  return m_filteredVector.size();
215 
216  int count = 0;
218 
219  if( m_sourceVector )
220  {
221  for( DRC_ITEM* item : *m_sourceVector )
222  {
223  if( bds.GetSeverity( item->GetErrorCode() ) == aSeverity )
224  count++;
225  }
226  }
227 
228  return count;
229  }
std::vector< DRC_ITEM * > m_filteredVector
Definition: drc_provider.h:182
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
std::vector< DRC_ITEM * > * m_sourceVector
Definition: drc_provider.h:179
PCB_BASE_FRAME * m_frame
Definition: drc_provider.h:178
BOARD * GetBoard() const
int GetSeverity(int aDRCErrorCode)
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References PCB_BASE_FRAME::GetBoard(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetSeverity(), VECTOR_DRC_ITEMS_PROVIDER::m_filteredVector, VECTOR_DRC_ITEMS_PROVIDER::m_frame, and VECTOR_DRC_ITEMS_PROVIDER::m_sourceVector.

◆ GetItem()

DRC_ITEM* VECTOR_DRC_ITEMS_PROVIDER::GetItem ( int  aIndex)
inlineoverridevirtualinherited

Function GetItem retrieves a RC_ITEM by index.

Implements RC_ITEMS_PROVIDER.

Definition at line 231 of file drc_provider.h.

232  {
233  return (m_filteredVector)[aIndex];
234  }
std::vector< DRC_ITEM * > m_filteredVector
Definition: drc_provider.h:182

References VECTOR_DRC_ITEMS_PROVIDER::m_filteredVector.

◆ SetSeverities()

void VECTOR_DRC_ITEMS_PROVIDER::SetSeverities ( int  aSeverities)
inlineoverridevirtualinherited

Implements RC_ITEMS_PROVIDER.

Definition at line 193 of file drc_provider.h.

194  {
195  m_severities = aSeverities;
196 
198 
199  m_filteredVector.clear();
200 
201  if( m_sourceVector )
202  {
203  for( DRC_ITEM* item : *m_sourceVector )
204  {
205  if( bds.GetSeverity( item->GetErrorCode() ) & aSeverities )
206  m_filteredVector.push_back( item );
207  }
208  }
209  }
std::vector< DRC_ITEM * > m_filteredVector
Definition: drc_provider.h:182
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
std::vector< DRC_ITEM * > * m_sourceVector
Definition: drc_provider.h:179
PCB_BASE_FRAME * m_frame
Definition: drc_provider.h:178
BOARD * GetBoard() const
int GetSeverity(int aDRCErrorCode)
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References PCB_BASE_FRAME::GetBoard(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetSeverity(), VECTOR_DRC_ITEMS_PROVIDER::m_filteredVector, VECTOR_DRC_ITEMS_PROVIDER::m_frame, VECTOR_DRC_ITEMS_PROVIDER::m_severities, and VECTOR_DRC_ITEMS_PROVIDER::m_sourceVector.


The documentation for this class was generated from the following file: