KiCad PCB EDA Suite
fp_lib_table.cpp File Reference
#include <fctsys.h>
#include <common.h>
#include <kiface_i.h>
#include <footprint_info.h>
#include <lib_id.h>
#include <lib_table_lexer.h>
#include <pgm_base.h>
#include <search_stack.h>
#include <systemdirsappend.h>
#include <fp_lib_table.h>
#include <class_module.h>

Go to the source code of this file.

Macros

#define OPT_SEP   '|'
 options separator character More...
 

Functions

static void setLibNickname (MODULE *aModule, const wxString &aNickname, const wxString &aFootprintName)
 

Variables

static const wxChar global_tbl_name [] = wxT( "fp-lib-table" )
 

Macro Definition Documentation

◆ OPT_SEP

#define OPT_SEP   '|'

options separator character

Definition at line 39 of file fp_lib_table.cpp.

Function Documentation

◆ setLibNickname()

static void setLibNickname ( MODULE aModule,
const wxString &  aNickname,
const wxString &  aFootprintName 
)
static

Definition at line 305 of file fp_lib_table.cpp.

307 {
308  // The library cannot know its own name, because it might have been renamed or moved.
309  // Therefore footprints cannot know their own library nickname when residing in
310  // a footprint library.
311  // Only at this API layer can we tell the footprint about its actual library nickname.
312  if( aModule )
313  {
314  // remove "const"-ness, I really do want to set nickname without
315  // having to copy the LIB_ID and its two strings, twice each.
316  LIB_ID& fpid = (LIB_ID&) aModule->GetFPID();
317 
318  // Catch any misbehaving plugin, which should be setting internal footprint name properly:
319  wxASSERT( aFootprintName == fpid.GetLibItemName().wx_str() );
320 
321  // and clearing nickname
322  wxASSERT( !fpid.GetLibNickname().size() );
323 
324  fpid.SetLibNickname( aNickname );
325  }
326 }
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
const LIB_ID & GetFPID() const
Definition: class_module.h:192
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
int SetLibNickname(const UTF8 &aNickname)
Override the logical library name portion of the LIB_ID to aNickname.
Definition: lib_id.cpp:193
wxString wx_str() const
Definition: utf8.cpp:51
std::string::size_type size() const
Definition: utf8.h:115

References MODULE::GetFPID(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), LIB_ID::SetLibNickname(), UTF8::size(), and UTF8::wx_str().

Referenced by FP_LIB_TABLE::FootprintLoad().

Variable Documentation

◆ global_tbl_name

const wxChar global_tbl_name[] = wxT( "fp-lib-table" )
static