KiCad PCB EDA Suite
eagle_parser.h
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) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
5  * Copyright (C) 2012-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  * Copyright (C) 2017 CERN
7  *
8  * @author Alejandro GarcĂ­a Montoro <alejandro.garciamontoro@gmail.com>
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, you may find one here:
22  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
23  * or you may search the http://www.gnu.org website for the version 2 license,
24  * or you may write to the Free Software Foundation, Inc.,
25  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26  */
27 
28 
29 #ifndef _EAGLE_PARSER_H_
30 #define _EAGLE_PARSER_H_
31 
32 #include <map>
33 #include <memory>
34 #include <unordered_map>
35 
36 #include <wx/xml/xml.h>
37 #include <wx/string.h>
38 #include <wx/filename.h>
39 
40 #include <layer_ids.h>
41 #include <trigo.h>
42 #include <core/wx_stl_compat.h>
43 
44 class FOOTPRINT;
45 struct EINSTANCE;
46 struct EPART;
47 struct ETEXT;
48 
49 typedef std::unordered_map<wxString, wxXmlNode*> NODE_MAP;
50 typedef std::map<wxString, FOOTPRINT*> FOOTPRINT_MAP;
51 typedef std::map<wxString, EINSTANCE*> EINSTANCE_MAP;
52 typedef std::map<wxString, std::unique_ptr<EPART>> EPART_MAP;
53 
55 wxString escapeName( const wxString& aNetName );
56 
57 static inline wxXmlNode* getChildrenNodes( NODE_MAP& aMap, const wxString& aName )
58 {
59  auto it = aMap.find( aName );
60  return it == aMap.end() ? nullptr : it->second->GetChildren();
61 }
62 
63 
68 struct XML_PARSER_ERROR : std::runtime_error
69 {
76  XML_PARSER_ERROR( const wxString& aMessage ) noexcept :
77  std::runtime_error( "XML parser failed - " + aMessage.ToStdString() )
78  {}
79 };
80 
81 
83 struct TRIPLET
84 {
85  const char* element;
86  const char* attribute;
87  const char* value;
88 
89  TRIPLET( const char* aElement, const char* aAttribute = "", const char* aValue = "" ) :
90  element( aElement ),
91  attribute( aAttribute ),
92  value( aValue )
93  {}
94 };
95 
96 
110 class XPATH
111 {
112  std::vector<TRIPLET> p;
113 
114 public:
115  void push( const char* aPathSegment, const char* aAttribute="" )
116  {
117  p.emplace_back( aPathSegment, aAttribute );
118  }
119 
120  void clear() { p.clear(); }
121 
122  void pop() { p.pop_back(); }
123 
125  void Value( const char* aValue )
126  {
127  p.back().value = aValue;
128  }
129 
131  void Attribute( const char* aAttribute )
132  {
133  p.back().attribute = aAttribute;
134  }
135 
137  wxString Contents()
138  {
139  typedef std::vector<TRIPLET>::const_iterator CITER_TRIPLET;
140 
141  wxString ret;
142 
143  for( CITER_TRIPLET it = p.begin(); it != p.end(); ++it )
144  {
145  if( it != p.begin() )
146  ret += '.';
147 
148  ret += it->element;
149 
150  if( it->attribute[0] && it->value[0] )
151  {
152  ret += '[';
153  ret += it->attribute;
154  ret += '=';
155  ret += it->value;
156  ret += ']';
157  }
158  }
159 
160  return ret;
161  }
162 };
163 
164 
172 template<typename T>
173 T Convert( const wxString& aValue )
174 {
175  throw XML_PARSER_ERROR( "Conversion failed. Unknown type." );
176 }
177 
178 template <>
179 wxString Convert<wxString>( const wxString& aValue );
180 
187 template <typename T>
189 {
190 private:
193 
196 
197 public:
202  m_isAvailable( false ),
203  m_data( T() )
204  {}
205 
211  OPTIONAL_XML_ATTRIBUTE( const wxString& aData )
212  {
213  m_data = T();
214  m_isAvailable = !aData.IsEmpty();
215 
216  if( m_isAvailable )
217  Set( aData );
218  }
219 
224  template<typename V = T>
226  m_isAvailable( true ),
227  m_data( aData )
228  {}
229 
233  operator bool() const
234  {
235  return m_isAvailable;
236  }
237 
244  OPTIONAL_XML_ATTRIBUTE<T>& operator =( const wxString& aData )
245  {
246  m_isAvailable = !aData.IsEmpty();
247 
248  if( m_isAvailable )
249  Set( aData );
250 
251  return *this;
252  }
253 
261  {
262  m_data = aData;
263  m_isAvailable = true;
264 
265  return *this;
266  }
267 
271  bool operator ==( const T& aOther ) const
272  {
273  return m_isAvailable && ( aOther == m_data );
274  }
275 
281  void Set( const wxString& aString )
282  {
283  m_data = Convert<T>( aString );
284  m_isAvailable = !aString.IsEmpty();
285  }
286 
292  T& Get()
293  {
294  assert( m_isAvailable );
295  return m_data;
296  }
297 
303  const T& CGet() const
304  {
305  assert( m_isAvailable );
306  return m_data;
307  }
308 
315  {
316  return Get();
317  }
318 
324  const T& operator*() const
325  {
326  return CGet();
327  }
328 
335  {
336  return &Get();
337  }
338 
344  const T* operator->() const
345  {
346  return &CGet();
347  }
348 };
349 
350 
358 NODE_MAP MapChildren( wxXmlNode* aCurrentNode );
359 
361 wxPoint ConvertArcCenter( const wxPoint& aStart, const wxPoint& aEnd, double aAngle );
362 
363 // Pre-declare for typedefs
364 struct EROT;
365 struct ECOORD;
372 
373 
374 // All of the 'E'STRUCTS below merely hold Eagle XML information verbatim, in binary.
375 // For maintenance and troubleshooting purposes, it was thought that we'd need to
376 // separate the conversion process into distinct steps. There is no intent to have KiCad
377 // forms of information in these 'E'STRUCTS. They are only binary forms
378 // of the Eagle information in the corresponding Eagle XML nodes.
379 
380 // Eagle coordinates
381 struct ECOORD
382 {
384  {
389  };
390 
392  long long int value;
393 
395  static constexpr EAGLE_UNIT ECOORD_UNIT = EU_NM;
396 
398  : value( 0 )
399  {
400  }
401 
402  ECOORD( int aValue, enum EAGLE_UNIT aUnit )
403  : value( ConvertToNm( aValue, aUnit ) )
404  {
405  }
406 
407  ECOORD( const wxString& aValue, enum EAGLE_UNIT aUnit );
408 
409  int ToMils() const
410  {
411  return value / 25400;
412  }
413 
414  int To100NanoMeters() const
415  {
416  return value / 100;
417  }
418 
419  int ToNanoMeters() const
420  {
421  return value;
422  }
423 
424  float ToMm() const
425  {
426  return value / 1000000.0;
427  }
428 
429  int ToSchUnits() const { return To100NanoMeters(); }
430  int ToPcbUnits() const { return ToNanoMeters(); }
431 
432  ECOORD operator+( const ECOORD& aOther ) const
433  {
434  return ECOORD( value + aOther.value, ECOORD_UNIT );
435  }
436 
437  ECOORD operator-( const ECOORD& aOther ) const
438  {
439  return ECOORD( value - aOther.value, ECOORD_UNIT );
440  }
441 
442  bool operator==( const ECOORD& aOther ) const
443  {
444  return value == aOther.value;
445  }
446 
448  static long long int ConvertToNm( int aValue, enum EAGLE_UNIT aUnit );
449 };
450 
451 
453 struct ENET
454 {
455  int netcode;
456  wxString netname;
457 
458  ENET( int aNetCode, const wxString& aNetName ) :
459  netcode( aNetCode ),
460  netname( aNetName )
461  {}
462 
463  ENET() :
464  netcode( 0 )
465  {}
466 };
467 
468 
470 struct EROT
471 {
472  bool mirror;
473  bool spin;
474  double degrees;
475 
476  EROT() :
477  mirror( false ),
478  spin( false ),
479  degrees( 0 )
480  {}
481 
482  EROT( double aDegrees ) :
483  mirror( false ),
484  spin( false ),
485  degrees( aDegrees )
486  {}
487 };
488 
489 
491 struct EWIRE
492 {
499 
500  // for style: (continuous | longdash | shortdash | dashdot)
501  enum {
506  };
509 
510  // for cap: (flat | round)
511  enum {
514  };
516 
517  EWIRE( wxXmlNode* aWire );
518 };
519 
520 
522 struct EJUNCTION
523 {
526 
527  EJUNCTION( wxXmlNode* aJunction);
528 };
529 
530 
532 struct ELABEL
533 {
540  wxString netname;
541 
542  ELABEL( wxXmlNode* aLabel, const wxString& aNetName );
543 };
544 
545 
547 struct EVIA
548 {
556 
557  EVIA( wxXmlNode* aVia );
558 };
559 
560 
562 struct ECIRCLE
563 {
569 
570  ECIRCLE( wxXmlNode* aCircle );
571 };
572 
573 
575 struct ERECT
576 {
581  int layer;
583 
584  ERECT( wxXmlNode* aRect );
585 };
586 
587 
594 struct EATTR
595 {
596  wxString name;
604 
605  enum { // for 'display'
610  };
613 
614  EATTR( wxXmlNode* aTree );
615  EATTR() {}
616 };
617 
618 
621 {
628  int layer;
629 
631 
632  EDIMENSION( wxXmlNode* aDimension );
633 };
634 
635 
637 struct ETEXT
638 {
639  wxString text;
643  int layer;
647 
648  enum { // for align
654 
655  // opposites are -1 x above, used by code tricks in here
660  };
661 
663 
664  ETEXT( wxXmlNode* aText );
665 
667  wxSize ConvertSize() const;
668 };
669 
670 
674 struct EFRAME
675 {
680  int columns;
681  int rows;
682  int layer;
687 
688  EFRAME( wxXmlNode* aFrameNode );
689 };
690 
691 
694 {
695  wxString name;
700 
701  EPAD_COMMON( wxXmlNode* aPad );
702 };
703 
704 
706 struct EPAD : public EPAD_COMMON
707 {
710 
711  // for shape: (square | round | octagon | long | offset)
712  enum {
713  UNDEF = -1,
719  };
722 
723  EPAD( wxXmlNode* aPad );
724 };
725 
726 
728 struct ESMD : public EPAD_COMMON
729 {
732  int layer;
735 
736  ESMD( wxXmlNode* aSMD );
737 };
738 
739 
741 struct EPIN
742 {
743  wxString name;
746 
750  opt_wxString function;
753 
754  EPIN( wxXmlNode* aPin );
755 };
756 
757 
759 struct EVERTEX
760 {
764 
765  EVERTEX( wxXmlNode* aVertex );
766 };
767 
768 
770 struct EPOLYGON
771 {
773  int layer;
775 
776  // KiCad priority is opposite of Eagle rank, that is:
777  // - Eagle Low rank drawn first
778  // - KiCad high priority drawn first
779  // So since Eagle has an upper limit we define this, used for the cases
780  // where no rank is specified.
781  static const int max_priority = 6;
782 
783  enum { // for pour
787  };
788  int pour;
793 
794  EPOLYGON( wxXmlNode* aPolygon );
795 };
796 
797 
799 struct EHOLE
800 {
804 
805  EHOLE( wxXmlNode* aHole );
806 };
807 
808 
810 struct EELEMENT
811 {
812  wxString name;
813  wxString library;
814  wxString package;
815  wxString value;
821 
822  EELEMENT( wxXmlNode* aElement );
823 };
824 
825 
826 struct ELAYER
827 {
828  int number;
829  wxString name;
830  int color;
831  int fill;
834 
835  ELAYER( wxXmlNode* aLayer );
836 };
837 
838 
840 {
841  enum
842  {
843  TOP = 1,
844  ROUTE2 = 2,
845  ROUTE3 = 3,
846  ROUTE4 = 4,
847  ROUTE5 = 5,
848  ROUTE6 = 6,
849  ROUTE7 = 7,
850  ROUTE8 = 8,
851  ROUTE9 = 9,
852  ROUTE10 = 10,
853  ROUTE11 = 11,
854  ROUTE12 = 12,
855  ROUTE13 = 13,
856  ROUTE14 = 14,
857  ROUTE15 = 15,
858  BOTTOM = 16,
859  PADS = 17,
860  VIAS = 18,
861  UNROUTED = 19,
862  DIMENSION = 20,
863  TPLACE = 21,
864  BPLACE = 22,
865  TORIGINS = 23,
866  BORIGINS = 24,
867  TNAMES = 25,
868  BNAMES = 26,
869  TVALUES = 27,
870  BVALUES = 28,
871  TSTOP = 29,
872  BSTOP = 30,
873  TCREAM = 31,
874  BCREAM = 32,
875  TFINISH = 33,
876  BFINISH = 34,
877  TGLUE = 35,
878  BGLUE = 36,
879  TTEST = 37,
880  BTEST = 38,
881  TKEEPOUT = 39,
882  BKEEPOUT = 40,
883  TRESTRICT = 41,
884  BRESTRICT = 42,
885  VRESTRICT = 43,
886  DRILLS = 44,
887  HOLES = 45,
888  MILLING = 46,
889  MEASURES = 47,
890  DOCUMENT = 48,
893  TDOCU = 51,
894  BDOCU = 52,
895  NETS = 91,
896  BUSSES = 92,
897  PINS = 93,
898  SYMBOLS = 94,
899  NAMES = 95,
900  VALUES = 96,
901  INFO = 97,
902  GUIDE = 98,
903  USERLAYER1 = 160,
905  };
906 };
907 
908 
909 struct EPART
910 {
911  /*
912  * <!ELEMENT part (attribute*, variant*)>
913  * <!ATTLIST part
914  * name %String; #REQUIRED
915  * library %String; #REQUIRED
916  * deviceset %String; #REQUIRED
917  * device %String; #REQUIRED
918  * technology %String; ""
919  * value %String; #IMPLIED
920  * >
921  */
922 
923  wxString name;
924  wxString library;
925  wxString deviceset;
926  wxString device;
929  std::map<std::string,std::string> attribute;
930  std::map<std::string,std::string> variant;
931 
932  EPART( wxXmlNode* aPart );
933 };
934 
935 
936 struct EINSTANCE
937 {
938  /*
939  * <!ELEMENT instance (attribute)*>
940  * <!ATTLIST instance
941  * part %String; #REQUIRED
942  * gate %String; #REQUIRED
943  * x %Coord; #REQUIRED
944  * y %Coord; #REQUIRED
945  * smashed %Bool; "no"
946  * rot %Rotation; "R0"
947  * >
948  */
949 
950  wxString part;
951  wxString gate;
956 
957  EINSTANCE( wxXmlNode* aInstance );
958 };
959 
960 
961 struct EGATE
962 {
963  /*
964  * <!ELEMENT gate EMPTY>
965  * <!ATTLIST gate
966  * name %String; #REQUIRED
967  * symbol %String; #REQUIRED
968  * x %Coord; #REQUIRED
969  * y %Coord; #REQUIRED
970  * addlevel %GateAddLevel; "next"
971  * swaplevel %Int; "0"
972  * >
973  */
974 
975  wxString name;
976  wxString symbol;
977 
980 
983 
984  enum
985  {
991  };
992 
993  EGATE( wxXmlNode* aGate );
994 };
995 
996 
997 struct ECONNECT
998 {
999  /*
1000  * <!ELEMENT connect EMPTY>
1001  * <!ATTLIST connect
1002  * gate %String; #REQUIRED
1003  * pin %String; #REQUIRED
1004  * pad %String; #REQUIRED
1005  * route %ContactRoute; "all"
1006  * >
1007  */
1008  wxString gate;
1009  wxString pin;
1010  wxString pad;
1011  //int contactroute; // TODO
1012 
1013  ECONNECT( wxXmlNode* aConnect );
1014 };
1015 
1016 
1017 struct EDEVICE
1018 {
1019  /*
1020  * <!ELEMENT device (connects?, technologies?)>
1021  * <!ATTLIST device
1022  * name %String; ""
1023  * package %String; #IMPLIED
1024  * >
1025  */
1026  wxString name;
1028 
1029  std::vector<ECONNECT> connects;
1030 
1031  EDEVICE( wxXmlNode* aDevice );
1032 };
1033 
1034 
1036 {
1037  /*
1038  <!ELEMENT deviceset (description?, gates, devices)>
1039  <!ATTLIST deviceset
1040  name %String; #REQUIRED
1041  prefix %String; ""
1042  uservalue %Bool; "no"
1043  >
1044  */
1045 
1046  wxString name;
1049  //std::vector<EDEVICE> devices;
1050  //std::vector<EGATE> gates;
1051 
1052 
1053  EDEVICE_SET( wxXmlNode* aDeviceSet );
1054 };
1055 
1056 
1057 struct ECLASS
1058 {
1059  wxString number;
1060  wxString name;
1061  std::map<wxString, ECOORD> clearanceMap;
1062 
1063  ECLASS( wxXmlNode* aClass );
1064 };
1065 
1066 
1067 #endif // _EAGLE_PARSER_H_
void Set(const wxString &aString)
Attempt to convert a string to the base type.
Definition: eagle_parser.h:281
wxString name
wxString Contents()
return the contents of the XPATH as a single string
Definition: eagle_parser.h:137
Eagle vertex.
Definition: eagle_parser.h:759
int To100NanoMeters() const
Definition: eagle_parser.h:414
Eagle rotation.
Definition: eagle_parser.h:470
wxString deviceset
Definition: eagle_parser.h:925
Eagle Junction.
Definition: eagle_parser.h:522
bool mirror
Definition: eagle_parser.h:472
opt_double curve
range is -359.9..359.9
Definition: eagle_parser.h:508
ECOORD x
Definition: eagle_parser.h:744
wxString pad
wxString Convert< wxString >(const wxString &aValue)
opt_int rank
Definition: eagle_parser.h:792
wxString part
Definition: eagle_parser.h:950
int ToSchUnits() const
Definition: eagle_parser.h:429
wxString name
Definition: eagle_parser.h:923
OPTIONAL_XML_ATTRIBUTE< T > & operator=(const wxString &aData)
Assign to a string (optionally) containing the data.
Definition: eagle_parser.h:244
int ToNanoMeters() const
Definition: eagle_parser.h:419
ECOORD x
Definition: eagle_parser.h:534
opt_ecoord diam
Definition: eagle_parser.h:554
opt_wxString technology
Definition: eagle_parser.h:927
wxString library
Definition: eagle_parser.h:924
opt_wxString direction
Definition: eagle_parser.h:749
void clear()
Definition: eagle_parser.h:120
opt_erot rot
Definition: eagle_parser.h:538
float ToMm() const
Definition: eagle_parser.h:424
opt_int cap
Definition: eagle_parser.h:515
ECOORD operator-(const ECOORD &aOther) const
Definition: eagle_parser.h:437
opt_bool border_bottom
Definition: eagle_parser.h:686
const T & CGet() const
Return a constant reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:303
ECLASS(wxXmlNode *aClass)
T & operator *()
Return a reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:314
ECOORD drill
< inclusive
Definition: eagle_parser.h:553
T & Get()
Return a reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:292
opt_wxString shape
Definition: eagle_parser.h:555
ECOORD y
Definition: eagle_parser.h:762
void push(const char *aPathSegment, const char *aAttribute="")
Definition: eagle_parser.h:115
opt_bool border_left
Definition: eagle_parser.h:683
Eagle element element.
Definition: eagle_parser.h:810
Keep track of what we are working on within a PTREE.
Definition: eagle_parser.h:110
ECOORD x2
Definition: eagle_parser.h:579
static const int max_priority
Definition: eagle_parser.h:781
opt_double ratio
Definition: eagle_parser.h:645
opt_bool visible
Definition: eagle_parser.h:832
void Attribute(const char *aAttribute)
modify the last path node's attribute
Definition: eagle_parser.h:131
int number
Definition: eagle_parser.h:828
OPTIONAL_XML_ATTRIBUTE()
Construct a default OPTIONAL_XML_ATTRIBUTE, whose data is not available.
Definition: eagle_parser.h:201
opt_wxString xref
Definition: eagle_parser.h:539
opt_erot rot
Definition: eagle_parser.h:820
wxString gate
ECOORD width
Definition: eagle_parser.h:497
opt_bool thermals
Definition: eagle_parser.h:791
int LAYER_NUM
This can be replaced with int and removed.
Definition: layer_ids.h:41
opt_bool smashed
Definition: eagle_parser.h:819
bool operator==(const ECOORD &aOther) const
Converts a size expressed in a certain unit to nanometers.
Definition: eagle_parser.h:442
std::map< std::string, std::string > variant
Definition: eagle_parser.h:930
OPTIONAL_XML_ATTRIBUTE(T aData)
Definition: eagle_parser.h:225
wxString name
Definition: eagle_parser.h:695
const char * element
Definition: eagle_parser.h:85
wxPoint ConvertArcCenter(const wxPoint &aStart, const wxPoint &aEnd, double aAngle)
opt_erot rot
Definition: eagle_parser.h:582
double degrees
Definition: eagle_parser.h:474
ECOORD width
Definition: eagle_parser.h:772
ECOORD x
Definition: eagle_parser.h:952
Eagle SMD pad.
Definition: eagle_parser.h:728
ECOORD y
Definition: eagle_parser.h:565
ECOORD x1
Definition: eagle_parser.h:676
ECOORD operator+(const ECOORD &aOther) const
Definition: eagle_parser.h:432
ECOORD y1
Definition: eagle_parser.h:677
ECOORD y
Definition: eagle_parser.h:817
ECOORD y
Definition: eagle_parser.h:525
Eagle hole element.
Definition: eagle_parser.h:799
Implement a simple wrapper around runtime_error to isolate the errors thrown by the Eagle XML parser.
Definition: eagle_parser.h:68
OPTIONAL_XML_ATTRIBUTE< int > opt_int
Definition: eagle_parser.h:367
wxString netname
Definition: eagle_parser.h:540
Eagle text element.
Definition: eagle_parser.h:637
int layer
Definition: eagle_parser.h:682
opt_erot rot
Definition: eagle_parser.h:603
ELAYER(wxXmlNode *aLayer)
opt_bool thermals
Definition: eagle_parser.h:699
ECOORD width
Definition: eagle_parser.h:567
opt_int swaplevel
Definition: eagle_parser.h:751
ECOORD x
Definition: eagle_parser.h:564
Eagle pin element.
Definition: eagle_parser.h:741
EPIN(wxXmlNode *aPin)
Parse an Eagle frame element.
Definition: eagle_parser.h:674
int fill
Definition: eagle_parser.h:831
Eagle label.
Definition: eagle_parser.h:532
opt_wxString value
Definition: eagle_parser.h:928
nanometers
Definition: eagle_parser.h:385
EDEVICE(wxXmlNode *aDevice)
ECOORD y
Definition: eagle_parser.h:535
EPART(wxXmlNode *aPart)
OPTIONAL_XML_ATTRIBUTE< wxString > opt_wxString
Definition: eagle_parser.h:365
int layer_back_most
< extent
Definition: eagle_parser.h:552
segment (element) of our XPATH into the Eagle XML document tree in PTREE form.
Definition: eagle_parser.h:83
ECONNECT(wxXmlNode *aConnect)
EVERTEX(wxXmlNode *aVertex)
wxString name
opt_int align
Definition: eagle_parser.h:612
ECOORD dy
Definition: eagle_parser.h:731
wxString gate
Definition: eagle_parser.h:951
ESMD(wxXmlNode *aSMD)
opt_ecoord isolate
Definition: eagle_parser.h:789
wxString name
Definition: eagle_parser.h:596
T * operator->()
Return a pointer to the value of the attribute assuming it is available.
Definition: eagle_parser.h:334
wxString name
Definition: eagle_parser.h:829
ECOORD y1
Definition: eagle_parser.h:494
EJUNCTION(wxXmlNode *aJunction)
wxString value
Definition: eagle_parser.h:815
OPTIONAL_XML_ATTRIBUTE< double > opt_double
Definition: eagle_parser.h:368
opt_int style
Definition: eagle_parser.h:507
ECOORD x
Definition: eagle_parser.h:801
wxString escapeName(const wxString &aNetName)
OPTIONAL_XML_ATTRIBUTE< bool > opt_bool
Definition: eagle_parser.h:369
EDIMENSION(wxXmlNode *aDimension)
LAYER_NUM layer
Definition: eagle_parser.h:498
opt_ecoord y
Definition: eagle_parser.h:599
ELABEL(wxXmlNode *aLabel, const wxString &aNetName)
int layer
Definition: eagle_parser.h:581
Eagle thru hole pad.
Definition: eagle_parser.h:706
opt_ecoord spacing
Definition: eagle_parser.h:774
wxString name
Definition: eagle_parser.h:812
ECOORD size
Definition: eagle_parser.h:536
const T * operator->() const
Return a constant pointer to the value of the attribute assuming it is available.
Definition: eagle_parser.h:344
EWIRE(wxXmlNode *aWire)
EHOLE(wxXmlNode *aHole)
static constexpr EAGLE_UNIT ECOORD_UNIT
Definition: eagle_parser.h:395
ECOORD y1
Definition: eagle_parser.h:578
Eagle circle.
Definition: eagle_parser.h:562
ECOORD x2
Definition: eagle_parser.h:678
ECOORD dx
Definition: eagle_parser.h:730
wxString symbol
Definition: eagle_parser.h:976
EPOLYGON(wxXmlNode *aPolygon)
std::vector< TRIPLET > p
Definition: eagle_parser.h:112
ECOORD x
Definition: eagle_parser.h:640
int columns
Definition: eagle_parser.h:680
bool m_isAvailable
A boolean indicating if the data is present or not.
Definition: eagle_parser.h:192
std::map< std::string, std::string > attribute
Definition: eagle_parser.h:929
wxSize ConvertSize() const
Calculate text size based on font type and size.
Model an optional XML attribute.
Definition: eagle_parser.h:188
ECOORD size
Definition: eagle_parser.h:642
EDEVICE_SET(wxXmlNode *aDeviceSet)
int layer
Definition: eagle_parser.h:732
opt_int swaplevel
Definition: eagle_parser.h:982
opt_wxString value
Definition: eagle_parser.h:597
wxString text
Definition: eagle_parser.h:639
std::map< wxString, EINSTANCE * > EINSTANCE_MAP
Definition: eagle_parser.h:51
EVIA(wxXmlNode *aVia)
wxString name
Definition: eagle_parser.h:975
EGATE(wxXmlNode *aGate)
ECOORD x
Definition: eagle_parser.h:816
opt_int roundness
Definition: eagle_parser.h:733
mils/thous
Definition: eagle_parser.h:388
LAYER_NUM layer
Definition: eagle_parser.h:568
Eagle XML rectangle in binary.
Definition: eagle_parser.h:575
opt_int align
Definition: eagle_parser.h:662
Eagle net.
Definition: eagle_parser.h:453
ECOORD y2
Definition: eagle_parser.h:679
opt_double curve
range is -359.9..359.9
Definition: eagle_parser.h:763
millimeters
Definition: eagle_parser.h:386
int rows
Definition: eagle_parser.h:681
ECOORD y2
Definition: eagle_parser.h:496
opt_bool border_right
Definition: eagle_parser.h:685
opt_wxString prefix
Parse an Eagle "attribute" XML element.
Definition: eagle_parser.h:594
opt_ecoord x
Definition: eagle_parser.h:598
opt_int layer
Definition: eagle_parser.h:601
Eagle via.
Definition: eagle_parser.h:547
bool operator==(const T &aOther) const
Definition: eagle_parser.h:271
ECOORD x1
Definition: eagle_parser.h:577
opt_wxString dimensionType
Definition: eagle_parser.h:630
opt_int addlevel
Definition: eagle_parser.h:981
EPAD_COMMON(wxXmlNode *aPad)
opt_erot rot
Definition: eagle_parser.h:646
int netcode
Definition: eagle_parser.h:455
NODE_MAP MapChildren(wxXmlNode *aCurrentNode)
Provide an easy access to the children of an XML node via their names.
wxString name
opt_wxString font
Definition: eagle_parser.h:644
ECOORD x
Definition: eagle_parser.h:761
opt_ecoord diameter
Definition: eagle_parser.h:709
std::map< wxString, std::unique_ptr< EPART > > EPART_MAP
Translates Eagle special characters to their counterparts in KiCad.
Definition: eagle_parser.h:52
TRIPLET(const char *aElement, const char *aAttribute="", const char *aValue="")
Definition: eagle_parser.h:89
Structure holding common properties for through-hole and SMD pads.
Definition: eagle_parser.h:693
T m_data
The actual data if m_isAvailable is true; otherwise, garbage.
Definition: eagle_parser.h:195
OPTIONAL_XML_ATTRIBUTE(const wxString &aData)
Definition: eagle_parser.h:211
std::map< wxString, FOOTPRINT * > FOOTPRINT_MAP
Definition: eagle_parser.h:50
wxString netname
Definition: eagle_parser.h:456
ECOORD radius
Definition: eagle_parser.h:566
std::vector< ECONNECT > connects
EFRAME(wxXmlNode *aFrameNode)
opt_double ratio
Definition: eagle_parser.h:602
opt_erot rot
Definition: eagle_parser.h:697
std::map< wxString, ECOORD > clearanceMap
ECOORD x
Definition: eagle_parser.h:978
ECOORD y
Definition: eagle_parser.h:550
opt_bool smashed
Definition: eagle_parser.h:954
ECOORD x
Definition: eagle_parser.h:524
ECOORD(int aValue, enum EAGLE_UNIT aUnit)
Definition: eagle_parser.h:402
LAYER_NUM layer
Definition: eagle_parser.h:537
wxString number
opt_bool first
Definition: eagle_parser.h:721
Eagle wire.
Definition: eagle_parser.h:491
opt_bool orphans
Definition: eagle_parser.h:790
opt_bool uservalue
ECOORD x
Definition: eagle_parser.h:549
T Convert(const wxString &aValue)
Convert a wxString to a generic type T.
Definition: eagle_parser.h:173
ECOORD y
Definition: eagle_parser.h:745
ERECT(wxXmlNode *aRect)
wxString name
Definition: eagle_parser.h:743
opt_wxString package
opt_erot rot
Definition: eagle_parser.h:955
opt_int shape
Definition: eagle_parser.h:720
Eagle dimension element.
Definition: eagle_parser.h:620
wxString package
Definition: eagle_parser.h:814
bool spin
Definition: eagle_parser.h:473
ECOORD y
Definition: eagle_parser.h:953
ECOORD y2
Definition: eagle_parser.h:580
EROT(double aDegrees)
Definition: eagle_parser.h:482
ECOORD y
Definition: eagle_parser.h:641
Eagle polygon, without vertices which are parsed as needed.
Definition: eagle_parser.h:770
opt_int display
Definition: eagle_parser.h:611
void pop()
Definition: eagle_parser.h:122
ECOORD drill
Definition: eagle_parser.h:708
ECOORD y
Definition: eagle_parser.h:802
const char * value
Definition: eagle_parser.h:87
ENET(int aNetCode, const wxString &aNetName)
Definition: eagle_parser.h:458
opt_bool stop
Definition: eagle_parser.h:698
int layer
Definition: eagle_parser.h:643
wxString device
Definition: eagle_parser.h:926
ECOORD x1
Definition: eagle_parser.h:493
const char * attribute
Definition: eagle_parser.h:86
int ToMils() const
Definition: eagle_parser.h:409
wxString library
Definition: eagle_parser.h:813
XML_PARSER_ERROR(const wxString &aMessage) noexcept
Build an XML error by just calling its parent class constructor, std::runtime_error,...
Definition: eagle_parser.h:76
ECIRCLE(wxXmlNode *aCircle)
opt_wxString visible
Definition: eagle_parser.h:747
ECOORD drill
Definition: eagle_parser.h:803
ETEXT(wxXmlNode *aText)
EELEMENT(wxXmlNode *aElement)
wxString pin
opt_wxString length
Definition: eagle_parser.h:748
int color
Definition: eagle_parser.h:830
static long long int ConvertToNm(int aValue, enum EAGLE_UNIT aUnit)
opt_bool border_top
Definition: eagle_parser.h:684
opt_bool active
Definition: eagle_parser.h:833
ECOORD x2
Definition: eagle_parser.h:495
OPTIONAL_XML_ATTRIBUTE< ECOORD > opt_ecoord
Definition: eagle_parser.h:371
int ToPcbUnits() const
Definition: eagle_parser.h:430
std::unordered_map< wxString, wxXmlNode * > NODE_MAP
Definition: eagle_parser.h:47
long long int value
Unit used for the value field.
Definition: eagle_parser.h:392
static wxXmlNode * getChildrenNodes(NODE_MAP &aMap, const wxString &aName)
Definition: eagle_parser.h:57
OPTIONAL_XML_ATTRIBUTE< EROT > opt_erot
Definition: eagle_parser.h:370
EINSTANCE(wxXmlNode *aInstance)
opt_ecoord size
Definition: eagle_parser.h:600
EPAD(wxXmlNode *aPad)
void Value(const char *aValue)
modify the last path node's value
Definition: eagle_parser.h:125
int layer_front_most
Definition: eagle_parser.h:551
ECOORD y
Definition: eagle_parser.h:979
opt_bool cream
Definition: eagle_parser.h:734
opt_bool locked
Definition: eagle_parser.h:818
opt_erot rot
Definition: eagle_parser.h:752