KiCad PCB EDA Suite
FOOTPRINT_INFO Class Reference

#include <footprint_info.h>

Inheritance diagram for FOOTPRINT_INFO:
LIB_TREE_ITEM FOOTPRINT_INFO_IMPL

Public Member Functions

virtual ~FOOTPRINT_INFO ()
 
const wxString & GetFootprintName () const
 
wxString GetLibNickname () const override
 
const wxString & GetName () const override
 
LIB_ID GetLibId () const override
 
const wxString & GetDescription () override
 
const wxString & GetKeywords ()
 
wxString GetSearchText () override
 
unsigned GetPadCount ()
 
unsigned GetUniquePadCount ()
 
int GetOrderNum ()
 
bool InLibrary (const wxString &aLibrary) const
 Test if the FOOTPRINT_INFO object was loaded from aLibrary. More...
 
virtual bool IsRoot () const
 For items having aliases, IsRoot() indicates the principal item. More...
 
virtual int GetUnitCount ()
 For items with units, return the number of units. More...
 
virtual wxString GetUnitReference (int aUnit)
 For items with units, return an identifier for unit x. More...
 

Protected Member Functions

void ensure_loaded ()
 
virtual void load ()
 lazily load stuff not filled in by constructor. This may throw IO_ERRORS. More...
 

Protected Attributes

FOOTPRINT_LISTm_owner
 provides access to FP_LIB_TABLE More...
 
bool m_loaded
 
wxString m_nickname
 library as known in FP_LIB_TABLE More...
 
wxString m_fpname
 Module name. More...
 
int m_num
 Order number in the display list. More...
 
unsigned m_pad_count
 Number of pads. More...
 
unsigned m_unique_pad_count
 Number of unique pads. More...
 
wxString m_doc
 Footprint description. More...
 
wxString m_keywords
 Footprint keywords. More...
 

Friends

bool operator< (const FOOTPRINT_INFO &item1, const FOOTPRINT_INFO &item2)
 FOOTPRINT object list sort function. More...
 

Detailed Description

Definition at line 62 of file footprint_info.h.

Constructor & Destructor Documentation

◆ ~FOOTPRINT_INFO()

virtual FOOTPRINT_INFO::~FOOTPRINT_INFO ( )
inlinevirtual

Definition at line 67 of file footprint_info.h.

68  {
69  }

Member Function Documentation

◆ ensure_loaded()

void FOOTPRINT_INFO::ensure_loaded ( )
inlineprotected

Definition at line 144 of file footprint_info.h.

145  {
146  if( !m_loaded )
147  load();
148  }
virtual void load()
lazily load stuff not filled in by constructor. This may throw IO_ERRORS.

◆ GetDescription()

const wxString& FOOTPRINT_INFO::GetDescription ( )
inlineoverridevirtual

Implements LIB_TREE_ITEM.

Definition at line 94 of file footprint_info.h.

95  {
96  ensure_loaded();
97  return m_doc;
98  }
wxString m_doc
Footprint description.

Referenced by CVPCB_MAINFRAME::DisplayStatus().

◆ GetFootprintName()

const wxString& FOOTPRINT_INFO::GetFootprintName ( ) const
inline

Definition at line 74 of file footprint_info.h.

75  {
76  return m_fpname;
77  }
wxString m_fpname
Module name.

Referenced by CVPCB_MAINFRAME::AutomaticFootprintMatching(), and FOOTPRINT_FILTER::ITERATOR::FootprintFilterMatch().

◆ GetKeywords()

const wxString& FOOTPRINT_INFO::GetKeywords ( )
inline

Definition at line 100 of file footprint_info.h.

101  {
102  ensure_loaded();
103  return m_keywords;
104  }
wxString m_keywords
Footprint keywords.

Referenced by CVPCB_MAINFRAME::DisplayStatus().

◆ GetLibId()

LIB_ID FOOTPRINT_INFO::GetLibId ( ) const
inlineoverridevirtual

Implements LIB_TREE_ITEM.

Definition at line 89 of file footprint_info.h.

90  {
91  return LIB_ID( m_nickname, m_fpname );
92  }
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
wxString m_fpname
Module name.
wxString m_nickname
library as known in FP_LIB_TABLE

◆ GetLibNickname()

wxString FOOTPRINT_INFO::GetLibNickname ( ) const
inlineoverridevirtual

Implements LIB_TREE_ITEM.

Definition at line 79 of file footprint_info.h.

80  {
81  return m_nickname;
82  }
wxString m_nickname
library as known in FP_LIB_TABLE

Referenced by CVPCB_MAINFRAME::DisplayStatus(), FOOTPRINT_FILTER::ITERATOR::FootprintFilterMatch(), and DISPLAY_FOOTPRINTS_FRAME::InitDisplay().

◆ GetName()

const wxString& FOOTPRINT_INFO::GetName ( void  ) const
inlineoverridevirtual

Implements LIB_TREE_ITEM.

Definition at line 84 of file footprint_info.h.

85  {
86  return m_fpname;
87  }
wxString m_fpname
Module name.

◆ GetOrderNum()

int FOOTPRINT_INFO::GetOrderNum ( )
inline

Definition at line 127 of file footprint_info.h.

128  {
129  ensure_loaded();
130  return m_num;
131  }
int m_num
Order number in the display list.

◆ GetPadCount()

unsigned FOOTPRINT_INFO::GetPadCount ( )
inline

Definition at line 115 of file footprint_info.h.

116  {
117  ensure_loaded();
118  return m_pad_count;
119  }
unsigned m_pad_count
Number of pads.

◆ GetSearchText()

wxString FOOTPRINT_INFO::GetSearchText ( )
inlineoverridevirtual

