KiCad PCB EDA Suite
FP_LIB_TABLE Class Reference

#include <fp_lib_table.h>

Inheritance diagram for FP_LIB_TABLE:
LIB_TABLE PROJECT::_ELEM FP_LIB_TABLE_GRID

Public Types

enum  SAVE_T { SAVE_OK , SAVE_SKIPPED }
 The set of return values from FootprintSave() 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...
 
 FP_LIB_TABLE (FP_LIB_TABLE *aFallBackTable=nullptr)
 Build a footprint library table by pre-pending this table fragment in front of aFallBackTable. More...
 
bool operator== (const FP_LIB_TABLE &aFpTable) const
 
bool operator!= (const FP_LIB_TABLE &r) const
 
const FP_LIB_TABLE_ROWFindRow (const wxString &aNickName, bool aCheckIfEnabled=false)
 Return an FP_LIB_TABLE_ROW if aNickName is found in this table or in any chained fall back table fragment. More...
 
void FootprintEnumerate (wxArrayString &aFootprintNames, const wxString &aNickname, bool aBestEfforts)
 Return a list of footprint names contained within the library given by aNickname. More...
 
long long GenerateTimestamp (const wxString *aNickname)
 Generate a hashed timestamp representing the last-mod-times of the library indicated by aNickname, or all libraries if aNickname is NULL. More...
 
