KiCad PCB EDA Suite
SYMBOL_LIB_TABLE Class Reference

#include <symbol_lib_table.h>

Inheritance diagram for SYMBOL_LIB_TABLE:
LIB_TABLE PROJECT::_ELEM SYMBOL_LIB_TABLE_GRID

Public Types

enum  SAVE_T { SAVE_OK , SAVE_SKIPPED }
 The set of return values from SaveSymbol() below. More...
 

Public Member Functions

KICAD_T Type () override
 
virtual void Parse (LIB_TABLE_LEXER *aLexer) override
 Parse the #LIB_TABLE_LEXER s-expression library table format into the appropriate LIB_TABLE_ROW objects. More...
 
virtual void Format (OUTPUTFORMATTER *aOutput, int aIndentLevel) const override
 Generate the table in s-expression format to aOutput with an indentation level of aIndentLevel. More...
 
 SYMBOL_LIB_TABLE (SYMBOL_LIB_TABLE *aFallBackTable=nullptr)
 Build a symbol library table by pre-pending this table fragment in front of aFallBackTable. More...
 
SYMBOL_LIB_TABLE_ROWFindRow (const wxString &aNickName, bool aCheckIfEnabled=false)
 Return an SYMBOL_LIB_TABLE_ROW if aNickName is found in this table or in any chained fallBack table fragment. More...
 
int GetModifyHash ()
 
void EnumerateSymbolLib (const wxString &aNickname, wxArrayString &aAliasNames, bool aPowerSymbolsOnly=false)
 Return a list of symbol alias names contained within the library given by aNickname. More...
 
void LoadSymbolLib (std::vector< LIB_SYMBOL * > &aAliasList, const wxString &aNickname, bool aPowerSymbolsOnly=false)
 
LIB_SYMBOLLoadSymbol (const wxString &aNickname, const wxString &aName)
 Load a LIB_SYMBOL having aName from the library given by aNickname. More...
 
LIB_SYMBOLLoadSymbol (const LIB_ID &aLibId)
 
SAVE_T SaveSymbol (const wxString &aNickname, const LIB_SYMBOL *aSymbol, bool aOverwrite=true)
 Write aSymbol to an existing library given by aNickname. More...
 
void DeleteSymbol (const wxString &aNickname, const wxString &aSymbolName)
 Deletes the aSymbolName from the library given by aNickname. More...
 
bool IsSymbolLibWritable (const wxString &aNickname)
 Return true if the library given by aNickname is writable. More...
 
bool IsSymbolLibLoaded (const wxString &aNickname)
 Return true if the library given by aNickname was successfully loaded. More...
 
void DeleteSymbolLib (const wxString &aNickname)
 
void CreateSymbolLib (const wxString &aNickname)
 
LIB_SYMBOLLoadSymbolWithOptionalNickname (const LIB_ID &aId)
 Load a LIB_SYMBOL having aFootprintId with possibly an empty library nickname. More...
 
void Clear ()
 Delete all rows. More...
 
bool operator== (const LIB_TABLE &r) const
 Compares this table against another. More...
 
bool operator!= (const LIB_TABLE &r) const
 
unsigned GetCount () const
 Get the number of rows contained in the table. More...
 
LIB_TABLE_ROWAt (unsigned aIndex)
 Get the 'n'th LIB_TABLE_ROW object. More...
 
const LIB_TABLE_ROWAt (unsigned aIndex) const
 Get the 'n'th LIB_TABLE_ROW object. More...
 
bool IsEmpty (bool aIncludeFallback=true)
 Return true if the table is empty. More...
 
const wxString GetDescription (const wxString &aNickname)
 
bool HasLibrary (const wxString &aNickname, bool aCheckEnabled=false) const
 Test for the existence of aNickname in the library table. More...
 
bool HasLibraryWithPath (const wxString &aPath) const
 Test for the existence of aPath in the library table. More...
 
std::vector< wxString > GetLogicalLibs ()
 Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE. More...
 
wxString GetFullURI (const wxString &aLibNickname, bool aExpandEnvVars=true) const
 Return the full URI of the library mapped to aLibNickname. More...
 
bool InsertRow (LIB_TABLE_ROW *aRow, bool doReplace=false)
 Adds aRow if it does not already exist or if doReplace is true. More...
 
bool RemoveRow (const LIB_TABLE_ROW *aRow)
 Removes a row from the table. More...
 
const LIB_TABLE_ROWFindRowByURI (const wxString &aURI)
 
void Load (const wxString &aFileName)
 Load the library table using the path defined by aFileName aFallBackTable. More...
 
void Save (const wxString &aFileName) const
 Write this library table to aFileName in s-expression form. More...
 
int GetVersion () const
 Returns the version number (0 if unset) More...
 

Static Public Member Functions

static bool LoadGlobalTable (SYMBOL_LIB_TABLE &aTable)
 Load the global symbol library table into aTable. More...
 
static wxString GetGlobalTableFileName ()
 Fetch the global symbol library table file name. More...
 
static const wxString GlobalPathEnvVariableName ()
 Return the name of the environment variable used to hold the directory of locally installed "KiCad sponsored" system symbol libraries. More...
 
static SYMBOL_LIB_TABLEGetGlobalLibTable ()
 
static const wxString & GetSymbolLibTableFileName ()
 
static STRING_UTF8_MAPParseOptions (const std::string &aOptionsList)
 Parses aOptionsList and places the result into a #PROPERTIES object which is returned. More...
 
static UTF8 FormatOptions (const STRING_UTF8_MAP *aProperties)
 Returns a list of options from the aProperties parameter. More...
 

Static Public Attributes

static const char * PropPowerSymsOnly = "pwr_sym_only"
 
static const char * PropNonPowerSymsOnly = "non_pwr_sym_only"
 

Protected Types

typedef std::map< wxString, int > INDEX
 this is a non-owning index into the LIB_TABLE_ROWS table More...
 
typedef INDEX::iterator INDEX_ITER
 
typedef INDEX::const_iterator INDEX_CITER
 
typedef INDEX::value_type INDEX_VALUE
 

Protected Member Functions

LIB_TABLE_ROWfindRow (const wxString &aNickname, bool aCheckIfEnabled=false) const
 Return a LIB_TABLE_ROW if aNickname is found in this table or in any chained fallBack table fragment, else NULL. More...
 
bool migrate ()
 Updates the env vars from older version of KiCad, provided they do not currently resolve to anything. More...
 
void reindex ()
 
void ensureIndex ()
 

Protected Attributes

LIB_TABLE_ROWS m_rows
 
INDEX m_nickIndex
 this particular key is the nickName within each row. More...
 
LIB_TABLEm_fallBack
 
int m_version
 Versioning to handle importing old tables. More...
 
std::mutex m_nickIndexMutex
 Mutex to protect access to the nickIndex variable. More...
 

Static Private Attributes

static int m_modifyHash = 1
 helper for GetModifyHash() More...
 

Friends

class SYMBOL_LIB_TABLE_GRID
 
class PANEL_SYM_LIB_TABLE
 

Detailed Description

Definition at line 133 of file symbol_lib_table.h.

Member Typedef Documentation

◆ INDEX

typedef std::map<wxString,int> LIB_TABLE::INDEX
protectedinherited

this is a non-owning index into the LIB_TABLE_ROWS table

Definition at line 569 of file lib_table_base.h.

◆ INDEX_CITER

typedef INDEX::const_iterator LIB_TABLE::INDEX_CITER
protectedinherited

Definition at line 571 of file lib_table_base.h.

◆ INDEX_ITER

typedef INDEX::iterator LIB_TABLE::INDEX_ITER
protectedinherited

Definition at line 570 of file lib_table_base.h.

◆ INDEX_VALUE

typedef INDEX::value_type LIB_TABLE::INDEX_VALUE
protectedinherited

Definition at line 572 of file lib_table_base.h.

Member Enumeration Documentation

◆ SAVE_T

The set of return values from SaveSymbol() below.

Enumerator
SAVE_OK 
SAVE_SKIPPED 

Definition at line 206 of file symbol_lib_table.h.

Constructor & Destructor Documentation

◆ SYMBOL_LIB_TABLE()

SYMBOL_LIB_TABLE::SYMBOL_LIB_TABLE ( SYMBOL_LIB_TABLE aFallBackTable = nullptr)

Build a symbol library table by pre-pending this table fragment in front of aFallBackTable.

Loading of this table fragment is done by using Parse().

Parameters
aFallBackTableis another SYMBOL_LIB_TABLE which is searched only when a row is not found in this table. No ownership is taken of aFallBackTable.

Definition at line 103 of file symbol_lib_table.cpp.

103 :
104 LIB_TABLE( aFallBackTable )
105{
106 // not copying fall back, simply search aFallBackTable separately
107 // if "nickName not found".
108}
LIB_TABLE(LIB_TABLE *aFallBackTable=nullptr)
Build a library table by pre-pending this table fragment in front of aFallBackTable.

Member Function Documentation

◆ At() [1/2]

LIB_TABLE_ROW & LIB_TABLE::At ( unsigned  aIndex)
inlineinherited

