KiCad PCB EDA Suite
DRC_LIST_GENERIC Class Reference

Class DRC_LIST_GENERIC is an implementation of the interface named DRC_ITEM_LIST which uses a vector of pointers to DRC_ITEMs to fulfill the interface. More...

#include <dialog_drclistbox.h>

Inheritance diagram for DRC_LIST_GENERIC:
DRC_ITEM_LIST

Public Member Functions

 DRC_LIST_GENERIC (DRC_LIST *aList)
 
void DeleteAllItems () override
 Function DeleteAllItems removes and deletes all the items in the list. More...
 
const DRC_ITEMGetItem (int aIndex) override
 Function GetItem retrieves a DRC_ITEM by pointer. More...
 
void DeleteItem (int aIndex) override
 Function DeleteAllItems removes and deletes desired item from the list. More...
 
int GetCount () override
 Function GetCount returns the number of items in the list. More...
 

Private Attributes

DRC_LISTm_vector
 

Detailed Description

Class DRC_LIST_GENERIC is an implementation of the interface named DRC_ITEM_LIST which uses a vector of pointers to DRC_ITEMs to fulfill the interface.

No ownership is taken of the vector, which will reside in class DRC

Definition at line 115 of file dialog_drclistbox.h.

Constructor & Destructor Documentation

◆ DRC_LIST_GENERIC()

DRC_LIST_GENERIC::DRC_LIST_GENERIC ( DRC_LIST aList)
inline

Definition at line 121 of file dialog_drclistbox.h.

121  :
122  m_vector(aList)
123  {
124  }

Member Function Documentation

◆ DeleteAllItems()

void DRC_LIST_GENERIC::DeleteAllItems ( )
inlineoverridevirtual

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

Implements DRC_ITEM_LIST.

Definition at line 133 of file dialog_drclistbox.h.

134  {
135  if( m_vector )
136  {
137  for( unsigned i=0; i<m_vector->size(); ++i )
138  delete (*m_vector)[i];
139 
140  m_vector->clear();
141  }
142  }
size_t i
Definition: json11.cpp:597

References i, and m_vector.

◆ DeleteItem()

void DRC_LIST_GENERIC::DeleteItem ( int  aIndex)
inlineoverridevirtual

Function DeleteAllItems removes and deletes desired item from the list.

Parameters
aIndexThe 0 based index into the list of the desired item which is to be deleted.

Implements DRC_ITEM_LIST.

Definition at line 155 of file dialog_drclistbox.h.

156  {
157  if( m_vector && (unsigned)aIndex < m_vector->size() )
158  {
159  delete (*m_vector)[aIndex];
160  m_vector->erase( m_vector->begin()+aIndex );
161  }
162  }

References m_vector.

◆ GetCount()

int DRC_LIST_GENERIC::GetCount ( )
inlineoverridevirtual

Function GetCount returns the number of items in the list.

Implements DRC_ITEM_LIST.

Definition at line 169 of file dialog_drclistbox.h.

170  {
171  if( m_vector )
172  {
173  return m_vector->size();
174  }
175  return 0;
176  }

References m_vector.

◆ GetItem()

const DRC_ITEM* DRC_LIST_GENERIC::GetItem ( int  aIndex)
inlineoverridevirtual

Function GetItem retrieves a DRC_ITEM by pointer.

The actual item remains owned by the list container.

Parameters
aIndexThe 0 based index into the list of the desired item.
Returns
const DRC_ITEM* - the desired item or NULL if aIndex is out of range.

Implements DRC_ITEM_LIST.

Definition at line 145 of file dialog_drclistbox.h.

146  {
147  if( m_vector && (unsigned)aIndex < m_vector->size() )
148  {
149  const DRC_ITEM* item = (*m_vector)[aIndex];
150  return item;
151  }
152  return NULL;
153  }
Class DRC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item.
Definition: drc_item.h:48

References m_vector.

Member Data Documentation

◆ m_vector

DRC_LIST* DRC_LIST_GENERIC::m_vector
private

Definition at line 117 of file dialog_drclistbox.h.

Referenced by DeleteAllItems(), DeleteItem(), GetCount(), and GetItem().


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