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

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  ptr = Kiface().IfaceOrAddress( aId );
127 
128  if( !ptr )
129  {
130  KIFACE* kiface = aKiway.KiFACE( KIWAY::FACE_PCB );
131  ptr = kiface->IfaceOrAddress( aId );
132  }
133 
134  return static_cast<FOOTPRINT_LIST*>( ptr );
135  }
136  catch( ... )
137  {
138  return nullptr;
139  }
140 }
BITMAP2CMP_SETTINGS kiface
virtual void * IfaceOrAddress(int aDataId) override=0
Return pointer to the requested object.
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
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:196
Implement a participant in the KIWAY alchemy.
Definition: kiway.h:148

References KIWAY::FACE_PCB, KIFACE_BASE::IfaceOrAddress(), kiface, 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 }
wxString m_fpname
Module name.
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
wxString m_nickname
library as known in FP_LIB_TABLE

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