Get the 'n'th LIB_TABLE_ROW object.

Parameters
aIndexindex of row (must exist: from 0 to GetCount() - 1)
Returns
reference to the row

Definition at line 375 of file lib_table_base.h.

376 {
377 return m_rows[aIndex];
378 }
LIB_TABLE_ROWS m_rows

References LIB_TABLE::m_rows.

Referenced by FP_LIB_TABLE::LoadGlobalTable(), LoadGlobalTable(), SYMBOL_GRID_TRICKS::paste_text(), FP_GRID_TRICKS::paste_text(), and PCB::IFACE::SaveFileAs().

◆ At() [2/2]

const LIB_TABLE_ROW & LIB_TABLE::At ( unsigned  aIndex) const
inlineinherited

Get the 'n'th LIB_TABLE_ROW object.

Parameters
aIndexindex of row (must exist: from 0 to GetCount() - 1)
Returns
reference to the row

Definition at line 383 of file lib_table_base.h.

384 {
385 return m_rows[aIndex];
386 }

References LIB_TABLE::m_rows.

◆ Clear()

void LIB_TABLE::Clear ( )
inlineinherited

Delete all rows.

Definition at line 330 of file lib_table_base.h.

331 {
332 std::lock_guard<std::mutex> lock( m_nickIndexMutex );
333
334 m_rows.clear();
335 m_nickIndex.clear();
336 }
INDEX m_nickIndex
this particular key is the nickName within each row.
std::mutex m_nickIndexMutex
Mutex to protect access to the nickIndex variable.

References LIB_TABLE::m_nickIndex, LIB_TABLE::m_nickIndexMutex, and LIB_TABLE::m_rows.

Referenced by PANEL_SYM_LIB_TABLE::TransferDataFromWindow(), and PANEL_FP_LIB_TABLE::TransferDataFromWindow().

◆ CreateSymbolLib()

void SYMBOL_LIB_TABLE::CreateSymbolLib ( const wxString &  aNickname)

Definition at line 494 of file symbol_lib_table.cpp.