void PrefetchLib (const wxString &aNickname)
 If possible, prefetches the specified library (e.g. More...
 
FOOTPRINTFootprintLoad (const wxString &aNickname, const wxString &aFootprintName, bool aKeepUUID=false)
 Load a footprint having aFootprintName from the library given by aNickname. More...
 
bool FootprintExists (const wxString &aNickname, const wxString &aFootprintName)
 Indicates whether or not the given footprint already exists in the given library. More...
 
const FOOTPRINTGetEnumeratedFootprint (const wxString &aNickname, const wxString &aFootprintName)
 A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management. More...
 
SAVE_T FootprintSave (const wxString &aNickname, const FOOTPRINT *aFootprint, bool aOverwrite=true)
 Write aFootprint to an existing library given by aNickname. More...
 
void FootprintDelete (const wxString &aNickname, const wxString &aFootprintName)
 Delete the aFootprintName from the library given by aNickname. More...
 
bool IsFootprintLibWritable (const wxString &aNickname)
 Return true if the library given by aNickname is writable. More...
 
void FootprintLibDelete (const wxString &aNickname)
 
void FootprintLibCreate (const wxString &aNickname)
 
FOOTPRINTFootprintLoadWithOptionalNickname (const LIB_ID &aFootprintId, bool aKeepUUID=false)
 Load a footprint having aFootprintId with possibly an empty 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 (FP_LIB_TABLE &aTable)
 Load the global footprint library table into aTable. More...
 
static wxString GetGlobalTableFileName ()
 
static const wxString GlobalPathEnvVariableName ()
 Return the name of the environment variable used to hold the directory of locally installed "KiCad sponsored" system footprint libraries. More...
 
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...
 

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 (bool aForce)
 Rebuilds the m_nickIndex. More...
 
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::shared_mutex m_nickIndexMutex
 Mutex to protect access to the nickIndex variable. More...
 

Friends

class FP_LIB_TABLE_GRID
 

Detailed Description

Definition at line 96 of file fp_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 582 of file lib_table_base.h.

◆ INDEX_CITER

typedef INDEX::const_iterator LIB_TABLE::INDEX_CITER
protectedinherited

Definition at line 584 of file lib_table_base.h.

◆ INDEX_ITER

typedef INDEX::iterator LIB_TABLE::INDEX_ITER
protectedinherited

Definition at line 583 of file lib_table_base.h.

◆ INDEX_VALUE

typedef INDEX::value_type LIB_TABLE::INDEX_VALUE
protectedinherited

Definition at line 585 of file lib_table_base.h.

Member Enumeration Documentation

◆ SAVE_T

The set of return values from FootprintSave() below.

Enumerator
SAVE_OK 
SAVE_SKIPPED 

Definition at line 198 of file fp_lib_table.h.

199 {
200 SAVE_OK,
202 };

Constructor & Destructor Documentation

◆ FP_LIB_TABLE()

FP_LIB_TABLE::FP_LIB_TABLE ( FP_LIB_TABLE aFallBackTable = nullptr)

Build a footprint 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 FP_LIB_TABLE which is searched only when a row is not found in this table. No ownership is taken of aFallBackTable.

Definition at line 67 of file fp_lib_table.cpp.

67 :
68 LIB_TABLE( aFallBackTable )
69{
70 // not copying fall back, simply search aFallBackTable separately
71 // if "nickName not found".
72}
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 376 of file lib_table_base.h.

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

References LIB_TABLE::m_rows.

Referenced by LoadGlobalTable(), SYMBOL_LIB_TABLE::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 384 of file lib_table_base.h.

385 {
386 return m_rows[aIndex];
387 }

References LIB_TABLE::m_rows.

◆ Clear()

void LIB_TABLE::Clear ( )
inlineinherited

Delete all rows.

Definition at line 331 of file lib_table_base.h.

332 {
333 std::lock_guard<std::shared_mutex> lock( m_nickIndexMutex );
334
335 m_rows.clear();
336 m_nickIndex.clear();
337 }
INDEX m_nickIndex
this particular key is the nickName within each row.
std::shared_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 LoadGlobalTable(), SYMBOL_LIB_TABLE::LoadGlobalTable(), PANEL_SYM_LIB_TABLE::TransferDataFromWindow(), and PANEL_FP_LIB_TABLE::TransferDataFromWindow().

◆ ensureIndex()

void LIB_TABLE::ensureIndex ( )
inlineprotectedinherited

Definition at line 565 of file lib_table_base.h.

566 {
567 // The dialog lib table editor may not maintain the nickIndex.
568 // Lazy indexing may be required. To handle lazy indexing, we must enforce
569 // that "nickIndex" is either empty or accurate, but never inaccurate.
570 if( !m_nickIndex.size() )
571 reindex( false );
572 }
void reindex(bool aForce)
Rebuilds the m_nickIndex.

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

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

◆ FindRow()

const FP_LIB_TABLE_ROW * FP_LIB_TABLE::FindRow ( const wxString &  aNickName,
bool  aCheckIfEnabled = false 
)

Return an FP_LIB_TABLE_ROW if aNickName is found in this table or in any chained fall back table fragment.

If aCheckIfEnabled is true, the library will be ignored even if it is disabled. Otherwise, the row found will be returned even if entry is disabled.

The PLUGIN is loaded and attached to the "plugin" field of the FP_LIB_TABLE_ROW if not already loaded.

Parameters
aNickNameis the name of library nickname to find.
aCheckIfEnabledis the flag to check if the library found is enabled.
Returns
the library NickName if found.
Exceptions
IO_ERRORif aNickName cannot be found.

Definition at line 310 of file fp_lib_table.cpp.

311{
312 // Do not optimize this code. Is done this way specifically to fix a runtime
313 // error with clang 4.0.1.
314 LIB_TABLE_ROW* ltrow = findRow( aNickname, aCheckIfEnabled );
315 FP_LIB_TABLE_ROW* row = dynamic_cast< FP_LIB_TABLE_ROW* >( ltrow );
316
317 if( !row )
318 {
319 wxString msg = wxString::Format( _( "fp-lib-table files contain no library named '%s'." ),
320 aNickname );
321
322 THROW_IO_ERROR( msg );
323 }
324
325 // We've been 'lazy' up until now, but it cannot be deferred any longer,
326 // instantiate a PLUGIN of the proper kind if it is not already in this
327 // FP_LIB_TABLE_ROW.
328 if( !row->plugin )
329 row->setPlugin( IO_MGR::PluginFind( row->type ) );
330
331 return row;
332}
Hold a record identifying a library accessed by the appropriate footprint library PLUGIN object in th...
Definition: fp_lib_table.h:41
void setPlugin(PLUGIN *aPlugin)
Definition: fp_lib_table.h:84
PLUGIN::RELEASER plugin
Definition: fp_lib_table.h:91
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Return a PLUGIN which the caller can use to import, export, save, or load design documents.
Definition: io_mgr.cpp:58
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
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,...
#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

References _, LIB_TABLE::findRow(), Format(), FP_LIB_TABLE_ROW::plugin, IO_MGR::PluginFind(), FP_LIB_TABLE_ROW::setPlugin(), THROW_IO_ERROR, and FP_LIB_TABLE_ROW::type.

Referenced by FP_TREE_MODEL_ADAPTER::AddLibraries(), EXPORTER_STEP::composePCB(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), FOOTPRINT_EDIT_FRAME::DuplicateFootprint(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), FootprintDelete(), FootprintEnumerate(), FootprintExists(), FootprintLibCreate(), FootprintLibDelete(), FootprintLoad(), FootprintSave(), GenerateTimestamp(), GetEnumeratedFootprint(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), idf_export_footprint(), IsFootprintLibWritable(), RENDER_3D_RAYTRACE::load3DModels(), RENDER_3D_OPENGL::load3dModels(), LoadGlobalTable(), PrefetchLib(), DRC_TEST_PROVIDER_LIBRARY_PARITY::Run(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FP_TREE_SYNCHRONIZING_ADAPTER::Sync(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), and PANEL_FP_PROPERTIES_3D_MODEL::validateModelExists().

◆ 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 std::shared_lock<std::shared_mutex> lock( cur->m_nickIndexMutex );
197
198 for( const std::pair<const wxString, int>& entry : cur->m_nickIndex )
199 {
200 if( entry.first == aNickName )
201 {
202 row = &cur->m_rows[entry.second];
203
204 if( !aCheckIfEnabled || row->GetIsEnabled() )
205 return row;
206 }
207 }
208
209 // Repeat, this time looking for names that were "fixed" by legacy versions because
210 // the old eeschema file format didn't support spaces in tokens.
211 for( const std::pair<const wxString, int>& entry : cur->m_nickIndex )
212 {
213 wxString legacyLibName = entry.first;
214 legacyLibName.Replace( " ", "_" );
215
216 if( legacyLibName == aNickName )
217 {
218 row = &cur->m_rows[entry.second];
219
220 if( !aCheckIfEnabled || row->GetIsEnabled() )
221 return row;
222 }
223 }
224
225 // not found, search fall back table(s), if any
226 } while( ( cur = cur->m_fallBack ) != nullptr );
227
228 return nullptr; // not found
229}
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, LIB_TABLE::m_nickIndexMutex, and LIB_TABLE::m_rows.

Referenced by SYMBOL_LIB_TABLE::FindRow(), 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 232 of file lib_table_base.cpp.

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

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

◆ FootprintDelete()

