KiCad PCB EDA Suite
Loading...
Searching...
No Matches
LIB_ID Class Reference

A logical library item identifier and consists of various portions much like a URI. More...

#include <lib_id.h>

Public Member Functions

 LIB_ID ()
 
 LIB_ID (const wxString &aLibraryName, const wxString &aItemName)
 This LIB_ID ctor is a special version which ignores the parsing due to symbol names allowing '/' as a valid character.
 
int Parse (const UTF8 &aId, bool aFix=false)
 Parse LIB_ID with the information from aId.
 
const UTF8GetLibNickname () const
 Return the logical library name portion of a LIB_ID.
 
const wxString GetUniStringLibNickname () const
 
int SetLibNickname (const UTF8 &aLibNickname)
 Override the logical library name portion of the LIB_ID to aLibNickname.
 
const UTF8GetLibItemName () const
 
const wxString GetUniStringLibItemName () const
 Get strings for display messages in dialogs.
 
int SetLibItemName (const UTF8 &aLibItemName)
 Override the library item name portion of the LIB_ID to aLibItemName.
 
UTF8 GetSubLibraryName () const
 Some LIB_IDs can have a sub-library identifier in addition to a library nickname.
 
void SetSubLibraryName (const UTF8 &aName)
 
const wxString GetUniStringSubLibraryName () const
 
const wxString GetFullLibraryName () const
 
UTF8 Format () const
 
wxString GetUniStringLibId () const
 
bool IsValid () const
 Check if this LID_ID is valid.
 
bool IsLegacy () const
 
void clear ()
 Clear the contents of the library nickname, library entry name.
 
bool empty () const
 
int compare (const LIB_ID &aLibId) const
 Compare the contents of LIB_ID objects by performing a std::string comparison of the library nickname, library entry name.
 
bool operator< (const LIB_ID &aLibId) const
 
bool operator> (const LIB_ID &aLibId) const
 
bool operator== (const LIB_ID &aLibId) const
 
bool operator!= (const LIB_ID &aLibId) const
 

Static Public Member Functions

static UTF8 Format (const UTF8 &aLibraryName, const UTF8 &aLibItemName)
 
static int HasIllegalChars (const UTF8 &aLibItemName)
 Examine aLibItemName for invalid LIB_ID item name characters.
 
static UTF8 FixIllegalChars (const UTF8 &aLibItemName, bool aLib)
 Replace illegal LIB_ID item name characters with underscores '_'.
 
static unsigned FindIllegalLibraryNameChar (const UTF8 &aLibraryName)
 Looks for characters that are illegal in library nicknames.
 

Static Protected Member Functions

static bool isLegalChar (unsigned aUniChar)
 Tests whether a Unicode character is a legal LIB_ID item name character.
 
static bool isLegalLibraryNameChar (unsigned aUniChar)
 Tests whether a Unicode character is a legal LIB_ID library nickname character.
 

Protected Attributes

UTF8 m_libraryName
 The nickname of the library or empty.
 
UTF8 m_itemName
 The name of the entry in the logical library.
 
UTF8 m_subLibraryName
 Optional sub-library name used for grouping within a library.
 

Detailed Description

A logical library item identifier and consists of various portions much like a URI.

It consists of of a dyad of the library nickname and the name of the item in the library This is a generic library identifier that can be used for any type of library that contains multiple named items such as footprint or symbol libraries.

Example LIB_ID string: "smt:R_0805".

  • "smt" is the logical library name used to look up library information saved in the #LIB_TABLE.
  • "R" is the name of the item within the library.
Author
Dick Hollenbeck

Definition at line 48 of file lib_id.h.

Constructor & Destructor Documentation

◆ LIB_ID() [1/2]

LIB_ID::LIB_ID ( )
inline

Definition at line 51 of file lib_id.h.

Referenced by compare(), operator!=(), operator<(), operator==(), and operator>().

◆ LIB_ID() [2/2]

LIB_ID::LIB_ID ( const wxString & aLibraryName,
const wxString & aItemName )

This LIB_ID ctor is a special version which ignores the parsing due to symbol names allowing '/' as a valid character.

This was causing the symbol names to be truncated at the first occurrence of '/' in the symbol name.

Parameters
aLibraryNameis the library name used to look up the library item in the #LIB_TABLE.
aItemNameis the name of the library item which is not parsed by the standard LIB_ID::Parse() function.

Definition at line 93 of file lib_id.cpp.

References m_itemName, and m_libraryName.

Member Function Documentation