495{
496 const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
497 wxCHECK( row && row->plugin, /* void */ );
498 row->plugin->CreateSymbolLib( row->GetFullURI( true ), row->GetProperties() );
499}
const wxString GetFullURI(bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
const STRING_UTF8_MAP * GetProperties() const
Return the constant #PROPERTIES for this library (LIB_TABLE_ROW).
virtual void CreateSymbolLib(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
Create a new empty symbol library at aLibraryPath.
Definition: sch_plugin.cpp:110
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_PLUGIN obje...
SCH_PLUGIN::SCH_PLUGIN_RELEASER plugin
SYMBOL_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an SYMBOL_LIB_TABLE_ROW if aNickName is found in this table or in any chained fallBack table f...

References SCH_PLUGIN::CreateSymbolLib(), FindRow(), LIB_TABLE_ROW::GetFullURI(), LIB_TABLE_ROW::GetProperties(), and SYMBOL_LIB_TABLE_ROW::plugin.

Referenced by SYMBOL_LIBRARY_MANAGER::addLibrary().

◆ DeleteSymbol()

void SYMBOL_LIB_TABLE::DeleteSymbol ( const wxString &  aNickname,
const wxString &  aSymbolName 
)

Deletes the aSymbolName from the library given by aNickname.

Parameters
aNicknameis a locator for the "library", it is a "name" in LIB_TABLE_ROW.
aSymbolNameis the name of a symbol to delete from the specified library.
Exceptions
IO_ERRORif there is a problem finding the footprint or the library, or deleting it.

Definition at line 463 of file symbol_lib_table.cpp.

464{
465 const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
466 wxCHECK( row && row->plugin, /* void */ );
467 return row->plugin->DeleteSymbol( row->GetFullURI( true ), aSymbolName, row->GetProperties() );
468}
virtual void DeleteSymbol(const wxString &aLibraryPath, const wxString &aSymbolName, const STRING_UTF8_MAP *aProperties=nullptr)
Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath.
Definition: sch_plugin.cpp:102

References SCH_PLUGIN::DeleteSymbol(), FindRow(), LIB_TABLE_ROW::GetFullURI(), LIB_TABLE_ROW::GetProperties(), and SYMBOL_LIB_TABLE_ROW::plugin.

Referenced by SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer().

◆ DeleteSymbolLib()

void SYMBOL_LIB_TABLE::DeleteSymbolLib ( const wxString &  aNickname)

Definition at line 486 of file symbol_lib_table.cpp.

487{
488 const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
489 wxCHECK( row && row->plugin, /* void */ );
490 row->plugin->DeleteSymbolLib( row->GetFullURI( true ), row->GetProperties() );
491}
virtual bool DeleteSymbolLib(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
Delete an existing symbol library and returns true if successful, or if library does not exist return...
Definition: sch_plugin.cpp:117

References SCH_PLUGIN::DeleteSymbolLib(), FindRow(), LIB_TABLE_ROW::GetFullURI(), LIB_TABLE_ROW::GetProperties(), and SYMBOL_LIB_TABLE_ROW::plugin.

◆ ensureIndex()

void LIB_TABLE::ensureIndex ( )
inlineprotectedinherited

Definition at line 552 of file lib_table_base.h.

553 {
554 // The dialog lib table editor may not maintain the nickIndex.
555 // Lazy indexing may be required. To handle lazy indexing, we must enforce
556 // that "nickIndex" is either empty or accurate, but never inaccurate.
557 if( !m_nickIndex.size() )
558 reindex();
559 }
void reindex()

References LIB_TABLE::m_nickIndex, and LIB_TABLE::reindex().

Referenced by LIB_TABLE::findRow(), LIB_TABLE::FindRowByURI(), and LIB_TABLE::InsertRow().

◆ EnumerateSymbolLib()

void SYMBOL_LIB_TABLE::EnumerateSymbolLib ( const wxString &  aNickname,
wxArrayString &  aAliasNames,
bool  aPowerSymbolsOnly = false 
)

Return a list of symbol alias names contained within the library given by aNickname.

Parameters
aNicknameis a locator for the "library", it is a "name" in LIB_TABLE_ROW.
aAliasNamesis a reference to an array for the alias names.
aPowerSymbolsOnlyis a flag to enumerate only power symbols.
Exceptions
IO_ERRORif the library cannot be found or loaded.

Definition at line 317 of file symbol_lib_table.cpp.

319{
320 SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
321 wxCHECK( row && row->plugin, /* void */ );
322
323 wxString options = row->GetOptions();
324
325 if( aPowerSymbolsOnly )
326 row->SetOptions( row->GetOptions() + " " + PropPowerSymsOnly );
327
328 row->SetLoaded( false );
329 row->plugin->EnumerateSymbolLib( aAliasNames, row->GetFullURI( true ), row->GetProperties() );
330 row->SetLoaded( true );
331
332 if( aPowerSymbolsOnly )
333 row->SetOptions( options );
334}
const wxString & GetOptions() const
Return the options string, which may hold a password or anything else needed to instantiate the under...
void SetLoaded(bool aLoaded)
Mark the row as being a loaded library.
void SetOptions(const wxString &aOptions)
Change the library options strings.
virtual void EnumerateSymbolLib(wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
Definition: sch_plugin.cpp:67
static const char * PropPowerSymsOnly

References SCH_PLUGIN::EnumerateSymbolLib(), FindRow(), LIB_TABLE_ROW::GetFullURI(), LIB_TABLE_ROW::GetOptions(), LIB_TABLE_ROW::GetProperties(), SYMBOL_LIB_TABLE_ROW::plugin, PropPowerSymsOnly, LIB_TABLE_ROW::SetLoaded(), and LIB_TABLE_ROW::SetOptions().

Referenced by SYMBOL_LIBRARY_MANAGER::getOriginalSymbols().

◆ FindRow()

SYMBOL_LIB_TABLE_ROW * SYMBOL_LIB_TABLE::FindRow ( const wxString &  aNickName,
bool  aCheckIfEnabled = false 
)

Return an SYMBOL_LIB_TABLE_ROW if aNickName is found in this table or in any chained fallBack table fragment.

The SCH_PLUGIN is loaded and attached to the "plugin" fieldf the SYMBOL_LIB_TABLE_ROW if not already loaded.

Parameters
aNickNameis the name of the row to find.
aCheckIfEnabledis a flag to verify if the table entry is enabled or disabled.
Returns
the row found or NULL if aNickName was not found.

Definition at line 337 of file symbol_lib_table.cpp.

338{
340 dynamic_cast< SYMBOL_LIB_TABLE_ROW* >( findRow( aNickname, aCheckIfEnabled ) );
341
342 if( !row )
343 return nullptr;
344
345 // We've been 'lazy' up until now, but it cannot be deferred any longer,
346 // instantiate a PLUGIN of the proper kind if it is not already in this
347 // SYMBOL_LIB_TABLE_ROW.
348 if( !row->plugin )
349 {
350 row->setPlugin( SCH_IO_MGR::FindPlugin( row->type ) );
351 row->plugin->SetLibTable( this );
352 }
353
354 return row;
355}
LIB_TABLE_ROW * findRow(const wxString &aNickname, bool aCheckIfEnabled=false) const
Return a LIB_TABLE_ROW if aNickname is found in this table or in any chained fallBack table fragment,...
virtual void SetLibTable(SYMBOL_LIB_TABLE *aTable)
Some library plugins need to have access to their parent library table.
Definition: sch_io_mgr.h:515
void setPlugin(SCH_PLUGIN *aPlugin)

References LIB_TABLE::findRow(), SYMBOL_LIB_TABLE_ROW::plugin, SCH_PLUGIN::SetLibTable(), SYMBOL_LIB_TABLE_ROW::setPlugin(), and SYMBOL_LIB_TABLE_ROW::type.

Referenced by SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), CreateSymbolLib(), DeleteSymbol(), DeleteSymbolLib(), EnumerateSymbolLib(), SYMBOL_LIBRARY_MANAGER::GetLibrary(), GetModifyHash(), IsSymbolLibLoaded(), IsSymbolLibWritable(), LoadGlobalTable(), SCH_EDIT_FRAME::LoadSheetFromFile(), LoadSymbol(), LoadSymbolLib(), SCH_BASE_FRAME::PickSymbolFromLibTree(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), SYMBOL_EDIT_FRAME::replaceLibTableEntry(), SaveSymbol(), and ERC_TESTER::TestLibSymbolIssues().

◆ findRow()

LIB_TABLE_ROW * LIB_TABLE::findRow ( const wxString &  aNickname,
bool  aCheckIfEnabled = false 
) const
protectedinherited

Return a LIB_TABLE_ROW if aNickname is found in this table or in any chained fallBack table fragment, else NULL.

Parameters
aNicknameis the name of the library table entry to find.
aCheckIfEnabledis a flag to check if the library table entry is enabled.
Returns
a pointer to the LIB_TABLE_ROW found.

Definition at line 187 of file lib_table_base.cpp.

188{
189 LIB_TABLE_ROW* row = nullptr;
190 LIB_TABLE* cur = (LIB_TABLE*) this;
191
192 do
193 {
194 cur->ensureIndex();
195
196 for( const std::pair<const wxString, int>& entry : cur->m_nickIndex )
197 {
198 if( entry.first == aNickName )
199 {
200 row = &cur->m_rows[entry.second];
201
202 if( !aCheckIfEnabled || row->GetIsEnabled() )
203 return row;
204 }
205 }
206
207 // Repeat, this time looking for names that were "fixed" by legacy versions because
208 // the old eeschema file format didn't support spaces in tokens.
209 for( const std::pair<const wxString, int>& entry : cur->m_nickIndex )
210 {
211 wxString legacyLibName = entry.first;
212 legacyLibName.Replace( " ", "_" );
213
214 if( legacyLibName == aNickName )
215 {
216 row = &cur->m_rows[entry.second];
217
218 if( !aCheckIfEnabled || row->GetIsEnabled() )
219 return row;
220 }
221 }
222
223 // not found, search fall back table(s), if any
224 } while( ( cur = cur->m_fallBack ) != nullptr );
225
226 return nullptr; // not found
227}
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
bool GetIsEnabled() const
Manage LIB_TABLE_ROW records (rows), and can be searched based on library nickname.
LIB_TABLE * m_fallBack
void ensureIndex()

References LIB_TABLE::ensureIndex(), LIB_TABLE_ROW::GetIsEnabled(), LIB_TABLE::m_fallBack, LIB_TABLE::m_nickIndex, and LIB_TABLE::m_rows.

Referenced by FindRow(), FP_LIB_TABLE::FindRow(), LIB_TABLE::GetDescription(), LIB_TABLE::GetFullURI(), and LIB_TABLE::HasLibrary().

◆ FindRowByURI()

const LIB_TABLE_ROW * LIB_TABLE::FindRowByURI ( const wxString &  aURI)
inherited
Returns
a LIB_TABLE_ROW pointer if aURI is found in this table or in any chained fallBack table fragments, else NULL.

Definition at line 230 of file lib_table_base.cpp.

231{
232 LIB_TABLE* cur = this;
233
234 do
235 {
236 cur->ensureIndex();
237
238 for( unsigned i = 0; i < cur->m_rows.size(); i++ )
239 {
240 wxString tmp = cur->m_rows[i].GetFullURI( true );
241
242 if( tmp.Find( "://" ) != wxNOT_FOUND )
243 {
244 if( tmp == aURI )
245 return &cur->m_rows[i]; // found as URI
246 }
247 else
248 {
249 wxFileName fn = aURI;
250
251 // This will also test if the file is a symlink so if we are comparing
252 // a symlink to the same real file, the comparison will be true. See
253 // wxFileName::SameAs() in the wxWidgets source.
254 if( fn == wxFileName( tmp ) )
255 return &cur->m_rows[i]; // found as full path and file name
256 }
257 }
258
259 // not found, search fall back table(s), if any
260 } while( ( cur = cur->m_fallBack ) != nullptr );
261
262 return nullptr; // not found
263}

References LIB_TABLE::ensureIndex(), LIB_TABLE::m_fallBack, and LIB_TABLE::m_rows.

Referenced by PCB_EDIT_FRAME::ExportFootprintsToLibrary(), SYMBOL_EDIT_FRAME::KiwayMailIn(), and FOOTPRINT_EDIT_FRAME::KiwayMailIn().

◆ Format()

void SYMBOL_LIB_TABLE::Format ( OUTPUTFORMATTER aOutput,
int  aIndentLevel 
) const
overridevirtual

Generate the table in s-expression format to aOutput with an indentation level of aIndentLevel.

Parameters
aOutputis the OUTPUTFORMATTER to format the table into.
aIndentLevelis the indentation level (2 spaces) to indent.
Exceptions
IO_ERRORif an I/O error occurs during output.
boost::interprocess::lock_exceptif separate process attempt to access the table.

Implements LIB_TABLE.

Definition at line 279 of file symbol_lib_table.cpp.

280{
281 aOutput->Print( aIndentLevel, "(sym_lib_table\n" );
282 aOutput->Print( aIndentLevel + 1, "(version %d)\n", m_version );
283
284 for( LIB_TABLE_ROWS_CITER it = m_rows.begin(); it != m_rows.end(); ++it )
285 {
286 it->Format( aOutput, aIndentLevel+1 );
287 }
288
289 aOutput->Print( aIndentLevel, ")\n" );
290}
int m_version
Versioning to handle importing old tables.
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:433
LIB_TABLE_ROWS::const_iterator LIB_TABLE_ROWS_CITER

References LIB_TABLE::m_rows, LIB_TABLE::m_version, and OUTPUTFORMATTER::Print().

Referenced by DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), SCH_ALTIUM_PLUGIN::Load(), CADSTAR_SCH_ARCHIVE_PLUGIN::Load(), and SCH_EAGLE_PLUGIN::Load().

◆ FormatOptions()

UTF8 LIB_TABLE::FormatOptions ( const STRING_UTF8_MAP aProperties)
staticinherited

Returns a list of options from the aProperties parameter.

The name=value pairs will be separated with the '|' character. The =value portion may not be present. You might expect something like "name1=value1|name2=value2|flag_me". Notice that flag_me does not have a value. This is ok.

Parameters
aPropertiesis the PROPERTIES to format or NULL. If NULL the returned string will be empty.

Definition at line 445 of file lib_table_base.cpp.

446{
447 UTF8 ret;
448
449 if( aProperties )
450 {
451 for( STRING_UTF8_MAP::const_iterator it = aProperties->begin(); it != aProperties->end(); ++it )
452 {
453 const std::string& name = it->first;
454
455 const UTF8& value = it->second;
456
457 if( ret.size() )
458 ret += OPT_SEP;
459
460 ret += name;
461
462 // the separation between name and value is '='
463 if( value.size() )
464 {
465 ret += '=';
466
467 for( std::string::const_iterator si = value.begin(); si != value.end(); ++si )
468 {
469 // escape any separator in the value.
470 if( *si == OPT_SEP )
471 ret += '\\';
472
473 ret += *si;
474 }
475 }
476 }
477 }
478
479 return ret;
480}
const char * name
Definition: DXF_plotter.cpp:56
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
Definition: utf8.h:71
std::string::const_iterator begin() const
Definition: utf8.h:192
std::string::size_type size() const
Definition: utf8.h:110
std::string::const_iterator end() const
Definition: utf8.h:193
#define OPT_SEP
options separator character

References UTF8::begin(), UTF8::end(), name, OPT_SEP, and UTF8::size().

Referenced by DIALOG_FP_PLUGIN_OPTIONS::TransferDataFromWindow().

◆ GetCount()

unsigned LIB_TABLE::GetCount ( ) const
inlineinherited

◆ GetDescription()

const wxString LIB_TABLE::GetDescription ( const wxString &  aNickname)
inherited
Returns
the library description from aNickname, or an empty string if aNickname does not exist.

Definition at line 139 of file lib_table_base.cpp.

140{
141 // Use "no exception" form of find row and ignore disabled flag.
142 const LIB_TABLE_ROW* row = findRow( aNickname );
143
144 if( row )
145 return row->GetDescr();
146 else
147 return wxEmptyString;
148}
const wxString & GetDescr() const
Return the description of the library referenced by this row.

References LIB_TABLE::findRow(), and LIB_TABLE_ROW::GetDescr().

Referenced by SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), SYMBOL_TREE_MODEL_ADAPTER::AddLibrary(), FOOTPRINT_EDIT_FRAME::buildSaveAsDialog(), SYMBOL_EDIT_FRAME::buildSaveAsDialog(), and PCB_BASE_FRAME::SelectLibrary().

◆ GetFullURI()

wxString LIB_TABLE::GetFullURI ( const wxString &  aLibNickname,
bool  aExpandEnvVars = true 
) const
inherited

Return the full URI of the library mapped to aLibNickname.

Definition at line 174 of file lib_table_base.cpp.

175{
176 const LIB_TABLE_ROW* row = findRow( aNickname, true );
177
178 wxString retv;
179
180 if( row )
181 retv = row->GetFullURI( aExpandEnvVars );
182
183 return retv;
184}

References LIB_TABLE::findRow(), and LIB_TABLE_ROW::GetFullURI().

Referenced by CVPCB_MAINFRAME::DisplayStatus(), SCH_EDIT_FRAME::LoadSheetFromFile(), NETLIST_EXPORTER_XML::makeLibraries(), and FOOTPRINT_EDITOR_CONTROL::SaveAs().

◆ GetGlobalLibTable()

◆ GetGlobalTableFileName()

wxString SYMBOL_LIB_TABLE::GetGlobalTableFileName ( )
static

Fetch the global symbol library table file name.

Returns
the platform specific global symbol library path and file name.

Definition at line 682 of file symbol_lib_table.cpp.

683{
684 wxFileName fn;
685
687 fn.SetName( global_tbl_name );
688
689 return fn.GetFullPath();
690}
static wxString GetUserSettingsPath()
Return the user configuration path used to store KiCad's configuration files.
static const wxString global_tbl_name("sym-lib-table")

References SETTINGS_MANAGER::GetUserSettingsPath(), and global_tbl_name().

Referenced by SYMBOL_EDIT_FRAME::addLibTableEntry(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::GetGlobalTableFileName(), InvokeSchEditSymbolLibTable(), LoadGlobalTable(), SCH::IFACE::OnKifaceStart(), SYMBOL_EDIT_FRAME::replaceLibTableEntry(), SCH_BASE_FRAME::saveSymbolLibTables(), and DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::TransferDataFromWindow().

◆ GetLogicalLibs()

std::vector< wxString > LIB_TABLE::GetLogicalLibs ( )
inherited

Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.

Definition at line 266 of file lib_table_base.cpp.

267{
268 // Only return unique logical library names. Use std::set::insert() to quietly reject any
269 // duplicates (usually due to encountering a duplicate nickname in a fallback table).
270
271 std::set<wxString> unique;
272 std::vector<wxString> ret;
273 const LIB_TABLE* cur = this;
274
275 do
276 {
277 for( LIB_TABLE_ROWS_CITER it = cur->m_rows.begin(); it!=cur->m_rows.end(); ++it )
278 {
279 if( it->GetIsEnabled() )
280 unique.insert( it->GetNickName() );
281 }
282
283 } while( ( cur = cur->m_fallBack ) != nullptr );
284
285 ret.reserve( unique.size() );
286
287 // return a sorted, unique set of nicknames in a std::vector<wxString> to caller
288 for( std::set< wxString >::const_iterator it = unique.begin(); it!=unique.end(); ++it )
289 ret.push_back( *it );
290
291 // We want to allow case-sensitive duplicates but sort by case-insensitive ordering
292 std::sort( ret.begin(), ret.end(),
293 []( const wxString& lhs, const wxString& rhs )
294 {
295 return StrNumCmp( lhs, rhs, true /* ignore case */ ) < 0;
296 } );
297
298 return ret;
299}

References LIB_TABLE::m_fallBack, and LIB_TABLE::m_rows.

Referenced by FP_TREE_MODEL_ADAPTER::AddLibraries(), CVPCB_MAINFRAME::BuildLibrariesListBox(), FOOTPRINT_EDIT_FRAME::buildSaveAsDialog(), SYMBOL_EDIT_FRAME::buildSaveAsDialog(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FP_LIB_TABLE::FootprintLoadWithOptionalNickname(), FP_LIB_TABLE::GenerateTimestamp(), GetFootprintLibraries(), SYMBOL_LIBRARY_MANAGER::GetLibraryCount(), GetModifyHash(), guessNickname(), CVPCB_MAINFRAME::LoadFootprintFiles(), LoadSymbolWithOptionalNickname(), FOOTPRINT_VIEWER_FRAME::OnActivate(), SYMBOL_VIEWER_FRAME::OnSelectSymbol(), SCH_BASE_FRAME::PickSymbolFromLibTree(), FOOTPRINT_LIST_IMPL::ReadFootprintFiles(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), PCB_BASE_FRAME::SelectLibrary(), and FP_TREE_SYNCHRONIZING_ADAPTER::Sync().

◆ GetModifyHash()

int SYMBOL_LIB_TABLE::GetModifyHash ( )

Definition at line 293 of file symbol_lib_table.cpp.

294{
295 int hash = 0;
296 std::vector< wxString > libNames = GetLogicalLibs();
297
298 for( const auto& libName : libNames )
299 {
300 const SYMBOL_LIB_TABLE_ROW* row = FindRow( libName, true );
301
302 if( !row || !row->plugin )
303 {
304 wxFAIL;
305 continue;
306 }
307
308 hash += row->plugin->GetModifyHash();
309 }
310
311 hash += m_modifyHash;
312
313 return hash;
314}
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
virtual int GetModifyHash() const =0
Return the modification hash from the library cache.
static int m_modifyHash
helper for GetModifyHash()

References FindRow(), LIB_TABLE::GetLogicalLibs(), SCH_PLUGIN::GetModifyHash(), m_modifyHash, and SYMBOL_LIB_TABLE_ROW::plugin.

Referenced by SYMBOL_LIBRARY_MANAGER::GetHash(), and LIB_SYMBOL_LIBRARY_MANAGER::Sync().

◆ GetSymbolLibTableFileName()

◆ GetVersion()

int LIB_TABLE::GetVersion ( ) const
inlineinherited

Returns the version number (0 if unset)

Returns
integer version number read from table

Definition at line 518 of file lib_table_base.h.

519 {
520 return m_version;
521 }

References LIB_TABLE::m_version.

◆ GlobalPathEnvVariableName()

const wxString SYMBOL_LIB_TABLE::GlobalPathEnvVariableName ( )
static

Return the name of the environment variable used to hold the directory of locally installed "KiCad sponsored" system symbol libraries.

These can be either legacy or sweet format. The only thing special about this particular environment variable is that it is set automatically by KiCad on program start up, if it is not set already in the environment.

Definition at line 532 of file symbol_lib_table.cpp.

533{
534 return "KICAD7_SYMBOL_DIR";
535}

Referenced by PANEL_SYM_LIB_TABLE::populateEnvironReadOnlyTable().

◆ HasLibrary()

◆ HasLibraryWithPath()

bool LIB_TABLE::HasLibraryWithPath ( const wxString &  aPath) const
inherited

Test for the existence of aPath in the library table.

Parameters
aCheckEnabledif true will only return true for enabled libraries
Returns
true if a library aNickname exists in the table.

Definition at line 162 of file lib_table_base.cpp.

163{
164 for( const LIB_TABLE_ROW& row : m_rows )
165 {
166 if( row.GetFullURI() == aPath )
167 return true;
168 }
169
170 return false;
171}

References LIB_TABLE::m_rows.

Referenced by PCM_FP_LIB_TRAVERSER::OnDir(), and PCM_SYM_LIB_TRAVERSER::OnFile().

◆ InsertRow()

bool LIB_TABLE::InsertRow ( LIB_TABLE_ROW aRow,
bool  doReplace = false 
)
inherited

Adds aRow if it does not already exist or if doReplace is true.

If doReplace is not true and the key for aRow already exists, the function fails and returns false.

The key for the table is the nickName, and all in this table must be unique.

Parameters
aRowis the new row to insert, or to forcibly add if doReplace is true.
doReplaceif true, means insert regardless of whether aRow's key already exists. If false, then fail if the key already exists.
Returns
bool - true if the operation succeeded.

Definition at line 302 of file lib_table_base.cpp.

303{
304 ensureIndex();
305
306 std::lock_guard<std::mutex> lock( m_nickIndexMutex );
307
308 INDEX_CITER it = m_nickIndex.find( aRow->GetNickName() );
309
310 aRow->SetParent( this );
311
312 if( it == m_nickIndex.end() )
313 {
314 m_rows.push_back( aRow );
315 m_nickIndex.insert( INDEX_VALUE( aRow->GetNickName(), m_rows.size() - 1 ) );
316 return true;
317 }
318
319 if( doReplace )
320 {
321 m_rows.replace( it->second, aRow );
322 return true;
323 }
324
325 return false;
326}
void SetParent(LIB_TABLE *aParent)
const wxString & GetNickName() const
INDEX::value_type INDEX_VALUE
INDEX::const_iterator INDEX_CITER

References LIB_TABLE::ensureIndex(), LIB_TABLE_ROW::GetNickName(), LIB_TABLE::m_nickIndex, LIB_TABLE::m_nickIndexMutex, LIB_TABLE::m_rows, and LIB_TABLE_ROW::SetParent().

Referenced by SYMBOL_LIBRARY_MANAGER::addLibrary(), PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_EDIT_FRAME::addLibTableEntry(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), LIB_TABLE_TEST_FIXTURE::LIB_TABLE_TEST_FIXTURE(), SCH_ALTIUM_PLUGIN::Load(), CADSTAR_SCH_ARCHIVE_PLUGIN::Load(), SCH_EAGLE_PLUGIN::Load(), PCM_FP_LIB_TRAVERSER::OnDir(), PCM_SYM_LIB_TRAVERSER::OnFile(), PCB_EDIT_FRAME::OpenProjectFiles(), Parse(), and FP_LIB_TABLE::Parse().

◆ IsEmpty()

bool LIB_TABLE::IsEmpty ( bool  aIncludeFallback = true)
inherited

Return true if the table is empty.

Parameters
aIncludeFallbackis used to determine if the fallback table should be included in the test.
Returns
true if the footprint library table is empty.

Definition at line 130 of file lib_table_base.cpp.

131{
132 if( !aIncludeFallback || !m_fallBack )
133 return m_rows.empty();
134
135 return m_rows.empty() && m_fallBack->IsEmpty( true );
136}
bool IsEmpty(bool aIncludeFallback=true)
Return true if the table is empty.

References LIB_TABLE::IsEmpty(), LIB_TABLE::m_fallBack, and LIB_TABLE::m_rows.

Referenced by BOOST_AUTO_TEST_CASE(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), LIB_TABLE::IsEmpty(), and SCH_EDIT_FRAME::LoadSheetFromFile().

◆ IsSymbolLibLoaded()

bool SYMBOL_LIB_TABLE::IsSymbolLibLoaded ( const wxString &  aNickname)

Return true if the library given by aNickname was successfully loaded.

Parameters
aNicknameis the library nickname in the symbol library table.
Exceptions
IO_ERRORif no library at aNickname exists.

Definition at line 478 of file symbol_lib_table.cpp.

479{
480 const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
481 wxCHECK( row, false );
482 return row->GetIsLoaded();
483}
bool GetIsLoaded() const

References FindRow(), and LIB_TABLE_ROW::GetIsLoaded().

Referenced by SYMBOL_LIBRARY_MANAGER::IsLibraryLoaded().

◆ IsSymbolLibWritable()

bool SYMBOL_LIB_TABLE::IsSymbolLibWritable ( const wxString &  aNickname)

Return true if the library given by aNickname is writable.

It is possible that some symbols libraries are read only because of where they are installed.

Parameters
aNicknameis the library nickname in the symbol library table.
Exceptions
IO_ERRORif no library at aNickname exists.

Definition at line 471 of file symbol_lib_table.cpp.

472{
473 const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
474 wxCHECK( row && row->plugin, false );
475 return row->plugin->IsSymbolLibWritable( row->GetFullURI( true ) );
476}
virtual bool IsSymbolLibWritable(const wxString &aLibraryPath)
Return true if the library at aLibraryPath is writable.
Definition: sch_plugin.cpp:125

References FindRow(), LIB_TABLE_ROW::GetFullURI(), SCH_PLUGIN::IsSymbolLibWritable(), and SYMBOL_LIB_TABLE_ROW::plugin.

Referenced by SYMBOL_LIBRARY_MANAGER::IsLibraryReadOnly().

◆ Load()

void LIB_TABLE::Load ( const wxString &  aFileName)
inherited

Load the library table using the path defined by aFileName aFallBackTable.

Parameters
aFileNamecontains the full path to the s-expression file.
Exceptions
IO_ERRORif an error occurs attempting to load the footprint library table.

Definition at line 354 of file lib_table_base.cpp.

355{
356 // It's OK if footprint library tables are missing.
357 if( wxFileName::IsFileReadable( aFileName ) )
358 {
359 FILE_LINE_READER reader( aFileName );
360 LIB_TABLE_LEXER lexer( &reader );
361
362 Parse( &lexer );
363
364 if( m_version != 7 && migrate() && wxFileName::IsFileWritable( aFileName ) )
365 Save( aFileName );
366 }
367}
A LINE_READER that reads from an open file.
Definition: richio.h:173
bool migrate()
Updates the env vars from older version of KiCad, provided they do not currently resolve to anything.
virtual void Parse(LIB_TABLE_LEXER *aLexer)=0
Parse the #LIB_TABLE_LEXER s-expression library table format into the appropriate LIB_TABLE_ROW objec...
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.

References LIB_TABLE::m_version, LIB_TABLE::migrate(), LIB_TABLE::Parse(), and LIB_TABLE::Save().

Referenced by FP_LIB_TABLE::LoadGlobalTable(), LoadGlobalTable(), SCH_EDIT_FRAME::LoadSheetFromFile(), PROJECT::PcbFootprintLibs(), PCB::IFACE::SaveFileAs(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::TransferDataFromWindow(), and DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG::TransferDataFromWindow().

◆ LoadGlobalTable()

bool SYMBOL_LIB_TABLE::LoadGlobalTable ( SYMBOL_LIB_TABLE aTable)
static

Load the global symbol library table into aTable.

This probably should be move into the application object when KiCad is changed to a single process application. This is the least painful solution for the time being.

Parameters
aTablethe SYMBOL_LIB_TABLE object to load.
Returns
true if the global library table exists and is loaded properly.
Exceptions
IO_ERRORif an error occurs attempting to load the symbol library table.

Definition at line 600 of file symbol_lib_table.cpp.

601{
602 bool tableExists = true;
603 wxFileName fn = GetGlobalTableFileName();
604
605 if( !fn.FileExists() )
606 {
607 tableExists = false;
608
609 if( !fn.DirExists() && !fn.Mkdir( 0x777, wxPATH_MKDIR_FULL ) )
610 {
611 THROW_IO_ERROR( wxString::Format( _( "Cannot create global library table path '%s'." ),
612 fn.GetPath() ) );
613 }
614
615 // Attempt to copy the default global file table from the KiCad
616 // template folder to the user's home configuration path.
617 SEARCH_STACK ss;
618
619 SystemDirsAppend( &ss );
620
621 wxString templatePath =
622 Pgm().GetLocalEnvVariables().at( wxT( "KICAD7_TEMPLATE_DIR" ) ).GetValue();
623
624 if( !templatePath.IsEmpty() )
625 ss.AddPaths( templatePath, 0 );
626
627 wxString fileName = ss.FindValidPath( global_tbl_name );
628
629 // The fallback is to create an empty global symbol table for the user to populate.
630 if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) )
631 {
632 SYMBOL_LIB_TABLE emptyTable;
633
634 emptyTable.Save( fn.GetFullPath() );
635 }
636 }
637
638 aTable.Load( fn.GetFullPath() );
639
640 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
642
643 wxString packagesPath = Pgm().GetLocalEnvVariables().at( wxT( "KICAD7_3RD_PARTY" ) ).GetValue();
644
645 if( settings->m_PcmLibAutoAdd )
646 {
647 // Scan for libraries in PCM packages directory
648 wxFileName d( packagesPath, "" );
649 d.AppendDir( "symbols" );
650
651 if( d.DirExists() )
652 {
653 PCM_SYM_LIB_TRAVERSER traverser( packagesPath, aTable, settings->m_PcmLibPrefix );
654 wxDir dir( d.GetPath() );
655
656 dir.Traverse( traverser );
657 }
658 }
659
660 if( settings->m_PcmLibAutoRemove )
661 {
662 // Remove PCM libraries that no longer exist
663 std::vector<wxString> to_remove;
664
665 for( size_t i = 0; i < aTable.GetCount(); i++ )
666 {
667 LIB_TABLE_ROW& row = aTable.At( i );
668 wxString path = row.GetFullURI( true );
669
670 if( path.StartsWith( packagesPath ) && !wxFile::Exists( path ) )
671 to_remove.push_back( row.GetNickName() );
672 }
673
674 for( const wxString& nickName : to_remove )
675 aTable.RemoveRow( aTable.FindRow( nickName ) );
676 }
677
678 return tableExists;
679}
wxString m_PcmLibPrefix
LIB_TABLE_ROW & At(unsigned aIndex)
Get the 'n'th LIB_TABLE_ROW object.
void Load(const wxString &aFileName)
Load the library table using the path defined by aFileName aFallBackTable.
bool RemoveRow(const LIB_TABLE_ROW *aRow)
Removes a row from the table.
unsigned GetCount() const
Get the number of rows contained in the table.
Look for files in a number of paths.
Definition: search_stack.h:42
void AddPaths(const wxString &aPaths, int aIndex=-1)
Insert or append path(s).
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
static wxString GetGlobalTableFileName()
Fetch the global symbol library table file name.
#define _(s)
#define THROW_IO_ERROR(msg)
Definition: ki_exception.h:38
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
void SystemDirsAppend(SEARCH_STACK *aSearchStack)
Append system places to aSearchStack in a platform specific way and pertinent to KiCad programs.

References _, SEARCH_STACK::AddPaths(), LIB_TABLE::At(), FindRow(), Format(), SETTINGS_MANAGER::GetAppSettings(), LIB_TABLE::GetCount(), LIB_TABLE_ROW::GetFullURI(), GetGlobalTableFileName(), LIB_TABLE_ROW::GetNickName(), global_tbl_name(), LIB_TABLE::Load(), KICAD_SETTINGS::m_PcmLibAutoAdd, KICAD_SETTINGS::m_PcmLibAutoRemove, KICAD_SETTINGS::m_PcmLibPrefix, path, Pgm(), LIB_TABLE::RemoveRow(), LIB_TABLE::Save(), SystemDirsAppend(), and THROW_IO_ERROR.

Referenced by SCH::IFACE::OnKifaceStart(), and DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::TransferDataFromWindow().

◆ LoadSymbol() [1/2]

LIB_SYMBOL * SYMBOL_LIB_TABLE::LoadSymbol ( const LIB_ID aLibId)
inline

Definition at line 198 of file symbol_lib_table.h.

199 {
200 return LoadSymbol( aLibId.GetLibNickname(), aLibId.GetLibItemName() );
201 }
const UTF8 & GetLibItemName() const
Definition: lib_id.h:102
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:87
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.

References LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), and LoadSymbol().

◆ LoadSymbol() [2/2]

LIB_SYMBOL * SYMBOL_LIB_TABLE::LoadSymbol ( const wxString &  aNickname,
const wxString &  aName 
)

Load a LIB_SYMBOL having aName from the library given by aNickname.

Parameters
aNicknameis a locator for the "library", it is a "name" in LIB_TABLE_ROW
aNameis the name of the LIB_SYMBOL to load.
aFlattenset to true to flatten derived parts.
Returns
the symbol alias if found or NULL if not found.
Exceptions
IO_ERRORif the library cannot be found or read. No exception is thrown in the case where aNickname cannot be found.

Definition at line 393 of file symbol_lib_table.cpp.

394{
395 SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
396
397 if( !row || !row->plugin )
398 return nullptr;
399
400 // If another thread is loading this library at the moment; continue
401 std::unique_lock<std::mutex> lock( row->GetMutex(), std::try_to_lock );
402
403 if( !lock.owns_lock() )
404 return nullptr;
405
406 LIB_SYMBOL* symbol = row->plugin->LoadSymbol( row->GetFullURI( true ), aSymbolName,
407 row->GetProperties() );
408
409 if( symbol )
410 {
411 // The library cannot know its own name, because it might have been renamed or moved.
412 // Therefore footprints cannot know their own library nickname when residing in
413 // a symbol library.
414 // Only at this API layer can we tell the symbol about its actual library nickname.
415 LIB_ID id = symbol->GetLibId();
416
417 id.SetLibNickname( row->GetNickName() );
418 symbol->SetLibId( id );
419
420 SIM_MODEL::MigrateSimModel<LIB_SYMBOL, LIB_FIELD>( *symbol, nullptr );
421 }
422
423 return symbol;
424}
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
int SetLibNickname(const UTF8 &aNickname)
Override the logical library name portion of the LIB_ID to aNickname.
Definition: lib_id.cpp:98
Define a library symbol object.
Definition: lib_symbol.h:99
LIB_ID GetLibId() const override
Definition: lib_symbol.h:141
void SetLibId(const LIB_ID &aLibId)
Definition: lib_symbol.h:142
std::mutex & GetMutex()
virtual LIB_SYMBOL * LoadSymbol(const wxString &aLibraryPath, const wxString &aPartName, const STRING_UTF8_MAP *aProperties=nullptr)
Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this...
Definition: sch_plugin.cpp:85

References FindRow(), LIB_TABLE_ROW::GetFullURI(), LIB_SYMBOL::GetLibId(), LIB_TABLE_ROW::GetMutex(), LIB_TABLE_ROW::GetNickName(), LIB_TABLE_ROW::GetProperties(), SCH_PLUGIN::LoadSymbol(), SYMBOL_LIB_TABLE_ROW::plugin, LIB_SYMBOL::SetLibId(), and LIB_ID::SetLibNickname().

Referenced by FOOTPRINT_INFO_GENERATOR::GenerateHtml(), SYMBOL_LIBRARY_MANAGER::GetAlias(), SYMBOL_LIBRARY_MANAGER::GetBufferedSymbol(), SYMBOL_LIBRARY_MANAGER::getOriginalSymbols(), SCH_EAGLE_PLUGIN::loadInstance(), LoadSymbol(), SCH_DATABASE_PLUGIN::loadSymbolFromRow(), LoadSymbolWithOptionalNickname(), SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(), SchGetLibSymbol(), SYMBOL_LIBRARY_MANAGER::SymbolExists(), and SCH_SCREEN::UpdateSymbolLinks().

◆ LoadSymbolLib()

void SYMBOL_LIB_TABLE::LoadSymbolLib ( std::vector< LIB_SYMBOL * > &  aAliasList,
const wxString &  aNickname,
bool  aPowerSymbolsOnly = false 
)

Definition at line 358 of file symbol_lib_table.cpp.

360{
361 SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
362 wxCHECK( row && row->plugin, /* void */ );
363
364 std::lock_guard<std::mutex> lock( row->GetMutex() );
365
366 wxString options = row->GetOptions();
367
368 if( aPowerSymbolsOnly )
369 row->SetOptions( row->GetOptions() + " " + PropPowerSymsOnly );
370
371 row->SetLoaded( false );
372 row->plugin->SetLibTable( this );
373 row->plugin->EnumerateSymbolLib( aSymbolList, row->GetFullURI( true ), row->GetProperties() );
374 row->SetLoaded( true );
375
376 if( aPowerSymbolsOnly )
377 row->SetOptions( options );
378
379 // The library cannot know its own name, because it might have been renamed or moved.
380 // Therefore footprints cannot know their own library nickname when residing in
381 // a symbol library.
382 // Only at this API layer can we tell the symbol about its actual library nickname.
383 for( LIB_SYMBOL* symbol : aSymbolList )
384 {
385 LIB_ID id = symbol->GetLibId();
386
387 id.SetLibNickname( row->GetNickName() );
388 symbol->SetLibId( id );
389 }
390}

References SCH_PLUGIN::EnumerateSymbolLib(), FindRow(), LIB_TABLE_ROW::GetFullURI(), LIB_TABLE_ROW::GetMutex(), LIB_TABLE_ROW::GetNickName(), LIB_TABLE_ROW::GetOptions(), LIB_TABLE_ROW::GetProperties(), SYMBOL_LIB_TABLE_ROW::plugin, PropPowerSymsOnly, LIB_ID::SetLibNickname(), SCH_PLUGIN::SetLibTable(), LIB_TABLE_ROW::SetLoaded(), and LIB_TABLE_ROW::SetOptions().

Referenced by SYMBOL_TREE_MODEL_ADAPTER::AddLibrary(), SYMBOL_LIBRARY_MANAGER::GetAliases(), and SYMBOL_ASYNC_LOADER::worker().

◆ LoadSymbolWithOptionalNickname()

LIB_SYMBOL * SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname ( const LIB_ID aId)

Load a LIB_SYMBOL having aFootprintId with possibly an empty library nickname.

Parameters
aIdthe library nickname and name of the symbol to load.
Returns
the library symbol if found (the library owns it) or NULL if not found.
Exceptions
IO_ERRORif the library cannot be found or read. No exception is thrown in the case where aId cannot be found.
PARSE_ERRORif aId is not parsed OK.

Definition at line 502 of file symbol_lib_table.cpp.

503{
504 wxString nickname = aLibId.GetLibNickname();
505 wxString name = aLibId.GetLibItemName();
506
507 if( nickname.size() )
508 {
509 return LoadSymbol( nickname, name );
510 }
511 else
512 {
513 // nickname is empty, sequentially search (alphabetically) all libs/nicks for first match:
514 std::vector<wxString> nicks = GetLogicalLibs();
515
516 // Search each library going through libraries alphabetically.
517 for( unsigned i = 0; i < nicks.size(); ++i )
518 {
519 // FootprintLoad() returns NULL on not found, does not throw exception
520 // unless there's an IO_ERROR.
521 LIB_SYMBOL* ret = LoadSymbol( nicks[i], name );
522
523 if( ret )
524 return ret;
525 }
526
527 return nullptr;
528 }
529}

References LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), LIB_TABLE::GetLogicalLibs(), LoadSymbol(), and name.

