KiCad PCB EDA Suite
FOOTPRINT_INFO_IMPL Class Reference

#include <footprint_info_impl.h>

Inheritance diagram for FOOTPRINT_INFO_IMPL:
FOOTPRINT_INFO LIB_TREE_ITEM

Public Member Functions

 FOOTPRINT_INFO_IMPL (FOOTPRINT_LIST *aOwner, const wxString &aNickname, const wxString &aFootprintName)
 
 FOOTPRINT_INFO_IMPL (const wxString &aNickname, const wxString &aFootprintName, const wxString &aDescription, const wxString &aKeywords, int aOrderNum, unsigned int aPadCount, unsigned int aUniquePadCount)
 
 FOOTPRINT_INFO_IMPL (const wxString &aNickname, const wxString &aFootprintName)
 
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

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

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...
 

Detailed Description

Definition at line 34 of file footprint_info_impl.h.

Constructor & Destructor Documentation

FOOTPRINT_INFO_IMPL::FOOTPRINT_INFO_IMPL ( FOOTPRINT_LIST aOwner,
const wxString &  aNickname,
const wxString &  aFootprintName 
)
inline

Definition at line 37 of file footprint_info_impl.h.

References load(), FOOTPRINT_INFO::m_fpname, FOOTPRINT_INFO::m_loaded, FOOTPRINT_INFO::m_nickname, FOOTPRINT_INFO::m_num, FOOTPRINT_INFO::m_owner, FOOTPRINT_INFO::m_pad_count, and FOOTPRINT_INFO::m_unique_pad_count.

Referenced by FOOTPRINT_LIST_IMPL::JoinWorkers().

39  {
40  m_nickname = aNickname;
41  m_fpname = aFootprintName;
42  m_num = 0;
43  m_pad_count = 0;
45 
46  m_owner = aOwner;
47  m_loaded = false;
48  load();
49  }
unsigned m_pad_count
Number of pads.
int m_num
Order number in the display list.
FOOTPRINT_LIST * m_owner
provides access to FP_LIB_TABLE
wxString m_fpname
Module name.
wxString m_nickname
library as known in FP_LIB_TABLE
virtual void load() override
lazily load stuff not filled in by constructor. This may throw IO_ERRORS.
unsigned m_unique_pad_count
Number of unique pads.
FOOTPRINT_INFO_IMPL::FOOTPRINT_INFO_IMPL ( const wxString &  aNickname,
const wxString &  aFootprintName,
const wxString &  aDescription,
const wxString &  aKeywords,
int  aOrderNum,
unsigned int  aPadCount,
unsigned int  aUniquePadCount 
)
inline

Definition at line 52 of file footprint_info_impl.h.

References FOOTPRINT_INFO::m_doc, FOOTPRINT_INFO::m_fpname, FOOTPRINT_INFO::m_keywords, FOOTPRINT_INFO::m_loaded, FOOTPRINT_INFO::m_nickname, FOOTPRINT_INFO::m_num, FOOTPRINT_INFO::m_owner, FOOTPRINT_INFO::m_pad_count, and FOOTPRINT_INFO::m_unique_pad_count.

55  {
56  m_nickname = aNickname;
57  m_fpname = aFootprintName;
58  m_num = aOrderNum;
59  m_pad_count = aPadCount;
60  m_unique_pad_count = aUniquePadCount;
61  m_doc = aDescription;
62  m_keywords = aKeywords;
63 
64  m_owner = nullptr;
65  m_loaded = true;
66  }
unsigned m_pad_count
Number of pads.
int m_num
Order number in the display list.
FOOTPRINT_LIST * m_owner
provides access to FP_LIB_TABLE
wxString m_doc
Footprint description.
wxString m_fpname
Module name.
wxString m_keywords
Footprint keywords.
wxString m_nickname
library as known in FP_LIB_TABLE
unsigned m_unique_pad_count
Number of unique pads.
FOOTPRINT_INFO_IMPL::FOOTPRINT_INFO_IMPL ( const wxString &  aNickname,
const wxString &  aFootprintName 
)
inline