void FP_LIB_TABLE::FootprintDelete ( const wxString &  aNickname,
const wxString &  aFootprintName 
)

Delete the aFootprintName from the library given by aNickname.

Parameters
aNicknameis a locator for the "library", it is a "name" in LIB_TABLE_ROW.
aFootprintNameis the name of a footprint 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 429 of file fp_lib_table.cpp.

430{
431 const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
432 wxASSERT( (PLUGIN*) row->plugin );
433 return row->plugin->FootprintDelete( row->GetFullURI( true ), aFootprintName,
434 row->GetProperties() );
435}
const FP_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an FP_LIB_TABLE_ROW if aNickName is found in this table or in any chained fall back table frag...
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).
A base class that BOARD loading and saving plugins should derive from.
Definition: io_mgr.h:270
virtual void FootprintDelete(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr)
Delete aFootprintName from the library at aLibraryPath.
Definition: plugin.cpp:114

References FindRow(), PLUGIN::FootprintDelete(), LIB_TABLE_ROW::GetFullURI(), LIB_TABLE_ROW::GetProperties(), and FP_LIB_TABLE_ROW::plugin.

Referenced by FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), and FOOTPRINT_EDITOR_CONTROL::RenameFootprint().

◆ FootprintEnumerate()

void FP_LIB_TABLE::FootprintEnumerate ( wxArrayString &  aFootprintNames,
const wxString &  aNickname,
bool  aBestEfforts 
)

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

Parameters
aFootprintNamesis the list to fill with the footprint names found in aNickname
aNicknameis a locator for the "library", it is a "name" in LIB_TABLE_ROW.
aBestEffortsif true, don't throw on errors.
Exceptions
IO_ERRORif the library cannot be found, or footprint cannot be loaded.

Definition at line 292 of file fp_lib_table.cpp.

294{
295 const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
296 wxASSERT( (PLUGIN*) row->plugin );
297 row->plugin->FootprintEnumerate( aFootprintNames, row->GetFullURI( true ), aBestEfforts,
298 row->GetProperties() );
299}
virtual void FootprintEnumerate(wxArrayString &aFootprintNames, const wxString &aLibraryPath, bool aBestEfforts, const STRING_UTF8_MAP *aProperties=nullptr)
Return a list of footprint names contained within the library at aLibraryPath.
Definition: plugin.cpp:67

References FindRow(), PLUGIN::FootprintEnumerate(), LIB_TABLE_ROW::GetFullURI(), LIB_TABLE_ROW::GetProperties(), and FP_LIB_TABLE_ROW::plugin.

Referenced by GetFootprints(), guessNickname(), and FOOTPRINT_LIST_IMPL::loadFootprints().

◆ FootprintExists()

bool FP_LIB_TABLE::FootprintExists ( const wxString &  aNickname,
const wxString &  aFootprintName 
)

Indicates whether or not the given footprint already exists in the given library.

Definition at line 370 of file fp_lib_table.cpp.

371{
372 try
373 {
374 const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
375 wxASSERT( (PLUGIN*) row->plugin );
376
377 return row->plugin->FootprintExists( row->GetFullURI( true ), aFootprintName,
378 row->GetProperties() );
379 }
380 catch( ... )
381 {
382 return false;
383 }
384}
virtual bool FootprintExists(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr)
Check for the existence of a footprint.
Definition: plugin.cpp:89

References FindRow(), PLUGIN::FootprintExists(), LIB_TABLE_ROW::GetFullURI(), LIB_TABLE_ROW::GetProperties(), and FP_LIB_TABLE_ROW::plugin.

Referenced by FOOTPRINT_EDIT_FRAME::DuplicateFootprint(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), FOOTPRINT_EDITOR_CONTROL::PasteFootprint(), FOOTPRINT_EDITOR_CONTROL::RenameFootprint(), and FOOTPRINT_EDIT_FRAME::SaveFootprintAs().

◆ FootprintLibCreate()

void FP_LIB_TABLE::FootprintLibCreate ( const wxString &  aNickname)

Definition at line 454 of file fp_lib_table.cpp.