◆ clear()

void LIB_ID::clear ( )

Clear the contents of the library nickname, library entry name.

Definition at line 44 of file lib_id.cpp.

References m_itemName, m_libraryName, and m_subLibraryName.

Referenced by Parse().

◆ compare()

int LIB_ID::compare ( const LIB_ID & aLibId) const

Compare the contents of LIB_ID objects by performing a std::string comparison of the library nickname, library entry name.

Parameters
aLibIdis the LIB_ID to compare against.
Returns
-1 if less than aLibId, 1 if greater than aLibId, and 0 if equal to aLibId.

Definition at line 161 of file lib_id.cpp.

References LIB_ID(), m_itemName, and m_libraryName.

Referenced by operator<(), operator==(), and operator>().

◆ empty()

◆ FindIllegalLibraryNameChar()

unsigned LIB_ID::FindIllegalLibraryNameChar ( const UTF8 & aLibraryName)
static

Looks for characters that are illegal in library nicknames.

Parameters
aLibraryNameis the logical library name to be tested.
Returns
Invalid character found in the name or 0 is the name is valid.

Definition at line 237 of file lib_id.cpp.

References isLegalLibraryNameChar().

Referenced by DIALOG_DESIGN_BLOCK_PROPERTIES::TransferDataFromWindow(), and LIB_TABLE_GRID_TRICKS::VerifyTable().

◆ FixIllegalChars()

UTF8 LIB_ID::FixIllegalChars ( const UTF8 & aLibItemName,
bool aLib )
static

◆ Format() [1/2]

UTF8 LIB_ID::Format ( ) const
Returns
the fully formatted text of the LIB_ID in a UTF8 string.

Definition at line 119 of file lib_id.cpp.

References m_itemName, and m_libraryName.

