KiCad PCB EDA Suite
netlist_exporter_generic.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) 1992-2013 jp.charras at wanadoo.fr
5  * Copyright (C) 2013-2017 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 1992-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 
27 
28 #include <build_version.h>
29 #include <sch_base_frame.h>
30 #include <class_library.h>
31 #include <connection_graph.h>
32 #include <refdes_utils.h>
33 
34 #include <class_library.h>
35 #include <sch_base_frame.h>
36 #include <symbol_lib_table.h>
37 
38 
39 static bool sortPinsByNumber( LIB_PIN* aPin1, LIB_PIN* aPin2 );
40 
41 bool NETLIST_EXPORTER_GENERIC::WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions )
42 {
43  // Prepare list of nets generation
44  for( unsigned ii = 0; ii < m_masterList->size(); ii++ )
45  m_masterList->GetItem( ii )->m_Flag = 0;
46 
47  // output the XML format netlist.
48  wxXmlDocument xdoc;
49 
50  xdoc.SetRoot( makeRoot( GNL_ALL ) );
51 
52  return xdoc.Save( aOutFileName, 2 /* indent bug, today was ignored by wxXml lib */ );
53 }
54 
55 
57 {
58  XNODE* xroot = node( "export" );
59 
60  xroot->AddAttribute( "version", "D" );
61 
62  if( aCtl & GNL_HEADER )
63  // add the "design" header
64  xroot->AddChild( makeDesignHeader() );
65 
66  if( aCtl & GNL_COMPONENTS )
67  xroot->AddChild( makeComponents() );
68 
69  if( aCtl & GNL_PARTS )
70  xroot->AddChild( makeLibParts() );
71 
72  if( aCtl & GNL_LIBRARIES )
73  // must follow makeGenericLibParts()
74  xroot->AddChild( makeLibraries() );
75 
76  if( aCtl & GNL_NETS )
77  xroot->AddChild( makeListOfNets() );
78 
79  return xroot;
80 }
81 
82 
85 {
86  wxString value;
87  wxString datasheet;
88  wxString footprint;
89 
90  std::map< wxString, wxString > f;
91 };
92 
93 
95 {
96  COMP_FIELDS fields;
97 
98  if( comp->GetUnitCount() > 1 )
99  {
100  // Sadly, each unit of a component can have its own unique fields. This
101  // block finds the unit with the lowest number having a non blank field
102  // value and records it. Therefore user is best off setting fields
103  // into only the first unit. But this scavenger algorithm will find
104  // any non blank fields in all units and use the first non-blank field
105  // for each unique field name.
106 
107  wxString ref = comp->GetRef( aSheet );
108 
109  SCH_SHEET_LIST sheetList( g_RootSheet );
110  int minUnit = comp->GetUnit();
111 
112  for( unsigned i = 0; i < sheetList.size(); i++ )
113  {
114  for( EDA_ITEM* item = sheetList[i].LastDrawList(); item; item = item->Next() )
115  {
116  if( item->Type() != SCH_COMPONENT_T )
117  continue;
118 
119  SCH_COMPONENT* comp2 = (SCH_COMPONENT*) item;
120 
121  wxString ref2 = comp2->GetRef( &sheetList[i] );
122 
123  if( ref2.CmpNoCase( ref ) != 0 )
124  continue;
125 
126  int unit = comp2->GetUnit();
127 
128  // The lowest unit number wins. User should only set fields in any one unit.
129  // remark: IsVoid() returns true for empty strings or the "~" string (empty field value)
130  if( !comp2->GetField( VALUE )->IsVoid()
131  && ( unit < minUnit || fields.value.IsEmpty() ) )
132  fields.value = comp2->GetField( VALUE )->GetText();
133 
134  if( !comp2->GetField( FOOTPRINT )->IsVoid()
135  && ( unit < minUnit || fields.footprint.IsEmpty() ) )
136  fields.footprint = comp2->GetField( FOOTPRINT )->GetText();
137 
138  if( !comp2->GetField( DATASHEET )->IsVoid()
139  && ( unit < minUnit || fields.datasheet.IsEmpty() ) )
140  fields.datasheet = comp2->GetField( DATASHEET )->GetText();
141 
142  for( int fldNdx = MANDATORY_FIELDS; fldNdx < comp2->GetFieldCount(); ++fldNdx )
143  {
144  SCH_FIELD* f = comp2->GetField( fldNdx );
145 
146  if( f->GetText().size()
147  && ( unit < minUnit || fields.f.count( f->GetName() ) == 0 ) )
148  {
149  fields.f[ f->GetName() ] = f->GetText();
150  }
151  }
152 
153  minUnit = std::min( unit, minUnit );
154  }
155  }
156 
157  }
158  else
159  {
160  fields.value = comp->GetField( VALUE )->GetText();
161  fields.footprint = comp->GetField( FOOTPRINT )->GetText();
162  fields.datasheet = comp->GetField( DATASHEET )->GetText();
163 
164  for( int fldNdx = MANDATORY_FIELDS; fldNdx < comp->GetFieldCount(); ++fldNdx )
165  {
166  SCH_FIELD* f = comp->GetField( fldNdx );
167 
168  if( f->GetText().size() )
169  fields.f[ f->GetName() ] = f->GetText();
170  }
171  }
172 
173  // Do not output field values blank in netlist:
174  if( fields.value.size() )
175  xcomp->AddChild( node( "value", fields.value ) );
176  else // value field always written in netlist
177  xcomp->AddChild( node( "value", "~" ) );
178 
179  if( fields.footprint.size() )
180  xcomp->AddChild( node( "footprint", fields.footprint ) );
181 
182  if( fields.datasheet.size() )
183  xcomp->AddChild( node( "datasheet", fields.datasheet ) );
184 
185  if( fields.f.size() )
186  {
187  XNODE* xfields;
188  xcomp->AddChild( xfields = node( "fields" ) );
189 
190  // non MANDATORY fields are output alphabetically
191  for( std::map< wxString, wxString >::const_iterator it = fields.f.begin();
192  it != fields.f.end(); ++it )
193  {
194  XNODE* xfield;
195  xfields->AddChild( xfield = node( "field", it->second ) );
196  xfield->AddAttribute( "name", it->first );
197  }
198  }
199 
200 }
201 
202 
204 {
205  XNODE* xcomps = node( "components" );
206 
207  wxString timeStamp;
208 
210 
211  SCH_SHEET_LIST sheetList( g_RootSheet );
212 
213  // Output is xml, so there is no reason to remove spaces from the field values.
214  // And XML element names need not be translated to various languages.
215 
216  for( unsigned i = 0; i < sheetList.size(); i++ )
217  {
218  for( EDA_ITEM* schItem = sheetList[i].LastDrawList(); schItem; schItem = schItem->Next() )
219  {
220  SCH_COMPONENT* comp = findNextComponent( schItem, &sheetList[i] );
221 
222  if( !comp )
223  break; // No component left
224 
225  schItem = comp;
226 
227  XNODE* xcomp; // current component being constructed
228 
229  // Output the component's elements in order of expected access frequency.
230  // This may not always look best, but it will allow faster execution
231  // under XSL processing systems which do sequential searching within
232  // an element.
233 
234  xcomps->AddChild( xcomp = node( "comp" ) );
235  xcomp->AddAttribute( "ref", comp->GetRef( &sheetList[i] ) );
236 
237  addComponentFields( xcomp, comp, &sheetList[i] );
238 
239  XNODE* xlibsource;
240  xcomp->AddChild( xlibsource = node( "libsource" ) );
241 
242  // "logical" library name, which is in anticipation of a better search
243  // algorithm for parts based on "logical_lib.part" and where logical_lib
244  // is merely the library name minus path and extension.
245  PART_SPTR part = comp->GetPartRef().lock();
246 
247  if( part )
248  xlibsource->AddAttribute( "lib", part->GetLibId().GetLibNickname() );
249 
250  // We only want the symbol name, not the full LIB_ID.
251  xlibsource->AddAttribute( "part", comp->GetLibId().GetLibItemName() );
252 
253  xlibsource->AddAttribute( "description", comp->GetDescription() );
254 
255  XNODE* xsheetpath;
256 
257  xcomp->AddChild( xsheetpath = node( "sheetpath" ) );
258  xsheetpath->AddAttribute( "names", sheetList[i].PathHumanReadable() );
259  xsheetpath->AddAttribute( "tstamps", sheetList[i].Path() );
260 
261  timeStamp.Printf( "%8.8lX", (unsigned long)comp->GetTimeStamp() );
262  xcomp->AddChild( node( "tstamp", timeStamp ) );
263  }
264  }
265 
266  return xcomps;
267 }
268 
269 
271 {
272  SCH_SCREEN* screen;
273  XNODE* xdesign = node( "design" );
274  XNODE* xtitleBlock;
275  XNODE* xsheet;
276  XNODE* xcomment;
277  wxString sheetTxt;
278  wxFileName sourceFileName;
279 
280  // the root sheet is a special sheet, call it source
281  xdesign->AddChild( node( "source", g_RootSheet->GetScreen()->GetFileName() ) );
282 
283  xdesign->AddChild( node( "date", DateAndTime() ) );
284 
285  // which Eeschema tool
286  xdesign->AddChild( node( "tool", wxString( "Eeschema " ) + GetBuildVersion() ) );
287 
288  /*
289  Export the sheets information
290  */
291  SCH_SHEET_LIST sheetList( g_RootSheet );
292 
293  for( unsigned i = 0; i < sheetList.size(); i++ )
294  {
295  screen = sheetList[i].LastScreen();
296 
297  xdesign->AddChild( xsheet = node( "sheet" ) );
298 
299  // get the string representation of the sheet index number.
300  // Note that sheet->GetIndex() is zero index base and we need to increment the
301  // number by one to make it human readable
302  sheetTxt.Printf( "%u", i + 1 );
303  xsheet->AddAttribute( "number", sheetTxt );
304  xsheet->AddAttribute( "name", sheetList[i].PathHumanReadable() );
305  xsheet->AddAttribute( "tstamps", sheetList[i].Path() );
306 
307 
308  TITLE_BLOCK tb = screen->GetTitleBlock();
309 
310  xsheet->AddChild( xtitleBlock = node( "title_block" ) );
311 
312  xtitleBlock->AddChild( node( "title", tb.GetTitle() ) );
313  xtitleBlock->AddChild( node( "company", tb.GetCompany() ) );
314  xtitleBlock->AddChild( node( "rev", tb.GetRevision() ) );
315  xtitleBlock->AddChild( node( "date", tb.GetDate() ) );
316 
317  // We are going to remove the fileName directories.
318  sourceFileName = wxFileName( screen->GetFileName() );
319  xtitleBlock->AddChild( node( "source", sourceFileName.GetFullName() ) );
320 
321  xtitleBlock->AddChild( xcomment = node( "comment" ) );
322  xcomment->AddAttribute( "number", "1" );
323  xcomment->AddAttribute( "value", tb.GetComment1() );
324 
325  xtitleBlock->AddChild( xcomment = node( "comment" ) );
326  xcomment->AddAttribute( "number", "2" );
327  xcomment->AddAttribute( "value", tb.GetComment2() );
328 
329  xtitleBlock->AddChild( xcomment = node( "comment" ) );
330  xcomment->AddAttribute( "number", "3" );
331  xcomment->AddAttribute( "value", tb.GetComment3() );
332 
333  xtitleBlock->AddChild( xcomment = node( "comment" ) );
334  xcomment->AddAttribute( "number", "4" );
335  xcomment->AddAttribute( "value", tb.GetComment4() );
336  }
337 
338  return xdesign;
339 }
340 
341 
343 {
344  XNODE* xlibs = node( "libraries" ); // auto_ptr
345 
346  for( std::set<wxString>::iterator it = m_libraries.begin(); it!=m_libraries.end(); ++it )
347  {
348  wxString libNickname = *it;
349  XNODE* xlibrary;
350 
351  if( m_libTable->HasLibrary( libNickname ) )
352  {
353  xlibs->AddChild( xlibrary = node( "library" ) );
354  xlibrary->AddAttribute( "logical", libNickname );
355  xlibrary->AddChild( node( "uri", m_libTable->GetFullURI( libNickname ) ) );
356  }
357 
358  // @todo: add more fun stuff here
359  }
360 
361  return xlibs;
362 }
363 
364 
366 {
367  XNODE* xlibparts = node( "libparts" ); // auto_ptr
368 
369  LIB_PINS pinList;
370  LIB_FIELDS fieldList;
371 
372  m_libraries.clear();
373 
374  for( std::set<LIB_PART*>::iterator it = m_LibParts.begin(); it!=m_LibParts.end(); ++it )
375  {
376  LIB_PART* lcomp = *it;
377  wxString libNickname = lcomp->GetLibId().GetLibNickname();;
378 
379  // The library nickname will be empty if the cache library is used.
380  if( !libNickname.IsEmpty() )
381  m_libraries.insert( libNickname ); // inserts component's library if unique
382 
383  XNODE* xlibpart;
384  xlibparts->AddChild( xlibpart = node( "libpart" ) );
385  xlibpart->AddAttribute( "lib", libNickname );
386  xlibpart->AddAttribute( "part", lcomp->GetName() );
387 
388  if( lcomp->GetAliasCount() )
389  {
390  wxArrayString aliases = lcomp->GetAliasNames( false );
391  if( aliases.GetCount() )
392  {
393  XNODE* xaliases = node( "aliases" );
394  xlibpart->AddChild( xaliases );
395  for( unsigned i=0; i<aliases.GetCount(); ++i )
396  {
397  xaliases->AddChild( node( "alias", aliases[i] ) );
398  }
399  }
400  }
401 
402  //----- show the important properties -------------------------
403  if( !lcomp->GetAlias( 0 )->GetDescription().IsEmpty() )
404  xlibpart->AddChild( node( "description", lcomp->GetAlias( 0 )->GetDescription() ) );
405 
406  if( !lcomp->GetAlias( 0 )->GetDocFileName().IsEmpty() )
407  xlibpart->AddChild( node( "docs", lcomp->GetAlias( 0 )->GetDocFileName() ) );
408 
409  // Write the footprint list
410  if( lcomp->GetFootprints().GetCount() )
411  {
412  XNODE* xfootprints;
413  xlibpart->AddChild( xfootprints = node( "footprints" ) );
414 
415  for( unsigned i=0; i<lcomp->GetFootprints().GetCount(); ++i )
416  {
417  xfootprints->AddChild( node( "fp", lcomp->GetFootprints()[i] ) );
418  }
419  }
420 
421  //----- show the fields here ----------------------------------
422  fieldList.clear();
423  lcomp->GetFields( fieldList );
424 
425  XNODE* xfields;
426  xlibpart->AddChild( xfields = node( "fields" ) );
427 
428  for( unsigned i=0; i<fieldList.size(); ++i )
429  {
430  if( !fieldList[i].GetText().IsEmpty() )
431  {
432  XNODE* xfield;
433  xfields->AddChild( xfield = node( "field", fieldList[i].GetText() ) );
434  xfield->AddAttribute( "name", fieldList[i].GetName(false) );
435  }
436  }
437 
438  //----- show the pins here ------------------------------------
439  pinList.clear();
440  lcomp->GetPins( pinList, 0, 0 );
441 
442  /* we must erase redundant Pins references in pinList
443  * These redundant pins exist because some pins
444  * are found more than one time when a component has
445  * multiple parts per package or has 2 representations (DeMorgan conversion)
446  * For instance, a 74ls00 has DeMorgan conversion, with different pin shapes,
447  * and therefore each pin appears 2 times in the list.
448  * Common pins (VCC, GND) can also be found more than once.
449  */
450  sort( pinList.begin(), pinList.end(), sortPinsByNumber );
451  for( int ii = 0; ii < (int)pinList.size()-1; ii++ )
452  {
453  if( pinList[ii]->GetNumber() == pinList[ii+1]->GetNumber() )
454  { // 2 pins have the same number, remove the redundant pin at index i+1
455  pinList.erase(pinList.begin() + ii + 1);
456  ii--;
457  }
458  }
459 
460  if( pinList.size() )
461  {
462  XNODE* pins;
463 
464  xlibpart->AddChild( pins = node( "pins" ) );
465  for( unsigned i=0; i<pinList.size(); ++i )
466  {
467  XNODE* pin;
468 
469  pins->AddChild( pin = node( "pin" ) );
470  pin->AddAttribute( "num", pinList[i]->GetNumber() );
471  pin->AddAttribute( "name", pinList[i]->GetName() );
472  pin->AddAttribute( "type", pinList[i]->GetCanonicalElectricalTypeName() );
473 
474  // caution: construction work site here, drive slowly
475  }
476  }
477  }
478 
479  return xlibparts;
480 }
481 
482 
484 {
485  XNODE* xnets = node( "nets" ); // auto_ptr if exceptions ever get used.
486  wxString netCodeTxt;
487  wxString netName;
488  wxString ref;
489 
490  XNODE* xnet = 0;
491  int netCode;
492  int lastNetCode = -1;
493  int sameNetcodeCount = 0;
494 
495 
496  /* output:
497  <net code="123" name="/cfcard.sch/WAIT#">
498  <node ref="R23" pin="1"/>
499  <node ref="U18" pin="12"/>
500  </net>
501  */
502 
503  m_LibParts.clear(); // must call this function before using m_LibParts.
504 
505  if( aUseGraph )
506  {
507  wxASSERT( m_graph );
508 
509  for( const auto& it : m_graph->m_net_code_to_subgraphs_map )
510  {
511  bool added = false;
512 
513  auto code = it.first;
514  auto subgraphs = it.second;
515  auto net_name = subgraphs[0]->GetNetName();
516 
517  XNODE* xnode;
518 
519  for( auto subgraph : subgraphs )
520  {
521  auto sheet = subgraph->m_sheet;
522 
523  for( auto item : subgraph->m_items )
524  {
525  if( item->Type() == SCH_PIN_T )
526  {
527  auto pin = static_cast<SCH_PIN*>( item );
528 
529  auto refText = pin->GetParentComponent()->GetRef( &sheet );
530  auto pinText = pin->GetNumber();
531 
532  // Skip power symbols and virtual components
533  if( refText[0] == wxChar( '#' ) )
534  continue;
535 
536  if( !added )
537  {
538  xnets->AddChild( xnet = node( "net" ) );
539  netCodeTxt.Printf( "%d", code );
540  xnet->AddAttribute( "code", netCodeTxt );
541  xnet->AddAttribute( "name", net_name );
542 
543  added = true;
544  }
545 
546  xnet->AddChild( xnode = node( "node" ) );
547  xnode->AddAttribute( "ref", refText );
548  xnode->AddAttribute( "pin", pinText );
549  }
550  }
551  }
552  }
553  }
554  else
555  {
556  for( unsigned ii = 0; ii < m_masterList->size(); ii++ )
557  {
558  NETLIST_OBJECT* nitem = m_masterList->GetItem( ii );
559  SCH_COMPONENT* comp;
560 
561  // New net found, write net id;
562  if( ( netCode = nitem->GetNet() ) != lastNetCode )
563  {
564  sameNetcodeCount = 0; // item count for this net
565  netName = nitem->GetNetName();
566  lastNetCode = netCode;
567  }
568 
569  if( nitem->m_Type != NET_PIN )
570  continue;
571 
572  if( nitem->m_Flag != 0 ) // Redundant pin, skip it
573  continue;
574 
575  comp = nitem->GetComponentParent();
576 
577  // Get the reference for the net name and the main parent component
578  ref = comp->GetRef( &nitem->m_SheetPath );
579  if( ref[0] == wxChar( '#' ) )
580  continue;
581 
582  if( ++sameNetcodeCount == 1 )
583  {
584  xnets->AddChild( xnet = node( "net" ) );
585  netCodeTxt.Printf( "%d", netCode );
586  xnet->AddAttribute( "code", netCodeTxt );
587  xnet->AddAttribute( "name", netName );
588  }
589 
590  XNODE* xnode;
591  xnet->AddChild( xnode = node( "node" ) );
592  xnode->AddAttribute( "ref", ref );
593  xnode->AddAttribute( "pin", nitem->GetPinNumText() );
594  }
595  }
596 
597  return xnets;
598 }
599 
600 
601 XNODE* NETLIST_EXPORTER_GENERIC::node( const wxString& aName, const wxString& aTextualContent /* = wxEmptyString*/ )
602 {
603  XNODE* n = new XNODE( wxXML_ELEMENT_NODE, aName );
604 
605  if( aTextualContent.Len() > 0 ) // excludes wxEmptyString, the parameter's default value
606  n->AddChild( new XNODE( wxXML_TEXT_NODE, wxEmptyString, aTextualContent ) );
607 
608  return n;
609 }
610 
611 
612 static bool sortPinsByNumber( LIB_PIN* aPin1, LIB_PIN* aPin2 )
613 {
614  // return "lhs < rhs"
615  return UTIL::RefDesStringCompare( aPin1->GetNumber(), aPin2->GetNumber() ) < 0;
616 }
Class SCH_SHEET_LIST.
bool WriteNetlist(const wxString &aOutFileName, unsigned aNetlistOptions) override
Function WriteNetlist writes to specified output file.
Class SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
const wxString & GetFileName() const
Definition: sch_screen.h:124
SCH_COMPONENT * GetComponentParent() const
For Pins (NET_PINS):
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
PART_REF & GetPartRef()
name of datasheet
XNODE * makeComponents()
Function makeComponents.
UNIQUE_STRINGS m_ReferencesAlreadyFound
Used for "multi parts per package" components, avoids processing a lib component more than once.
XNODE * node(const wxString &aName, const wxString &aTextualContent=wxEmptyString)
Function node is a convenience function that creates a new XNODE with an optional textual child.
LIB_ALIAS * GetAlias(size_t aIndex)
XNODE * makeListOfNets(bool aUseGraph=true)
Function makeListOfNets fills out an XML node with a list of nets and returns it.
const wxString GetText() const override
Function GetText returns the string associated with the text object.
Definition: sch_field.cpp:105
int GetNet() const
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
int GetUnitCount() const
Return the number of units per package of the symbol.
Collection of utility functions for component reference designators (refdes)
const wxString & GetComment4() const
Definition: title_block.h:124
const TITLE_BLOCK & GetTitleBlock() const
Definition: sch_screen.h:129
wxString GetDescription() const
Return information about the aliased parts.
SCH_SHEET_PATH m_SheetPath
void Clear()
Function Clear erases the record.
SCH_COMPONENT * findNextComponent(EDA_ITEM *aItem, SCH_SHEET_PATH *aSheetPath)
NETLIST_ITEM_T m_Type
std::map< int, std::vector< CONNECTION_SUBGRAPH * > > m_net_code_to_subgraphs_map
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:268
Class TITLE_BLOCK holds the information shown in the lower right corner of a plot,...
Definition: title_block.h:40
NETLIST_OBJECT_LIST * m_masterList
Field Name Module PCB, i.e. "16DIP300".
bool IsVoid() const
Function IsVoid returns true if the field is either empty or holds "~".
Definition: sch_field.cpp:299
const wxString & GetDocFileName() const
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
int RefDesStringCompare(const wxString &aFirst, const wxString &aSecond)
Acts just like the strcmp function but treats numbers within the string text correctly for sorting.
XNODE * makeRoot(int aCtl=GNL_ALL)
Function makeGenericRoot builds the entire document tree for the generic export.
std::set< LIB_PART *, LIB_PART_LESS_THAN > m_LibParts
unique library parts used. LIB_PART items are sorted by names
wxArrayString GetAliasNames(bool aIncludeRoot=true) const
std::set< wxString > m_libraries
Set of library nicknames.
#define VALUE
int GetUnit() const
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:56
void addComponentFields(XNODE *xcomp, SCH_COMPONENT *comp, SCH_SHEET_PATH *aSheet)
wxString GetBuildVersion()
Function GetBuildVersion Return the build version string.
const wxString & GetRevision() const
Definition: title_block.h:89
wxString GetFullURI(const wxString &aLibNickname, bool aExpandEnvVars=true) const
Return the full URI of the library mapped to aLibNickname.
std::shared_ptr< LIB_PART > PART_SPTR
shared pointer to LIB_PART
const wxString & GetCompany() const
Definition: title_block.h:99
XNODE * makeDesignHeader()
Function makeDesignHeader fills out a project "design" header into an XML node.
const wxString & GetComment3() const
Definition: title_block.h:123
const LIB_ID & GetLibId() const
Define a library symbol object.
Holder for multi-unit component fields.
timestamp_t GetTimeStamp() const
Definition: base_struct.h:210
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
wxString GetText(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:33
Class SCH_SHEET_PATH.
const wxString GetRef(const SCH_SHEET_PATH *aSheet)
Return the reference for the given sheet path.
wxArrayString & GetFootprints()
const wxString & GetPinNumText() const
Function GetPinNum returns a pin number in wxString form.
int GetFieldCount() const
Return the number of fields in this symbol.
Class XNODE holds an XML or S-expression element.
Definition: xnode.h:43
const wxString & GetDescription() override
const wxString & GetDate() const
Definition: title_block.h:79
const wxString & GetNumber() const
Definition: lib_pin.h:178
const wxString & GetComment2() const
Definition: title_block.h:122
NETLIST_OBJECT * GetItem(unsigned aIdx) const
Acces to an item in list.
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
Definition: lib_draw_item.h:61
const wxString & GetName() const
const wxString & GetComment1() const
Definition: title_block.h:121
wxString GetNetName(bool adoptTimestamp=false) const
Function GetNetName.
std::vector< LIB_FIELD > LIB_FIELDS
Definition: lib_field.h:250
wxString GetName(bool aUseDefaultName=true) const
Function GetName returns the field name.
Definition: sch_field.cpp:427
size_t i
Definition: json11.cpp:597
#define GNL_ALL
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:73
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157
XNODE * makeLibraries()
Function makeLibraries fills out an XML node with a list of used libraries and returns it.
std::map< wxString, wxString > f
const wxString & GetTitle() const
Definition: title_block.h:65
size_t GetAliasCount() const
Definition for part library class.
static bool sortPinsByNumber(LIB_PIN *aPin1, LIB_PIN *aPin2)
const LIB_ID & GetLibId() const
wxString DateAndTime()
Definition: string.cpp:333
void GetFields(LIB_FIELDS &aList)
Return a list of fields within this part.
#define min(a, b)
Definition: auxiliary.h:85
XNODE * makeLibParts()
Function makeLibParts fills out an XML node with the unique library parts and returns it.