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 63 of file class_regulator_data.h.

63 {}

◆ ~REGULATOR_LIST()

REGULATOR_LIST::~REGULATOR_LIST ( )
inline

Definition at line 64 of file class_regulator_data.h.

65  {
66  for( REGULATOR_DATA* regulator : m_List )
67  delete regulator;
68  }
std::vector< REGULATOR_DATA * > m_List

References m_List.

Member Function Documentation

◆ Add()

void REGULATOR_LIST::Add ( REGULATOR_DATA aItem)
inline

Definition at line 75 of file class_regulator_data.h.

76  {
77  // add new item an try to keep alphabetic order,
78  // and because name have numbers inside, use a KiCad compare function
79  // that handles number as numbers not ASCII chars
80  unsigned ii = 0;
81 
82  for( ; ii < m_List.size(); ii++ )
83  {
84  if( StrNumCmp( aItem->m_Name, m_List[ii]->m_Name, true ) < 0 )
85  break;
86  }
87 
88  m_List.insert( m_List.begin() + ii, aItem );
89  }
std::vector< REGULATOR_DATA * > m_List
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.

References m_List, REGULATOR_DATA::m_Name, and StrNumCmp().

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

◆ GetCount()

unsigned int REGULATOR_LIST::GetCount ( )
inline

Definition at line 70 of file class_regulator_data.h.

71  {
72  return m_List.size();
73  }
std::vector< REGULATOR_DATA * > m_List

References m_List.

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

◆ GetReg()

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

Definition at line 91 of file class_regulator_data.h.

92  {
93  for( REGULATOR_DATA* regulator : m_List )
94  {
95  if( aName.CmpNoCase( regulator->m_Name ) == 0 )
96  return regulator;
97  }
98  return nullptr;
99  }
std::vector< REGULATOR_DATA * > m_List

References m_List.

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

◆ GetRegList()

wxArrayString REGULATOR_LIST::GetRegList ( ) const
inline

Definition at line 134 of file class_regulator_data.h.

135  {
136  wxArrayString list;
137 
138  for( REGULATOR_DATA* regulator : m_List )
139  list.Add( regulator->m_Name );
140 
141  return list;
142  }
std::vector< REGULATOR_DATA * > m_List

References m_List.

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

◆ Remove()

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

Definition at line 101 of file class_regulator_data.h.

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

References m_List.

Referenced by PANEL_REGULATOR::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 119 of file class_regulator_data.h.

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

References m_List, and REGULATOR_DATA::m_Name.

Referenced by PANEL_REGULATOR::OnEditRegulator().

Member Data Documentation

◆ m_List

std::vector<REGULATOR_DATA*> REGULATOR_LIST::m_List

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