KiCad PCB EDA Suite
symbol_lib_table.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) 2016-2017 Wayne Stambaugh <stambaughw@gmail.com>
5  * Copyright (C) 2016-2017 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 
26 #include <fctsys.h>
27 #include <common.h>
28 #include <kiface_i.h>
29 #include <macros.h>
30 #include <lib_id.h>
31 #include <lib_table_lexer.h>
32 #include <symbol_lib_table.h>
33 #include <class_libentry.h>
34 
35 #define OPT_SEP '|'
36 
37 using namespace LIB_TABLE_T;
38 
39 
40 static const wxString global_tbl_name( "sym-lib-table" );
41 
42 
43 const char* SYMBOL_LIB_TABLE::PropPowerSymsOnly = "pwr_sym_only";
44 const char* SYMBOL_LIB_TABLE::PropNonPowerSymsOnly = "non_pwr_sym_only";
45 int SYMBOL_LIB_TABLE::m_modifyHash = 1; // starts at 1 and goes up
46 
47 
52 
53 
55 {
56  return LIB_TABLE_ROW::operator == ( aRow ) && type == aRow.type;
57 }
58 
59 
60 void SYMBOL_LIB_TABLE_ROW::SetType( const wxString& aType )
61 {
62  type = SCH_IO_MGR::EnumFromStr( aType );
63 
64  if( SCH_IO_MGR::SCH_FILE_T( -1 ) == type )
65  type = SCH_IO_MGR::SCH_LEGACY;
66 }
67 
68 
70  LIB_TABLE( aFallBackTable )
71 {
72  // not copying fall back, simply search aFallBackTable separately
73  // if "nickName not found".
74 }
75 
76 
78 {
79  return g_symbolLibraryTable;
80 }
81 
82 
83 void SYMBOL_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
84 {
85  T tok;
86  wxString errMsg; // to collect error messages
87 
88  // This table may be nested within a larger s-expression, or not.
89  // Allow for parser of that optional containing s-epression to have looked ahead.
90  if( in->CurTok() != T_sym_lib_table )
91  {
92  in->NeedLEFT();
93  if( ( tok = in->NextTok() ) != T_sym_lib_table )
94  in->Expecting( T_sym_lib_table );
95  }
96 
97  while( ( tok = in->NextTok() ) != T_RIGHT )
98  {
99  std::unique_ptr< SYMBOL_LIB_TABLE_ROW > row( new SYMBOL_LIB_TABLE_ROW );
100 
101  if( tok == T_EOF )
102  in->Expecting( T_RIGHT );
103 
104  if( tok != T_LEFT )
105  in->Expecting( T_LEFT );
106 
107  // in case there is a "row integrity" error, tell where later.
108  int lineNum = in->CurLineNumber();
109 
110  if( ( tok = in->NextTok() ) != T_lib )
111  in->Expecting( T_lib );
112 
113  // (name NICKNAME)
114  in->NeedLEFT();
115 
116  if( ( tok = in->NextTok() ) != T_name )
117  in->Expecting( T_name );
118 
119  in->NeedSYMBOLorNUMBER();
120 
121  row->SetNickName( in->FromUTF8() );
122 
123  in->NeedRIGHT();
124 
125  // After (name), remaining (lib) elements are order independent, and in
126  // some cases optional.
127  bool sawType = false;
128  bool sawOpts = false;
129  bool sawDesc = false;
130  bool sawUri = false;
131  bool sawDisabled = false;
132 
133  while( ( tok = in->NextTok() ) != T_RIGHT )
134  {
135  if( tok == T_EOF )
136  in->Unexpected( T_EOF );
137 
138  if( tok != T_LEFT )
139  in->Expecting( T_LEFT );
140 
141  tok = in->NeedSYMBOLorNUMBER();
142 
143  switch( tok )
144  {
145  case T_uri:
146  if( sawUri )
147  in->Duplicate( tok );
148  sawUri = true;
149  in->NeedSYMBOLorNUMBER();
150  row->SetFullURI( in->FromUTF8() );
151  break;
152 
153  case T_type:
154  if( sawType )
155  in->Duplicate( tok );
156  sawType = true;
157  in->NeedSYMBOLorNUMBER();
158  row->SetType( in->FromUTF8() );
159  break;
160 
161  case T_options:
162  if( sawOpts )
163  in->Duplicate( tok );
164  sawOpts = true;
165  in->NeedSYMBOLorNUMBER();
166  row->SetOptions( in->FromUTF8() );
167  break;
168 
169  case T_descr:
170  if( sawDesc )
171  in->Duplicate( tok );
172  sawDesc = true;
173  in->NeedSYMBOLorNUMBER();
174  row->SetDescr( in->FromUTF8() );
175  break;
176 
177  case T_disabled:
178  if( sawDisabled )
179  in->Duplicate( tok );
180  sawDisabled = true;
181  row->SetEnabled( false );
182  break;
183 
184  default:
185  in->Unexpected( tok );
186  }
187 
188  in->NeedRIGHT();
189  }
190 
191  if( !sawType )
192  in->Expecting( T_type );
193 
194  if( !sawUri )
195  in->Expecting( T_uri );
196 
197  // all nickNames within this table fragment must be unique, so we do not
198  // use doReplace in InsertRow(). (However a fallBack table can have a
199  // conflicting nickName and ours will supercede that one since in
200  // FindLib() we search this table before any fall back.)
201  wxString nickname = row->GetNickName(); // store it to be able to used it
202  // after row deletion if an error occurs
203  LIB_TABLE_ROW* tmp = row.release();
204 
205  if( !InsertRow( tmp ) )
206  {
207  delete tmp; // The table did not take ownership of the row.
208 
209  wxString msg = wxString::Format(
210  _( "Duplicate library nickname \"%s\" found in symbol library "
211  "table file line %d" ), GetChars( nickname ), lineNum );
212 
213  if( !errMsg.IsEmpty() )
214  errMsg << '\n';
215 
216  errMsg << msg;
217  }
218  }
219 
220  if( !errMsg.IsEmpty() )
221  THROW_IO_ERROR( errMsg );
222 }
223 
224 
225 void SYMBOL_LIB_TABLE::Format( OUTPUTFORMATTER* aOutput, int aIndentLevel ) const
226 {
227  aOutput->Print( aIndentLevel, "(sym_lib_table\n" );
228 
229  for( LIB_TABLE_ROWS_CITER it = rows.begin(); it != rows.end(); ++it )
230  {
231  it->Format( aOutput, aIndentLevel+1 );
232  }
233 
234  aOutput->Print( aIndentLevel, ")\n" );
235 }
236 
237 
239 {
240  int hash = 0;
241  std::vector< wxString > libNames = GetLogicalLibs();
242 
243  for( const auto& libName : libNames )
244  {
245  const SYMBOL_LIB_TABLE_ROW* row = FindRow( libName );
246 
247  if( !row || !row->plugin )
248  {
249  wxFAIL;
250  continue;
251  }
252 
253  hash += row->plugin->GetModifyHash();
254  }
255 
256  hash += m_modifyHash;
257 
258  return hash;
259 }
260 
261 
262 size_t SYMBOL_LIB_TABLE::GetSymbolCount( const wxString& aNickname )
263 {
264  SYMBOL_LIB_TABLE_ROW* row = dynamic_cast< SYMBOL_LIB_TABLE_ROW* >( findRow( aNickname ) );
265  wxCHECK( row && row->plugin, 0 );
266 
267  return row->plugin->GetSymbolLibCount( row->GetFullURI( true ) );
268 }
269 
270 
271 void SYMBOL_LIB_TABLE::EnumerateSymbolLib( const wxString& aNickname, wxArrayString& aAliasNames,
272  bool aPowerSymbolsOnly )
273 {
274  SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
275  wxCHECK( row && row->plugin, /* void */ );
276 
277  wxString options = row->GetOptions();
278 
279  if( aPowerSymbolsOnly )
280  row->SetOptions( row->GetOptions() + " " + PropPowerSymsOnly );
281 
282  row->plugin->EnumerateSymbolLib( aAliasNames, row->GetFullURI( true ), row->GetProperties() );
283 
284  if( aPowerSymbolsOnly )
285  row->SetOptions( options );
286 }
287 
288 
289 SYMBOL_LIB_TABLE_ROW* SYMBOL_LIB_TABLE::FindRow( const wxString& aNickname )
290 
291 {
292  SYMBOL_LIB_TABLE_ROW* row = dynamic_cast< SYMBOL_LIB_TABLE_ROW* >( findRow( aNickname ) );
293 
294  if( !row )
295  {
296  wxString msg = wxString::Format(
297  _( "sym-lib-table files contain no library with nickname \"%s\"" ),
298  GetChars( aNickname ) );
299 
300  THROW_IO_ERROR( msg );
301  }
302 
303  // We've been 'lazy' up until now, but it cannot be deferred any longer,
304  // instantiate a PLUGIN of the proper kind if it is not already in this
305  // SYMBOL_LIB_TABLE_ROW.
306  if( !row->plugin )
307  row->setPlugin( SCH_IO_MGR::FindPlugin( row->type ) );
308 
309  return row;
310 }
311 
312 
313 void SYMBOL_LIB_TABLE::LoadSymbolLib( std::vector<LIB_ALIAS*>& aAliasList,
314  const wxString& aNickname, bool aPowerSymbolsOnly )
315 {
316  SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
317  wxCHECK( row && row->plugin, /* void */ );
318 
319  wxString options = row->GetOptions();
320 
321  if( aPowerSymbolsOnly )
322  row->SetOptions( row->GetOptions() + " " + PropPowerSymsOnly );
323 
324  row->plugin->EnumerateSymbolLib( aAliasList, row->GetFullURI( true ), row->GetProperties() );
325 
326  if( aPowerSymbolsOnly )
327  row->SetOptions( options );
328 
329  // The library cannot know its own name, because it might have been renamed or moved.
330  // Therefore footprints cannot know their own library nickname when residing in
331  // a symbol library.
332  // Only at this API layer can we tell the symbol about its actual library nickname.
333  for( LIB_ALIAS* alias : aAliasList )
334  {
335  // remove "const"-ness, I really do want to set nickname without
336  // having to copy the LIB_ID and its two strings, twice each.
337  LIB_ID& id = (LIB_ID&) alias->GetPart()->GetLibId();
338 
339  id.SetLibNickname( row->GetNickName() );
340  }
341 }
342 
343 
344 LIB_ALIAS* SYMBOL_LIB_TABLE::LoadSymbol( const wxString& aNickname, const wxString& aAliasName )
345 {
346  const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
347  wxCHECK( row && row->plugin, nullptr );
348 
349  LIB_ALIAS* ret = row->plugin->LoadSymbol( row->GetFullURI( true ), aAliasName,
350  row->GetProperties() );
351 
352  // The library cannot know its own name, because it might have been renamed or moved.
353  // Therefore footprints cannot know their own library nickname when residing in
354  // a symbol library.
355  // Only at this API layer can we tell the symbol about its actual library nickname.
356  if( ret )
357  {
358  // remove "const"-ness, I really do want to set nickname without
359  // having to copy the LIB_ID and its two strings, twice each.
360  LIB_ID& id = (LIB_ID&) ret->GetPart()->GetLibId();
361 
362  id.SetLibNickname( row->GetNickName() );
363  }
364 
365  return ret;
366 }
367 
368 
370  const LIB_PART* aSymbol, bool aOverwrite )
371 {
372  const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
373  wxCHECK( row && row->plugin, SAVE_SKIPPED );
374 
375  if( !aOverwrite )
376  {
377  // Try loading the footprint to see if it already exists, caller wants overwrite
378  // protection, which is atypical, not the default.
379 
380  wxString name = aSymbol->GetLibId().GetLibItemName();
381 
382  std::unique_ptr< LIB_ALIAS > symbol( row->plugin->LoadSymbol( row->GetFullURI( true ),
383  name,
384  row->GetProperties() ) );
385 
386  if( symbol.get() )
387  return SAVE_SKIPPED;
388  }
389 
390  row->plugin->SaveSymbol( row->GetFullURI( true ), aSymbol, row->GetProperties() );
391 
392  return SAVE_OK;
393 }
394 
395 
396 void SYMBOL_LIB_TABLE::DeleteSymbol( const wxString& aNickname, const wxString& aSymbolName )
397 {
398  const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
399  wxCHECK( row && row->plugin, /* void */ );
400  return row->plugin->DeleteSymbol( row->GetFullURI( true ), aSymbolName,
401  row->GetProperties() );
402 }
403 
404 
405 void SYMBOL_LIB_TABLE::DeleteAlias( const wxString& aNickname, const wxString& aAliasName )
406 {
407  const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
408  wxCHECK( row && row->plugin, /* void */ );
409  return row->plugin->DeleteAlias( row->GetFullURI( true ), aAliasName,
410  row->GetProperties() );
411 }
412 
413 
414 bool SYMBOL_LIB_TABLE::IsSymbolLibWritable( const wxString& aNickname )
415 {
416  const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
417  wxCHECK( row && row->plugin, false );
418  return row->plugin->IsSymbolLibWritable( row->GetFullURI( true ) );
419 }
420 
421 
422 void SYMBOL_LIB_TABLE::DeleteSymbolLib( const wxString& aNickname )
423 {
424  const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
425  wxCHECK( row && row->plugin, /* void */ );
426  row->plugin->DeleteSymbolLib( row->GetFullURI( true ), row->GetProperties() );
427 }
428 
429 
430 void SYMBOL_LIB_TABLE::CreateSymbolLib( const wxString& aNickname )
431 {
432  const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
433  wxCHECK( row && row->plugin, /* void */ );
434  row->plugin->CreateSymbolLib( row->GetFullURI( true ), row->GetProperties() );
435 }
436 
437 
439 {
440  wxString nickname = aLibId.GetLibNickname();
441  wxString name = aLibId.GetLibItemName();
442 
443  if( nickname.size() )
444  {
445  return LoadSymbol( nickname, name );
446  }
447 
448  // nickname is empty, sequentially search (alphabetically) all libs/nicks for first match:
449  else
450  {
451  std::vector<wxString> nicks = GetLogicalLibs();
452 
453  // Search each library going through libraries alphabetically.
454  for( unsigned i = 0; i < nicks.size(); ++i )
455  {
456  // FootprintLoad() returns NULL on not found, does not throw exception
457  // unless there's an IO_ERROR.
458  LIB_ALIAS* ret = LoadSymbol( nicks[i], name );
459 
460  if( ret )
461  return ret;
462  }
463 
464  return NULL;
465  }
466 }
467 
468 
470 {
471  return "KICAD_SYMBOL_DIR";
472 }
473 
474 
476 {
477  bool tableExists = true;
478  wxFileName fn = GetGlobalTableFileName();
479 
480  if( !fn.FileExists() )
481  {
482  tableExists = false;
483 
484  if( !fn.DirExists() && !fn.Mkdir( 0x777, wxPATH_MKDIR_FULL ) )
485  {
486  THROW_IO_ERROR( wxString::Format( _( "Cannot create global library table path \"%s\"." ),
487  GetChars( fn.GetPath() ) ) );
488  }
489 
490  // Attempt to copy the default global file table from the KiCad
491  // template folder to the user's home configuration path.
492  wxString fileName = Kiface().KifaceSearch().FindValidPath( global_tbl_name );
493 
494  // The fallback is to create an empty global symbol table for the user to populate.
495  if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) )
496  {
497  SYMBOL_LIB_TABLE emptyTable;
498 
499  emptyTable.Save( fn.GetFullPath() );
500  }
501  }
502 
503  aTable.Load( fn.GetFullPath() );
504 
505  return tableExists;
506 }
507 
508 
510 {
511  wxFileName fn;
512 
513  fn.SetPath( GetKicadConfigPath() );
514  fn.SetName( global_tbl_name );
515 
516  return fn.GetFullPath();
517 }
518 
519 
521 {
522  return global_tbl_name;
523 }
LIB_ALIAS * LoadSymbol(const wxString &aNickname, const wxString &aAliasName)
Load a LIB_ALIAS having aAliasName from the library given by aNickname.
SAVE_T SaveSymbol(const wxString &aNickname, const LIB_PART *aSymbol, bool aOverwrite=true)
Write aSymbol to an existing library given by aNickname.
virtual void CreateSymbolLib(const wxString &aLibraryPath, const PROPERTIES *aProperties=NULL)
Create a new empty symbol library at aLibraryPath.
Definition: sch_plugin.cpp:126
static const wxString & GetSymbolLibTableFileName()
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
void EnumerateSymbolLib(const wxString &aNickname, wxArrayString &aAliasNames, bool aPowerSymbolsOnly=false)
Return a list of symbol alias names contained within the library given by aNickname.
SYMBOL_LIB_TABLE_ROW * FindRow(const wxString &aNickName)
Return an SYMBOL_LIB_TABLE_ROW if aNickName is found in this table or in any chained fallBack table f...
Part library alias object definition.
virtual LIB_ALIAS * LoadSymbol(const wxString &aLibraryPath, const wxString &aAliasName, const PROPERTIES *aProperties=NULL)
Load a LIB_ALIAS object having aAliasName from the aLibraryPath containing a library format that this...
Definition: sch_plugin.cpp:93
virtual bool DeleteSymbolLib(const wxString &aLibraryPath, const PROPERTIES *aProperties=NULL)
Delete an existing symbol library and returns true if successful, or if library does not exist return...
Definition: sch_plugin.cpp:133
Hold a record identifying a symbol library accessed by the appropriate symbol library SCH_PLUGIN obje...
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE...
SYMBOL_LIB_TABLE(SYMBOL_LIB_TABLE *aFallBackTable=NULL)
Build a symbol library table by pre-pending this table fragment in front of aFallBackTable.
void CreateSymbolLib(const wxString &aNickname)
const PROPERTIES * GetProperties() const
Return the constant PROPERTIES for this library (LIB_TABLE_ROW).
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Adds aRow if it does not already exist or if doReplace is true.
SCH_PLUGIN::SCH_PLUGIN_RELEASER plugin
virtual void DeleteSymbol(const wxString &aLibraryPath, const wxString &aAliasName, const PROPERTIES *aProperties=NULL)
Delete the entire LIB_PART associated with aAliasName from the library aLibraryPath.
Definition: sch_plugin.cpp:118
void DeleteSymbolLib(const wxString &aNickname)
void SetType(const wxString &aType) override
Change the schematic plugin type represented by this row.
virtual void EnumerateSymbolLib(wxArrayString &aAliasNameList, const wxString &aLibraryPath, const PROPERTIES *aProperties=NULL)
Populate a list of LIB_PART alias names contained within the library aLibraryPath.
Definition: sch_plugin.cpp:75
const LIB_ID & GetLibId() const
const wxString & GetOptions() const
Return the options string, which may hold a password or anything else needed to instantiate the under...
void LoadSymbolLib(std::vector< LIB_ALIAS * > &aAliasList, const wxString &aNickname, bool aPowerSymbolsOnly=false)
static const wxString GlobalPathEnvVariableName()
Return the name of the environment variable used to hold the directory of locally installed "KiCad sp...
size_t GetSymbolCount(const wxString &aNickname)
Return the number of symbols in the symbol library mapped to aNickname.
Class OUTPUTFORMATTER is an important interface (abstract class) used to output 8 bit text in a conve...
Definition: richio.h:327
LIB_TABLE_ROWS rows
static const wxString global_tbl_name("sym-lib-table")
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
bool IsSymbolLibWritable(const wxString &aNickname)
Return true if the library given by aNickname is writable.
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...
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
This file contains miscellaneous commonly used macros and functions.
virtual size_t GetSymbolLibCount(const wxString &aLibraryPath, const PROPERTIES *aProperties=NULL)
Definition: sch_plugin.cpp:66
bool operator==(const SYMBOL_LIB_TABLE_ROW &aRow) const
LIB_ALIAS * LoadSymbolWithOptionalNickname(const LIB_ID &aId)
Load a LIB_PART having aFootprintId with possibly an empty library nickname.
SEARCH_STACK & KifaceSearch()
Only for DSO specific &#39;non-library&#39; files.
Definition: kiface_i.h:127
virtual int GetModifyHash() const =0
Return the modification hash from the library cache.
static bool LoadGlobalTable(SYMBOL_LIB_TABLE &aTable)
Load the global symbol library table into aTable.
const UTF8 & GetLibItemName() const
Definition: lib_id.h:118
Class LIB_ITEM definition.
Define a library symbol object.
bool operator==(const LIB_TABLE_ROW &r) const
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
virtual void Format(OUTPUTFORMATTER *aOutput, int aIndentLevel) const override
Generate the table in s-expression format to aOutput with an indention level of aIndentLevel.
void setPlugin(SCH_PLUGIN *aPlugin)
LIB_TABLE_ROW * findRow(const wxString &aNickname) const
Return a LIB_TABLE_ROW if aNickname is found in this table or in any chained fallBack table fragment...
void Load(const wxString &aFileName)
Load the library table using the path defined by aFileName aFallBackTable.
wxString GetKicadConfigPath()
Return the user configuration path used to store KiCad&#39;s configuration files.
Definition: common.cpp:211
LIB_PART * GetPart() const
Get the shared LIB_PART.
int SetLibNickname(const UTF8 &aNickname)
Override the logical library name portion of the LIB_ID to aNickname.
Definition: lib_id.cpp:219
const wxString & GetNickName() const
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
LIB_TABLE_ROWS::const_iterator LIB_TABLE_ROWS_CITER
const char * name
Definition: DXF_plotter.cpp:61
void DeleteSymbol(const wxString &aNickname, const wxString &aSymbolName)
Deletes the aSymbolName from the library given by aNickname.
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
static SCH_FILE_T EnumFromStr(const wxString &aFileType)
Return the #SCH_FILE_T from the corresponding plugin type name: "kicad", "legacy", etc.
Definition: sch_io_mgr.cpp:96
static int m_modifyHash
helper for GetModifyHash()
virtual void Parse(LIB_TABLE_LEXER *aLexer) override
Parse the #LIB_TABLE_LEXER s-expression library table format into the appropriate LIB_TABLE_ROW objec...
size_t i
Definition: json11.cpp:597
The common library.
virtual bool IsSymbolLibWritable(const wxString &aLibraryPath)
Return true if the library at aLibraryPath is writable.
Definition: sch_plugin.cpp:141
virtual void DeleteAlias(const wxString &aLibraryPath, const wxString &aAliasName, const PROPERTIES *aProperties=NULL)
Delete aAliasName from the library at aLibraryPath.
Definition: sch_plugin.cpp:110
virtual void SaveSymbol(const wxString &aLibraryPath, const LIB_PART *aSymbol, const PROPERTIES *aProperties=NULL)
Write aSymbol to an existing library located at aLibraryPath.
Definition: sch_plugin.cpp:102
void SetOptions(const wxString &aOptions)
Change the library options strings.
SAVE_T
The set of return values from SaveSymbol() below.
static const char * PropNonPowerSymsOnly
SYMBOL_LIB_TABLE g_symbolLibraryTable
The global symbol library table.
wxString FindValidPath(const wxString &aFileName) const
Definition: search_stack.h:71
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:404
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:101
#define THROW_IO_ERROR(msg)
Definition: ki_exception.h:38
static wxString GetGlobalTableFileName()
Fetch the global symbol library table file name.
void DeleteAlias(const wxString &aNickname, const wxString &aAliasName)
Delete aAliasName from the library at aLibraryPath.
static const char * PropPowerSymsOnly
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE...
Manage LIB_TABLE_ROW records (rows), and can be searched based on library nickname.