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 <cerrno>
33 #include <map>
34 #include <unordered_map>
35 
36 #include <wx/xml/xml.h>
37 #include <wx/string.h>
38 #include <wx/filename.h>
39 
41 #include <convert_to_biu.h>
42 #include <trigo.h>
43 #include <kicad_string.h>
44 #include <common.h> // needed for wxString hash template
45 
46 class FOOTPRINT;
47 struct EINSTANCE;
48 struct EPART;
49 struct ETEXT;
50 
51 typedef std::unordered_map<wxString, wxXmlNode*> NODE_MAP;
52 typedef std::map<wxString, FOOTPRINT*> FOOTPRINT_MAP;
53 typedef std::map<wxString, EINSTANCE*> EINSTANCE_MAP;
54 typedef std::map<wxString, std::unique_ptr<EPART>> EPART_MAP;
55 
57 wxString escapeName( const wxString& aNetName );
58 
59 static inline wxXmlNode* getChildrenNodes( NODE_MAP& aMap, const wxString& aName )
60 {
61  auto it = aMap.find( aName );
62  return it == aMap.end() ? nullptr : it->second->GetChildren();
63 }
64 
65 
70 struct XML_PARSER_ERROR : std::runtime_error
71 {
78  XML_PARSER_ERROR( const wxString& aMessage ) noexcept :
79  std::runtime_error( "XML parser failed - " + aMessage.ToStdString() )
80  {}
81 };
82 
83 
85 struct TRIPLET
86 {
87  const char* element;
88  const char* attribute;
89  const char* value;
90 
91  TRIPLET( const char* aElement, const char* aAttribute = "", const char* aValue = "" ) :
92  element( aElement ),
93  attribute( aAttribute ),
94  value( aValue )
95  {}
96 };
97 
98 
112 class XPATH
113 {
114  std::vector<TRIPLET> p;
115 
116 public:
117  void push( const char* aPathSegment, const char* aAttribute="" )
118  {
119  p.emplace_back( aPathSegment, aAttribute );
120  }
121 
122  void clear() { p.clear(); }
123 
124  void pop() { p.pop_back(); }
125 
127  void Value( const char* aValue )
128  {
129  p.back().value = aValue;
130  }
131 
133  void Attribute( const char* aAttribute )
134  {
135  p.back().attribute = aAttribute;
136  }
137 
139  wxString Contents()
140  {
141  typedef std::vector<TRIPLET>::const_iterator CITER_TRIPLET;
142 
143  wxString ret;
144 
145  for( CITER_TRIPLET it = p.begin(); it != p.end(); ++it )
146  {
147  if( it != p.begin() )
148  ret += '.';
149 
150  ret += it->element;
151 
152  if( it->attribute[0] && it->value[0] )
153  {
154  ret += '[';
155  ret += it->attribute;
156  ret += '=';
157  ret += it->value;
158  ret += ']';
159  }
160  }
161 
162  return ret;
163  }
164 };
165 
166 
174 template<typename T>
175 T Convert( const wxString& aValue )
176 {
177  throw XML_PARSER_ERROR( "Conversion failed. Unknown type." );
178 }
179 
180 template <>
181 wxString Convert<wxString>( const wxString& aValue );
182 
189 template <typename T>
191 {
192 private:
195 
198 
199 public:
204  m_isAvailable( false ),
205  m_data( T() )
206  {}
207 
213  OPTIONAL_XML_ATTRIBUTE( const wxString& aData )
214  {
215  m_data = T();
216  m_isAvailable = !aData.IsEmpty();
217 
218  if( m_isAvailable )
219  Set( aData );
220  }
221 
226  template<typename V = T>
228  m_isAvailable( true ),
229  m_data( aData )
230  {}
231 
235  operator bool() const
236  {
237  return m_isAvailable;
238  }
239 
246  OPTIONAL_XML_ATTRIBUTE<T>& operator =( const wxString& aData )
247  {
248  m_isAvailable = !aData.IsEmpty();
249 
250  if( m_isAvailable )
251  Set( aData );
252 
253  return *this;
254  }
255 
263  {
264  m_data = aData;
265  m_isAvailable = true;
266 
267  return *this;
268  }
269 
273  bool operator ==( const T& aOther ) const
274  {
275  return m_isAvailable && ( aOther == m_data );
276  }
277 
283  void Set( const wxString& aString )
284  {
285  m_data = Convert<T>( aString );
286  m_isAvailable = !aString.IsEmpty();
287  }
288 
294  T& Get()
295  {
296  assert( m_isAvailable );
297  return m_data;
298  }
299 
305  const T& CGet() const
306  {
307  assert( m_isAvailable );
308  return m_data;
309  }
310 
317  {
318  return Get();
319  }
320 
326  const T& operator*() const
327  {
328  return CGet();
329  }
330 
337  {
338  return &Get();
339  }
340 
346  const T* operator->() const
347  {
348  return &CGet();
349  }
350 };
351 
352 
360 NODE_MAP MapChildren( wxXmlNode* aCurrentNode );
361 
363 wxPoint ConvertArcCenter( const wxPoint& aStart, const wxPoint& aEnd, double aAngle );
364 
365 // Pre-declare for typedefs
366 struct EROT;
367 struct ECOORD;
374 
375 
376 // All of the 'E'STRUCTS below merely hold Eagle XML information verbatim, in binary.
377 // For maintenance and troubleshooting purposes, it was thought that we'd need to
378 // separate the conversion process into distinct steps. There is no intent to have KiCad
379 // forms of information in these 'E'STRUCTS. They are only binary forms
380 // of the Eagle information in the corresponding Eagle XML nodes.
381 
382 // Eagle coordinates
383 struct ECOORD
384 {
386  {
391  };
392 
394  long long int value;
395 
397  static constexpr EAGLE_UNIT ECOORD_UNIT = EU_NM;
398 
400  : value( 0 )
401  {
402  }
403 
404  ECOORD( int aValue, enum EAGLE_UNIT aUnit )
405  : value( ConvertToNm( aValue, aUnit ) )
406  {
407  }
408 
409  ECOORD( const wxString& aValue, enum EAGLE_UNIT aUnit );
410 
411  int ToMils() const
412  {
413  return value / 25400;
414  }
415 
416  int To100NanoMeters() const
417  {
418  return value / 100;
419  }
420 
421  int ToNanoMeters() const
422  {
423  return value;
424  }
425 
426  float ToMm() const
427  {
428  return value / 1000000.0;
429  }
430 
431  int ToSchUnits() const { return To100NanoMeters(); }
432  int ToPcbUnits() const { return ToNanoMeters(); }
433 
434  ECOORD operator+( const ECOORD& aOther ) const
435  {
436  return ECOORD( value + aOther.value, ECOORD_UNIT );
437  }
438 
439  ECOORD operator-( const ECOORD& aOther ) const
440  {
441  return ECOORD( value - aOther.value, ECOORD_UNIT );
442  }
443 
444  bool operator==( const ECOORD& aOther ) const
445  {
446  return value == aOther.value;
447  }
448 
450  static long long int ConvertToNm( int aValue, enum EAGLE_UNIT aUnit );
451 };
452 
453 
455 struct ENET
456 {
457  int netcode;
458  wxString netname;
459 
460  ENET( int aNetCode, const wxString& aNetName ) :
461  netcode( aNetCode ),
462  netname( aNetName )
463  {}
464 
465  ENET() :
466  netcode( 0 )
467  {}
468 };
469 
470 
472 struct EROT
473 {
474  bool mirror;
475  bool spin;
476  double degrees;
477 
478  EROT() :
479  mirror( false ),
480  spin( false ),
481  degrees( 0 )
482  {}
483 
484  EROT( double aDegrees ) :
485  mirror( false ),
486  spin( false ),
487  degrees( aDegrees )
488  {}
489 };
490 
491 
493 struct EWIRE
494 {
501 
502  // for style: (continuous | longdash | shortdash | dashdot)
503  enum {
508  };
511 
512  // for cap: (flat | round)
513  enum {
516  };
518 
519  EWIRE( wxXmlNode* aWire );
520 };
521 
522 
524 struct EJUNCTION
525 {
528 
529  EJUNCTION( wxXmlNode* aJunction);
530 };
531 
532 
534 struct ELABEL
535 {
542  wxString netname;
543 
544  ELABEL( wxXmlNode* aLabel, const wxString& aNetName );
545 };
546 
547 
549 struct EVIA
550 {
558 
559  EVIA( wxXmlNode* aVia );
560 };
561 
562 
564 struct ECIRCLE
565 {
571 
572  ECIRCLE( wxXmlNode* aCircle );
573 };
574 
575 
577 struct ERECT
578 {
583  int layer;
585 
586  ERECT( wxXmlNode* aRect );
587 };
588 
589 
596 struct EATTR
597 {
598  wxString name;
606 
607  enum { // for 'display'
612  };
615 
616  EATTR( wxXmlNode* aTree );
617  EATTR() {}
618 };
619 
620 
623 {
630  int layer;
631 
633 
634  EDIMENSION( wxXmlNode* aDimension );
635 };
636 
637 
639 struct ETEXT
640 {
641  wxString text;
645  int layer;
649 
650  enum { // for align
656 
657  // opposites are -1 x above, used by code tricks in here
662  };
663 
665 
666  ETEXT( wxXmlNode* aText );
667 
669  wxSize ConvertSize() const;
670 };
671 
672 
676 struct EFRAME
677 {
682  int columns;
683  int rows;
684  int layer;
689 
690  EFRAME( wxXmlNode* aFrameNode );
691 };
692 
693 
696 {
697  wxString name;
702 
703  EPAD_COMMON( wxXmlNode* aPad );
704 };
705 
706 
708 struct EPAD : public EPAD_COMMON
709 {
712 
713  // for shape: (square | round | octagon | long | offset)
714  enum {
715  UNDEF = -1,
721  };
724 
725  EPAD( wxXmlNode* aPad );
726 };
727 
728 
730 struct ESMD : public EPAD_COMMON
731 {
734  int layer;
737 
738  ESMD( wxXmlNode* aSMD );
739 };
740 
741 
743 struct EPIN
744 {
745  wxString name;
748 
752  opt_wxString function;
755 
756  EPIN( wxXmlNode* aPin );
757 };
758 
759 
761 struct EVERTEX
762 {
766 
767  EVERTEX( wxXmlNode* aVertex );
768 };
769 
770 
772 struct EPOLYGON
773 {
775  int layer;
777 
778  // KiCad priority is opposite of Eagle rank, that is:
779  // - Eagle Low rank drawn first
780  // - KiCad high priority drawn first
781  // So since Eagle has an upper limit we define this, used for the cases
782  // where no rank is specified.
783  static const int max_priority = 6;
784 
785  enum { // for pour
789  };
790  int pour;
795 
796  EPOLYGON( wxXmlNode* aPolygon );
797 };
798 
799 
801 struct EHOLE
802 {
806 
807  EHOLE( wxXmlNode* aHole );
808 };
809 
810 
812 struct EELEMENT
813 {
814  wxString name;
815  wxString library;
816  wxString package;
817  wxString value;
823 
824  EELEMENT( wxXmlNode* aElement );
825 };
826 
827 
828 struct ELAYER
829 {
830  int number;
831  wxString name;
832  int color;
833  int fill;
836 
837  ELAYER( wxXmlNode* aLayer );
838 };
839 
840 
842 {
843  enum
844  {
845  TOP = 1,
846  ROUTE2 = 2,
847  ROUTE3 = 3,
848  ROUTE4 = 4,
849  ROUTE5 = 5,
850  ROUTE6 = 6,
851  ROUTE7 = 7,
852  ROUTE8 = 8,
853  ROUTE9 = 9,
854  ROUTE10 = 10,
855  ROUTE11 = 11,
856  ROUTE12 = 12,
857  ROUTE13 = 13,
858  ROUTE14 = 14,
859  ROUTE15 = 15,
860  BOTTOM = 16,
861  PADS = 17,
862  VIAS = 18,
863  UNROUTED = 19,
864  DIMENSION = 20,
865  TPLACE = 21,
866  BPLACE = 22,
867  TORIGINS = 23,
868  BORIGINS = 24,
869  TNAMES = 25,
870  BNAMES = 26,
871  TVALUES = 27,
872  BVALUES = 28,
873  TSTOP = 29,
874  BSTOP = 30,
875  TCREAM = 31,
876  BCREAM = 32,
877  TFINISH = 33,
878  BFINISH = 34,
879  TGLUE = 35,
880  BGLUE = 36,
881  TTEST = 37,
882  BTEST = 38,
883  TKEEPOUT = 39,
884  BKEEPOUT = 40,
885  TRESTRICT = 41,
886  BRESTRICT = 42,
887  VRESTRICT = 43,
888  DRILLS = 44,
889  HOLES = 45,
890  MILLING = 46,
891  MEASURES = 47,
892  DOCUMENT = 48,
895  TDOCU = 51,
896  BDOCU = 52,
897  NETS = 91,
898  BUSSES = 92,
899  PINS = 93,
900  SYMBOLS = 94,
901  NAMES = 95,
902  VALUES = 96,
903  INFO = 97,
904  GUIDE = 98,
905  USERLAYER1 = 160,
907  };
908 };
909 
910 
911 struct EPART
912 {
913  /*
914  * <!ELEMENT part (attribute*, variant*)>
915  * <!ATTLIST part
916  * name %String; #REQUIRED
917  * library %String; #REQUIRED
918  * deviceset %String; #REQUIRED
919  * device %String; #REQUIRED
920  * technology %String; ""
921  * value %String; #IMPLIED
922  * >
923  */
924 
925  wxString name;
926  wxString library;
927  wxString deviceset;
928  wxString device;
931  std::map<std::string,std::string> attribute;
932  std::map<std::string,std::string> variant;
933 
934  EPART( wxXmlNode* aPart );
935 };
936 
937 
938 struct EINSTANCE
939 {
940  /*
941  * <!ELEMENT instance (attribute)*>
942  * <!ATTLIST instance
943  * part %String; #REQUIRED
944  * gate %String; #REQUIRED
945  * x %Coord; #REQUIRED
946  * y %Coord; #REQUIRED
947  * smashed %Bool; "no"
948  * rot %Rotation; "R0"
949  * >
950  */
951 
952  wxString part;
953  wxString gate;
958 
959  EINSTANCE( wxXmlNode* aInstance );
960 };
961 
962 
963 struct EGATE
964 {
965  /*
966  * <!ELEMENT gate EMPTY>
967  * <!ATTLIST gate
968  * name %String; #REQUIRED
969  * symbol %String; #REQUIRED
970  * x %Coord; #REQUIRED
971  * y %Coord; #REQUIRED
972  * addlevel %GateAddLevel; "next"
973  * swaplevel %Int; "0"
974  * >
975  */
976 
977  wxString name;
978  wxString symbol;
979 
982 
985 
986  enum
987  {
993  };
994 
995  EGATE( wxXmlNode* aGate );
996 };
997 
998 
999 struct ECONNECT
1000 {
1001  /*
1002  * <!ELEMENT connect EMPTY>
1003  * <!ATTLIST connect
1004  * gate %String; #REQUIRED
1005  * pin %String; #REQUIRED
1006  * pad %String; #REQUIRED
1007  * route %ContactRoute; "all"
1008  * >
1009  */
1010  wxString gate;
1011  wxString pin;
1012  wxString pad;
1013  //int contactroute; // TODO
1014 
1015  ECONNECT( wxXmlNode* aConnect );
1016 };
1017 
1018 
1019 struct EDEVICE
1020 {
1021  /*
1022  * <!ELEMENT device (connects?, technologies?)>
1023  * <!ATTLIST device
1024  * name %String; ""
1025  * package %String; #IMPLIED
1026  * >
1027  */
1028  wxString name;
1030 
1031  std::vector<ECONNECT> connects;
1032 
1033  EDEVICE( wxXmlNode* aDevice );
1034 };
1035 
1036 
1038 {
1039  /*
1040  <!ELEMENT deviceset (description?, gates, devices)>
1041  <!ATTLIST deviceset
1042  name %String; #REQUIRED
1043  prefix %String; ""
1044  uservalue %Bool; "no"
1045  >
1046  */
1047 
1048  wxString name;
1051  //std::vector<EDEVICE> devices;
1052  //std::vector<EGATE> gates;
1053 
1054 
1055  EDEVICE_SET( wxXmlNode* aDeviceSet );
1056 };
1057 
1058 
1059 #endif // _EAGLE_PARSER_H_
void Set(const wxString &aString)
Attempt to convert a string to the base type.
Definition: eagle_parser.h:283
wxString name
wxString Contents()
return the contents of the XPATH as a single string
Definition: eagle_parser.h:139
Eagle vertex.
Definition: eagle_parser.h:761
int To100NanoMeters() const
Definition: eagle_parser.h:416
Eagle rotation.
Definition: eagle_parser.h:472
wxString deviceset
Definition: eagle_parser.h:927
Eagle Junction.
Definition: eagle_parser.h:524
bool mirror
Definition: eagle_parser.h:474
opt_double curve
range is -359.9..359.9
Definition: eagle_parser.h:510
ECOORD x
Definition: eagle_parser.h:746
wxString pad
wxString Convert< wxString >(const wxString &aValue)
opt_int rank
Definition: eagle_parser.h:794
wxString part
Definition: eagle_parser.h:952
int ToSchUnits() const
Definition: eagle_parser.h:431
wxString name
Definition: eagle_parser.h:925
OPTIONAL_XML_ATTRIBUTE< T > & operator=(const wxString &aData)
Assign to a string (optionally) containing the data.
Definition: eagle_parser.h:246
int ToNanoMeters() const
Definition: eagle_parser.h:421
ECOORD x
Definition: eagle_parser.h:536
opt_ecoord diam
Definition: eagle_parser.h:556
opt_wxString technology
Definition: eagle_parser.h:929
wxString library
Definition: eagle_parser.h:926
opt_wxString direction
Definition: eagle_parser.h:751
void clear()
Definition: eagle_parser.h:122
opt_erot rot
Definition: eagle_parser.h:540
float ToMm() const
Definition: eagle_parser.h:426
opt_int cap
Definition: eagle_parser.h:517
ECOORD operator-(const ECOORD &aOther) const
Definition: eagle_parser.h:439
opt_bool border_bottom
Definition: eagle_parser.h:688
const T & CGet() const
Return a constant reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:305
T & operator *()
Return a reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:316
ECOORD drill
< inclusive
Definition: eagle_parser.h:555
T & Get()
Return a reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:294
opt_wxString shape
Definition: eagle_parser.h:557
ECOORD y
Definition: eagle_parser.h:764
void push(const char *aPathSegment, const char *aAttribute="")
Definition: eagle_parser.h:117
opt_bool border_left
Definition: eagle_parser.h:685
Eagle element element.
Definition: eagle_parser.h:812
Keep track of what we are working on within a PTREE.
Definition: eagle_parser.h:112
ECOORD x2
Definition: eagle_parser.h:581
static const int max_priority
Definition: eagle_parser.h:783
opt_double ratio
Definition: eagle_parser.h:647
opt_bool visible
Definition: eagle_parser.h:834
void Attribute(const char *aAttribute)
modify the last path node's attribute
Definition: eagle_parser.h:133
int number
Definition: eagle_parser.h:830
OPTIONAL_XML_ATTRIBUTE()
Construct a default OPTIONAL_XML_ATTRIBUTE, whose data is not available.
Definition: eagle_parser.h:203
opt_wxString xref
Definition: eagle_parser.h:541
opt_erot rot
Definition: eagle_parser.h:822
wxString gate
ECOORD width
Definition: eagle_parser.h:499
opt_bool thermals
Definition: eagle_parser.h:793
opt_bool smashed
Definition: eagle_parser.h:821
bool operator==(const ECOORD &aOther) const
Converts a size expressed in a certain unit to nanometers.
Definition: eagle_parser.h:444
std::map< std::string, std::string > variant
Definition: eagle_parser.h:932
OPTIONAL_XML_ATTRIBUTE(T aData)
Definition: eagle_parser.h:227
wxString name
Definition: eagle_parser.h:697
const char * element
Definition: eagle_parser.h:87
wxPoint ConvertArcCenter(const wxPoint &aStart, const wxPoint &aEnd, double aAngle)
opt_erot rot
Definition: eagle_parser.h:584
double degrees
Definition: eagle_parser.h:476
ECOORD width
Definition: eagle_parser.h:774
ECOORD x
Definition: eagle_parser.h:954
Eagle SMD pad.
Definition: eagle_parser.h:730
ECOORD y
Definition: eagle_parser.h:567
ECOORD x1
Definition: eagle_parser.h:678
ECOORD operator+(const ECOORD &aOther) const
Definition: eagle_parser.h:434
ECOORD y1
Definition: eagle_parser.h:679
ECOORD y
Definition: eagle_parser.h:819
ECOORD y
Definition: eagle_parser.h:527
Eagle hole element.
Definition: eagle_parser.h:801
Implement a simple wrapper around runtime_error to isolate the errors thrown by the Eagle XML parser.
Definition: eagle_parser.h:70
OPTIONAL_XML_ATTRIBUTE< int > opt_int
Definition: eagle_parser.h:369
wxString netname
Definition: eagle_parser.h:542
Eagle text element.
Definition: eagle_parser.h:639
int layer
Definition: eagle_parser.h:684
opt_erot rot
Definition: eagle_parser.h:605
ELAYER(wxXmlNode *aLayer)
opt_bool thermals
Definition: eagle_parser.h:701
ECOORD width
Definition: eagle_parser.h:569
opt_int swaplevel
Definition: eagle_parser.h:753
ECOORD x
Definition: eagle_parser.h:566
Eagle pin element.
Definition: eagle_parser.h:743
EPIN(wxXmlNode *aPin)
Parse an Eagle frame element.
Definition: eagle_parser.h:676
int fill
Definition: eagle_parser.h:833
Eagle label.
Definition: eagle_parser.h:534
opt_wxString value
Definition: eagle_parser.h:930
nanometers
Definition: eagle_parser.h:387
EDEVICE(wxXmlNode *aDevice)
ECOORD y
Definition: eagle_parser.h:537
EPART(wxXmlNode *aPart)
OPTIONAL_XML_ATTRIBUTE< wxString > opt_wxString
Definition: eagle_parser.h:367
int layer_back_most
< extent
Definition: eagle_parser.h:554
segment (element) of our XPATH into the Eagle XML document tree in PTREE form.
Definition: eagle_parser.h:85
ECONNECT(wxXmlNode *aConnect)
EVERTEX(wxXmlNode *aVertex)
wxString name
opt_int align
Definition: eagle_parser.h:614
ECOORD dy
Definition: eagle_parser.h:733
wxString gate
Definition: eagle_parser.h:953
ESMD(wxXmlNode *aSMD)
opt_ecoord isolate
Definition: eagle_parser.h:791
wxString name
Definition: eagle_parser.h:598
T * operator->()
Return a pointer to the value of the attribute assuming it is available.
Definition: eagle_parser.h:336
wxString name
Definition: eagle_parser.h:831
ECOORD y1
Definition: eagle_parser.h:496
EJUNCTION(wxXmlNode *aJunction)
wxString value
Definition: eagle_parser.h:817
OPTIONAL_XML_ATTRIBUTE< double > opt_double
Definition: eagle_parser.h:370
opt_int style
Definition: eagle_parser.h:509
ECOORD x
Definition: eagle_parser.h:803
wxString escapeName(const wxString &aNetName)
OPTIONAL_XML_ATTRIBUTE< bool > opt_bool
Definition: eagle_parser.h:371
EDIMENSION(wxXmlNode *aDimension)
LAYER_NUM layer
Definition: eagle_parser.h:500
opt_ecoord y
Definition: eagle_parser.h:601
ELABEL(wxXmlNode *aLabel, const wxString &aNetName)
int layer
Definition: eagle_parser.h:583
Eagle thru hole pad.
Definition: eagle_parser.h:708
opt_ecoord spacing
Definition: eagle_parser.h:776
wxString name
Definition: eagle_parser.h:814
ECOORD size
Definition: eagle_parser.h:538
const T * operator->() const
Return a constant pointer to the value of the attribute assuming it is available.
Definition: eagle_parser.h:346
EWIRE(wxXmlNode *aWire)
EHOLE(wxXmlNode *aHole)
static constexpr EAGLE_UNIT ECOORD_UNIT
Definition: eagle_parser.h:397
ECOORD y1
Definition: eagle_parser.h:580
Eagle circle.
Definition: eagle_parser.h:564
ECOORD x2
Definition: eagle_parser.h:680
ECOORD dx
Definition: eagle_parser.h:732
wxString symbol
Definition: eagle_parser.h:978
EPOLYGON(wxXmlNode *aPolygon)
std::vector< TRIPLET > p
Definition: eagle_parser.h:114
ECOORD x
Definition: eagle_parser.h:642
int columns
Definition: eagle_parser.h:682
bool m_isAvailable
A boolean indicating if the data is present or not.
Definition: eagle_parser.h:194
std::map< std::string, std::string > attribute
Definition: eagle_parser.h:931
wxSize ConvertSize() const
Calculate text size based on font type and size.
Model an optional XML attribute.
Definition: eagle_parser.h:190
ECOORD size
Definition: eagle_parser.h:644
EDEVICE_SET(wxXmlNode *aDeviceSet)
int layer
Definition: eagle_parser.h:734
opt_int swaplevel
Definition: eagle_parser.h:984
opt_wxString value
Definition: eagle_parser.h:599
wxString text
Definition: eagle_parser.h:641
std::map< wxString, EINSTANCE * > EINSTANCE_MAP
Definition: eagle_parser.h:53
EVIA(wxXmlNode *aVia)
wxString name
Definition: eagle_parser.h:977
EGATE(wxXmlNode *aGate)
ECOORD x
Definition: eagle_parser.h:818
opt_int roundness
Definition: eagle_parser.h:735
mils/thous
Definition: eagle_parser.h:390
LAYER_NUM layer
Definition: eagle_parser.h:570
Eagle XML rectangle in binary.
Definition: eagle_parser.h:577
opt_int align
Definition: eagle_parser.h:664
Eagle net.
Definition: eagle_parser.h:455
ECOORD y2
Definition: eagle_parser.h:681
opt_double curve
range is -359.9..359.9
Definition: eagle_parser.h:765
int LAYER_NUM
This can be replaced with int and removed.
millimeters
Definition: eagle_parser.h:388
int rows
Definition: eagle_parser.h:683
ECOORD y2
Definition: eagle_parser.h:498
opt_bool border_right
Definition: eagle_parser.h:687
opt_wxString prefix
Parse an Eagle "attribute" XML element.
Definition: eagle_parser.h:596
opt_ecoord x
Definition: eagle_parser.h:600
opt_int layer
Definition: eagle_parser.h:603
Eagle via.
Definition: eagle_parser.h:549
bool operator==(const T &aOther) const
Definition: eagle_parser.h:273
ECOORD x1
Definition: eagle_parser.h:579
opt_wxString dimensionType
Definition: eagle_parser.h:632
opt_int addlevel
Definition: eagle_parser.h:983
EPAD_COMMON(wxXmlNode *aPad)
opt_erot rot
Definition: eagle_parser.h:648
int netcode
Definition: eagle_parser.h:457
NODE_MAP MapChildren(wxXmlNode *aCurrentNode)
Provide an easy access to the children of an XML node via their names.
Board layer functions and definitions.
opt_wxString font
Definition: eagle_parser.h:646
ECOORD x
Definition: eagle_parser.h:763
opt_ecoord diameter
Definition: eagle_parser.h:711
std::map< wxString, std::unique_ptr< EPART > > EPART_MAP
Translates Eagle special characters to their counterparts in KiCad.
Definition: eagle_parser.h:54
TRIPLET(const char *aElement, const char *aAttribute="", const char *aValue="")
Definition: eagle_parser.h:91
Structure holding common properties for through-hole and SMD pads.
Definition: eagle_parser.h:695
T m_data
The actual data if m_isAvailable is true; otherwise, garbage.
Definition: eagle_parser.h:197
OPTIONAL_XML_ATTRIBUTE(const wxString &aData)
Definition: eagle_parser.h:213
std::map< wxString, FOOTPRINT * > FOOTPRINT_MAP
Definition: eagle_parser.h:52
wxString netname
Definition: eagle_parser.h:458
ECOORD radius
Definition: eagle_parser.h:568
std::vector< ECONNECT > connects
EFRAME(wxXmlNode *aFrameNode)
opt_double ratio
Definition: eagle_parser.h:604
opt_erot rot
Definition: eagle_parser.h:699
ECOORD x
Definition: eagle_parser.h:980
ECOORD y
Definition: eagle_parser.h:552
opt_bool smashed
Definition: eagle_parser.h:956
The common library.
ECOORD x
Definition: eagle_parser.h:526
ECOORD(int aValue, enum EAGLE_UNIT aUnit)
Definition: eagle_parser.h:404
LAYER_NUM layer
Definition: eagle_parser.h:539
opt_bool first
Definition: eagle_parser.h:723
Eagle wire.
Definition: eagle_parser.h:493
opt_bool orphans
Definition: eagle_parser.h:792
opt_bool uservalue
ECOORD x
Definition: eagle_parser.h:551
T Convert(const wxString &aValue)
Convert a wxString to a generic type T.
Definition: eagle_parser.h:175
ECOORD y
Definition: eagle_parser.h:747
ERECT(wxXmlNode *aRect)
wxString name
Definition: eagle_parser.h:745
opt_wxString package
opt_erot rot
Definition: eagle_parser.h:957
opt_int shape
Definition: eagle_parser.h:722
Eagle dimension element.
Definition: eagle_parser.h:622
wxString package
Definition: eagle_parser.h:816
bool spin
Definition: eagle_parser.h:475
ECOORD y
Definition: eagle_parser.h:955
ECOORD y2
Definition: eagle_parser.h:582
EROT(double aDegrees)
Definition: eagle_parser.h:484
ECOORD y
Definition: eagle_parser.h:643
Eagle polygon, without vertices which are parsed as needed.
Definition: eagle_parser.h:772
opt_int display
Definition: eagle_parser.h:613
void pop()
Definition: eagle_parser.h:124
ECOORD drill
Definition: eagle_parser.h:710
ECOORD y
Definition: eagle_parser.h:804
const char * value
Definition: eagle_parser.h:89
ENET(int aNetCode, const wxString &aNetName)
Definition: eagle_parser.h:460
opt_bool stop
Definition: eagle_parser.h:700
int layer
Definition: eagle_parser.h:645
wxString device
Definition: eagle_parser.h:928
ECOORD x1
Definition: eagle_parser.h:495
const char * attribute
Definition: eagle_parser.h:88
int ToMils() const
Definition: eagle_parser.h:411
wxString library
Definition: eagle_parser.h:815
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:78
ECIRCLE(wxXmlNode *aCircle)
opt_wxString visible
Definition: eagle_parser.h:749
ECOORD drill
Definition: eagle_parser.h:805
ETEXT(wxXmlNode *aText)
EELEMENT(wxXmlNode *aElement)
wxString pin
opt_wxString length
Definition: eagle_parser.h:750
int color
Definition: eagle_parser.h:832
static long long int ConvertToNm(int aValue, enum EAGLE_UNIT aUnit)
opt_bool border_top
Definition: eagle_parser.h:686
opt_bool active
Definition: eagle_parser.h:835
ECOORD x2
Definition: eagle_parser.h:497
OPTIONAL_XML_ATTRIBUTE< ECOORD > opt_ecoord
Definition: eagle_parser.h:373
int ToPcbUnits() const
Definition: eagle_parser.h:432
std::unordered_map< wxString, wxXmlNode * > NODE_MAP
Definition: eagle_parser.h:49
long long int value
Unit used for the value field.
Definition: eagle_parser.h:394
static wxXmlNode * getChildrenNodes(NODE_MAP &aMap, const wxString &aName)
Definition: eagle_parser.h:59
OPTIONAL_XML_ATTRIBUTE< EROT > opt_erot
Definition: eagle_parser.h:372
EINSTANCE(wxXmlNode *aInstance)
opt_ecoord size
Definition: eagle_parser.h:602
EPAD(wxXmlNode *aPad)
void Value(const char *aValue)
modify the last path node's value
Definition: eagle_parser.h:127
int layer_front_most
Definition: eagle_parser.h:553
ECOORD y
Definition: eagle_parser.h:981
opt_bool cream
Definition: eagle_parser.h:736
opt_bool locked
Definition: eagle_parser.h:820
opt_erot rot
Definition: eagle_parser.h:754