◆ migrate()

bool LIB_TABLE::migrate ( )
protectedinherited

Updates the env vars from older version of KiCad, provided they do not currently resolve to anything.

Returns
True if the tables were modified

Definition at line 329 of file lib_table_base.cpp.

330{
331 bool table_updated = false;
332
333 for( LIB_TABLE_ROW& row : m_rows )
334 {
335 bool row_updated = false;
336 wxString uri = row.GetFullURI( true );
337
338 // If the uri still has a variable in it, that means that the user does not have
339 // these vars defined. We update the old vars to the KICAD7 versions on load
340 row_updated |= ( uri.Replace( wxS( "${KICAD5_" ), wxS( "${KICAD7_" ), false ) > 0 );
341 row_updated |= ( uri.Replace( wxS( "${KICAD6_" ), wxS( "${KICAD7_" ), false ) > 0 );
342
343 if( row_updated )
344 {
345 row.SetFullURI( uri );
346 table_updated = true;
347 }
348 }
349
350 return table_updated;
351}

References LIB_TABLE::m_rows.

Referenced by LIB_TABLE::Load().

◆ operator!=()

bool LIB_TABLE::operator!= ( const LIB_TABLE r) const
inlineinherited

Definition at line 360 of file lib_table_base.h.

360{ return !( *this == r ); }