Reimplemented from LIB_TREE_ITEM.

Definition at line 106 of file footprint_info.h.

107  {
108  // Matches are scored by offset from front of string, so inclusion of this spacer
109  // discounts matches found after it.
110  static const wxString discount( wxT( " " ) );
111 
112  return GetKeywords() + discount + GetDescription();
113  }
const wxString & GetDescription() override
const wxString & GetKeywords()

References LIB_TREE_ITEM::GetDescription().

◆ GetUniquePadCount()

unsigned FOOTPRINT_INFO::GetUniquePadCount ( )
inline

Definition at line 121 of file footprint_info.h.

122  {
123  ensure_loaded();
124  return m_unique_pad_count;
125  }
unsigned m_unique_pad_count
Number of unique pads.

Referenced by FOOTPRINT_FILTER::ITERATOR::PinCountMatch().

◆ GetUnitCount()

virtual int LIB_TREE_ITEM::GetUnitCount ( void  )
inlinevirtualinherited

For items with units, return the number of units.

Reimplemented in LIB_ALIAS.

Definition at line 59 of file lib_tree_item.h.

59 { return 0; }

Referenced by LIB_TREE_NODE_LIB_ID::LIB_TREE_NODE_LIB_ID(), and LIB_TREE_NODE_LIB_ID::Update().

◆ GetUnitReference()

virtual wxString LIB_TREE_ITEM::GetUnitReference ( int  aUnit)
inlinevirtualinherited

For items with units, return an identifier for unit x.

Reimplemented in LIB_ALIAS.

Definition at line 64 of file lib_tree_item.h.

64 { return wxEmptyString; }

Referenced by LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT().

◆ InLibrary()

bool FOOTPRINT_INFO::InLibrary ( const wxString &  aLibrary) const

Test if the FOOTPRINT_INFO object was loaded from aLibrary.

Parameters
aLibraryis the nickname of the library to test.
Returns
true if the FOOTPRINT_INFO object was loaded from aLibrary. Otherwise false.

Definition at line 77 of file footprint_info.cpp.

78 {
79  return aLibrary == m_nickname;
80 }
wxString m_nickname
library as known in FP_LIB_TABLE

References m_nickname.

◆ IsRoot()

virtual bool LIB_TREE_ITEM::IsRoot ( ) const
inlinevirtualinherited

For items having aliases, IsRoot() indicates the principal item.

Reimplemented in LIB_ALIAS.

Definition at line 54 of file lib_tree_item.h.

54 { return true; }

Referenced by LIB_TREE_NODE_LIB_ID::LIB_TREE_NODE_LIB_ID(), and LIB_TREE_NODE_LIB_ID::Update().

◆ load()

virtual void FOOTPRINT_INFO::load ( )
inlineprotectedvirtual

lazily load stuff not filled in by constructor. This may throw IO_ERRORS.

Reimplemented in FOOTPRINT_INFO_IMPL.

Definition at line 151 of file footprint_info.h.

151 { };

Friends And Related Function Documentation

◆ operator<

bool operator< ( const FOOTPRINT_INFO item1,
const FOOTPRINT_INFO item2 
)
friend

FOOTPRINT object list sort function.

Definition at line 168 of file footprint_info.h.

169 {
170  int retv = StrNumCmp( item1.m_nickname, item2.m_nickname, false );
171 
172  if( retv != 0 )
173  return retv < 0;
174 
175  // Technically footprint names are not case sensitive because the file name is used
176  // as the footprint name. On windows this would be problematic because windows does
177  // not support case sensitive file names by default. This should not cause any issues
178  // and allow for a future change to use the name defined in the footprint file.
179  return StrNumCmp( item1.m_fpname, item2.m_fpname, false ) < 0;
180 }
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
Definition: string.cpp:342
wxString m_fpname
Module name.
wxString m_nickname
library as known in FP_LIB_TABLE

Member Data Documentation

◆ m_doc

wxString FOOTPRINT_INFO::m_doc
protected

Footprint description.

Definition at line 162 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL::FOOTPRINT_INFO_IMPL(), and FOOTPRINT_INFO_IMPL::load().

◆ m_fpname

wxString FOOTPRINT_INFO::m_fpname
protected

Module name.

Definition at line 158 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL::FOOTPRINT_INFO_IMPL(), FOOTPRINT_INFO_IMPL::load(), and operator<().

◆ m_keywords

wxString FOOTPRINT_INFO::m_keywords
protected

Footprint keywords.

Definition at line 163 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL::FOOTPRINT_INFO_IMPL(), and FOOTPRINT_INFO_IMPL::load().

◆ m_loaded

bool FOOTPRINT_INFO::m_loaded
protected

◆ m_nickname

wxString FOOTPRINT_INFO::m_nickname
protected

◆ m_num

int FOOTPRINT_INFO::m_num
protected

Order number in the display list.

Definition at line 159 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL::FOOTPRINT_INFO_IMPL().

◆ m_owner

FOOTPRINT_LIST* FOOTPRINT_INFO::m_owner
protected

provides access to FP_LIB_TABLE

Definition at line 151 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL::FOOTPRINT_INFO_IMPL(), and FOOTPRINT_INFO_IMPL::load().

◆ m_pad_count

unsigned FOOTPRINT_INFO::m_pad_count
protected

Number of pads.

Definition at line 160 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL::FOOTPRINT_INFO_IMPL(), and FOOTPRINT_INFO_IMPL::load().

◆ m_unique_pad_count

unsigned FOOTPRINT_INFO::m_unique_pad_count
protected

Number of unique pads.

Definition at line 161 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL::FOOTPRINT_INFO_IMPL(), and FOOTPRINT_INFO_IMPL::load().


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