Definition at line 70 of file footprint_info_impl.h.

References load(), FOOTPRINT_INFO::m_fpname, FOOTPRINT_INFO::m_loaded, FOOTPRINT_INFO::m_nickname, and FOOTPRINT_INFO::m_owner.

71  {
72  m_nickname = aNickname;
73  m_fpname = aFootprintName;
74 
75  m_owner = nullptr;
76  m_loaded = true;
77  }
FOOTPRINT_LIST * m_owner
provides access to FP_LIB_TABLE
wxString m_fpname
Module name.
wxString m_nickname
library as known in FP_LIB_TABLE

Member Function Documentation

void FOOTPRINT_INFO::ensure_loaded ( )
inlineprotectedinherited

Definition at line 145 of file footprint_info.h.

146  {
147  if( !m_loaded )
148  load();
149  }
virtual void load()
lazily load stuff not filled in by constructor. This may throw IO_ERRORS.
const wxString& FOOTPRINT_INFO::GetDescription ( )
inlineoverridevirtualinherited

Implements LIB_TREE_ITEM.

Definition at line 95 of file footprint_info.h.

Referenced by CVPCB_MAINFRAME::DisplayStatus().

96  {
97  ensure_loaded();
98  return m_doc;
99  }
wxString m_doc
Footprint description.
const wxString& FOOTPRINT_INFO::GetFootprintName ( ) const
inlineinherited

Definition at line 75 of file footprint_info.h.

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

76  {
77  return m_fpname;
78  }
wxString m_fpname
Module name.
const wxString& FOOTPRINT_INFO::GetKeywords ( )
inlineinherited

Definition at line 101 of file footprint_info.h.

Referenced by CVPCB_MAINFRAME::DisplayStatus().

102  {
103  ensure_loaded();
104  return m_keywords;
105  }
wxString m_keywords
Footprint keywords.
LIB_ID FOOTPRINT_INFO::GetLibId ( ) const
inlineoverridevirtualinherited

Implements LIB_TREE_ITEM.

Definition at line 90 of file footprint_info.h.

91  {
92  return LIB_ID( m_nickname, m_fpname );
93  }
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
wxString FOOTPRINT_INFO::GetLibNickname ( ) const
inlineoverridevirtualinherited

Implements LIB_TREE_ITEM.

Definition at line 80 of file footprint_info.h.

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

81  {
82  return m_nickname;
83  }
wxString m_nickname
library as known in FP_LIB_TABLE
const wxString& FOOTPRINT_INFO::GetName ( void  ) const
inlineoverridevirtualinherited

Implements LIB_TREE_ITEM.

Definition at line 85 of file footprint_info.h.

Referenced by FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary().

86  {
87  return m_fpname;
88  }
wxString m_fpname
Module name.
int FOOTPRINT_INFO::GetOrderNum ( )
inlineinherited

Definition at line 128 of file footprint_info.h.

129  {
130  ensure_loaded();
131  return m_num;
132  }
int m_num
Order number in the display list.
unsigned FOOTPRINT_INFO::GetPadCount ( )
inlineinherited

Definition at line 116 of file footprint_info.h.

117  {
118  ensure_loaded();
119  return m_pad_count;
120  }
unsigned m_pad_count
Number of pads.
wxString FOOTPRINT_INFO::GetSearchText ( )
inlineoverridevirtualinherited

Reimplemented from LIB_TREE_ITEM.

Definition at line 107 of file footprint_info.h.

References LIB_TREE_ITEM::GetDescription().

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

Definition at line 122 of file footprint_info.h.

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

123  {
124  ensure_loaded();
125  return m_unique_pad_count;
126  }
unsigned m_unique_pad_count
Number of unique pads.
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.

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

59 { return 0; }
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.

Referenced by LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT().

64 { return wxEmptyString; }
bool FOOTPRINT_INFO::InLibrary ( const wxString &  aLibrary) const
inherited

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 78 of file footprint_info.cpp.

79 {
80  return aLibrary == m_nickname;
81 }
wxString m_nickname
library as known in FP_LIB_TABLE
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.

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

54 { return true; }
void FOOTPRINT_INFO_IMPL::load ( )
overrideprotectedvirtual

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

Reimplemented from FOOTPRINT_INFO.

Definition at line 45 of file footprint_info_impl.cpp.

References DO_NOT_INCLUDE_NPTH, MODULE::GetDescription(), FP_LIB_TABLE::GetEnumeratedFootprint(), MODULE::GetKeywords(), MODULE::GetPadCount(), FOOTPRINT_LIST::GetTable(), MODULE::GetUniquePadCount(), FOOTPRINT_INFO::m_doc, FOOTPRINT_INFO::m_fpname, FOOTPRINT_INFO::m_keywords, FOOTPRINT_INFO::m_loaded, FOOTPRINT_INFO::m_nickname, FOOTPRINT_INFO::m_owner, FOOTPRINT_INFO::m_pad_count, and FOOTPRINT_INFO::m_unique_pad_count.

Referenced by FOOTPRINT_INFO_IMPL().

46 {
47  FP_LIB_TABLE* fptable = m_owner->GetTable();
48 
49  wxASSERT( fptable );
50 
51  const MODULE* footprint = fptable->GetEnumeratedFootprint( m_nickname, m_fpname );
52 
53  if( footprint == NULL ) // Should happen only with malformed/broken libraries
54  {
55  m_pad_count = 0;
57  }
58  else
59  {
62  m_keywords = footprint->GetKeywords();
63  m_doc = footprint->GetDescription();
64  }
65 
66  m_loaded = true;
67 }
unsigned m_pad_count
Number of pads.
FOOTPRINT_LIST * m_owner
provides access to FP_LIB_TABLE
wxString m_doc
Footprint description.
const MODULE * GetEnumeratedFootprint(const wxString &aNickname, const wxString &aFootprintName)
Function GetEnumeratedFootprint.
wxString m_fpname
Module name.
const wxString & GetKeywords() const
Definition: class_module.h:199
wxString m_keywords
Footprint keywords.
unsigned GetPadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
GetPadCount returns the number of pads.
const wxString & GetDescription() const
Definition: class_module.h:196
unsigned GetUniquePadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
GetUniquePadCount returns the number of unique pads.
wxString m_nickname
library as known in FP_LIB_TABLE
unsigned m_unique_pad_count
Number of unique pads.
FP_LIB_TABLE * GetTable() const

Member Data Documentation

wxString FOOTPRINT_INFO::m_doc
protectedinherited

Footprint description.

Definition at line 163 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL(), and load().

wxString FOOTPRINT_INFO::m_fpname
protectedinherited

Module name.

Definition at line 159 of file footprint_info.h.

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

wxString FOOTPRINT_INFO::m_keywords
protectedinherited

Footprint keywords.

Definition at line 164 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL(), and load().

bool FOOTPRINT_INFO::m_loaded
protectedinherited

Definition at line 156 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL(), and load().

wxString FOOTPRINT_INFO::m_nickname
protectedinherited

library as known in FP_LIB_TABLE

Definition at line 158 of file footprint_info.h.

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

int FOOTPRINT_INFO::m_num
protectedinherited

Order number in the display list.

Definition at line 160 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL().

FOOTPRINT_LIST* FOOTPRINT_INFO::m_owner
protectedinherited

provides access to FP_LIB_TABLE

Definition at line 152 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL(), and load().

unsigned FOOTPRINT_INFO::m_pad_count
protectedinherited

Number of pads.

Definition at line 161 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL(), and load().

unsigned FOOTPRINT_INFO::m_unique_pad_count
protectedinherited

Number of unique pads.

Definition at line 162 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL(), and load().


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