◆ operator==()

bool LIB_TABLE::operator== ( const LIB_TABLE r) const
inlineinherited

Compares this table against another.

This compares the row contents against each other. Any fallback tables are not checked.

Definition at line 344 of file lib_table_base.h.

345 {
346 if( m_rows.size() == r.m_rows.size() )
347 {
348 unsigned i;
349
350 for( i = 0; i < m_rows.size() && m_rows[i] == r.m_rows[i]; ++i )
351 ;
352
353 if( i == m_rows.size() )
354 return true;
355 }
356
357 return false;
358 }

References LIB_TABLE::m_rows.

◆ Parse()

void SYMBOL_LIB_TABLE::Parse ( LIB_TABLE_LEXER *  aLexer)
overridevirtual

Parse the #LIB_TABLE_LEXER s-expression library table format into the appropriate LIB_TABLE_ROW objects.

Parameters
aLexeris the lexer to parse.
Exceptions
IO_ERRORif an I/O error occurs during parsing.
PARSER_ERRORif the lexer format to parse is invalid.
boost::bad_pointerif an any attempt to add an invalid pointer to the boost::ptr_vector.
boost::bad_indexif an index outside the row table bounds is accessed.

Implements LIB_TABLE.

Definition at line 117 of file symbol_lib_table.cpp.

