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 
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 )
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 
132  while( ( tok = in->NextTok() ) != T_RIGHT )
133  {
134  if( tok == T_EOF )
135  in->Unexpected( T_EOF );
136 
137  if( tok != T_LEFT )
138  in->Expecting( T_LEFT );
139 
140  tok = in->NeedSYMBOLorNUMBER();
141 
142  switch( tok )
143  {
144  case T_uri:
145  if( sawUri )
146  in->Duplicate( tok );
147  sawUri = true;
148  in->NeedSYMBOLorNUMBER();
149  row->SetFullURI( in->FromUTF8() );
150  break;
151 
152  case T_type:
153  if( sawType )
154  in->Duplicate( tok );
155  sawType = true;
156  in->NeedSYMBOLorNUMBER();
157  row->SetType( in->FromUTF8() );
158  break;
159 
160  case T_options:
161  if( sawOpts )
162  in->Duplicate( tok );
163  sawOpts = true;
164  in->NeedSYMBOLorNUMBER();
165  row->SetOptions( in->FromUTF8() );
166  break;
167 
168  case T_descr:
169  if( sawDesc )
170  in->Duplicate( tok );
171  sawDesc = true;
172  in->NeedSYMBOLorNUMBER();
173  row->SetDescr( in->FromUTF8() );
174  break;
175 
176  default:
177  in->Unexpected( tok );
178  }
179 
180  in->NeedRIGHT();
181  }
182 
183  if( !sawType )
184  in->Expecting( T_type );
185 
186  if( !sawUri )
187  in->Expecting( T_uri );
188 
189  // all nickNames within this table fragment must be unique, so we do not
190  // use doReplace in InsertRow(). (However a fallBack table can have a
191  // conflicting nickName and ours will supercede that one since in
192  // FindLib() we search this table before any fall back.)
193  wxString nickname = row->GetNickName(); // store it to be able to used it
194  // after row deletion if an error occurs
195  LIB_TABLE_ROW* tmp = row.release();
196 
197  if( !InsertRow( tmp ) )
198  {
199  delete tmp; // The table did not take ownership of the row.
200 
201  wxString msg = wxString::Format(
202  _( "Duplicate library nickname '%s' found in symbol library "
203  "table file line %d" ), GetChars( nickname ), lineNum );
204 
205  if( !errMsg.IsEmpty() )
206  errMsg << '\n';
207 
208  errMsg << msg;
209  }
210  }
211 
212  if( !errMsg.IsEmpty() )
213  THROW_IO_ERROR( errMsg );
214 }
215 
216 
217 void SYMBOL_LIB_TABLE::Format( OUTPUTFORMATTER* aOutput, int aIndentLevel ) const
218 {
219  aOutput->Print( aIndentLevel, "(sym_lib_table\n" );
220 
221  for( LIB_TABLE_ROWS_CITER it = rows.begin(); it != rows.end(); ++it )
222  it->Format( aOutput, aIndentLevel+1 );
223 
224  aOutput->Print( aIndentLevel, ")\n" );
225 }
226 
227 
229 {
230  int hash = 0;
231  std::vector< wxString > libNames = GetLogicalLibs();
232 
233  for( auto libName : libNames )
234  {
235  const SYMBOL_LIB_TABLE_ROW* row = FindRow( libName );
236 
237  if( !row || !row->plugin )
238  {
239  wxFAIL;
240  continue;
241  }
242 
243  hash += row->plugin->GetModifyHash();
244  }
245 
246  hash += m_modifyHash;
247 
248  return hash;
249 }
250 
251 
252 size_t SYMBOL_LIB_TABLE::GetSymbolCount( const wxString& aNickname )
253 {
254  SYMBOL_LIB_TABLE_ROW* row = dynamic_cast< SYMBOL_LIB_TABLE_ROW* >( findRow( aNickname ) );
255  wxCHECK( row && row->plugin, 0 );
256 
257  return row->plugin->GetSymbolLibCount( row->GetFullURI( true ) );
258 }
259 
260 
261 void SYMBOL_LIB_TABLE::EnumerateSymbolLib( const wxString& aNickname, wxArrayString& aAliasNames,
262  bool aPowerSymbolsOnly )
263 {
264  SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
265  wxCHECK( row && row->plugin, /* void */ );
266 
267  wxString options = row->GetOptions();
268 
269  if( aPowerSymbolsOnly )
270  row->SetOptions( row->GetOptions() + " " + PropPowerSymsOnly );
271 
272  row->plugin->EnumerateSymbolLib( aAliasNames, row->GetFullURI( true ), row->GetProperties() );
273 
274  if( aPowerSymbolsOnly )
275  row->SetOptions( options );
276 }
277 
278 
279 SYMBOL_LIB_TABLE_ROW* SYMBOL_LIB_TABLE::FindRow( const wxString& aNickname )
280 
281 {
282  SYMBOL_LIB_TABLE_ROW* row = dynamic_cast< SYMBOL_LIB_TABLE_ROW* >( findRow( aNickname ) );
283 
284  if( !row )
285  {
286  wxString msg = wxString::Format(
287  _( "sym-lib-table files contain no library with nickname '%s'" ),
288  GetChars( aNickname ) );
289 
290  THROW_IO_ERROR( msg );
291  }
292 
293  // We've been 'lazy' up until now, but it cannot be deferred any longer,
294  // instantiate a PLUGIN of the proper kind if it is not already in this
295  // SYMBOL_LIB_TABLE_ROW.
296  if( !row->plugin )
297  row->setPlugin( SCH_IO_MGR::FindPlugin( row->type ) );
298 
299  return row;
300 }
301 
302 
303 LIB_ALIAS* SYMBOL_LIB_TABLE::LoadSymbol( const wxString& aNickname, const wxString& aAliasName )
304 {
305  const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
306  wxCHECK( row && row->plugin, nullptr );
307 
308  LIB_ALIAS* ret = row->plugin->LoadSymbol( row->GetFullURI( true ), aAliasName,
309  row->GetProperties() );
310 
311  // The library cannot know its own name, because it might have been renamed or moved.
312  // Therefore footprints cannot know their own library nickname when residing in
313  // a symbol library.
314  // Only at this API layer can we tell the symbol about its actual library nickname.
315  if( ret )
316  {
317  // remove "const"-ness, I really do want to set nickname without
318  // having to copy the LIB_ID and its two strings, twice each.
319  LIB_ID& id = (LIB_ID&) ret->GetPart()->GetLibId();
320 
321  id.SetLibNickname( row->GetNickName() );
322  }
323 
324  return ret;
325 }
326 
327 
329  const LIB_PART* aSymbol, bool aOverwrite )
330 {
331  const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
332  wxCHECK( row && row->plugin, SAVE_SKIPPED );
333 
334  if( !aOverwrite )
335  {
336  // Try loading the footprint to see if it already exists, caller wants overwrite
337  // protection, which is atypical, not the default.
338 
339  wxString name = aSymbol->GetLibId().GetLibItemName();
340 
341  std::unique_ptr< LIB_ALIAS > symbol( row->plugin->LoadSymbol( row->GetFullURI( true ),
342  name,
343  row->GetProperties() ) );
344 
345  if( symbol.get() )
346  return SAVE_SKIPPED;
347  }
348 
349  row->plugin->SaveSymbol( row->GetFullURI( true ), aSymbol, row->GetProperties() );
350 
351  return SAVE_OK;
352 }
353 
354 
355 void SYMBOL_LIB_TABLE::DeleteSymbol( const wxString& aNickname, const wxString& aSymbolName )
356 {
357  const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
358  wxCHECK( row && row->plugin, /* void */ );
359  return row->plugin->DeleteSymbol( row->GetFullURI( true ), aSymbolName,
360  row->GetProperties() );
361 }
362 
363 
364 void SYMBOL_LIB_TABLE::DeleteAlias( const wxString& aNickname, const wxString& aAliasName )
365 {
366  const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
367  wxCHECK( row && row->plugin, /* void */ );
368  return row->plugin->DeleteAlias( row->GetFullURI( true ), aAliasName,
369  row->GetProperties() );
370 }
371 
372 
373 bool SYMBOL_LIB_TABLE::IsSymbolLibWritable( const wxString& aNickname )
374 {
375  const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
376  wxCHECK( row && row->plugin, false );
377  return row->plugin->IsSymbolLibWritable( row->GetFullURI( true ) );
378 }
379 
380 
381 void SYMBOL_LIB_TABLE::DeleteSymbolLib( const wxString& aNickname )
382 {
383  const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
384  wxCHECK( row && row->plugin, /* void */ );
385  row->plugin->DeleteSymbolLib( row->GetFullURI( true ), row->GetProperties() );
386 }
387 
388 
389 void SYMBOL_LIB_TABLE::CreateSymbolLib( const wxString& aNickname )
390 {
391  const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname );
392  wxCHECK( row && row->plugin, /* void */ );
393  row->plugin->CreateSymbolLib( row->GetFullURI( true ), row->GetProperties() );
394 }
395 
396 
398 {
399  wxString nickname = aLibId.GetLibNickname();
400  wxString name = aLibId.GetLibItemName();
401 
402  if( nickname.size() )
403  {
404  return LoadSymbol( nickname, name );
405  }
406 
407  // nickname is empty, sequentially search (alphabetically) all libs/nicks for first match:
408  else
409  {
410  std::vector<wxString> nicks = GetLogicalLibs();
411 
412  // Search each library going through libraries alphabetically.
413  for( unsigned i = 0; i < nicks.size(); ++i )
414  {
415  // FootprintLoad() returns NULL on not found, does not throw exception
416  // unless there's an IO_ERROR.
417  LIB_ALIAS* ret = LoadSymbol( nicks[i], name );
418 
419  if( ret )
420  return ret;
421  }
422 
423  return NULL;
424  }
425 }
426 
427 
429 {
430  return "KICAD_SYMBOL_DIR";
431 }
432 
433 
435 {
436  bool tableExists = true;
437  wxFileName fn = GetGlobalTableFileName();
438 
439  if( !fn.FileExists() )
440  {
441  tableExists = false;
442 
443  if( !fn.DirExists() && !fn.Mkdir( 0x777, wxPATH_MKDIR_FULL ) )
444  {
445  THROW_IO_ERROR( wxString::Format( _( "Cannot create global library table path '%s'." ),
446  GetChars( fn.GetPath() ) ) );
447  }
448 
449  // Attempt to copy the default global file table from the KiCad
450  // template folder to the user's home configuration path.
451  wxString fileName = Kiface().KifaceSearch().FindValidPath( global_tbl_name );
452 
453  // The fallback is to create an empty global symbol table for the user to populate.
454  if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) )
455  {
456  SYMBOL_LIB_TABLE emptyTable;
457 
458  emptyTable.Save( fn.GetFullPath() );
459  }
460  }
461 
462  aTable.Load( fn.GetFullPath() );
463 
464  return tableExists;
465 }
466 
467 
469 {
470  wxFileName fn;
471 
472  fn.SetPath( GetKicadConfigPath() );
473  fn.SetName( global_tbl_name );
474 
475  return fn.GetFullPath();
476 }
477 
478 
480 {
481  return global_tbl_name;
482 }
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...
LIB_TABLE_T::T CurTok()
Function CurTok returns whatever NextTok() returned the last time it was called.
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
T
enum T contains all this lexer's tokens.
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.
void Unexpected(int aTok)
Function Unexpected throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:369
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...
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")
Class LIB_ID.
Definition: lib_id.h:56
wxString FromUTF8()
Function FromUTF8 returns the current token text as a wxString, assuming that the input byte stream i...
Definition: dsnlexer.h:498
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 'non-library' files.
Definition: kiface_i.h:127
virtual int GetModifyHash() const =0
Return the modification hash from the library cache.
void NeedLEFT()
Function NeedLEFT calls NextTok() and then verifies that the token read in is a DSN_LEFT.
Definition: dsnlexer.cpp:393
static bool LoadGlobalTable(SYMBOL_LIB_TABLE &aTable)
Load the global symbol library table into aTable.
LIB_TABLE_T::T NeedSYMBOLorNUMBER()
Function NeedSYMBOLorNUMBER calls NextTok() and then verifies that the token read in satisfies bool I...
const UTF8 & GetLibItemName() const
Function GetLibItemName.
Definition: lib_id.h:129
Class LIB_ITEM definition.
Class LIB_PART defines a library part 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 Expecting(int aTok)
Function Expecting throws an IO_ERROR exception with an input file specific error message...
Definition: dsnlexer.cpp:353
void Load(const wxString &aFileName)
Load the library table using the path defined by aFileName aFallBackTable.
wxString GetKicadConfigPath()
Function GetKicadConfigPath.
Definition: common.cpp:217
LIB_PART * GetPart() const
Function GetPart gets the shared LIB_PART.
int SetLibNickname(const UTF8 &aNickname)
Function SetLibNickname.
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
LIB_TABLE_T::T NextTok()
Function NextTok returns the next token found in the input file or T_EOF when reaching the end of fil...
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
void Duplicate(int aTok)
Function Duplicate throws an IO_ERROR exception with a message saying specifically that aTok is a dup...
Definition: dsnlexer.cpp:377
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 object...
int CurLineNumber()
Function CurLineNumber returns the current line number within my LINE_READER.
Definition: dsnlexer.h:507
The common library.
virtual bool IsSymbolLibWritable(const wxString &aLibraryPath)
Return true if the library at aLibraryPath is writable.
Definition: sch_plugin.cpp:141
const char * name
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
void NeedRIGHT()
Function NeedRIGHT calls NextTok() and then verifies that the token read in is a DSN_RIGHT.
Definition: dsnlexer.cpp:401
Class LIB_TABLE_LEXER is an automatically generated class using the TokenList2DnsLexer.cmake technology, based on keywords provided by file: /home/kicad/workspace/kicad-doxygen/common/lib_table.keywords.
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
Function GetLibNickname.
Definition: lib_id.h:108
#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...
C++ does not put enum values in separate namespaces unless the enum itself is in a separate namespace...
Manage LIB_TABLE_ROW records (rows), and can be searched based on library nickname.