455{
456 const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
457 wxASSERT( (PLUGIN*) row->plugin );
458 row->plugin->FootprintLibCreate( row->GetFullURI( true ), row->GetProperties() );
459}
virtual void FootprintLibCreate(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
Create a new empty footprint library at aLibraryPath empty.
Definition: plugin.cpp:122

References FindRow(), PLUGIN::FootprintLibCreate(), LIB_TABLE_ROW::GetFullURI(), LIB_TABLE_ROW::GetProperties(), and FP_LIB_TABLE_ROW::plugin.

◆ FootprintLibDelete()

void FP_LIB_TABLE::FootprintLibDelete ( const wxString &  aNickname)

Definition at line 446 of file fp_lib_table.cpp.

447{
448 const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
449 wxASSERT( (PLUGIN*) row->plugin );
450 row->plugin->FootprintLibDelete( row->GetFullURI( true ), row->GetProperties() );
451}
virtual bool FootprintLibDelete(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
Delete an existing footprint library and returns true, or if library does not exist returns false,...
Definition: plugin.cpp:129

References FindRow(), PLUGIN::FootprintLibDelete(), LIB_TABLE_ROW::GetFullURI(), LIB_TABLE_ROW::GetProperties(), and FP_LIB_TABLE_ROW::plugin.

◆ FootprintLoad()

FOOTPRINT * FP_LIB_TABLE::FootprintLoad ( const wxString &  aNickname,
const wxString &  aFootprintName,
bool  aKeepUUID = false 
)

Load a footprint having aFootprintName from the library given by aNickname.

Parameters
aNicknameis a locator for the "library", it is a "name" in LIB_TABLE_ROW.
aFootprintNameis the name of the footprint to load.
aKeepUUID= true to keep initial items UUID, false to set new UUID normally true if loaded in the footprint editor, false if loaded in the board editor. Used only in kicad_plugin
Returns
the footprint if found caller owns it, else NULL if not found.
Exceptions
IO_ERRORif the library cannot be found or read. No exception is thrown in the case where aFootprintName cannot be found.

Definition at line 387 of file fp_lib_table.cpp.

389{
390 const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
391 wxASSERT( (PLUGIN*) row->plugin );
392
393 FOOTPRINT* ret = row->plugin->FootprintLoad( row->GetFullURI( true ), aFootprintName,
394 aKeepUUID, row->GetProperties() );
395
396 setLibNickname( ret, row->GetNickName(), aFootprintName );
397
398 return ret;
399}
const wxString & GetNickName() const
virtual FOOTPRINT * FootprintLoad(const wxString &aLibraryPath, const wxString &aFootprintName, bool aKeepUUID=false, const STRING_UTF8_MAP *aProperties=nullptr)
Load a footprint having aFootprintName from the aLibraryPath containing a library format that this PL...
Definition: plugin.cpp:97
static void setLibNickname(FOOTPRINT *aModule, const wxString &aNickname, const wxString &aFootprintName)

References FindRow(), PLUGIN::FootprintLoad(), LIB_TABLE_ROW::GetFullURI(), LIB_TABLE_ROW::GetNickName(), LIB_TABLE_ROW::GetProperties(), FP_LIB_TABLE_ROW::plugin, and setLibNickname().

Referenced by FootprintLoadWithOptionalNickname(), DRC_TEST_PROVIDER_LIBRARY_PARITY::Run(), and FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint().

◆ FootprintLoadWithOptionalNickname()

FOOTPRINT * FP_LIB_TABLE::FootprintLoadWithOptionalNickname ( const LIB_ID aFootprintId,
bool  aKeepUUID = false 
)

Load a footprint having aFootprintId with possibly an empty nickname.

Parameters
aFootprintIdthe [nickname] and footprint name of the footprint to load.
aKeepUUID= true to keep initial items UUID, false to set new UUID normally true if loaded in the footprint editor, false if loaded in the board editor used only in kicad_plugin
Returns
the FOOTPRINT if found caller owns it, else NULL if not found.
Exceptions
IO_ERRORif the library cannot be found or read. No exception is thrown in the case where aFootprintName cannot be found.
PARSE_ERRORif aFootprintId is not parsed OK.

Definition at line 462 of file fp_lib_table.cpp.

464{
465 wxString nickname = aFootprintId.GetLibNickname();
466 wxString fpname = aFootprintId.GetLibItemName();
467
468 if( nickname.size() )
469 {
470 return FootprintLoad( nickname, fpname, aKeepUUID );
471 }
472
473 // nickname is empty, sequentially search (alphabetically) all libs/nicks for first match:
474 else
475 {
476 std::vector<wxString> nicks = GetLogicalLibs();
477
478 // Search each library going through libraries alphabetically.
479 for( unsigned i = 0; i < nicks.size(); ++i )
480 {
481 // FootprintLoad() returns NULL on not found, does not throw exception
482 // unless there's an IO_ERROR.
483 FOOTPRINT* ret = FootprintLoad( nicks[i], fpname, aKeepUUID );
484
485 if( ret )
486 return ret;
487 }
488
489 return nullptr;
490 }
491}
FOOTPRINT * FootprintLoad(const wxString &aNickname, const wxString &aFootprintName, bool aKeepUUID=false)
Load a footprint having aFootprintName from the library given by aNickname.
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
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.

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

Referenced by PCB_BASE_FRAME::loadFootprint().

◆ FootprintSave()

FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave ( const wxString &  aNickname,
const FOOTPRINT aFootprint,
bool  aOverwrite = true 
)

Write aFootprint to an existing library given by aNickname.

If a footprint by the same name already exists, it is replaced.

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

Definition at line 402 of file fp_lib_table.cpp.

404{
405 const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
406 wxASSERT( (PLUGIN*) row->plugin );
407
408 if( !aOverwrite )
409 {
410 // Try loading the footprint to see if it already exists, caller wants overwrite
411 // protection, which is atypical, not the default.
412
413 wxString fpname = aFootprint->GetFPID().GetLibItemName();
414
415 std::unique_ptr<FOOTPRINT> footprint( row->plugin->FootprintLoad( row->GetFullURI( true ),
416 fpname,
417 row->GetProperties() ) );
418
419 if( footprint.get() )
420 return SAVE_SKIPPED;
421 }
422
423 row->plugin->FootprintSave( row->GetFullURI( true ), aFootprint, row->GetProperties() );
424
425 return SAVE_OK;
426}
const LIB_ID & GetFPID() const
Definition: footprint.h:212
virtual void FootprintSave(const wxString &aLibraryPath, const FOOTPRINT *aFootprint, const STRING_UTF8_MAP *aProperties=nullptr)
Write aFootprint to an existing library located at aLibraryPath.
Definition: plugin.cpp:106

References FindRow(), PLUGIN::FootprintLoad(), PLUGIN::FootprintSave(), FOOTPRINT::GetFPID(), LIB_TABLE_ROW::GetFullURI(), LIB_ID::GetLibItemName(), LIB_TABLE_ROW::GetProperties(), FP_LIB_TABLE_ROW::plugin, SAVE_OK, and SAVE_SKIPPED.

Referenced by PCB_EDIT_FRAME::ExportFootprintsToLibrary(), and FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary().

◆ Format()

void FP_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 252 of file fp_lib_table.cpp.

253{
254 aOutput->Print( aIndentLevel, "(fp_lib_table\n" );
255 aOutput->Print( aIndentLevel + 1, "(version %d)\n", m_version );
256
257 for( LIB_TABLE_ROWS_CITER it = m_rows.begin(); it != m_rows.end(); ++it )
258 it->Format( aOutput, aIndentLevel+1 );
259
260 aOutput->Print( aIndentLevel, ")\n" );
261}
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().

◆ 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 447 of file lib_table_base.cpp.

448{
449 UTF8 ret;
450
451 if( aProperties )
452 {
453 for( STRING_UTF8_MAP::const_iterator it = aProperties->begin(); it != aProperties->end(); ++it )
454 {
455 const std::string& name = it->first;
456
457 const UTF8& value = it->second;
458
459 if( ret.size() )
460 ret += OPT_SEP;
461
462 ret += name;
463
464 // the separation between name and value is '='
465 if( value.size() )
466 {
467 ret += '=';
468
469 for( std::string::const_iterator si = value.begin(); si != value.end(); ++si )
470 {
471 // escape any separator in the value.
472 if( *si == OPT_SEP )
473 ret += '\\';
474
475 ret += *si;
476 }
477 }
478 }
479 }
480
481 return ret;
482}
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().

◆ GenerateTimestamp()

long long FP_LIB_TABLE::GenerateTimestamp ( const wxString *  aNickname)

Generate a hashed timestamp representing the last-mod-times of the library indicated by aNickname, or all libraries if aNickname is NULL.

Definition at line 264 of file fp_lib_table.cpp.

265{
266 long long hash = 0;
267
268 if( aNickname )
269 {
270 const FP_LIB_TABLE_ROW* row = FindRow( *aNickname, true );
271
272 wxCHECK( row && row->plugin, hash );
273
274 return row->plugin->GetLibraryTimestamp( row->GetFullURI( true ) ) +
275 wxHashTable::MakeKey( *aNickname );
276 }
277
278 for( const wxString& nickname : GetLogicalLibs() )
279 {
280 const FP_LIB_TABLE_ROW* row = FindRow( nickname, true );
281
282 wxCHECK2( row && row->plugin, continue );
283
284 hash += row->plugin->GetLibraryTimestamp( row->GetFullURI( true ) ) +
285 wxHashTable::MakeKey( nickname );
286 }
287
288 return hash;
289}
virtual long long GetLibraryTimestamp(const wxString &aLibraryPath) const =0
Generate a timestamp representing all the files in the library (including the library directory).

References FindRow(), LIB_TABLE_ROW::GetFullURI(), PLUGIN::GetLibraryTimestamp(), LIB_TABLE::GetLogicalLibs(), and FP_LIB_TABLE_ROW::plugin.

Referenced by FOOTPRINT_LIST_IMPL::ReadFootprintFiles().

◆ 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().

◆ GetEnumeratedFootprint()

const FOOTPRINT * FP_LIB_TABLE::GetEnumeratedFootprint ( const wxString &  aNickname,
const wxString &  aFootprintName 
)

A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management.

The return value is const to allow it to return a reference to a cached item.

Definition at line 359 of file fp_lib_table.cpp.

361{
362 const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
363 wxASSERT( (PLUGIN*) row->plugin );
364
365 return row->plugin->GetEnumeratedFootprint( row->GetFullURI( true ), aFootprintName,
366 row->GetProperties() );
367}
virtual const FOOTPRINT * GetEnumeratedFootprint(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr)
A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management.
Definition: plugin.cpp:80

References FindRow(), PLUGIN::GetEnumeratedFootprint(), LIB_TABLE_ROW::GetFullURI(), LIB_TABLE_ROW::GetProperties(), and FP_LIB_TABLE_ROW::plugin.

Referenced by FOOTPRINT_PREVIEW_PANEL::DisplayFootprint(), FOOTPRINT_INFO_GENERATOR::GenerateHtml(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), and FOOTPRINT_INFO_IMPL::load().

◆ 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().

◆ GetGlobalTableFileName()

wxString FP_LIB_TABLE::GetGlobalTableFileName ( )
static
Returns
the platform specific global footprint library path and file name.

Definition at line 645 of file fp_lib_table.cpp.

646{
647 wxFileName fn;
648
650 fn.SetName( global_tbl_name );
651
652 return fn.GetFullPath();
653}
static wxString GetUserSettingsPath()
Return the user configuration path used to store KiCad's configuration files.
static const wxChar global_tbl_name[]

References SETTINGS_MANAGER::GetUserSettingsPath(), and global_tbl_name.

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG::GetGlobalTableFileName(), InvokePcbLibTableEditor(), PCB::IFACE::loadGlobalLibTable(), LoadGlobalTable(), and DIALOG_GLOBAL_FP_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 268 of file lib_table_base.cpp.

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

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(), FootprintLoadWithOptionalNickname(), GenerateTimestamp(), GetFootprintLibraries(), SYMBOL_LIBRARY_MANAGER::GetLibraryCount(), SYMBOL_LIB_TABLE::GetModifyHash(), guessNickname(), CVPCB_MAINFRAME::LoadFootprintFiles(), SYMBOL_LIB_TABLE::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().

◆ GetVersion()

int LIB_TABLE::GetVersion ( ) const
inlineinherited

Returns the version number (0 if unset)

Returns
integer version number read from table

Definition at line 519 of file lib_table_base.h.

520 {
521 return m_version;
522 }

References LIB_TABLE::m_version.

◆ GlobalPathEnvVariableName()

const wxString FP_LIB_TABLE::GlobalPathEnvVariableName ( )
static

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

These can be either legacy or pretty 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 494 of file fp_lib_table.cpp.

495{
496 return wxS( "KICAD7_FOOTPRINT_DIR" );
497}

Referenced by DIALOG_CONFIG_EQUFILES::Init(), and PANEL_FP_LIB_TABLE::populateEnvironReadOnlyTable().

◆ HasLibrary()

bool LIB_TABLE::HasLibrary ( const wxString &  aNickname,
bool  aCheckEnabled = false 
) const
inherited

◆ 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 304 of file lib_table_base.cpp.

305{
306 ensureIndex();
307
308 std::lock_guard<std::shared_mutex> lock( m_nickIndexMutex );
309
310 INDEX_CITER it = m_nickIndex.find( aRow->GetNickName() );
311
312 aRow->SetParent( this );
313
314 if( it == m_nickIndex.end() )
315 {
316 m_rows.push_back( aRow );
317 m_nickIndex.insert( INDEX_VALUE( aRow->GetNickName(), m_rows.size() - 1 ) );
318 return true;
319 }
320
321 if( doReplace )
322 {
323 m_rows.replace( it->second, aRow );
324 return true;
325 }
326
327 return false;
328}
void SetParent(LIB_TABLE *aParent)
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(), SYMBOL_LIB_TABLE::Parse(), and 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().

◆ IsFootprintLibWritable()

bool FP_LIB_TABLE::IsFootprintLibWritable ( const wxString &  aNickname)

Return true if the library given by aNickname is writable.

Often system libraries are read only because of where they are installed.

Exceptions
IO_ERRORif no library at aLibraryPath exists.

Definition at line 438 of file fp_lib_table.cpp.

439{
440 const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
441 wxASSERT( (PLUGIN*) row->plugin );
442 return row->plugin->IsFootprintLibWritable( row->GetFullURI( true ) );
443}
virtual bool IsFootprintLibWritable(const wxString &aLibraryPath)
Return true if the library at aLibraryPath is writable.
Definition: plugin.cpp:137

References FindRow(), LIB_TABLE_ROW::GetFullURI(), PLUGIN::IsFootprintLibWritable(), and FP_LIB_TABLE_ROW::plugin.

Referenced by FOOTPRINT_EDIT_FRAME::UpdateTitle().

◆ 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 356 of file lib_table_base.cpp.

357{
358 // It's OK if footprint library tables are missing.
359 if( wxFileName::IsFileReadable( aFileName ) )
360 {
361 FILE_LINE_READER reader( aFileName );
362 LIB_TABLE_LEXER lexer( &reader );
363
364 Parse( &lexer );
365
366 if( m_version != 7 && migrate() && wxFileName::IsFileWritable( aFileName ) )
367 Save( aFileName );
368 }
369}
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 LoadGlobalTable(), SYMBOL_LIB_TABLE::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 FP_LIB_TABLE::LoadGlobalTable ( FP_LIB_TABLE aTable)
static

Load the global footprint 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 FP_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 footprint library table.

Definition at line 561 of file fp_lib_table.cpp.

562{
563 bool tableExists = true;
564 wxFileName fn = GetGlobalTableFileName();
565
566 if( !fn.FileExists() )
567 {
568 tableExists = false;
569
570 if( !fn.DirExists() && !fn.Mkdir( 0x777, wxPATH_MKDIR_FULL ) )
571 {
572 THROW_IO_ERROR( wxString::Format( _( "Cannot create global library table path '%s'." ),
573 fn.GetPath() ) );
574 }
575
576 // Attempt to copy the default global file table from the KiCad
577 // template folder to the user's home configuration path.
578 SEARCH_STACK ss;
579
580 SystemDirsAppend( &ss );
581
582 wxString templatePath =
583 Pgm().GetLocalEnvVariables().at( wxT( "KICAD7_TEMPLATE_DIR" ) ).GetValue();
584
585 if( !templatePath.IsEmpty() )
586 ss.AddPaths( templatePath, 0 );
587
588 wxString fileName = ss.FindValidPath( global_tbl_name );
589
590 // The fallback is to create an empty global footprint table for the user to populate.
591 if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) )
592 {
593 FP_LIB_TABLE emptyTable;
594
595 emptyTable.Save( fn.GetFullPath() );
596 }
597 }
598
599 aTable.Clear();
600 aTable.Load( fn.GetFullPath() );
601
602 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
604
605 wxString packagesPath = Pgm().GetLocalEnvVariables().at( wxT( "KICAD7_3RD_PARTY" ) ).GetValue();
606
607 if( settings->m_PcmLibAutoAdd )
608 {
609 // Scan for libraries in PCM packages directory
610
611 wxFileName d( packagesPath, wxS( "" ) );
612 d.AppendDir( wxS( "footprints" ) );
613
614 if( d.DirExists() )
615 {
616 PCM_FP_LIB_TRAVERSER traverser( packagesPath, aTable, settings->m_PcmLibPrefix );
617 wxDir dir( d.GetPath() );
618
619 dir.Traverse( traverser );
620 }
621 }
622
623 if( settings->m_PcmLibAutoRemove )
624 {
625 // Remove PCM libraries that no longer exist
626 std::vector<wxString> to_remove;
627
628 for( size_t i = 0; i < aTable.GetCount(); i++ )
629 {
630 LIB_TABLE_ROW& row = aTable.At( i );
631 wxString path = row.GetFullURI( true );
632
633 if( path.StartsWith( packagesPath ) && !wxDir::Exists( path ) )
634 to_remove.push_back( row.GetNickName() );
635 }
636
637 for( const wxString& nickName : to_remove )
638 aTable.RemoveRow( aTable.FindRow( nickName ) );
639 }
640
641 return tableExists;
642}
static wxString GetGlobalTableFileName()
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.
void Clear()
Delete all rows.
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,...
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(), LIB_TABLE::Clear(), 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 PCB::IFACE::loadGlobalLibTable(), CV::IFACE::OnKifaceStart(), and DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG::TransferDataFromWindow().

