KiCad PCB EDA Suite
footprint_info.cpp File Reference
#include <footprint_info.h>
#include <fp_lib_table.h>
#include <dialogs/html_messagebox.h>
#include <kicad_string.h>
#include <kiface_ids.h>
#include <kiway.h>
#include <lib_id.h>
#include <thread>
#include <utility>

Go to the source code of this file.

Functions

bool operator< (const FOOTPRINT_INFO &lhs, const FOOTPRINT_INFO &rhs)
 
static FOOTPRINT_LISTget_instance_from_id (KIWAY &aKiway, int aId)
 

Function Documentation

◆ get_instance_from_id()

static FOOTPRINT_LIST* get_instance_from_id ( KIWAY aKiway,
int  aId 
)
static

Definition at line 120 of file footprint_info.cpp.

121 {
122  void* ptr = nullptr;
123 
124  try
125  {
126  KIFACE* kiface = aKiway.KiFACE( KIWAY::FACE_PCB );
127 
128  ptr = kiface->IfaceOrAddress( aId );
129 
130  return static_cast<FOOTPRINT_LIST*>( ptr );
131  }
132  catch( ... )
133  {
134  return nullptr;
135  }
136 }
BITMAP2CMP_SETTINGS kiface
pcbnew DSO
Definition: kiway.h:269
virtual KIFACE * KiFACE(FACE_T aFaceId, bool doLoad=true)
Return the KIFACE* given a FACE_T.
Definition: kiway.cpp:180
Implement a participant in the KIWAY alchemy.
Definition: kiway.h:147

References KIWAY::FACE_PCB, kiface, and KIWAY::KiFACE().

Referenced by FOOTPRINT_LIST::GetInstance().

◆ operator<()

bool operator< ( const FOOTPRINT_INFO lhs,
const FOOTPRINT_INFO rhs 
)

Definition at line 78 of file footprint_info.cpp.

79 {
80  int retv = StrNumCmp( lhs.m_nickname, rhs.m_nickname, false );
81 
82  if( retv != 0 )
83  return retv < 0;
84 
85  // Technically footprint names are not case sensitive because the file name is used
86  // as the footprint name. On windows this would be problematic because windows does
87  // not support case sensitive file names by default. This should not cause any issues
88  // and allow for a future change to use the name defined in the footprint file.
89  return StrNumCmp( lhs.m_fpname, rhs.m_fpname, false ) < 0;
90 }
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
Definition: string.cpp:420
wxString m_fpname
Module name.
wxString m_nickname
library as known in FP_LIB_TABLE

References FOOTPRINT_INFO::m_fpname, FOOTPRINT_INFO::m_nickname, and StrNumCmp().