KiCad PCB EDA Suite
class_library.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2004-2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2008-2017 Wayne Stambaugh <stambaughw@verizon.net>
6  * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
30 #include <algorithm>
31 #include <fctsys.h>
32 #include <kiface_i.h>
33 #include <gr_basic.h>
34 #include <macros.h>
35 #include <kicad_string.h>
36 #include <gestfich.h>
37 #include <eda_doc.h>
38 #include <wxstruct.h>
39 #include <richio.h>
40 #include <config_params.h>
42 #include <project_rescue.h>
43 #include <properties.h>
44 
45 #include <general.h>
46 #include <class_library.h>
47 #include <sch_legacy_plugin.h>
48 
49 #include <wx/progdlg.h>
50 #include <wx/tokenzr.h>
51 #include <wx/regex.h>
52 
53 #define DUPLICATE_NAME_MSG \
54  _( "Library '%s' has duplicate entry name '%s'.\n" \
55  "This may cause some unexpected behavior when loading components into a schematic." )
56 
57 
58 PART_LIB::PART_LIB( int aType, const wxString& aFileName, SCH_IO_MGR::SCH_FILE_T aPluginType ) :
59  // start @ != 0 so each additional library added
60  // is immediately detectable, zero would not be.
61  m_mod_hash( PART_LIBS::s_modify_generation ),
62  m_pluginType( aPluginType )
63 {
64  type = aType;
65  isModified = false;
66  timeStamp = 0;
67  timeStamp = wxDateTime::Now();
68  versionMajor = 0; // Will be updated after reading the lib file
69  versionMinor = 0; // Will be updated after reading the lib file
70 
71  fileName = aFileName;
72 
73  if( !fileName.IsOk() )
74  fileName = "unnamed.lib";
75 
77  m_properties = std::make_unique<PROPERTIES>();
78 }
79 
80 
82 {
83 }
84 
85 
86 void PART_LIB::Save( bool aSaveDocFile )
87 {
88  wxCHECK_RET( m_plugin != NULL, wxString::Format( "no plugin defined for library `%s`.",
89  fileName.GetFullPath() ) );
90 
91  PROPERTIES props;
92 
93  if( !aSaveDocFile )
95 
96  m_plugin->SaveLibrary( fileName.GetFullPath(), &props );
97  isModified = false;
98 }
99 
100 
101 void PART_LIB::Create( const wxString& aFileName )
102 {
103  wxString tmpFileName = fileName.GetFullPath();
104 
105  if( !aFileName.IsEmpty() )
106  tmpFileName = aFileName;
107 
108  m_plugin->CreateSymbolLib( tmpFileName, m_properties.get() );
109 }
110 
111 
113 {
114  if( m_pluginType != aPluginType )
115  {
116  m_pluginType = aPluginType;
118  }
119 }
120 
121 
122 bool PART_LIB::IsCache() const
123 {
125 }
126 
127 
129 {
130  (*m_properties)[ SCH_LEGACY_PLUGIN::PropNoDocFile ] = "";
131 }
132 
133 
135 {
137 }
138 
139 
140 void PART_LIB::EnableBuffering( bool aEnable )
141 {
142  if( aEnable )
143  (*m_properties)[ SCH_LEGACY_PLUGIN::PropBuffering ] = "";
144  else
146 }
147 
148 
149 void PART_LIB::GetAliasNames( wxArrayString& aNames )
150 {
151  m_plugin->EnumerateSymbolLib( aNames, fileName.GetFullPath(), m_properties.get() );
152 
153  aNames.Sort();
154 }
155 
156 
157 void PART_LIB::GetAliases( std::vector<LIB_ALIAS*>& aAliases )
158 {
159  m_plugin->EnumerateSymbolLib( aAliases, fileName.GetFullPath(), m_properties.get() );
160 
161  std::sort( aAliases.begin(), aAliases.end(),
162  [](LIB_ALIAS *lhs, LIB_ALIAS *rhs) -> bool
163  { return lhs->GetName() < rhs->GetName(); });
164 }
165 
166 
167 void PART_LIB::GetEntryTypePowerNames( wxArrayString& aNames )
168 {
169  std::vector<LIB_ALIAS*> aliases;
170 
171  m_plugin->EnumerateSymbolLib( aliases, fileName.GetFullPath() );
172 
173  for( size_t i = 0; i < aliases.size(); i++ )
174  {
175  LIB_ALIAS* alias = aliases[i];
176 
177  LIB_PART* root = alias->GetPart();
178 
179  if( !root || !root->IsPower() )
180  continue;
181 
182  aNames.Add( alias->GetName() );
183  }
184 
185  aNames.Sort();
186 }
187 
188 
189 LIB_ALIAS* PART_LIB::FindAlias( const wxString& aName )
190 {
191  LIB_ALIAS* alias = m_plugin->LoadSymbol( fileName.GetFullPath(), aName, m_properties.get() );
192 
193  // Set the library to this even though technically the legacy cache plugin owns the
194  // symbols. This allows the symbol library table conversion tool to determine the
195  // correct library where the symbol was found.
196  if( alias && alias->GetPart() && !alias->GetPart()->GetLib() )
197  alias->GetPart()->SetLib( this );
198 
199  return alias;
200 }
201 
202 
203 LIB_PART* PART_LIB::FindPart( const wxString& aName )
204 {
205  LIB_ALIAS* alias = FindAlias( aName );
206 
207  if( alias != NULL )
208  return alias->GetPart();
209 
210  return NULL;
211 }
212 
213 
215 {
216  // return true if at least one power part is found in lib
217  std::vector<LIB_ALIAS*> aliases;
218 
219  m_plugin->EnumerateSymbolLib( aliases, fileName.GetFullPath(), m_properties.get() );
220 
221  for( size_t i = 0; i < aliases.size(); i++ )
222  {
223  LIB_ALIAS* alias = aliases[i];
224 
225  LIB_PART* root = alias->GetPart();
226 
227  if( !root || root->IsPower() )
228  return true;
229  }
230 
231  return false;
232 }
233 
234 
236 {
237  // add a clone, not the caller's copy, the plugin take ownership of the new symbol.
238  m_plugin->SaveSymbol( fileName.GetFullPath(), new LIB_PART( *aPart, this ), m_properties.get() );
239 
240  // If we are not buffering, the library file is updated immediately when the plugin
241  // SaveSymbol() function is called.
242  if( IsBuffering() )
243  isModified = true;
244 
245  ++m_mod_hash;
246 }
247 
248 
250 {
251  wxCHECK_MSG( aEntry != NULL, NULL, "NULL pointer cannot be removed from library." );
252 
253  m_plugin->DeleteAlias( fileName.GetFullPath(), aEntry->GetName(), m_properties.get() );
254 
255  // If we are not buffering, the library file is updated immediately when the plugin
256  // SaveSymbol() function is called.
257  if( IsBuffering() )
258  isModified = true;
259 
260  ++m_mod_hash;
261  return NULL;
262 }
263 
264 
266 {
267  wxASSERT( aOldPart != NULL );
268  wxASSERT( aNewPart != NULL );
269 
270  m_plugin->DeleteSymbol( fileName.GetFullPath(), aOldPart->GetName(), m_properties.get() );
271 
272  LIB_PART* my_part = new LIB_PART( *aNewPart, this );
273 
274  m_plugin->SaveSymbol( fileName.GetFullPath(), my_part, m_properties.get() );
275 
276  // If we are not buffering, the library file is updated immediately when the plugin
277  // SaveSymbol() function is called.
278  if( IsBuffering() )
279  isModified = true;
280 
281  ++m_mod_hash;
282  return my_part;
283 }
284 
285 
286 PART_LIB* PART_LIB::LoadLibrary( const wxString& aFileName ) throw( IO_ERROR, boost::bad_pointer )
287 {
288  std::unique_ptr<PART_LIB> lib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, aFileName ) );
289 
290  std::vector<LIB_ALIAS*> aliases;
291  // This loads the library.
292  lib->GetAliases( aliases );
293 
294  // Now, set the LIB_PART m_library member but it will only be used
295  // when loading legacy libraries in the future. Once the symbols in the
296  // schematic have a full #LIB_ID, this will not get called.
297  for( size_t ii = 0; ii < aliases.size(); ii++ )
298  {
299  LIB_ALIAS* alias = aliases[ii];
300 
301  if( alias->GetPart() )
302  alias->GetPart()->SetLib( lib.get() );
303  }
304 
305  PART_LIB* ret = lib.release();
306  return ret;
307 }
308 
309 
310 PART_LIB* PART_LIBS::AddLibrary( const wxString& aFileName ) throw( IO_ERROR, boost::bad_pointer )
311 {
312  PART_LIB* lib;
313 
314  wxFileName fn = aFileName;
315  // Don't reload the library if it is already loaded.
316  lib = FindLibrary( fn.GetName() );
317 
318  if( lib )
319  return lib;
320 
321  lib = PART_LIB::LoadLibrary( aFileName );
322 
323  push_back( lib );
324 
325  return lib;
326 }
327 
328 
329 PART_LIB* PART_LIBS::AddLibrary( const wxString& aFileName, PART_LIBS::iterator& aIterator )
330  throw( IO_ERROR, boost::bad_pointer )
331 {
332  // Don't reload the library if it is already loaded.
333  wxFileName fn( aFileName );
334  PART_LIB* lib = FindLibrary( fn.GetName() );
335 
336  if( lib )
337  return lib;
338 
339  lib = PART_LIB::LoadLibrary( aFileName );
340 
341  if( aIterator >= begin() && aIterator < end() )
342  insert( aIterator, lib );
343  else
344  push_back( lib );
345 
346  return lib;
347 }
348 
349 
350 PART_LIB* PART_LIBS::FindLibrary( const wxString& aName )
351 {
352  for( PART_LIBS::iterator it = begin(); it!=end(); ++it )
353  {
354  if( it->GetName() == aName )
355  return &*it;
356  }
357 
358  return NULL;
359 }
360 
361 
362 PART_LIB* PART_LIBS::FindLibraryByFullFileName( const wxString& aFullFileName )
363 {
364  for( PART_LIBS::iterator it = begin(); it!=end(); ++it )
365  {
366  if( it->GetFullFileName() == aFullFileName )
367  return &*it;
368  }
369 
370  return NULL;
371 }
372 
373 
374 wxArrayString PART_LIBS::GetLibraryNames( bool aSorted )
375 {
376  wxArrayString cacheNames;
377  wxArrayString names;
378 
379  for( PART_LIB& lib : *this )
380  {
381  if( lib.IsCache() && aSorted )
382  cacheNames.Add( lib.GetName() );
383  else
384  names.Add( lib.GetName() );
385  }
386 
387  // Even sorted, the cache library is always at the end of the list.
388  if( aSorted )
389  names.Sort();
390 
391  for( unsigned int i = 0; i<cacheNames.Count(); i++ )
392  names.Add( cacheNames.Item( i ) );
393 
394  return names;
395 }
396 
397 
398 LIB_PART* PART_LIBS::FindLibPart( const LIB_ID& aLibId, const wxString& aLibraryName )
399 {
400  LIB_PART* part = NULL;
401 
402  for( PART_LIB& lib : *this )
403  {
404  if( !aLibraryName.IsEmpty() && lib.GetName() != aLibraryName )
405  continue;
406 
407  part = lib.FindPart( FROM_UTF8( aLibId.GetLibItemName() ) );
408 
409  if( part )
410  break;
411  }
412 
413  return part;
414 }
415 
416 
417 LIB_ALIAS* PART_LIBS::FindLibraryAlias( const LIB_ID& aLibId, const wxString& aLibraryName )
418 {
419  LIB_ALIAS* entry = NULL;
420 
421  for( PART_LIB& lib : *this )
422  {
423  if( !aLibraryName.IsEmpty() && lib.GetName() != aLibraryName )
424  continue;
425 
426  entry = lib.FindAlias( FROM_UTF8( aLibId.GetLibItemName() ) );
427 
428  if( entry )
429  break;
430  }
431 
432  return entry;
433 }
434 
435 
436 /* searches all libraries in the list for an entry, using a case insensitive comparison.
437  * Used to find an entry, when the normal (case sensitive) search fails.
438  */
439 void PART_LIBS::FindLibraryNearEntries( std::vector<LIB_ALIAS*>& aCandidates,
440  const wxString& aEntryName,
441  const wxString& aLibraryName )
442 {
443  for( PART_LIB& lib : *this )
444  {
445  if( !aLibraryName.IsEmpty() && lib.GetName() != aLibraryName )
446  continue;
447 
448  wxArrayString aliasNames;
449 
450  lib.GetAliasNames( aliasNames );
451 
452  if( aliasNames.IsEmpty() )
453  continue;
454 
455  for( size_t i = 0; i < aliasNames.size(); i++ )
456  {
457  if( aliasNames[i].CmpNoCase( aEntryName ) == 0 )
458  aCandidates.push_back( lib.FindAlias( aliasNames[i] ) );
459  }
460  }
461 }
462 
463 
464 int PART_LIBS::s_modify_generation = 1; // starts at 1 and goes up
465 
466 
468 {
469  int hash = 0;
470 
471  for( PART_LIBS::const_iterator it = begin(); it != end(); ++it )
472  {
473  hash += it->GetModHash();
474  }
475 
476  return hash;
477 }
478 
479 
480 void PART_LIBS::LibNamesAndPaths( PROJECT* aProject, bool doSave,
481  wxString* aPaths, wxArrayString* aNames )
482  throw( IO_ERROR, boost::bad_pointer )
483 {
484  wxString pro = aProject->GetProjectFullName();
485 
486  PARAM_CFG_ARRAY ca;
487 
488  if( aPaths )
489  ca.push_back( new PARAM_CFG_FILENAME( "LibDir", aPaths ) );
490 
491  if( aNames )
492  ca.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ), aNames, GROUP_SCH_LIBS ) );
493 
494  if( doSave )
495  {
496  aProject->ConfigSave( Kiface().KifaceSearch(), GROUP_SCH, ca );
497 
498  /*
499  {
500  wxString msg = wxString::Format( _(
501  "Unable save project's '%s' file" ),
502  GetChars( pro )
503  );
504  THROW_IO_ERROR( msg );
505  }
506  */
507  }
508  else
509  {
510  if( !aProject->ConfigLoad( Kiface().KifaceSearch(), GROUP_SCH, ca ) )
511  {
512  wxString msg = wxString::Format( _(
513  "Unable to load project's '%s' file" ),
514  GetChars( pro )
515  );
516  THROW_IO_ERROR( msg );
517  }
518  }
519 }
520 
521 
522 const wxString PART_LIBS::CacheName( const wxString& aFullProjectFilename )
523 {
524  /* until apr 2009 the project cache lib was named: <root_name>.cache.lib,
525  * and after: <root_name>-cache.lib. So if the <name>-cache.lib is not found,
526  * the old file will be renamed and returned.
527  */
528  wxFileName new_name = aFullProjectFilename;
529 
530  new_name.SetName( new_name.GetName() + "-cache" );
531  new_name.SetExt( SchematicLibraryFileExtension );
532 
533  if( new_name.FileExists() )
534  return new_name.GetFullPath();
535  else
536  {
537  wxFileName old_name = aFullProjectFilename;
538  old_name.SetExt( "cache.lib" );
539 
540  if( old_name.FileExists() )
541  {
542  wxRenameFile( old_name.GetFullPath(), new_name.GetFullPath() );
543  return new_name.GetFullPath();
544  }
545  }
546  return wxEmptyString;
547 }
548 
549 
550 void PART_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
551  throw( IO_ERROR, boost::bad_pointer )
552 {
553  wxString filename;
554  wxString libs_not_found;
555  SEARCH_STACK* lib_search = aProject->SchSearchS();
556 
557 #if defined(DEBUG) && 0
558  lib_search->Show( __func__ );
559 #endif
560 
561  wxArrayString lib_names;
562 
563  LibNamesAndPaths( aProject, false, NULL, &lib_names );
564 
565  // If the list is empty, force loading the standard power symbol library.
566  if( !lib_names.GetCount() )
567  lib_names.Add( "power" );
568 
569  wxASSERT( !size() ); // expect to load into "this" empty container.
570 
571  wxProgressDialog lib_dialog( _( "Loading Symbol Libraries" ),
572  wxEmptyString,
573  lib_names.GetCount(),
574  NULL,
575  wxPD_APP_MODAL );
576 
577  if( aShowProgress )
578  {
579  lib_dialog.Show();
580  }
581 
582  wxString progress_message;
583 
584  for( unsigned i = 0; i < lib_names.GetCount(); ++i )
585  {
586  if( aShowProgress )
587  {
588  lib_dialog.Update( i, _( "Loading " + lib_names[i] ) );
589  }
590 
591  wxFileName fn = lib_names[i];
592  // lib_names[] does not store the file extension. Set it:
593  fn.SetExt( SchematicLibraryFileExtension );
594 
595  // Skip if the file name is not valid..
596  if( !fn.IsOk() )
597  continue;
598 
599  if( !fn.FileExists() )
600  {
601  filename = lib_search->FindValidPath( fn.GetFullPath() );
602 
603  if( !filename )
604  {
605  libs_not_found += fn.GetFullPath();
606  libs_not_found += '\n';
607  continue;
608  }
609  }
610  else
611  { // ensure the lib filename has a absolute path.
612  // If the lib has no absolute path, and is found in the cwd by fn.FileExists(),
613  // make a full absolute path, to avoid issues with load library functions which
614  // expects an absolute path.
615  if( !fn.IsAbsolute() )
616  fn.MakeAbsolute();
617 
618  filename = fn.GetFullPath();
619  }
620 
621  try
622  {
623  AddLibrary( filename );
624  }
625  catch( const IO_ERROR& ioe )
626  {
627  wxString msg;
628  msg.Printf( _( "Part library '%s' failed to load. Error:\n %s" ),
629  GetChars( filename ), GetChars( ioe.What() ) );
630 
631  wxLogError( msg );
632  }
633  }
634 
635  if( aShowProgress )
636  {
637  lib_dialog.Destroy();
638  }
639 
640  // add the special cache library.
641  wxString cache_name = CacheName( aProject->GetProjectFullName() );
642  PART_LIB* cache_lib;
643 
644  if( !cache_name.IsEmpty() )
645  {
646  try
647  {
648  cache_lib = AddLibrary( cache_name );
649 
650  if( cache_lib )
651  cache_lib->SetCache();
652  }
653  catch( const IO_ERROR& ioe )
654  {
655  wxString msg = wxString::Format( _(
656  "Part library '%s' failed to load.\nError: %s" ),
657  GetChars( cache_name ),
658  GetChars( ioe.What() )
659  );
660 
661  THROW_IO_ERROR( msg );
662  }
663  }
664 
665  // Print the libraries not found
666  if( !libs_not_found.IsEmpty() )
667  {
668  // Use a different exception type so catch()er can route to proper use
669  // of the HTML_MESSAGE_BOX.
670  THROW_PARSE_ERROR( wxEmptyString, UTF8( __func__ ), UTF8( libs_not_found ), 0, 0 );
671  }
672 
673 #if defined(DEBUG) && 1
674  printf( "%s: lib_names:\n", __func__ );
675 
676  for( PART_LIBS::const_iterator it = begin(); it < end(); ++it )
677  printf( " %s\n", TO_UTF8( it->GetName() ) );
678 #endif
679 }
PART_LIB * GetLib()
bool HasPowerParts()
Function HasPowerParts.
Class UTF8 is an 8 bit std::string that is assuredly encoded in UTF8, and supplies special conversion...
Definition: utf8.h:53
int m_mod_hash
incremented each time library is changed.
void SetLib(PART_LIB *aLibrary)
A list of parameters type.
Part library alias object definition.
bool IsBuffering() const
LIB_PART * ReplacePart(LIB_PART *aOldPart, LIB_PART *aNewPart)
Replace an existing part entry in the library.
void GetAliasNames(wxArrayString &aNames)
Load a string array with the names of all the entries in this library.
std::unique_ptr< SCH_PLUGIN > m_plugin
static void LibNamesAndPaths(PROJECT *aProject, bool doSave, wxString *aPaths, wxArrayString *aNames=NULL)
Function LibNamesAndPaths either saves or loads the names of the currently configured part libraries ...
Class PROJECT holds project specific data.
Definition: project.h:52
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
This file is part of the common library TODO brief description.
bool IsPower() const
void LoadAllLibraries(PROJECT *aProject, bool aShowProgress=true)
Function LoadAllLibraries loads all of the project's libraries into this container, which should be cleared before calling it.
static int s_modify_generation
helper for GetModifyHash()
void Save(bool aSaveDocFile=true)
void GetEntryTypePowerNames(wxArrayString &aNames)
Load a string array with the names of entries of type POWER in this library.
bool isModified
Library modification status.
This file is part of the common library.
static SCH_PLUGIN * FindPlugin(SCH_FILE_T aFileType)
Function FindPlugin returns a SCH_PLUGIN which the caller can use to import, export, save, or load design documents.
Definition: sch_io_mgr.cpp:48
LIB_ALIAS * RemoveAlias(LIB_ALIAS *aEntry)
Safely remove aEntry from the library and return the next entry.
bool IsCache() const
wxArrayString GetLibraryNames(bool aSorted=true)
Function GetLibraryNames returns the list of part library file names without path and extension...
int GetModifyHash()
Return the modification hash for all libraries.
The common library.
int type
Library type indicator.
Class SEARCH_STACK looks for files in a number of places.
Definition: search_stack.h:41
Class LIB_ID.
Definition: lib_id.h:56
PART_LIB * FindLibrary(const wxString &aName)
Function FindLibrary finds a part library by aName.
static const wxString CacheName(const wxString &aFullProjectFilename)
Function cacheName returns the name of the cache library after potentially fixing it from an older na...
Class PROPERTIES is a name/value tuple with unique names and optional values.
Definition: properties.h:34
LIB_ALIAS * FindLibraryAlias(const LIB_ID &aLibId, const wxString &aLibraryName=wxEmptyString)
Function FindLibraryEntry searches all libraries in the list for an entry.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
Configuration parameter - PARAM_CFG_FILENAME Class Same as PARAM_CFG_WXSTRING, but stores "\" as "/"...
This file contains miscellaneous commonly used macros and functions.
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
void EnableBuffering(bool aEnable=true)
void GetAliases(std::vector< LIB_ALIAS * > &aAliases)
Load a vector with all the entries in this library.
#define THROW_PARSE_ERROR(aProblem, aSource, aInputLine, aLineNumber, aByteIndex)
Definition: ki_exception.h:133
Base window classes and related definitions.
const wxString & GetName() const
const UTF8 & GetLibItemName() const
Function GetLibItemName.
Definition: lib_id.h:129
wxDateTime timeStamp
Library save time and date.
PART_LIB * AddLibrary(const wxString &aFileName)
Function AddLibrary allocates and adds a part library to the library list.
const wxString GetName() const
Return the file name without path or extension.
static PART_LIB * LoadLibrary(const wxString &aFileName)
Function LoadLibrary allocates and loads a part library file.
Class LIB_PART defines a library part object.
The common library.
#define GROUP_SCH
Definition: config_params.h:44
void SetCache()
std::unique_ptr< PROPERTIES > m_properties
Library properties.
#define GROUP_SCH_LIBS
(Now in fp lib tables)
Definition: config_params.h:50
LIB_PART * FindLibPart(const LIB_ID &aLibId, const wxString &aLibraryName=wxEmptyString)
Function FindLibPart searches all libraries in the list for a part.
static const char * PropNoDocFile
const char* PropBuffering
#define THROW_IO_ERROR(x)
Definition: utf8.cpp:60
static bool Sort(const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL contain...
Definition: base_struct.h:463
SCH_IO_MGR::SCH_FILE_T m_pluginType
const wxString SchematicLibraryFileExtension
LIB_PART * GetPart() const
Function GetPart gets the shared LIB_PART.
wxFileName fileName
Library file name.
Class PART_LIBS is a collection of PART_LIBs.
void AddPart(LIB_PART *aPart)
Add aPart entry to library.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
const wxString & GetName() const
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
int versionMinor
Library minor version number.
static const char * PropBuffering
const char* PropBuffering
PART_LIB * FindLibraryByFullFileName(const wxString &aFullFileName)
void SetPluginType(SCH_IO_MGR::SCH_FILE_T aPluginType)
wxString FindValidPath(const wxString &aFileName) const
Definition: search_stack.h:71
Definition for part library class.
PART_LIB(int aType, const wxString &aFileName, SCH_IO_MGR::SCH_FILE_T aPluginType=SCH_IO_MGR::SCH_LEGACY)
void Create(const wxString &aFileName=wxEmptyString)
Class PART_LIB is used to load, save, search, and otherwise manipulate part library files...
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
int versionMajor
Library major version number.
void FindLibraryNearEntries(std::vector< LIB_ALIAS * > &aCandidates, const wxString &aEntryName, const wxString &aLibraryName=wxEmptyString)
Function FindLibraryNearEntries Searches all libraries in the list for an entry, using a case insensi...
LIB_ALIAS * FindAlias(const wxString &aName)
Find LIB_ALIAS by aName.
LIB_PART * FindPart(const wxString &aName)
Find part by aName.
SCH_FILE_T
Enum SCH_FILE_T is a set of file types that the SCH_IO_MGR knows about, and for which there has been ...
Definition: sch_io_mgr.h:53