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 104 of file dialog_drclistbox.h.

Constructor & Destructor Documentation

◆ DRC_LIST_GENERIC()

DRC_LIST_GENERIC::DRC_LIST_GENERIC ( DRC_LIST aList)
inline

Definition at line 110 of file dialog_drclistbox.h.

110  :
111  m_vector(aList)
112  {
113  }

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 122 of file dialog_drclistbox.h.

123  {
124  if( m_vector )
125  {
126  for( unsigned i=0; i<m_vector->size(); ++i )
127  delete (*m_vector)[i];
128 
129  m_vector->clear();
130  }
131  }
size_t i
Definition: json11.cpp:649

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 144 of file dialog_drclistbox.h.

145  {
146  if( m_vector && (unsigned)aIndex < m_vector->size() )
147  {
148  delete (*m_vector)[aIndex];
149  m_vector->erase( m_vector->begin()+aIndex );
150  }
151  }

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 158 of file dialog_drclistbox.h.

159  {
160  if( m_vector )
161  {
162  return m_vector->size();
163  }
164  return 0;
165  }

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 134 of file dialog_drclistbox.h.

135  {
136  if( m_vector && (unsigned)aIndex < m_vector->size() )
137  {
138  const DRC_ITEM* item = (*m_vector)[aIndex];
139  return item;
140  }
141  return NULL;
142  }
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 106 of file dialog_drclistbox.h.

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


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