KiCad PCB EDA Suite
RATSNEST_DRC_ITEMS_PROVIDER Class Reference

RATSNEST_DRC_ITEMS_PROVIDER. More...

#include <drc_results_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< std::shared_ptr< DRC_ITEM > > *aList)
 
void SetSeverities (int aSeverities) override
 
int GetCount (int aSeverity=-1) override
 
std::shared_ptr< RC_ITEMGetItem (int aIndex) override
 Retrieve a RC_ITEM by index. More...
 
void DeleteItem (int aIndex, bool aDeep) override
 Remove (and optionally deletes) the indexed item from the list. More...
 
void DeleteAllItems (bool aIncludeExclusions, bool aDeep) override
 

Detailed Description

Constructor & Destructor Documentation

◆ RATSNEST_DRC_ITEMS_PROVIDER()

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

Definition at line 234 of file drc_results_provider.h.

234  :
235  VECTOR_DRC_ITEMS_PROVIDER( aFrame, aList )
236  { }
VECTOR_DRC_ITEMS_PROVIDER(PCB_BASE_FRAME *aFrame, std::vector< std::shared_ptr< DRC_ITEM > > *aList)

Member Function Documentation

◆ DeleteAllItems()

void VECTOR_DRC_ITEMS_PROVIDER::DeleteAllItems ( bool  aIncludeExclusions,
bool  aDeep 
)
inlineoverridevirtualinherited

Implements RC_ITEMS_PROVIDER.

Definition at line 213 of file drc_results_provider.h.

214  {
215  if( aDeep )
216  {
217  m_sourceVector->clear();
218  }
219 
220  m_filteredVector.clear(); // no ownership of DRC_ITEM pointers
221  }
std::vector< std::shared_ptr< DRC_ITEM > > m_filteredVector
std::vector< std::shared_ptr< DRC_ITEM > > * m_sourceVector

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

Remove (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 195 of file drc_results_provider.h.

196  {
197  auto item = m_filteredVector[aIndex];
198  m_filteredVector.erase( m_filteredVector.begin() + aIndex );
199 
200  if( aDeep )
201  {
202  for( size_t i = 0; i < m_sourceVector->size(); ++i )
203  {
204  if( m_sourceVector->at( i ) == item )
205  {
206  m_sourceVector->erase( m_sourceVector->begin() + i );
207  break;
208  }
209  }
210  }
211  }
std::vector< std::shared_ptr< DRC_ITEM > > m_filteredVector
std::vector< std::shared_ptr< DRC_ITEM > > * m_sourceVector

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 170 of file drc_results_provider.h.

171  {
172  if( aSeverity < 0 )
173  return m_filteredVector.size();
174 
175  int count = 0;
177 
178  if( m_sourceVector )
179  {
180  for( auto item : *m_sourceVector )
181  {
182  if( bds.GetSeverity( item->GetErrorCode() ) == aSeverity )
183  count++;
184  }
185  }
186 
187  return count;
188  }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: class_board.h:558
std::vector< std::shared_ptr< DRC_ITEM > > m_filteredVector
std::vector< std::shared_ptr< DRC_ITEM > > * m_sourceVector
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()

std::shared_ptr<RC_ITEM> VECTOR_DRC_ITEMS_PROVIDER::GetItem ( int  aIndex)
inlineoverridevirtualinherited

Retrieve a RC_ITEM by index.

Implements RC_ITEMS_PROVIDER.

Definition at line 190 of file drc_results_provider.h.

191  {
192  return (m_filteredVector)[aIndex];
193  }
std::vector< std::shared_ptr< DRC_ITEM > > m_filteredVector

References VECTOR_DRC_ITEMS_PROVIDER::m_filteredVector.

◆ SetSeverities()

void VECTOR_DRC_ITEMS_PROVIDER::SetSeverities ( int  aSeverities)
inlineoverridevirtualinherited

Implements RC_ITEMS_PROVIDER.

Definition at line 152 of file drc_results_provider.h.

153  {
154  m_severities = aSeverities;
155 
157 
158  m_filteredVector.clear();
159 
160  if( m_sourceVector )
161  {
162  for( auto item : *m_sourceVector )
163  {
164  if( bds.GetSeverity( item->GetErrorCode() ) & aSeverities )
165  m_filteredVector.push_back( item );
166  }
167  }
168  }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: class_board.h:558
std::vector< std::shared_ptr< DRC_ITEM > > m_filteredVector
std::vector< std::shared_ptr< DRC_ITEM > > * m_sourceVector
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: