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
 
wxString GetName () const override
 
LIB_ID GetLibId () const override
 
wxString GetDescription () override
 
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 void GetChooserFields (std::map< wxString, wxString > &aColumnMap)
 Retrieves a key/value map of the fields on this item that should be exposed to the library browser/chooser for displaying in columns, searching, etc. More...
 
virtual bool IsRoot () const
 For items having aliases, IsRoot() indicates the principal item. More...
 
virtual wxString GetFootprint ()
 For items with footprint fields. More...
 
virtual int GetUnitCount () const
 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...
 
virtual wxString GetUnitDisplayName (int aUnit)
 For items with units, return a display name for unit x. More...
 
virtual bool HasUnitDisplayName (int aUnit)
 For items with units, return true if a display name is set for 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() [1/3]

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.

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 }
virtual void load() override
lazily load stuff not filled in by constructor. This may throw IO_ERRORS.
int m_num
Order number in the display list.
wxString m_fpname
Module name.
unsigned m_unique_pad_count
Number of unique pads.
unsigned m_pad_count
Number of pads.
FOOTPRINT_LIST * m_owner
provides access to FP_LIB_TABLE
wxString m_nickname
library as known in FP_LIB_TABLE

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.

◆ FOOTPRINT_INFO_IMPL() [2/3]

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.

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 }
wxString m_doc
Footprint description.
wxString m_keywords
Footprint keywords.

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.

◆ FOOTPRINT_INFO_IMPL() [3/3]

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

Definition at line 70 of file footprint_info_impl.h.

71 {
72 m_nickname = aNickname;
73 m_fpname = aFootprintName;
74
75 m_owner = nullptr;
76 m_loaded = true;
77 }

References FOOTPRINT_INFO::m_fpname, FOOTPRINT_INFO::m_loaded, FOOTPRINT_INFO::m_nickname, and FOOTPRINT_INFO::m_owner.

Member Function Documentation

◆ ensure_loaded()

void FOOTPRINT_INFO::ensure_loaded ( )
inlineprotectedinherited

Definition at line 135 of file footprint_info.h.

136 {
137 if( !m_loaded )
138 load();
139 }
virtual void load()
lazily load stuff not filled in by constructor. This may throw IO_ERRORS.

◆ GetChooserFields()

virtual void LIB_TREE_ITEM::GetChooserFields ( std::map< wxString, wxString > &  aColumnMap)
inlinevirtualinherited

Retrieves a key/value map of the fields on this item that should be exposed to the library browser/chooser for displaying in columns, searching, etc.

Reimplemented in LIB_SYMBOL.

Definition at line 56 of file lib_tree_item.h.

56{}

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

◆ GetDescription()

wxString FOOTPRINT_INFO::GetDescription ( )
inlineoverridevirtualinherited

Implements LIB_TREE_ITEM.

Definition at line 80 of file footprint_info.h.

81 {
83 return m_doc;
84 }

Referenced by CVPCB_MAINFRAME::DisplayStatus().

◆ GetFootprint()

virtual wxString LIB_TREE_ITEM::GetFootprint ( )
inlinevirtualinherited

For items with footprint fields.

Reimplemented in LIB_SYMBOL.

Definition at line 68 of file lib_tree_item.h.

68{ return wxEmptyString; }

Referenced by LIB_TREE_NODE_LIB_ID::LIB_TREE_NODE_LIB_ID().

◆ GetFootprintName()

const wxString & FOOTPRINT_INFO::GetFootprintName ( ) const
inlineinherited

◆ GetKeywords()

wxString FOOTPRINT_INFO::GetKeywords ( )
inlineinherited

Definition at line 86 of file footprint_info.h.

87 {
89 return m_keywords;
90 }

Referenced by CVPCB_MAINFRAME::DisplayStatus().

◆ GetLibId()

LIB_ID FOOTPRINT_INFO::GetLibId ( ) const
inlineoverridevirtualinherited

Implements LIB_TREE_ITEM.

Definition at line 75 of file footprint_info.h.

76 {
77 return LIB_ID( m_nickname, m_fpname );
78 }
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49

◆ GetLibNickname()

wxString FOOTPRINT_INFO::GetLibNickname ( ) const
inlineoverridevirtualinherited

◆ GetName()

wxString FOOTPRINT_INFO::GetName ( void  ) const
inlineoverridevirtualinherited

Implements LIB_TREE_ITEM.

Definition at line 73 of file footprint_info.h.

73{ return m_fpname; }

◆ GetOrderNum()

int FOOTPRINT_INFO::GetOrderNum ( )
inlineinherited

Definition at line 113 of file footprint_info.h.

114 {
116 return m_num;
117 }

◆ GetPadCount()

unsigned FOOTPRINT_INFO::GetPadCount ( )
inlineinherited

Definition at line 101 of file footprint_info.h.

102 {
104 return m_pad_count;
105 }

◆ GetSearchText()

wxString FOOTPRINT_INFO::GetSearchText ( )
inlineoverridevirtualinherited

Reimplemented from LIB_TREE_ITEM.

Definition at line 92 of file footprint_info.h.