◆ 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 331 of file lib_table_base.cpp.

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

References LIB_TABLE::m_rows.

Referenced by LIB_TABLE::Load().

◆ operator!=() [1/2]

bool FP_LIB_TABLE::operator!= ( const FP_LIB_TABLE r) const
inline

Definition at line 117 of file fp_lib_table.h.

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

◆ operator!=() [2/2]

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

Definition at line 361 of file lib_table_base.h.

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

◆ operator==() [1/2]

bool FP_LIB_TABLE::operator== ( const FP_LIB_TABLE aFpTable) const

Definition at line 235 of file fp_lib_table.cpp.

236{
237 if( m_rows.size() == aFpTable.m_rows.size() )
238 {
239 for( unsigned i = 0; i < m_rows.size(); ++i )
240 {
241 if( (FP_LIB_TABLE_ROW&)m_rows[i] != (FP_LIB_TABLE_ROW&)aFpTable.m_rows[i] )
242 return false;
243 }
244
245 return true;
246 }
247
248 return false;
249}

References LIB_TABLE::m_rows.

◆ operator==() [2/2]

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 345 of file lib_table_base.h.

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

References LIB_TABLE::m_rows.

◆ Parse()

void FP_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 75 of file fp_lib_table.cpp.

76{
77 T tok;
78 wxString errMsg; // to collect error messages
79
80 // This table may be nested within a larger s-expression, or not.
81 // Allow for parser of that optional containing s-epression to have looked ahead.
82 if( in->CurTok() != T_fp_lib_table )
83 {
84 in->NeedLEFT();
85
86 if( ( tok = in->NextTok() ) != T_fp_lib_table )
87 in->Expecting( T_fp_lib_table );
88 }
89
90 while( ( tok = in->NextTok() ) != T_RIGHT )
91 {
92 std::unique_ptr<FP_LIB_TABLE_ROW> row = std::make_unique<FP_LIB_TABLE_ROW>();
93
94 if( tok == T_EOF )
95 in->Expecting( T_RIGHT );
96
97 if( tok != T_LEFT )
98 in->Expecting( T_LEFT );
99
100 // in case there is a "row integrity" error, tell where later.
101 int lineNum = in->CurLineNumber();
102 tok = in->NextTok();
103
104 // Optionally parse the current version number
105 if( tok == T_version )
106 {
107 in->NeedNUMBER( "version" );
108 m_version = std::stoi( in->CurText() );
109 in->NeedRIGHT();
110 continue;
111 }
112
113 if( tok != T_lib )
114 in->Expecting( T_lib );
115
116 // (name NICKNAME)
117 in->NeedLEFT();
118
119 if( ( tok = in->NextTok() ) != T_name )
120 in->Expecting( T_name );
121
122 in->NeedSYMBOLorNUMBER();
123
124 row->SetNickName( in->FromUTF8() );
125
126 in->NeedRIGHT();
127
128 // After (name), remaining (lib) elements are order independent, and in
129 // some cases optional.
130 bool sawType = false;
131 bool sawOpts = false;
132 bool sawDesc = false;
133 bool sawUri = false;
134 bool sawDisabled = false;
135
136 while( ( tok = in->NextTok() ) != T_RIGHT )
137 {
138 if( tok == T_EOF )
139 in->Unexpected( T_EOF );
140
141 if( tok != T_LEFT )
142 in->Expecting( T_LEFT );
143
144 tok = in->NeedSYMBOLorNUMBER();
145
146 switch( tok )
147 {
148 case T_uri:
149 if( sawUri )
150 in->Duplicate( tok );
151 sawUri = true;
152 in->NeedSYMBOLorNUMBER();
153 row->SetFullURI( in->FromUTF8() );
154 break;
155
156 case T_type:
157 if( sawType )
158 in->Duplicate( tok );
159 sawType = true;
160 in->NeedSYMBOLorNUMBER();
161 row->SetType( in->FromUTF8() );
162 break;
163
164 case T_options:
165 if( sawOpts )
166 in->Duplicate( tok );
167 sawOpts = true;
168 in->NeedSYMBOLorNUMBER();
169 row->SetOptions( in->FromUTF8() );
170 break;
171
172 case T_descr:
173 if( sawDesc )
174 in->Duplicate( tok );
175 sawDesc = true;
176 in->NeedSYMBOLorNUMBER();
177 row->SetDescr( in->FromUTF8() );
178 break;
179
180 case T_disabled:
181 if( sawDisabled )
182 in->Duplicate( tok );
183 sawDisabled = true;
184 row->SetEnabled( false );
185 break;
186
187 case T_hidden:
188 // Hiding footprint libraries is not yet supported. Unclear what path can set this
189 // attribute, but clear it on load.
190 row->SetVisible();
191 break;
192
193 default:
194 in->Unexpected( tok );
195 }
196
197 in->NeedRIGHT();
198 }
199
200 if( !sawType )
201 in->Expecting( T_type );
202
203 if( !sawUri )
204 in->Expecting( T_uri );
205
206 // all nickNames within this table fragment must be unique, so we do not
207 // use doReplace in InsertRow(). (However a fallBack table can have a
208 // conflicting nickName and ours will supercede that one since in
209 // FindLib() we search this table before any fall back.)
210 wxString nickname = row->GetNickName(); // store it to be able to used it
211 // after row deletion if an error occurs
212 LIB_TABLE_ROW* tmp = row.release();
213
214 if( !InsertRow( tmp ) )
215 {
216 delete tmp; // The table did not take ownership of the row.
217
218 wxString msg = wxString::Format( _( "Duplicate library nickname '%s' found in "
219 "footprint library table file line %d." ),
220 nickname,
221 lineNum );
222
223 if( !errMsg.IsEmpty() )
224 errMsg << '\n';
225
226 errMsg << msg;
227 }
228 }
229
230 if( !errMsg.IsEmpty() )
231 THROW_IO_ERROR( errMsg );
232}
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 FP_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 382 of file lib_table_base.cpp.

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

