KiCad PCB EDA Suite
REGULATOR_LIST Class Reference

#include <class_regulator_data.h>

Public Member Functions

 REGULATOR_LIST ()
 
 ~REGULATOR_LIST ()
 
unsigned int GetCount ()
 
void Add (REGULATOR_DATA *aItem)
 
REGULATOR_DATAGetReg (const wxString &aName)
 
void Remove (const wxString &aRegName)
 
void Replace (REGULATOR_DATA *aItem)
 Replace an old REGULATOR_DATA by a new one The old one is deleted the 2 items must have the same name. More...
 
wxArrayString GetRegList () const
 

Public Attributes

std::vector< REGULATOR_DATA * > m_List
 

Detailed Description

Definition at line 60 of file class_regulator_data.h.

Constructor & Destructor Documentation

◆ REGULATOR_LIST()

REGULATOR_LIST::REGULATOR_LIST ( )
inline

Definition at line 66 of file class_regulator_data.h.

66 {};

◆ ~REGULATOR_LIST()

REGULATOR_LIST::~REGULATOR_LIST ( )
inline

Definition at line 67 of file class_regulator_data.h.

68  {
69  for( unsigned ii = 0; ii < m_List.size(); ii++ )
70  delete m_List[ii];
71  }
std::vector< REGULATOR_DATA * > m_List

References m_List.

Member Function Documentation

◆ Add()

void REGULATOR_LIST::Add ( REGULATOR_DATA aItem)
inline

Definition at line 78 of file class_regulator_data.h.

79  {
80  // add new item an try to keep alphabetic order,
81  // and because name have numbers inside, use a KiCad compare function
82  // that handles number as numbers not ascii chars
83  unsigned ii = 0;
84  for( ; ii < m_List.size(); ii++ )
85  {
86  if( UTIL::RefDesStringCompare( aItem->m_Name, m_List[ii]->m_Name ) < 0 )
87  break;
88  }
89  m_List.insert( m_List.begin() + ii, aItem );
90  }
std::vector< REGULATOR_DATA * > m_List
int RefDesStringCompare(const wxString &aFirst, const wxString &aSecond)
Acts just like the strcmp function but treats numbers within the string text correctly for sorting.

References m_List, REGULATOR_DATA::m_Name, and UTIL::RefDesStringCompare().

Referenced by PCB_CALCULATOR_FRAME::OnAddRegulator(), and PCB_CALCULATOR_DATAFILE_PARSER::ParseRegulatorDescr().

◆ GetCount()

unsigned int REGULATOR_LIST::GetCount ( )
inline

Definition at line 73 of file class_regulator_data.h.

74  {
75  return m_List.size();
76  }
std::vector< REGULATOR_DATA * > m_List

References m_List.

Referenced by PCB_CALCULATOR_FRAME::OnDataFileSelection(), and PCB_CALCULATOR_FRAME::SelectLastSelectedRegulator().

◆ GetReg()

REGULATOR_DATA* REGULATOR_LIST::GetReg ( const wxString &  aName)
inline

Definition at line 92 of file class_regulator_data.h.

93  {
94  for( unsigned ii = 0; ii < m_List.size(); ii++ )
95  {
96  if( aName.CmpNoCase( m_List[ii]->m_Name ) == 0 )
97  {
98  return m_List[ii];
99  }
100  }
101  return NULL;
102  }
std::vector< REGULATOR_DATA * > m_List
#define NULL

References m_List, and NULL.

Referenced by PCB_CALCULATOR_FRAME::OnAddRegulator(), PCB_CALCULATOR_FRAME::OnEditRegulator(), and PCB_CALCULATOR_FRAME::OnRegulatorSelection().

◆ GetRegList()

wxArrayString REGULATOR_LIST::GetRegList ( ) const
inline

Definition at line 137 of file class_regulator_data.h.

138  {
139  wxArrayString list;
140  for( unsigned ii = 0; ii < m_List.size(); ii++ )
141  list.Add( m_List[ii]->m_Name );
142 
143  return list;
144  }
std::vector< REGULATOR_DATA * > m_List

References m_List.

Referenced by PCB_CALCULATOR_FRAME::OnAddRegulator(), PCB_CALCULATOR_FRAME::OnDataFileSelection(), PCB_CALCULATOR_FRAME::OnRemoveRegulator(), and PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME().

◆ Remove()

void REGULATOR_LIST::Remove ( const wxString &  aRegName)
inline

Definition at line 104 of file class_regulator_data.h.

105  {
106  for( unsigned ii = 0; ii < m_List.size(); ii++ )
107  {
108  if( aRegName.CmpNoCase( m_List[ii]->m_Name ) == 0 )
109  {
110  // Found! remove it
111  m_List.erase( m_List.begin() + ii );
112  break;
113  }
114  }
115  }
std::vector< REGULATOR_DATA * > m_List

References m_List.

Referenced by PCB_CALCULATOR_FRAME::OnRemoveRegulator().

◆ Replace()

void REGULATOR_LIST::Replace ( REGULATOR_DATA aItem)
inline

Replace an old REGULATOR_DATA by a new one The old one is deleted the 2 items must have the same name.

Definition at line 122 of file class_regulator_data.h.

123  {
124  // Search for the old regulator
125  for( unsigned ii = 0; ii < m_List.size(); ii++ )
126  {
127  if( aItem->m_Name.CmpNoCase( m_List[ii]->m_Name ) == 0 )
128  {
129  // Found! remove it
130  delete m_List[ii];
131  m_List[ii] = aItem;
132  break;
133  }
134  }
135  }
std::vector< REGULATOR_DATA * > m_List

References m_List, and REGULATOR_DATA::m_Name.

Referenced by PCB_CALCULATOR_FRAME::OnEditRegulator().

Member Data Documentation

◆ m_List


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