Referenced by SCH_SCREEN::AddLibSymbol(), BOARD_NETLIST_UPDATER::addNewFootprint(), CVPCB_ASSOCIATION_TOOL::Associate(), CVPCB_MAINFRAME::AssociateFootprint(), BOOST_AUTO_TEST_CASE(), GENCAD_EXPORTER::createDevicesSection(), RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(), LEGACY_SYMBOL_LIB::FindSymbol(), SCH_IO_KICAD_SEXPR::Format(), PCB_IO_KICAD_SEXPR::format(), PCB_IO_KICAD_SEXPR::format(), FOOTPRINT_SEARCH_HANDLER::getResultCell(), SYMBOL_SEARCH_HANDLER::getResultCell(), DIALOG_CHANGE_SYMBOLS::getSymbolReferences(), PCB_EDIT_FRAME::LoadFootprints(), DSN::SPECCTRA_DB::makeIMAGE(), FOOTPRINT_CHOOSER_FRAME::OnOK(), SYMBOL_CHOOSER_FRAME::OnOK(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_IO_ALTIUM::ParseImplementation(), SCH_DRAWING_TOOLS::PlaceSymbol(), DIALOG_EXCHANGE_FOOTPRINTS::processFootprint(), CVPCB_MAINFRAME::readNetListAndFpFiles(), CVPCB_MAINFRAME::refreshAfterSymbolSearch(), BOARD_NETLIST_UPDATER::replaceFootprint(), SCH_IO_KICAD_SEXPR::saveGroup(), SCH_IO_KICAD_LEGACY::saveSymbol(), SCH_IO_KICAD_SEXPR::saveSymbol(), PCB_BASE_FRAME::SelectFootprintFromLibrary(), CADSTAR_SCH_ARCHIVE_LOADER::setFootprintOnSymbol(), LIB_SYMBOL::SetLibId(), DIALOG_EDIT_SYMBOLS_LIBID::setLibIdByBrowser(), LIB_SYMBOL::SetName(), FOOTPRINTS_LISTBOX::SetSelectedFootprint(), BOARD_NETLIST_UPDATER::testConnectivity(), FOOTPRINT_CHOOSER_FRAME::Update3DView(), BOARD_NETLIST_UPDATER::UpdateNetlist(), and FOOTPRINT_EDIT_FRAME::UpdateTitle().

◆ Format() [2/2]

UTF8 LIB_ID::Format ( const UTF8 & aLibraryName,
const UTF8 & aLibItemName )
static
Returns
a string in the proper format as an LIB_ID for a combination of aLibraryName, aLibItemName
Exceptions
PARSE_ERRORif any of the pieces are illegal.

Definition at line 135 of file lib_id.cpp.

References _, UTF8::c_str(), checkLibNickname(), UTF8::size(), and THROW_PARSE_ERROR.

◆ GetFullLibraryName()

const wxString LIB_ID::GetFullLibraryName ( ) const
Returns
a display-formatted name of the library and sublibrary (if present)

Definition at line 271 of file lib_id.cpp.

References m_libraryName, and m_subLibraryName.

Referenced by COMPONENTS_MANAGER::AddComponent().

◆ GetLibItemName()

const UTF8 & LIB_ID::GetLibItemName ( ) const
inline
Returns
the library item name, i.e. footprintName, in UTF8.

Definition at line 102 of file lib_id.h.

References m_itemName.

Referenced by COMPONENTS_MANAGER::AddComponent(), SYMBOL_EDITOR_CONTROL::AddSymbol(), PCB_CONTROL::AppendBoard(), BASIC_FOOTPRINT_INFO::BASIC_FOOTPRINT_INFO(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), FOOTPRINT_EDIT_FRAME::canCloseWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::checkFootprintName(), SCH_REFERENCE::CompareLibName(), DESIGN_BLOCK_PANE::DeleteDesignBlockFromLibrary(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), SCH_SYMBOL::Deserialize(), DESIGN_BLOCK_LIBRARY_ADAPTER::DesignBlockLoadWithOptionalNickname(), DESIGN_BLOCK_IO::DesignBlockSave(), BOARD_INSPECTION_TOOL::DiffFootprint(), SCH_INSPECTION_TOOL::DiffSymbol(), FOOTPRINT_PREVIEW_PANEL::DisplayFootprint(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), PCBNEW_JOBS_HANDLER::doFpExportSvg(), FOOTPRINT_EDIT_FRAME::DuplicateFootprint(), SYMBOL_EDIT_FRAME::DuplicateSymbol(), SYMBOL_EDITOR_CONTROL::EditLibrarySymbol(), SYMBOL_EDITOR_CONTROL::EditSymbol(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolPropertiesFromLibrary(), PCB_EDIT_FRAME::ExchangeFootprint(), FOOTPRINT_EDIT_FRAME::ExportFootprint(), LIB_TREE_MODEL_ADAPTER::FindItem(), LEGACY_SYMBOL_LIBS::FindLibSymbol(), RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(), SYMBOL_EDITOR_CONTROL::FlattenSymbol(), PCB_IO_KICAD_SEXPR::format(), DESIGN_BLOCK_TREE_MODEL_ADAPTER::GenerateInfo(), PLACE_FILE_EXPORTER::GenPositionData(), DESIGN_BLOCK_PANE::GetDesignBlock(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), FOOTPRINT_LIST::GetFootprintInfo(), SYMBOL_EDIT_FRAME::getTargetSymbol(), guessNickname(), API_HANDLER_FOOTPRINT::handleSaveCopyOfDocument(), FOOTPRINT_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDIT_FRAME::IsCurrentSymbol(), CV::kiface(), CADSTAR_PCB_ARCHIVE_LOADER::loadComponentLibrary(), FOOTPRINT_LIBRARY_ADAPTER::LoadFootprint(), PCB_IO_KICAD_LEGACY::loadFOOTPRINT(), PCB_EDIT_FRAME::LoadFootprints(), FOOTPRINT_LIBRARY_ADAPTER::LoadFootprintWithOptionalNickname(), PCB_IO_KICAD_LEGACY::loadFP_SHAPE(), PCB_IO_KICAD_LEGACY::loadPAD(), SYMBOL_EDIT_FRAME::LoadSymbol(), SYMBOL_LIBRARY_ADAPTER::LoadSymbol(), DIALOG_EDIT_SYMBOLS_LIBID::onClickOrphansButton(), PCB_BASE_FRAME::OnFpChangeDebounceTimer(), FOOTPRINT_EDITOR_CONTROL::OpenDirectory(), PCB_EDIT_FRAME::OpenProjectFiles(), FOOTPRINT_EDITOR_CONTROL::OpenWithTextEditor(), PCB_IO_EAGLE::packageText(), kiapi::common::PackLibId(), SCH_EASYEDAPRO_PARSER::ParseSchematic(), PANEL_SYMBOL_CHOOSER::populateFootprintSelector(), CVPCB_MAINFRAME::readNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_VIEWER_FRAME::ReloadFootprint(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), FOOTPRINT_EDITOR_CONTROL::RenameFootprint(), SYMBOL_EDIT_FRAME::Revert(), DRC_TEST_PROVIDER_LIBRARY_PARITY::Run(), PCB_EDIT_FRAME::SaveBoardAsDesignBlock(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_LIBRARY_ADAPTER::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), HEADLESS_FOOTPRINT_CONTEXT::SaveFootprintInLibrary(), PCB_EDIT_FRAME::SaveSelectionAsDesignBlock(), SCH_EDIT_FRAME::SaveSelectionAsDesignBlock(), SCH_EDIT_FRAME::SaveSheetAsDesignBlock(), SCH_IO_KICAD_SEXPR_LIB_CACHE::SaveSymbol(), SYMBOL_EDIT_FRAME::saveSymbolCopyAs(), SchGetLibSymbol(), PCB_BASE_FRAME::setFPWatcher(), LIB_TREE::setState(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), PANEL_SYMBOL_CHOOSER::showFootprintFor(), ERC_TESTER::TestFootprintLinkIssues(), ERC_TESTER::TestLibSymbolIssues(), DIALOG_FOOTPRINT_ASSOCIATIONS::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), PCB_EDIT_FRAME::UpdateDesignBlockFromBoard(), PCB_EDIT_FRAME::UpdateDesignBlockFromSelection(), SCH_EDIT_FRAME::UpdateDesignBlockFromSelection(), SCH_EDIT_FRAME::UpdateDesignBlockFromSheet(), BOARD_NETLIST_UPDATER::UpdateNetlist(), SYMBOL_LIBRARY_MANAGER::UpdateSymbol(), and FOOTPRINT_EDIT_FRAME::UpdateTitle().

◆ GetLibNickname()

const UTF8 & LIB_ID::GetLibNickname ( ) const
inline

Return the logical library name portion of a LIB_ID.

Definition at line 87 of file lib_id.h.

References m_libraryName.

Referenced by SYMBOL_EDITOR_CONTROL::AddSymbol(), BASIC_FOOTPRINT_INFO::BASIC_FOOTPRINT_INFO(), EXPORTER_STEP::buildFootprint3DShapes(), SCH_SCREENS::ChangeSymbolLibNickname(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::checkFootprintName(), CheckForParentalChainConflicts(), CheckSavingIntoOwnInheritance(), LIB_FIELDS_EDITOR_GRID_DATA_MODEL::createActualDerivedSymbol(), DESIGN_BLOCK_PANE::DeleteDesignBlockFromLibrary(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), DESIGN_BLOCK_LIBRARY_ADAPTER::DesignBlockLoadWithOptionalNickname(), BOARD_INSPECTION_TOOL::DiffFootprint(), SCH_INSPECTION_TOOL::DiffSymbol(), FOOTPRINT_PREVIEW_PANEL::DisplayFootprint(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), SYMBOL_SAVE_AS_HANDLER::DoSave(), FOOTPRINT_EDIT_FRAME::DuplicateFootprint(), SYMBOL_EDIT_FRAME::DuplicateSymbol(), SYMBOL_EDITOR_CONTROL::DuplicateSymbol(), DESIGN_BLOCK_PANE::EditDesignBlockProperties(), FOOTPRINT_EDITOR_CONTROL::editFootprintPropertiesFromLibrary(), SYMBOL_EDITOR_CONTROL::EditLibrarySymbol(), SYMBOL_EDITOR_CONTROL::EditSymbol(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolPropertiesFromLibrary(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), LIB_TREE_MODEL_ADAPTER::FindItem(), RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(), SYMBOL_EDITOR_CONTROL::FlattenSymbol(), DESIGN_BLOCK_TREE_MODEL_ADAPTER::GenerateInfo(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), DESIGN_BLOCK_PANE::GetDesignBlock(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), FOOTPRINT_LIST::GetFootprintInfo(), SCH_SCREENS::GetLibNicknames(), FOOTPRINT_EDIT_FRAME::GetLoadedFPID(), SCH_SYMBOL::GetMsgPanelInfo(), GetSafeRootSymbol(), SYMBOL_EDIT_FRAME::getTargetLib(), SYMBOL_EDIT_FRAME::getTargetSymbol(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), guessNickname(), API_HANDLER_FOOTPRINT::handleSaveCopyOfDocument(), SCH_SCREENS::HasNoFullyDefinedLibIds(), idf_export_footprint(), FOOTPRINT_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDIT_FRAME::IsCurrentSymbol(), CV::kiface(), SYMBOL_EDIT_FRAME::KiwayMailIn(), SYMBOL_VIEWER_FRAME::KiwayMailIn(), FOOTPRINT_LIBRARY_ADAPTER::LoadFootprint(), FOOTPRINT_LIBRARY_ADAPTER::LoadFootprintWithOptionalNickname(), SYMBOL_EDIT_FRAME::LoadSymbol(), SYMBOL_LIBRARY_ADAPTER::LoadSymbol(), PCB_BASE_FRAME::OnFpChangeDebounceTimer(), FOOTPRINT_EDITOR_CONTROL::OpenDirectory(), SYMBOL_EDITOR_CONTROL::OpenDirectory(), FOOTPRINT_EDITOR_CONTROL::OpenWithTextEditor(), SYMBOL_EDITOR_CONTROL::OpenWithTextEditor(), kiapi::common::PackLibId(), DESIGN_BLOCK_CONTROL::PinLibrary(), LIB_TREE_MODEL_ADAPTER::PinLibrary(), PANEL_SYMBOL_CHOOSER::populateFootprintSelector(), FOOTPRINT_EDIT_FRAME::ReloadFootprint(), FOOTPRINT_VIEWER_FRAME::ReloadFootprint(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), FOOTPRINT_EDITOR_CONTROL::RenameFootprint(), SYMBOL_EDITOR_CONTROL::RenameSymbol(), SYMBOL_EDIT_FRAME::Revert(), DRC_TEST_PROVIDER_LIBRARY_PARITY::Run(), PCB_DESIGN_BLOCK_CONTROL::SaveBoardAsDesignBlock(), PCB_EDIT_FRAME::SaveBoardAsDesignBlock(), SYMBOL_EDIT_FRAME::saveCurrentSymbol(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), SYMBOL_EDIT_FRAME::SaveLibraryAs(), PCB_DESIGN_BLOCK_CONTROL::SaveSelectionAsDesignBlock(), PCB_EDIT_FRAME::SaveSelectionAsDesignBlock(), SCH_DESIGN_BLOCK_CONTROL::SaveSelectionAsDesignBlock(), SCH_EDIT_FRAME::SaveSelectionAsDesignBlock(), SCH_DESIGN_BLOCK_CONTROL::SaveSheetAsDesignBlock(), SCH_EDIT_FRAME::SaveSheetAsDesignBlock(), SYMBOL_EDIT_FRAME::saveSymbolCopyAs(), SchGetLibSymbol(), PCB_BASE_FRAME::setFPWatcher(), LIB_TREE::setState(), SCH_BASE_FRAME::setSymWatcher(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), PANEL_SYMBOL_CHOOSER::showFootprintFor(), ERC_TESTER::TestFootprintLinkIssues(), ERC_TESTER::TestLibSymbolIssues(), DIALOG_FOOTPRINT_ASSOCIATIONS::TransferDataToWindow(), FOOTPRINT_EDITOR_CONTROL::tryToSaveFootprintInLibrary(), DESIGN_BLOCK_CONTROL::UnpinLibrary(), LIB_TREE_MODEL_ADAPTER::UnpinLibrary(), LIB_TREE_NODE_ITEM::Update(), PCB_EDIT_FRAME::UpdateDesignBlockFromBoard(), PCB_EDIT_FRAME::UpdateDesignBlockFromSelection(), SCH_EDIT_FRAME::UpdateDesignBlockFromSelection(), SCH_EDIT_FRAME::UpdateDesignBlockFromSheet(), and FOOTPRINT_EDIT_FRAME::UpdateTitle().

◆ GetSubLibraryName()

UTF8 LIB_ID::GetSubLibraryName ( ) const
inline

Some LIB_IDs can have a sub-library identifier in addition to a library nickname.

This identifier is not part of the canonical LIB_ID and is not written out / parsed. It is only used for internal sorting/grouping, if present.

Returns
the sub-library name for this LIB_ID, if one exists

Definition at line 130 of file lib_id.h.

References m_subLibraryName.

◆ GetUniStringLibId()

wxString LIB_ID::GetUniStringLibId ( ) const
inline

◆ GetUniStringLibItemName()

◆ GetUniStringLibNickname()

◆ GetUniStringSubLibraryName()

const wxString LIB_ID::GetUniStringSubLibraryName ( ) const
inline

Definition at line 132 of file lib_id.h.

References m_subLibraryName.

◆ HasIllegalChars()

int LIB_ID::HasIllegalChars ( const UTF8 & aLibItemName)
static

Examine aLibItemName for invalid LIB_ID item name characters.

Parameters
aLibItemNameis the LIB_ID name to test for illegal characters.
Returns
offset of first illegal character otherwise -1.

Definition at line 176 of file lib_id.cpp.

References isLegalChar().

Referenced by RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(), and Parse().

◆ IsLegacy()

bool LIB_ID::IsLegacy ( ) const
inline

◆ isLegalChar()

bool LIB_ID::isLegalChar ( unsigned aUniChar)
staticprotected

Tests whether a Unicode character is a legal LIB_ID item name character.

The criteria for legal LIB_ID character is as follows:

  • For both symbol and footprint names, neither '/' or ':' are legal. They are reserved characters used by LIB_ID::Parse.
  • Spaces are allowed in footprint names as they are a legal filename character on all operating systems.
  • Spaces are not allowed in symbol names since symbol names are not quoted in the schematic or symbol library file formats.
  • Spaces are allowed in footprint library nicknames as they are quoted in the footprint library table file format.
  • Spaces are now also allowed in symbol library nicknames since they are quoted in the new symbol library sexpr file format.
  • Illegal file name characters are not allowed in footprint names since the file name is the footprint name.
  • Illegal file name characters except '/' are allowed in symbol names since the name is not the file name.
Note
aUniChar is expected to be a 32 bit Unicode character, not a UTF8 char, that use a variable length coding value.

Definition at line 209 of file lib_id.cpp.

Referenced by FixIllegalChars(), and HasIllegalChars().

◆ isLegalLibraryNameChar()

bool LIB_ID::isLegalLibraryNameChar ( unsigned aUniChar)
staticprotected

Tests whether a Unicode character is a legal LIB_ID library nickname character.

Note
aUniChar is expected to be a 32 bit Unicode character, not a UTF8 char, that use a variable length coding value.

Definition at line 249 of file lib_id.cpp.

Referenced by FindIllegalLibraryNameChar(), and FixIllegalChars().

◆ IsValid()

bool LIB_ID::IsValid ( ) const
inline

Check if this LID_ID is valid.

A valid LIB_ID must have both the library nickname and the library item name defined.

Note
A return value of true does not indicated that the LIB_ID is a valid #LIB_TABLE entry.
Returns
true is the LIB_ID is valid.

Definition at line 172 of file lib_id.h.

References m_itemName, and m_libraryName.

Referenced by PCB_CONTROL::AppendDesignBlock(), CVPCB_ASSOCIATION_TOOL::Associate(), CVPCB_MAINFRAME::AssociateFootprint(), CVPCB_ASSOCIATION_TOOL::CopyAssoc(), CVPCB_ASSOCIATION_TOOL::CutAssoc(), DESIGN_BLOCK_PANE::DeleteDesignBlockFromLibrary(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), DESIGN_BLOCK_IO::DesignBlockSave(), DIALOG_SYMBOL_CHOOSER::DIALOG_SYMBOL_CHOOSER(), SYMBOL_EDITOR_CONTROL::DuplicateSymbol(), DESIGN_BLOCK_PANE::EditDesignBlockProperties(), RESCUE_CACHE_CANDIDATE::FindRescues(), SYMBOL_EDITOR_CONTROL::FlattenSymbol(), DESIGN_BLOCK_TREE_MODEL_ADAPTER::GenerateInfo(), SYMBOL_EDIT_FRAME::getTargetSymbol(), SCH_DRAWING_TOOLS::ImportSheet(), SYMBOL_EDIT_FRAME::LoadSymbol(), SCH_IO_HTTP_LIB::loadSymbolFromPart(), SCH_IO_DATABASE::loadSymbolFromRow(), PANEL_FOOTPRINT_CHOOSER::onFootprintSelected(), FOOTPRINT_CHOOSER_FRAME::OnOK(), SYMBOL_CHOOSER_FRAME::OnOK(), CVPCB_MAINFRAME::OnSelectComponent(), PANEL_SYMBOL_CHOOSER::onSymbolSelected(), CVPCB_MAINFRAME::onTextFilterChangedTimer(), PCB_DESIGN_BLOCK_PANE::PCB_DESIGN_BLOCK_PANE(), SCH_BASE_FRAME::PickSymbolFromLibrary(), SCH_DRAWING_TOOLS::PlaceSymbol(), PANEL_SYMBOL_CHOOSER::populateFootprintSelector(), DIALOG_EXCHANGE_FOOTPRINTS::processMatchingFootprints(), DIALOG_CHANGE_SYMBOLS::processMatchingSymbols(), FOOTPRINT_EDITOR_CONTROL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), PANEL_DESIGN_BLOCK_CHOOSER::RefreshLibs(), PANEL_SYMBOL_CHOOSER::Regenerate(), LIBRARY_EDITOR_CONTROL::regenerateLibraryTree(), SCH_DESIGN_BLOCK_PANE::SCH_DESIGN_BLOCK_PANE(), PCB_BASE_FRAME::SelectFootprintFromLibrary(), DIALOG_EDIT_SYMBOLS_LIBID::setLibIdByBrowser(), PANEL_FOOTPRINT_CHOOSER::SetPreselect(), PANEL_SYMBOL_CHOOSER::SetPreselect(), PANEL_SYMBOL_CHOOSER::showFootprint(), FOOTPRINT_CHOOSER_FRAME::ShowModal(), SYMBOL_CHOOSER_FRAME::ShowModal(), SYMBOL_EDIT_FRAME::SyncLibraries(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), FOOTPRINT_CHOOSER_FRAME::Update3DView(), PCB_EDIT_FRAME::UpdateDesignBlockFromSelection(), DIALOG_CHANGE_SYMBOLS::updateFieldsList(), FOOTPRINT_EDIT_FRAME::UpdateTitle(), and DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::Validate().

◆ operator!=()

bool LIB_ID::operator!= ( const LIB_ID & aLibId) const
inline

Definition at line 210 of file lib_id.h.

References LIB_ID().

◆ operator<()

bool LIB_ID::operator< ( const LIB_ID & aLibId) const
inline

Definition at line 207 of file lib_id.h.

References compare(), and LIB_ID().

◆ operator==()

bool LIB_ID::operator== ( const LIB_ID & aLibId) const
inline

Definition at line 209 of file lib_id.h.

References compare(), and LIB_ID().

◆ operator>()

bool LIB_ID::operator> ( const LIB_ID & aLibId) const
inline

Definition at line 208 of file lib_id.h.

References compare(), and LIB_ID().

◆ Parse()

int LIB_ID::Parse ( const UTF8 & aId,
bool aFix = false )

Parse LIB_ID with the information from aId.

A typical LIB_ID string consists of a library nickname followed by a library item name. e.g.: "smt:R_0805", or e.g.: "mylib:R_0805", or e.g.: "ttl:7400"

Parameters
aIdis the string to populate the LIB_ID object.
aFixindicates invalid chars should be replaced with '_'.
Returns
minus 1 (i.e. -1) means success, >= 0 indicates the character offset into aId at which an error was detected.

Definition at line 52 of file lib_id.cpp.

References clear(), UTF8::find(), FixIllegalChars(), HasIllegalChars(), UTF8::npos, SetLibItemName(), SetLibNickname(), and UTF8::substr().

Referenced by PCAD2KICAD::PCAD_FOOTPRINT::AddToBoard(), AltiumToKiCadLibID(), BOARD_NETLIST_UPDATER::applyComponentVariants(), CVPCB_ASSOCIATION_TOOL::Associate(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), CVPCB_ASSOCIATION_TOOL::CopyAssoc(), EasyEdaToKiCadLibID(), EasyEdaToKiCadLibID(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), FOOTPRINT_LIST::GetFootprintInfo(), API_HANDLER_FOOTPRINT::handleSaveCopyOfDocument(), DIALOG_CHANGE_SYMBOLS::isMatch(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), CV::kiface(), CMP_READER::Load(), PCB_IO_KICAD_LEGACY::loadAllSections(), CADSTAR_PCB_ARCHIVE_LOADER::loadComponentLibrary(), FABMASTER::loadFootprints(), SCH_IO_KICAD_LEGACY::loadSymbol(), SCH_IO_HTTP_LIB::loadSymbolFromPart(), SCH_IO_DATABASE::loadSymbolFromRow(), PCB_IO_EAGLE::makeFootprint(), DIALOG_EDIT_SYMBOLS_LIBID::onClickOrphansButton(), PANEL_FOOTPRINT_CHOOSER::PANEL_FOOTPRINT_CHOOSER(), KICAD_NETLIST_PARSER::parseComponent(), PCB_IO_KICAD_SEXPR_PARSER::parseFOOTPRINT_unchecked(), PCB_IO_KICAD_SEXPR_PARSER::parseGROUP(), KICAD_NETLIST_PARSER::parseGroup(), SCH_IO_KICAD_SEXPR_PARSER::parseGroup(), SCH_IO_KICAD_SEXPR_PARSER::parseLibSymbol(), SCH_IO_KICAD_SEXPR_PARSER::parseSchematicSymbol(), CVPCB_ASSOCIATION_TOOL::PasteAssoc(), DIALOG_EXCHANGE_FOOTPRINTS::processMatchingFootprints(), DIALOG_CHANGE_SYMBOLS::processMatchingSymbols(), SCH_IO_KICAD_SEXPR_LIB_CACHE::SaveSymbol(), PCB_BASE_FRAME::SelectFootprintFromLibrary(), DIALOG_EDIT_SYMBOLS_LIBID::setLibIdByBrowser(), PANEL_SYMBOL_CHOOSER::showFootprint(), FOOTPRINT_CHOOSER_FRAME::ShowModal(), SYMBOL_CHOOSER_FRAME::ShowModal(), ERC_TESTER::TestFootprintFilters(), ERC_TESTER::TestFootprintLinkIssues(), EASYEDAPRO::ToKiCadLibID(), DIALOG_EDIT_SYMBOLS_LIBID::TransferDataFromWindow(), DIALOG_GROUP_PROPERTIES::TransferDataFromWindow(), DIALOG_CHANGE_SYMBOLS::updateFieldsList(), BOARD_NETLIST_UPDATER::UpdateNetlist(), and DIALOG_EDIT_SYMBOLS_LIBID::validateLibIds().

◆ SetLibItemName()

◆ SetLibNickname()

int LIB_ID::SetLibNickname ( const UTF8 & aLibNickname)

Override the logical library name portion of the LIB_ID to aLibNickname.

Returns
int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset into the parameter at which an error was detected, usually because it contained '/' or ':'.

Definition at line 100 of file lib_id.cpp.

References checkLibNickname(), and m_libraryName.

Referenced by BuildRemoteLibId(), SCH_SCREENS::ChangeSymbolLibNickname(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::checkFootprintName(), LIB_BUFFER::CreateBuffer(), FOOTPRINT_LIBRARY_ADAPTER::enumerateLibrary(), PCB_EDIT_FRAME::ExportFootprintsToLibrary(), SCH_EDITOR_CONTROL::ExportSymbolsToLibrary(), DESIGN_BLOCK_TREE_MODEL_ADAPTER::getDesignBlocks(), PADS_SCH::PADS_SCH_SYMBOL_BUILDER::GetKiCadPowerSymbolId(), SYMBOL_LIBRARY_ADAPTER::GetSymbols(), guessNickname(), REMOTE_SYMBOL_IMPORT_JOB::Import(), FOOTPRINT_LIBRARY_ADAPTER::LoadFootprint(), SCH_IO_CADSTAR_ARCHIVE::LoadSchematicFile(), SCH_IO_PADS::LoadSchematicFile(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(), SYMBOL_LIBRARY_ADAPTER::LoadSymbol(), SCH_IO_HTTP_LIB::loadSymbolFromPart(), ISSUE24107_FIXTURE::makeMultiUnitLib(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::OpenProjectFiles(), Parse(), SCH_IO_ALTIUM::ParseComponent(), PlaceRemoteDownloadedSymbol(), PANEL_REMOTE_SYMBOL::receiveSymbol(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_LIBRARY_ADAPTER::SaveFootprint(), and FOOTPRINT_EDITOR_CONTROL::tryToSaveFootprintInLibrary().

◆ SetSubLibraryName()

void LIB_ID::SetSubLibraryName ( const UTF8 & aName)
inline

Member Data Documentation

◆ m_itemName

UTF8 LIB_ID::m_itemName
protected

The name of the entry in the logical library.

Definition at line 272 of file lib_id.h.

Referenced by clear(), compare(), empty(), Format(), GetLibItemName(), GetUniStringLibItemName(), IsLegacy(), IsValid(), LIB_ID(), and SetLibItemName().

◆ m_libraryName

UTF8 LIB_ID::m_libraryName
protected

The nickname of the library or empty.

Definition at line 271 of file lib_id.h.

Referenced by clear(), compare(), empty(), Format(), GetFullLibraryName(), GetLibNickname(), GetUniStringLibNickname(), IsLegacy(), IsValid(), LIB_ID(), and SetLibNickname().

◆ m_subLibraryName

UTF8 LIB_ID::m_subLibraryName
protected

Optional sub-library name used for grouping within a library.

Definition at line 273 of file lib_id.h.

Referenced by clear(), GetFullLibraryName(), GetSubLibraryName(), GetUniStringSubLibraryName(), and SetSubLibraryName().


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