◆ PrefetchLib()

void FP_LIB_TABLE::PrefetchLib ( const wxString &  aNickname)

If possible, prefetches the specified library (e.g.

performing downloads). Does not parse. Threadsafe.

This is a no-op for libraries that cannot be prefetched.

Parameters
aNicknameis a locator for the library; it is a name in LIB_TABLE_ROW.
Exceptions
IO_ERRORif there is an error prefetching the library.

Definition at line 302 of file fp_lib_table.cpp.

303{
304 const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
305 wxASSERT( (PLUGIN*) row->plugin );
306 row->plugin->PrefetchLib( row->GetFullURI( true ), row->GetProperties() );
307}
virtual void PrefetchLib(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
If possible, prefetches the specified library (e.g.
Definition: plugin.cpp:75

References FindRow(), LIB_TABLE_ROW::GetFullURI(), LIB_TABLE_ROW::GetProperties(), FP_LIB_TABLE_ROW::plugin, and PLUGIN::PrefetchLib().

Referenced by FOOTPRINT_LIST_IMPL::loadLibs().

◆ reindex()

void LIB_TABLE::reindex ( bool  aForce)
inlineprotectedinherited

Rebuilds the m_nickIndex.

Parameters
aForceis to avoid rebuilding the index multiple times because multiple threads hit ensureIndex at the same time

Definition at line 549 of file lib_table_base.h.

550 {
551 std::lock_guard<std::shared_mutex> lock( m_nickIndexMutex );
552
553 if( !aForce )
554 {
555 if( m_nickIndex.size() )
556 return;
557 }
558
559 m_nickIndex.clear();
560
561 for( LIB_TABLE_ROWS_ITER it = m_rows.begin(); it != m_rows.end(); ++it )
562 m_nickIndex.insert( INDEX_VALUE( it->GetNickName(), it - m_rows.begin() ) );
563 }
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 451 of file lib_table_base.h.

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

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

Referenced by SYMBOL_LIBRARY_MANAGER::addLibrary(), LoadGlobalTable(), and SYMBOL_LIB_TABLE::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 372 of file lib_table_base.cpp.

373{
374 FILE_OUTPUTFORMATTER sf( aFileName );
375
376 // Force the lib table version to 7 before saving
377 m_version = 7;
378 Format( &sf, 0 );
379}
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(), SCH_EDITOR_CONTROL::ExportSymbolsToLibrary(), InvokePcbLibTableEditor(), InvokeSchEditSymbolLibTable(), LIB_TABLE::Load(), LoadGlobalTable(), SYMBOL_LIB_TABLE::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().

◆ Type()

KICAD_T FP_LIB_TABLE::Type ( )
inlineoverridevirtual

Implements PROJECT::_ELEM.

Definition at line 99 of file fp_lib_table.h.

99{ return FP_LIB_TABLE_T; }
@ FP_LIB_TABLE_T
Definition: typeinfo.h:235

References FP_LIB_TABLE_T.

Referenced by PROJECT::PcbFootprintLibs().

Friends And Related Function Documentation

◆ FP_LIB_TABLE_GRID

friend class FP_LIB_TABLE_GRID
friend

Definition at line 291 of file fp_lib_table.h.

Member Data Documentation

◆ m_fallBack

LIB_TABLE* LIB_TABLE::m_fallBack
protectedinherited

◆ m_nickIndex

INDEX LIB_TABLE::m_nickIndex
protectedinherited

this particular key is the nickName within each row.

Definition at line 588 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::shared_mutex LIB_TABLE::m_nickIndexMutex
mutableprotectedinherited

Mutex to protect access to the nickIndex variable.

Definition at line 596 of file lib_table_base.h.

Referenced by LIB_TABLE::Clear(), LIB_TABLE::findRow(), 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 593 of file lib_table_base.h.

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


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