KiCad PCB EDA Suite
FOOTPRINT_WIZARDS Class Reference

#include <class_footprint_wizard.h>

Static Public Member Functions

static void register_wizard (FOOTPRINT_WIZARD *aWizard)
 Function register_wizard A footprint wizard calls this static method when it wants to register itself into the system wizards Note: if it is already registered, this function do nothing if n existing wizard with the same name exists, this existing wizard will be unregistered. More...
 
static bool deregister_object (void *aObject)
 Function deregister_object Anyone calls this method to deregister an object which builds a wizard, it will lookup on the vector calling GetObject until find, then removed and deleted. More...
 
static FOOTPRINT_WIZARDGetWizard (wxString aName)
 Function GetWizard. More...
 
static FOOTPRINT_WIZARDGetWizard (int aIndex)
 Function GetWizard. More...
 
static int GetWizardsCount ()
 Function GetWizardsCount. More...
 

Static Private Attributes

static std::vector< FOOTPRINT_WIZARD * > m_FootprintWizards
 FOOTPRINT_WIZARD system wide static list. More...
 

Detailed Description

Definition at line 171 of file class_footprint_wizard.h.

Member Function Documentation

bool FOOTPRINT_WIZARDS::deregister_object ( void *  aObject)
static

Function deregister_object Anyone calls this method to deregister an object which builds a wizard, it will lookup on the vector calling GetObject until find, then removed and deleted.

Parameters
aObjectis the footprint wizard object to be deregistered

Definition at line 103 of file class_footprint_wizard.cpp.

References FOOTPRINT_WIZARD::GetObject(), GetWizard(), GetWizardsCount(), m_FootprintWizards, and max.

Referenced by PYTHON_FOOTPRINT_WIZARDS::deregister_wizard().

104 {
105  int max = GetWizardsCount();
106 
107  for( int ii = 0; ii < max; ii++ )
108  {
109  FOOTPRINT_WIZARD* wizard = GetWizard( ii );
110 
111  if( wizard->GetObject() == aObject )
112  {
113  m_FootprintWizards.erase( m_FootprintWizards.begin() + ii );
114  delete wizard;
115  return true;
116  }
117  }
118 
119  return false;
120 }
static FOOTPRINT_WIZARD * GetWizard(wxString aName)
Function GetWizard.
virtual void * GetObject()=0
Function GetObject This method gets the pointer to the object from where this wizard constructs...
static int GetWizardsCount()
Function GetWizardsCount.
#define max(a, b)
Definition: auxiliary.h:86
Class FOOTPRINT_WIZARD This is the parent class from where any footprint wizard class must derive...
static std::vector< FOOTPRINT_WIZARD * > m_FootprintWizards
FOOTPRINT_WIZARD system wide static list.
FOOTPRINT_WIZARD * FOOTPRINT_WIZARDS::GetWizard ( wxString  aName)
static

Function GetWizard.

Parameters
aNameis the footprint wizard name
Returns
a wizard object by it's name or NULL if it isn't available.

Definition at line 53 of file class_footprint_wizard.cpp.

References FOOTPRINT_WIZARD::GetName(), GetWizardsCount(), and max.

Referenced by deregister_object(), FOOTPRINT_WIZARD_FRAME::GetBuiltFootprint(), FOOTPRINT_WIZARD_FRAME::GetMyWizard(), DIALOG_FOOTPRINT_WIZARD_LIST::initLists(), DIALOG_FOOTPRINT_WIZARD_LIST::OnCellFpGeneratorClick(), and register_wizard().

54 {
55  int max = GetWizardsCount();
56 
57  for( int i = 0; i<max; i++ )
58  {
59  FOOTPRINT_WIZARD* wizard = GetWizard( i );
60 
61  wxString name = wizard->GetName();
62 
63  if( name.Cmp( aName )==0 )
64  return wizard;
65  }
66 
67  return NULL;
68 }
static FOOTPRINT_WIZARD * GetWizard(wxString aName)
Function GetWizard.
static int GetWizardsCount()
Function GetWizardsCount.
#define max(a, b)
Definition: auxiliary.h:86
virtual wxString GetName()=0
Function GetName.
Class FOOTPRINT_WIZARD This is the parent class from where any footprint wizard class must derive...
FOOTPRINT_WIZARD * FOOTPRINT_WIZARDS::GetWizard ( int  aIndex)
static

Function GetWizard.

Returns
a wizard object by it's number or NULL if it isn't available.
Parameters
aIndexis the wizard index in list

Definition at line 47 of file class_footprint_wizard.cpp.

References m_FootprintWizards.

48 {
49  return m_FootprintWizards[aIndex];
50 }
static std::vector< FOOTPRINT_WIZARD * > m_FootprintWizards
FOOTPRINT_WIZARD system wide static list.
int FOOTPRINT_WIZARDS::GetWizardsCount ( )
static

Function GetWizardsCount.

Returns
the number of wizards available into the system

Definition at line 71 of file class_footprint_wizard.cpp.

References m_FootprintWizards.

Referenced by deregister_object(), GetWizard(), DIALOG_FOOTPRINT_WIZARD_LIST::initLists(), and register_wizard().

72 {
73  return m_FootprintWizards.size();
74 }
static std::vector< FOOTPRINT_WIZARD * > m_FootprintWizards
FOOTPRINT_WIZARD system wide static list.
void FOOTPRINT_WIZARDS::register_wizard ( FOOTPRINT_WIZARD aWizard)
static

Function register_wizard A footprint wizard calls this static method when it wants to register itself into the system wizards Note: if it is already registered, this function do nothing if n existing wizard with the same name exists, this existing wizard will be unregistered.

Parameters
aWizardis the footprint wizard to be registered

Definition at line 77 of file class_footprint_wizard.cpp.

References FOOTPRINT_WIZARD::GetName(), GetWizard(), GetWizardsCount(), and m_FootprintWizards.

Referenced by FOOTPRINT_WIZARD::register_wizard().

78 {
79  // Search for this entry do not register twice this wizard):
80  for( int ii = 0; ii < GetWizardsCount(); ii++ )
81  {
82  if( aWizard == GetWizard( ii ) ) // Already registered
83  return;
84  }
85 
86  // Search for a wizard with the same name, and remove it if found
87  for( int ii = 0; ii < GetWizardsCount(); ii++ )
88  {
89  FOOTPRINT_WIZARD* wizard = GetWizard( ii );
90 
91  if( wizard->GetName() == aWizard->GetName() )
92  {
93  m_FootprintWizards.erase( m_FootprintWizards.begin() + ii );
94  delete wizard;
95  break;
96  }
97  }
98 
99  m_FootprintWizards.push_back( aWizard );
100 }
static FOOTPRINT_WIZARD * GetWizard(wxString aName)
Function GetWizard.
static int GetWizardsCount()
Function GetWizardsCount.
virtual wxString GetName()=0
Function GetName.
Class FOOTPRINT_WIZARD This is the parent class from where any footprint wizard class must derive...
static std::vector< FOOTPRINT_WIZARD * > m_FootprintWizards
FOOTPRINT_WIZARD system wide static list.

Member Data Documentation

std::vector< FOOTPRINT_WIZARD * > FOOTPRINT_WIZARDS::m_FootprintWizards
staticprivate

FOOTPRINT_WIZARD system wide static list.

Definition at line 177 of file class_footprint_wizard.h.

Referenced by deregister_object(), GetWizard(), GetWizardsCount(), and register_wizard().


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