118{
119 T tok;
120 wxString errMsg; // to collect error messages
121
122 // This table may be nested within a larger s-expression, or not.
123 // Allow for parser of that optional containing s-epression to have looked ahead.
124 if( in->CurTok() != T_sym_lib_table )
125 {
126 in->NeedLEFT();
127
128 if( ( tok = in->NextTok() ) != T_sym_lib_table )
129 in->Expecting( T_sym_lib_table );
130 }
131
132 while( ( tok = in->NextTok() ) != T_RIGHT )
133 {
134 std::unique_ptr< SYMBOL_LIB_TABLE_ROW > row = std::make_unique<SYMBOL_LIB_TABLE_ROW>();
135
136 if( tok == T_EOF )
137 in->Expecting( T_RIGHT );
138
139 if( tok != T_LEFT )
140 in->Expecting( T_LEFT );
141
142 // in case there is a "row integrity" error, tell where later.
143 int lineNum = in->CurLineNumber();
144 tok = in->NextTok();
145
146 // Optionally parse the current version number
147 if( tok == T_version )
148 {
149 in->NeedNUMBER( "version" );
150 m_version = std::stoi( in->CurText() );
151 in->NeedRIGHT();
152 continue;
153 }
154
155 if( tok != T_lib )
156 in->Expecting( T_lib );
157
158 // (name NICKNAME)
159 in->NeedLEFT();
160
161 if( ( tok = in->NextTok() ) != T_name )
162 in->Expecting( T_name );
163
164 in->NeedSYMBOLorNUMBER();
165
166 row->SetNickName( in->FromUTF8() );
167
168 in->NeedRIGHT();
169
170 // After (name), remaining (lib) elements are order independent, and in
171 // some cases optional.
172 bool sawType = false;
173 bool sawOpts = false;
174 bool sawDesc = false;
175 bool sawUri = false;
176 bool sawDisabled = false;
177 bool sawHidden = false;
178
179 while( ( tok = in->NextTok() ) != T_RIGHT )
180 {
181 if( tok == T_EOF )
182 in->Unexpected( T_EOF );
183
184 if( tok != T_LEFT )
185 in->Expecting( T_LEFT );
186
187 tok = in->NeedSYMBOLorNUMBER();
188
189 switch( tok )
190 {
191 case T_uri:
192 if( sawUri )
193 in->Duplicate( tok );
194 sawUri = true;
195 in->NeedSYMBOLorNUMBER();
196 row->SetFullURI( in->FromUTF8() );
197 break;
198
199 case T_type:
200 if( sawType )
201 in->Duplicate( tok );
202 sawType = true;
203 in->NeedSYMBOLorNUMBER();
204 row->SetType( in->FromUTF8() );
205 break;
206
207 case T_options:
208 if( sawOpts )
209 in->Duplicate( tok );
210 sawOpts = true;
211 in->NeedSYMBOLorNUMBER();
212 row->SetOptions( in->FromUTF8() );
213 break;
214
215 case T_descr:
216 if( sawDesc )
217 in->Duplicate( tok );
218 sawDesc = true;
219 in->NeedSYMBOLorNUMBER();
220 row->SetDescr( in->FromUTF8() );
221 break;
222
223 case T_disabled:
224 if( sawDisabled )
225 in->Duplicate( tok );
226 sawDisabled = true;
227 row->SetEnabled( false );
228 break;
229
230 case T_hidden:
231 if( sawHidden )
232 in->Duplicate( tok );
233 sawHidden = true;
234 row->SetVisible( false );
235 break;
236
237 default:
238 in->Unexpected( tok );
239 }
240
241 in->NeedRIGHT();
242 }
243
244 if( !sawType )
245 in->Expecting( T_type );
246
247 if( !sawUri )
248 in->Expecting( T_uri );
249
250 // all nickNames within this table fragment must be unique, so we do not
251 // use doReplace in InsertRow(). (However a fallBack table can have a
252 // conflicting nickName and ours will supercede that one since in
253 // FindLib() we search this table before any fall back.)
254 wxString nickname = row->GetNickName(); // store it to be able to used it
255 // after row deletion if an error occurs
256 LIB_TABLE_ROW* tmp = row.release();
257
258 if( !InsertRow( tmp ) )
259 {
260 delete tmp; // The table did not take ownership of the row.
261
262 wxString msg = wxString::Format( _( "Duplicate library nickname '%s' found in symbol "
263 "library table file line %d" ),
264 nickname,
265 lineNum );
266
267 if( !errMsg.IsEmpty() )
268 errMsg << '\n';
269
270 errMsg << msg;
271 }
272 }
273
274 if( !errMsg.IsEmpty() )
275 THROW_IO_ERROR( errMsg );
276}
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Adds aRow if it does not already exist or if doReplace is true.

References _, Format(), LIB_TABLE::InsertRow(), LIB_TABLE::m_version, and THROW_IO_ERROR.

Referenced by SYMBOL_GRID_TRICKS::paste_text().

◆ ParseOptions()

STRING_UTF8_MAP * LIB_TABLE::ParseOptions ( const std::string &  aOptionsList)
staticinherited

Parses aOptionsList and places the result into a #PROPERTIES object which is returned.

If the options field is empty, then the returned PROPERTIES will be a NULL pointer.

Typically aOptionsList comes from the "options" field within a LIB_TABLE_ROW and the format is simply a comma separated list of name value pairs. e.g.: [name1[=value1][|name2[=value2]]] etc. When using the UI to create or edit a library table, this formatting is handled for you.

Definition at line 380 of file lib_table_base.cpp.

381{
382 if( aOptionsList.size() )
383 {
384 const char* cp = &aOptionsList[0];
385 const char* end = cp + aOptionsList.size();
386
387 STRING_UTF8_MAP props;
388 std::string pair;
389
390 // Parse all name=value pairs
391 while( cp < end )
392 {
393 pair.clear();
394
395 // Skip leading white space.
396 while( cp < end && isspace( *cp ) )
397 ++cp;
398
399 // Find the end of pair/field
400 while( cp < end )
401 {
402 if( *cp == '\\' && cp + 1 < end && cp[1] == OPT_SEP )
403 {
404 ++cp; // skip the escape
405 pair += *cp++; // add the separator
406 }
407 else if( *cp == OPT_SEP )
408 {
409 ++cp; // skip the separator
410 break; // process the pair
411 }
412 else
413 {
414 pair += *cp++;
415 }
416 }
417
418 // stash the pair
419 if( pair.size() )
420 {
421 // first equals sign separates 'name' and 'value'.
422 size_t eqNdx = pair.find( '=' );
423
424 if( eqNdx != pair.npos )
425 {
426 std::string name = pair.substr( 0, eqNdx );
427 std::string value = pair.substr( eqNdx + 1 );
428 props[name] = value;
429 }
430 else
431 {
432 props[pair] = ""; // property is present, but with no value.
433 }
434 }
435 }
436
437 if( props.size() )
438 return new STRING_UTF8_MAP( props );
439 }
440
441 return nullptr;
442}
A name/value tuple with unique names and optional values.