93 {
94 // Matches are scored by offset from front of string, so inclusion of this spacer
95 // discounts matches found after it.
96 static const wxString discount( wxT( " " ) );
97
98 return GetKeywords() + discount + GetDescription();
99 }
wxString GetDescription() override
wxString GetKeywords()

References LIB_TREE_ITEM::GetDescription().

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

◆ GetUniquePadCount()

unsigned FOOTPRINT_INFO::GetUniquePadCount ( )
inlineinherited

Definition at line 107 of file footprint_info.h.

108 {
110 return m_unique_pad_count;
111 }

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

◆ GetUnitCount()

virtual int LIB_TREE_ITEM::GetUnitCount ( void  ) const
inlinevirtualinherited

For items with units, return the number of units.

Reimplemented in LIB_SYMBOL.

Definition at line 73 of file lib_tree_item.h.

73{ return 0; }

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

◆ GetUnitDisplayName()

virtual wxString LIB_TREE_ITEM::GetUnitDisplayName ( int  aUnit)
inlinevirtualinherited

For items with units, return a display name for unit x.

Reimplemented in LIB_SYMBOL.

Definition at line 83 of file lib_tree_item.h.

83{ return wxEmptyString; }

Referenced by LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT().

◆ GetUnitReference()

virtual wxString LIB_TREE_ITEM::GetUnitReference ( int  aUnit)
inlinevirtualinherited

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

Reimplemented in LIB_SYMBOL.

Definition at line 78 of file lib_tree_item.h.

78{ return wxEmptyString; }

Referenced by LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT().

◆ HasUnitDisplayName()

virtual bool LIB_TREE_ITEM::HasUnitDisplayName ( int  aUnit)
inlinevirtualinherited

For items with units, return true if a display name is set for x.

Reimplemented in LIB_SYMBOL.

Definition at line 88 of file lib_tree_item.h.

88{ return false; }

Referenced by LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT().

◆ InLibrary()

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

73{
74 return aLibrary == m_nickname;
75}

References FOOTPRINT_INFO::m_nickname.

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

◆ IsRoot()

virtual bool LIB_TREE_ITEM::IsRoot ( ) const
inlinevirtualinherited

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

Reimplemented in LIB_SYMBOL.

Definition at line 63 of file lib_tree_item.h.

63{ return true; }

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

◆ load()

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 42 of file footprint_info_impl.cpp.

43{
44 FP_LIB_TABLE* fptable = m_owner->GetTable();
45
46 wxASSERT( fptable );
47
48 const FOOTPRINT* footprint = fptable->GetEnumeratedFootprint( m_nickname, m_fpname );
49
50 if( footprint == nullptr ) // Should happen only with malformed/broken libraries
51 {
52 m_pad_count = 0;
54 }
55 else
56 {
59 m_keywords = footprint->GetKeywords();
60 m_doc = footprint->GetDescription();
61 }
62
63 m_loaded = true;
64}
FP_LIB_TABLE * GetTable() const
unsigned GetPadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of pads.
Definition: footprint.cpp:1224
wxString GetDescription() const
Definition: footprint.h:218
unsigned GetUniquePadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of unique non-blank pads.
Definition: footprint.cpp:1243
wxString GetKeywords() const
Definition: footprint.h:221
const FOOTPRINT * GetEnumeratedFootprint(const wxString &aNickname, const wxString &aFootprintName)
A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management.
@ DO_NOT_INCLUDE_NPTH
Definition: footprint.h:57

References DO_NOT_INCLUDE_NPTH, FOOTPRINT::GetDescription(), FP_LIB_TABLE::GetEnumeratedFootprint(), FOOTPRINT::GetKeywords(), FOOTPRINT::GetPadCount(), FOOTPRINT_LIST::GetTable(), FOOTPRINT::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().

Member Data Documentation

◆ m_doc

wxString FOOTPRINT_INFO::m_doc
protectedinherited

Footprint description.

Definition at line 153 of file footprint_info.h.

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

◆ m_fpname

wxString FOOTPRINT_INFO::m_fpname
protectedinherited

Module name.

Definition at line 149 of file footprint_info.h.

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

◆ m_keywords

wxString FOOTPRINT_INFO::m_keywords
protectedinherited

Footprint keywords.

Definition at line 154 of file footprint_info.h.

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

◆ m_loaded

bool FOOTPRINT_INFO::m_loaded
protectedinherited

◆ m_nickname

wxString FOOTPRINT_INFO::m_nickname
protectedinherited

◆ m_num

int FOOTPRINT_INFO::m_num
protectedinherited

Order number in the display list.

Definition at line 150 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL().

◆ m_owner

FOOTPRINT_LIST* FOOTPRINT_INFO::m_owner
protectedinherited

provides access to FP_LIB_TABLE

Definition at line 144 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL(), and load().

◆ m_pad_count

unsigned FOOTPRINT_INFO::m_pad_count
protectedinherited

Number of pads.

Definition at line 151 of file footprint_info.h.

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

◆ m_unique_pad_count

unsigned FOOTPRINT_INFO::m_unique_pad_count
protectedinherited

Number of unique pads.

Definition at line 152 of file footprint_info.h.

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


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