References name, and OPT_SEP.

Referenced by LIB_TABLE_ROW::SetOptions(), and DIALOG_FP_PLUGIN_OPTIONS::TransferDataToWindow().

◆ reindex()

void LIB_TABLE::reindex ( )
inlineprotectedinherited

Definition at line 542 of file lib_table_base.h.

543 {
544 std::lock_guard<std::mutex> lock( m_nickIndexMutex );
545
546 m_nickIndex.clear();
547
548 for( LIB_TABLE_ROWS_ITER it = m_rows.begin(); it != m_rows.end(); ++it )
549 m_nickIndex.insert( INDEX_VALUE( it->GetNickName(), it - m_rows.begin() ) );
550 }
LIB_TABLE_ROWS::iterator LIB_TABLE_ROWS_ITER

References LIB_TABLE::m_nickIndex, LIB_TABLE::m_nickIndexMutex, and LIB_TABLE::m_rows.

Referenced by LIB_TABLE::ensureIndex(), LIB_TABLE::RemoveRow(), PANEL_SYM_LIB_TABLE::TransferDataFromWindow(), and PANEL_FP_LIB_TABLE::TransferDataFromWindow().

◆ RemoveRow()

bool LIB_TABLE::RemoveRow ( const LIB_TABLE_ROW aRow)
inlineinherited

Removes a row from the table.

Parameters
aRowis the row to remove
Returns
true if the row was found (and removed)

Definition at line 450 of file lib_table_base.h.

451 {
452 for( auto iter = m_rows.begin(); iter != m_rows.end(); ++iter )
453 {
454 if( *iter == *aRow )
455 {
456 m_rows.erase( iter, iter + 1 );
457 reindex();
458 return true;
459 }
460 }
461 return false;
462 }

References LIB_TABLE::m_rows, and LIB_TABLE::reindex().

Referenced by SYMBOL_LIBRARY_MANAGER::addLibrary(), FP_LIB_TABLE::LoadGlobalTable(), and LoadGlobalTable().

◆ Save()

void LIB_TABLE::Save ( const wxString &  aFileName) const
inherited

Write this library table to aFileName in s-expression form.

Parameters
aFileNameis the name of the file to write to.

Definition at line 370 of file lib_table_base.cpp.

371{
372 FILE_OUTPUTFORMATTER sf( aFileName );
373
374 // Force the lib table version to 7 before saving
375 m_version = 7;
376 Format( &sf, 0 );
377}
Used for text file output.
Definition: richio.h:457
virtual void Format(OUTPUTFORMATTER *aOutput, int aIndentLevel) const =0
Generate the table in s-expression format to aOutput with an indentation level of aIndentLevel.

References LIB_TABLE::Format(), and LIB_TABLE::m_version.

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_EDIT_FRAME::addLibTableEntry(), InvokePcbLibTableEditor(), InvokeSchEditSymbolLibTable(), LIB_TABLE::Load(), FP_LIB_TABLE::LoadGlobalTable(), LoadGlobalTable(), PCB_EDIT_FRAME::OpenProjectFiles(), SYMBOL_EDIT_FRAME::replaceLibTableEntry(), PCB::IFACE::SaveFileAs(), SCH_BASE_FRAME::saveSymbolLibTables(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::TransferDataFromWindow(), and DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG::TransferDataFromWindow().

◆ SaveSymbol()

SYMBOL_LIB_TABLE::SAVE_T SYMBOL_LIB_TABLE::SaveSymbol ( const wxString &  aNickname,
const LIB_SYMBOL aSymbol,
bool  aOverwrite = true 
)

Write aSymbol to an existing library given by aNickname.

If a LIB_SYMBOL by the same name already exists or there are any conflicting alias names, the new LIB_SYMBOL will silently overwrite any existing aliases and/or part because libraries cannot have duplicate alias names. It is the responsibility of the caller to check the library for conflicts before saving.

Parameters
aNicknameis a locator for the "library", it is a "name" in LIB_TABLE_ROW
aSymbolis what to store in the library. The library owns the symbol after this call.
aOverwritewhen true means overwrite any existing symbol by the same name, else if false means skip the write and return SAVE_SKIPPED.
Returns
SAVE_T - SAVE_OK or SAVE_SKIPPED. If error saving, then IO_ERROR is thrown.
Exceptions
IO_ERRORif there is a problem saving the symbol.

Definition at line 427 of file symbol_lib_table.cpp.

429{
430 const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
431 wxCHECK( row && row->plugin, SAVE_SKIPPED );
432
433 if( !row->plugin->IsSymbolLibWritable( row->GetFullURI( true ) ) )
434 return SAVE_SKIPPED;
435
436 if( !aOverwrite )
437 {
438 // Try loading the footprint to see if it already exists, caller wants overwrite
439 // protection, which is atypical, not the default.
440
441 wxString name = aSymbol->GetLibId().GetLibItemName();
442
443 std::unique_ptr<LIB_SYMBOL> symbol( row->plugin->LoadSymbol( row->GetFullURI( true ),
444 name, row->GetProperties() ) );
445
446 if( symbol.get() )
447 return SAVE_SKIPPED;
448 }
449
450 try
451 {
452 row->plugin->SaveSymbol( row->GetFullURI( true ), aSymbol, row->GetProperties() );
453 }
454 catch( const IO_ERROR& )
455 {
456 return SAVE_SKIPPED;
457 }
458
459 return SAVE_OK;
460}
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual void SaveSymbol(const wxString &aLibraryPath, const LIB_SYMBOL *aSymbol, const STRING_UTF8_MAP *aProperties=nullptr)
Write aSymbol to an existing library located at aLibraryPath.
Definition: sch_plugin.cpp:94

References FindRow(), LIB_TABLE_ROW::GetFullURI(), LIB_SYMBOL::GetLibId(), LIB_ID::GetLibItemName(), LIB_TABLE_ROW::GetProperties(), SCH_PLUGIN::IsSymbolLibWritable(), SCH_PLUGIN::LoadSymbol(), name, SYMBOL_LIB_TABLE_ROW::plugin, SAVE_OK, SAVE_SKIPPED, and SCH_PLUGIN::SaveSymbol().

Referenced by SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer().

◆ Type()

KICAD_T SYMBOL_LIB_TABLE::Type ( )
inlineoverridevirtual

Implements PROJECT::_ELEM.

Definition at line 136 of file symbol_lib_table.h.

136{ return SYMBOL_LIB_TABLE_T; }
@ SYMBOL_LIB_TABLE_T
Definition: typeinfo.h:234

References SYMBOL_LIB_TABLE_T.

Friends And Related Function Documentation

◆ PANEL_SYM_LIB_TABLE

friend class PANEL_SYM_LIB_TABLE
friend

Definition at line 313 of file symbol_lib_table.h.

◆ SYMBOL_LIB_TABLE_GRID

friend class SYMBOL_LIB_TABLE_GRID
friend

Definition at line 312 of file symbol_lib_table.h.

Member Data Documentation

◆ m_fallBack

LIB_TABLE* LIB_TABLE::m_fallBack
protectedinherited

◆ m_modifyHash

int SYMBOL_LIB_TABLE::m_modifyHash = 1
staticprivate

helper for GetModifyHash()

Definition at line 315 of file symbol_lib_table.h.

Referenced by GetModifyHash().

◆ m_nickIndex

INDEX LIB_TABLE::m_nickIndex
protectedinherited

this particular key is the nickName within each row.

Definition at line 575 of file lib_table_base.h.

Referenced by LIB_TABLE::Clear(), LIB_TABLE::ensureIndex(), LIB_TABLE::findRow(), LIB_TABLE::InsertRow(), and LIB_TABLE::reindex().

◆ m_nickIndexMutex

std::mutex LIB_TABLE::m_nickIndexMutex
mutableprotectedinherited

Mutex to protect access to the nickIndex variable.

Definition at line 583 of file lib_table_base.h.

Referenced by LIB_TABLE::Clear(), LIB_TABLE::InsertRow(), and LIB_TABLE::reindex().

◆ m_rows

◆ m_version

int LIB_TABLE::m_version
mutableprotectedinherited

Versioning to handle importing old tables.

Definition at line 580 of file lib_table_base.h.

Referenced by Format(), FP_LIB_TABLE::Format(), LIB_TABLE::GetVersion(), LIB_TABLE::Load(), Parse(), FP_LIB_TABLE::Parse(), and LIB_TABLE::Save().

◆ PropNonPowerSymsOnly

const char * SYMBOL_LIB_TABLE::PropNonPowerSymsOnly = "non_pwr_sym_only"
static

Definition at line 139 of file symbol_lib_table.h.

◆ PropPowerSymsOnly

const char * SYMBOL_LIB_TABLE::PropPowerSymsOnly = "pwr_sym_only"
static

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