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-2018 KiCad Developers, see AUTHORS.txt for contributors.
6  * Copyright (C) 2017 CERN
7  * @author Alejandro GarcĂ­a Montoro <alejandro.garciamontoro@gmail.com>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
27 
28 #ifndef _EAGLE_PARSER_H_
29 #define _EAGLE_PARSER_H_
30 
31 #include <errno.h>
32 #include <unordered_map>
33 
34 #include <wx/xml/xml.h>
35 #include <wx/string.h>
36 #include <wx/filename.h>
37 
39 #include <convert_to_biu.h>
40 #include <macros.h>
41 #include <trigo.h>
42 #include <kicad_string.h>
43 #include <common.h>
44 
45 class MODULE;
46 struct EINSTANCE;
47 struct EPART;
48 struct ETEXT;
49 
50 typedef std::unordered_map<wxString, wxXmlNode*> NODE_MAP;
51 typedef std::map<wxString, MODULE*> MODULE_MAP;
52 typedef std::map<wxString, EINSTANCE*> EINSTANCE_MAP;
53 typedef std::map<wxString, std::unique_ptr<EPART>> EPART_MAP;
54 
56 wxString escapeName( const wxString& aNetName );
57 
58 static inline wxXmlNode* getChildrenNodes( NODE_MAP& aMap, const wxString& aName )
59 {
60  auto it = aMap.find( aName );
61  return it == aMap.end() ? nullptr : it->second->GetChildren();
62 }
63 
64 
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.push_back( TRIPLET( 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:
205  m_isAvailable( false ),
206  m_data( T() )
207  {}
208 
215  OPTIONAL_XML_ATTRIBUTE( const wxString& aData )
216  {
217  m_data = T();
218  m_isAvailable = !aData.IsEmpty();
219 
220  if( m_isAvailable )
221  Set( aData );
222  }
223 
229  template<typename V = T>
231  m_isAvailable( true ),
232  m_data( aData )
233  {}
234 
239  operator bool() const
240  {
241  return m_isAvailable;
242  }
243 
250  OPTIONAL_XML_ATTRIBUTE<T>& operator =( const wxString& aData )
251  {
252  m_isAvailable = !aData.IsEmpty();
253 
254  if( m_isAvailable )
255  Set( aData );
256 
257  return *this;
258  }
259 
266  OPTIONAL_XML_ATTRIBUTE<T>& operator =( T aData )
267  {
268  m_data = aData;
269  m_isAvailable = true;
270 
271  return *this;
272  }
273 
279  bool operator ==( const T& aOther ) const
280  {
281  return m_isAvailable && ( aOther == m_data );
282  }
283 
289  void Set( const wxString& aString )
290  {
291  m_data = Convert<T>( aString );
292  m_isAvailable = !aString.IsEmpty();
293  }
294 
300  T& Get()
301  {
302  assert( m_isAvailable );
303  return m_data;
304  }
305 
311  const T& CGet() const
312  {
313  assert( m_isAvailable );
314  return m_data;
315  }
316 
323  {
324  return Get();
325  }
326 
332  const T& operator*() const
333  {
334  return CGet();
335  }
336 
343  {
344  return &Get();
345  }
346 
352  const T* operator->() const
353  {
354  return &CGet();
355  }
356 };
357 
358 
366 NODE_MAP MapChildren( wxXmlNode* aCurrentNode );
367 
369 timestamp_t EagleTimeStamp( wxXmlNode* aTree );
370 
372 timestamp_t EagleModuleTstamp( const wxString& aName, const wxString& aValue, int aUnit );
373 
375 wxPoint ConvertArcCenter( const wxPoint& aStart, const wxPoint& aEnd, double aAngle );
376 
377 // Pre-declare for typedefs
378 struct EROT;
379 struct ECOORD;
386 
387 
388 // All of the 'E'STRUCTS below merely hold Eagle XML information verbatim, in binary.
389 // For maintenance and troubleshooting purposes, it was thought that we'd need to
390 // separate the conversion process into distinct steps. There is no intent to have KiCad
391 // forms of information in these 'E'STRUCTS. They are only binary forms
392 // of the Eagle information in the corresponding Eagle XML nodes.
393 
394 // Eagle coordinates
395 struct ECOORD
396 {
398  {
403  };
404 
406  long long int value;
407 
409  static constexpr EAGLE_UNIT ECOORD_UNIT = EU_NM;
410 
412  : value( 0 )
413  {
414  }
415 
416  ECOORD( int aValue, enum EAGLE_UNIT aUnit )
417  : value( ConvertToNm( aValue, aUnit ) )
418  {
419  }
420 
421  ECOORD( const wxString& aValue, enum EAGLE_UNIT aUnit );
422 
423  int ToMils() const
424  {
425  return value / 25400;
426  }
427 
428  int ToNanoMeters() const
429  {
430  return value;
431  }
432 
433  float ToMm() const
434  {
435  return value / 1000000.0;
436  }
437 
438  int ToSchUnits() const { return ToMils(); }
439  int ToPcbUnits() const { return ToNanoMeters(); }
440 
441  ECOORD operator+( const ECOORD& aOther ) const
442  {
443  return ECOORD( value + aOther.value, ECOORD_UNIT );
444  }
445 
446  ECOORD operator-( const ECOORD& aOther ) const
447  {
448  return ECOORD( value - aOther.value, ECOORD_UNIT );
449  }
450 
451  bool operator==( const ECOORD& aOther ) const
452  {
453  return value == aOther.value;
454  }
455 
457  static long long int ConvertToNm( int aValue, enum EAGLE_UNIT aUnit );
458 };
459 
460 
462 struct ENET
463 {
464  int netcode;
465  wxString netname;
466 
467  ENET( int aNetCode, const wxString& aNetName ) :
468  netcode( aNetCode ),
469  netname( aNetName )
470  {}
471 
472  ENET() :
473  netcode( 0 )
474  {}
475 };
476 
477 
479 struct EROT
480 {
481  bool mirror;
482  bool spin;
483  double degrees;
484 
485  EROT() :
486  mirror( false ),
487  spin( false ),
488  degrees( 0 )
489  {}
490 
491  EROT( double aDegrees ) :
492  mirror( false ),
493  spin( false ),
494  degrees( aDegrees )
495  {}
496 };
497 
498 
500 struct EWIRE
501 {
508 
509  // for style: (continuous | longdash | shortdash | dashdot)
510  enum {
515  };
516  opt_int style;
517  opt_double curve;
518 
519  // for cap: (flat | round)
520  enum {
523  };
524  opt_int cap;
525 
526  EWIRE( wxXmlNode* aWire );
527 };
528 
529 
531 struct EJUNCTION
532 {
535 
536  EJUNCTION( wxXmlNode* aJunction);
537 };
538 
539 
541 struct ELABEL
542 {
547  opt_erot rot;
548  opt_wxString xref;
549  wxString netname;
550 
551  ELABEL( wxXmlNode* aLabel, const wxString& aNetName );
552 };
553 
554 
556 struct EVIA
557 {
563  opt_ecoord diam;
564  opt_wxString shape;
565 
566  EVIA( wxXmlNode* aVia );
567 };
568 
569 
571 struct ECIRCLE
572 {
578 
579  ECIRCLE( wxXmlNode* aCircle );
580 };
581 
582 
584 struct ERECT
585 {
590  int layer;
591  opt_erot rot;
592 
593  ERECT( wxXmlNode* aRect );
594 };
595 
596 
603 struct EATTR
604 {
605  wxString name;
606  opt_wxString value;
607  opt_ecoord x;
608  opt_ecoord y;
609  opt_ecoord size;
610  opt_int layer;
611  opt_double ratio;
612  opt_erot rot;
613 
614  enum { // for 'display'
619  };
620  opt_int display;
621  opt_int align;
622 
623  EATTR( wxXmlNode* aTree );
624  EATTR() {}
625 };
626 
627 
630 {
637  int layer;
638 
639  opt_wxString dimensionType;
640 
641  EDIMENSION( wxXmlNode* aDimension );
642 };
643 
644 
646 struct ETEXT
647 {
648  wxString text;
652  int layer;
653  opt_wxString font;
654  opt_double ratio;
655  opt_erot rot;
656 
657  enum { // for align
663 
664  // opposites are -1 x above, used by code tricks in here
665  CENTER_RIGHT = -CENTER_LEFT,
666  BOTTOM_CENTER = -TOP_CENTER,
667  BOTTOM_LEFT = -TOP_RIGHT,
668  BOTTOM_RIGHT = -TOP_LEFT,
669  };
670 
671  opt_int align;
672 
673  ETEXT( wxXmlNode* aText );
674 
676  wxSize ConvertSize() const;
677 };
678 
679 
682 {
683  wxString name;
684  ECOORD x, y;
685  opt_erot rot;
686  opt_bool stop;
687  opt_bool thermals;
688 
689  EPAD_COMMON( wxXmlNode* aPad );
690 };
691 
692 
694 struct EPAD : public EPAD_COMMON
695 {
697  opt_ecoord diameter;
698 
699  // for shape: (square | round | octagon | long | offset)
700  enum {
706  };
707  opt_int shape;
708  opt_bool first;
709 
710  EPAD( wxXmlNode* aPad );
711 };
712 
713 
715 struct ESMD : public EPAD_COMMON
716 {
719  int layer;
720  opt_int roundness;
721  opt_bool cream;
722 
723  ESMD( wxXmlNode* aSMD );
724 };
725 
726 
728 struct EPIN
729 {
730  wxString name;
733 
734  opt_wxString visible;
735  opt_wxString length;
736  opt_wxString direction;
737  opt_wxString function;
738  opt_int swaplevel;
739  opt_erot rot;
740 
741  EPIN( wxXmlNode* aPin );
742 };
743 
744 
746 struct EVERTEX
747 {
750  opt_double curve;
751 
752  EVERTEX( wxXmlNode* aVertex );
753 };
754 
755 
757 struct EPOLYGON
758 {
760  int layer;
761  opt_ecoord spacing;
762 
763  // KiCad priority is opposite of Eagle rank, that is:
764  // - Eagle Low rank drawn first
765  // - KiCad high priority drawn first
766  // So since Eagle has an upper limit we define this, used for the cases
767  // where no rank is specified.
768  static const int max_priority = 6;
769 
770  enum { // for pour
774  };
775  int pour;
776  opt_ecoord isolate;
777  opt_bool orphans;
778  opt_bool thermals;
779  opt_int rank;
780 
781  EPOLYGON( wxXmlNode* aPolygon );
782 };
783 
784 
786 struct EHOLE
787 {
791 
792  EHOLE( wxXmlNode* aHole );
793 };
794 
795 
797 struct EELEMENT
798 {
799  wxString name;
800  wxString library;
801  wxString package;
802  wxString value;
805  opt_bool locked;
806  opt_bool smashed;
807  opt_erot rot;
808 
809  EELEMENT( wxXmlNode* aElement );
810 };
811 
812 
813 struct ELAYER
814 {
815  int number;
816  wxString name;
817  int color;
818  int fill;
819  opt_bool visible;
820  opt_bool active;
821 
822  ELAYER( wxXmlNode* aLayer );
823 };
824 
825 
827 {
828  enum
829  {
830  TOP = 1,
831  ROUTE2 = 2,
832  ROUTE3 = 3,
833  ROUTE4 = 4,
834  ROUTE5 = 5,
835  ROUTE6 = 6,
836  ROUTE7 = 7,
837  ROUTE8 = 8,
838  ROUTE9 = 9,
839  ROUTE10 = 10,
840  ROUTE11 = 11,
841  ROUTE12 = 12,
842  ROUTE13 = 13,
843  ROUTE14 = 14,
844  ROUTE15 = 15,
845  BOTTOM = 16,
846  PADS = 17,
847  VIAS = 18,
848  UNROUTED = 19,
849  DIMENSION = 20,
850  TPLACE = 21,
851  BPLACE = 22,
852  TORIGINS = 23,
853  BORIGINS = 24,
854  TNAMES = 25,
855  BNAMES = 26,
856  TVALUES = 27,
857  BVALUES = 28,
858  TSTOP = 29,
859  BSTOP = 30,
860  TCREAM = 31,
861  BCREAM = 32,
862  TFINISH = 33,
863  BFINISH = 34,
864  TGLUE = 35,
865  BGLUE = 36,
866  TTEST = 37,
867  BTEST = 38,
868  TKEEPOUT = 39,
869  BKEEPOUT = 40,
870  TRESTRICT = 41,
871  BRESTRICT = 42,
872  VRESTRICT = 43,
873  DRILLS = 44,
874  HOLES = 45,
875  MILLING = 46,
876  MEASURES = 47,
877  DOCUMENT = 48,
878  REFERENCELC = 49,
879  REFERENCELS = 50,
880  TDOCU = 51,
881  BDOCU = 52,
882  NETS = 91,
883  BUSSES = 92,
884  PINS = 93,
885  SYMBOLS = 94,
886  NAMES = 95,
887  VALUES = 96,
888  INFO = 97,
889  GUIDE = 98,
890  USERLAYER1 = 160,
891  USERLAYER2 = 161
892  };
893 };
894 
895 
896 struct EPART
897 {
898  /*
899  * <!ELEMENT part (attribute*, variant*)>
900  * <!ATTLIST part
901  * name %String; #REQUIRED
902  * library %String; #REQUIRED
903  * deviceset %String; #REQUIRED
904  * device %String; #REQUIRED
905  * technology %String; ""
906  * value %String; #IMPLIED
907  * >
908  */
909 
910  wxString name;
911  wxString library;
912  wxString deviceset;
913  wxString device;
914  opt_wxString technology;
915  opt_wxString value;
916  std::map<std::string,std::string> attribute;
917  std::map<std::string,std::string> variant;
918 
919  EPART( wxXmlNode* aPart );
920 };
921 
922 
923 struct EINSTANCE
924 {
925  /*
926  * <!ELEMENT instance (attribute)*>
927  * <!ATTLIST instance
928  * part %String; #REQUIRED
929  * gate %String; #REQUIRED
930  * x %Coord; #REQUIRED
931  * y %Coord; #REQUIRED
932  * smashed %Bool; "no"
933  * rot %Rotation; "R0"
934  * >
935  */
936 
937  wxString part;
938  wxString gate;
941  opt_bool smashed;
942  opt_erot rot;
943 
944  EINSTANCE( wxXmlNode* aInstance );
945 };
946 
947 
948 struct EGATE
949 {
950  /*
951  * <!ELEMENT gate EMPTY>
952  * <!ATTLIST gate
953  * name %String; #REQUIRED
954  * symbol %String; #REQUIRED
955  * x %Coord; #REQUIRED
956  * y %Coord; #REQUIRED
957  * addlevel %GateAddLevel; "next"
958  * swaplevel %Int; "0"
959  * >
960  */
961 
962  wxString name;
963  wxString symbol;
964 
967 
968  opt_int addlevel;
969  opt_int swaplevel;
970 
971  enum
972  {
977  ALWAYS
978  };
979 
980  EGATE( wxXmlNode* aGate );
981 };
982 
983 
984 struct ECONNECT
985 {
986  /*
987  * <!ELEMENT connect EMPTY>
988  * <!ATTLIST connect
989  * gate %String; #REQUIRED
990  * pin %String; #REQUIRED
991  * pad %String; #REQUIRED
992  * route %ContactRoute; "all"
993  * >
994  */
995  wxString gate;
996  wxString pin;
997  wxString pad;
998  //int contactroute; // TODO
999 
1000  ECONNECT( wxXmlNode* aConnect );
1001 };
1002 
1003 
1004 struct EDEVICE
1005 {
1006  /*
1007  <!ELEMENT device (connects?, technologies?)>
1008  <!ATTLIST device
1009  name %String; ""
1010  package %String; #IMPLIED
1011  >
1012 */
1013  wxString name;
1014  opt_wxString package;
1015 
1016  std::vector<ECONNECT> connects;
1017 
1018  EDEVICE( wxXmlNode* aDevice );
1019 };
1020 
1021 
1023 {
1024  /*
1025  <!ELEMENT deviceset (description?, gates, devices)>
1026  <!ATTLIST deviceset
1027  name %String; #REQUIRED
1028  prefix %String; ""
1029  uservalue %Bool; "no"
1030  >
1031  */
1032 
1033  wxString name;
1034  opt_wxString prefix;
1035  opt_bool uservalue;
1036  //std::vector<EDEVICE> devices;
1037  //std::vector<EGATE> gates;
1038 
1039 
1040  EDEVICE_SET( wxXmlNode* aDeviceSet );
1041 };
1042 
1043 
1044 #endif // _EAGLE_PARSER_H_
void Set(const wxString &aString)
Function Set tries to convert a string to the base type.
Definition: eagle_parser.h:289
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:746
Eagle rotation.
Definition: eagle_parser.h:479
wxString deviceset
Definition: eagle_parser.h:912
Eagle Junction.
Definition: eagle_parser.h:531
timestamp_t EagleModuleTstamp(const wxString &aName, const wxString &aValue, int aUnit)
Computes module timestamp basing on its name, value and unit
bool mirror
Definition: eagle_parser.h:481
opt_double curve
range is -359.9..359.9
Definition: eagle_parser.h:517
ECOORD x
Definition: eagle_parser.h:731
timestamp_t EagleTimeStamp(wxXmlNode *aTree)
Make a unique time stamp
const T & operator*() const
Operator * returns a constant reference to the value of the attribute assuming it is available...
Definition: eagle_parser.h:332
wxString pad
Definition: eagle_parser.h:997
boost::ptr_vector< NET > NETS
Definition: specctra.h:2689
wxString Convert< wxString >(const wxString &aValue)
opt_int rank
Definition: eagle_parser.h:779
wxString part
Definition: eagle_parser.h:937
wxString name
Definition: eagle_parser.h:910
long timestamp_t
timestamp_t is our type to represent unique IDs for all kinds of elements; historically simply the ti...
Definition: common.h:52
ECOORD x
Definition: eagle_parser.h:543
opt_ecoord diam
Definition: eagle_parser.h:563
opt_wxString technology
Definition: eagle_parser.h:914
wxString library
Definition: eagle_parser.h:911
boost::ptr_vector< PIN > PINS
Definition: specctra.h:1972
opt_wxString direction
Definition: eagle_parser.h:736
void clear()
Definition: eagle_parser.h:122
opt_erot rot
Definition: eagle_parser.h:547
opt_int cap
Definition: eagle_parser.h:524
float ToMm() const
Definition: eagle_parser.h:433
ECOORD drill
< inclusive
Definition: eagle_parser.h:562
T & Get()
Function Get returns a reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:300
opt_wxString shape
Definition: eagle_parser.h:564
ECOORD y
Definition: eagle_parser.h:749
void push(const char *aPathSegment, const char *aAttribute="")
Definition: eagle_parser.h:117
Eagle element element.
Definition: eagle_parser.h:797
Class XPATH keeps track of what we are working on within a PTREE.
Definition: eagle_parser.h:112
ECOORD x2
Definition: eagle_parser.h:588
opt_double ratio
Definition: eagle_parser.h:654
opt_bool visible
Definition: eagle_parser.h:819
void Attribute(const char *aAttribute)
modify the last path node&#39;s attribute
Definition: eagle_parser.h:133
int number
Definition: eagle_parser.h:815
OPTIONAL_XML_ATTRIBUTE()
Constructor OPTIONAL_XML_ATTRIBUTE construct a default OPTIONAL_XML_ATTRIBUTE, whose data is not avai...
Definition: eagle_parser.h:204
opt_wxString xref
Definition: eagle_parser.h:548
opt_erot rot
Definition: eagle_parser.h:807
wxString gate
Definition: eagle_parser.h:995
ECOORD width
Definition: eagle_parser.h:506
opt_bool thermals
Definition: eagle_parser.h:778
opt_bool smashed
Definition: eagle_parser.h:806
std::map< std::string, std::string > variant
Definition: eagle_parser.h:917
OPTIONAL_XML_ATTRIBUTE(T aData)
Constructor OPTIONAL_XML_ATTRIBUTE.
Definition: eagle_parser.h:230
wxString name
Definition: eagle_parser.h:683
const char * element
Definition: eagle_parser.h:87
wxPoint ConvertArcCenter(const wxPoint &aStart, const wxPoint &aEnd, double aAngle)
Convert an Eagle curve end to a KiCad center for S_ARC
opt_erot rot
Definition: eagle_parser.h:591
double degrees
Definition: eagle_parser.h:483
ECOORD width
Definition: eagle_parser.h:759
ECOORD x
Definition: eagle_parser.h:939
Eagle SMD pad.
Definition: eagle_parser.h:715
ECOORD y
Definition: eagle_parser.h:574
bool operator==(const PART_LIB &aLibrary, const wxString &aName)
Case insensitive library name comparison.
ECOORD y
Definition: eagle_parser.h:804
ECOORD y
Definition: eagle_parser.h:534
Eagle hole element.
Definition: eagle_parser.h:786
Class XML_PARSER_ERROR implements a simple wrapper around runtime_error to isolate the errors thrown ...
Definition: eagle_parser.h:70
OPTIONAL_XML_ATTRIBUTE< int > opt_int
Definition: eagle_parser.h:381
wxString netname
Definition: eagle_parser.h:549
bool operator==(const ECOORD &aOther) const
Definition: eagle_parser.h:451
Eagle text element.
Definition: eagle_parser.h:646
opt_erot rot
Definition: eagle_parser.h:612
std::map< wxString, MODULE * > MODULE_MAP
Definition: eagle_parser.h:51
opt_bool thermals
Definition: eagle_parser.h:687
ECOORD width
Definition: eagle_parser.h:576
opt_int swaplevel
Definition: eagle_parser.h:738
ECOORD x
Definition: eagle_parser.h:573
Eagle pin element.
Definition: eagle_parser.h:728
int fill
Definition: eagle_parser.h:818
Eagle label.
Definition: eagle_parser.h:541
opt_wxString value
Definition: eagle_parser.h:915
nanometers
Definition: eagle_parser.h:399
This file contains miscellaneous commonly used macros and functions.
ECOORD y
Definition: eagle_parser.h:544
#define TOP
Definition: autorout.h:49
OPTIONAL_XML_ATTRIBUTE< wxString > opt_wxString
Definition: eagle_parser.h:379
int layer_back_most
< extent
Definition: eagle_parser.h:561
segment (element) of our XPATH into the Eagle XML document tree in PTREE form.
Definition: eagle_parser.h:85
wxString name
opt_int align
Definition: eagle_parser.h:621
ECOORD dy
Definition: eagle_parser.h:718
wxString gate
Definition: eagle_parser.h:938
opt_ecoord isolate
Definition: eagle_parser.h:776
wxString name
Definition: eagle_parser.h:605
T * operator->()
Operator -> returns a pointer to the value of the attribute assuming it is available.
Definition: eagle_parser.h:342
wxString name
Definition: eagle_parser.h:816
ECOORD y1
Definition: eagle_parser.h:503
wxString value
Definition: eagle_parser.h:802
ECOORD operator+(const ECOORD &aOther) const
Definition: eagle_parser.h:441
int ToNanoMeters() const
Definition: eagle_parser.h:428
OPTIONAL_XML_ATTRIBUTE< double > opt_double
Definition: eagle_parser.h:382
opt_int style
Definition: eagle_parser.h:516
ECOORD x
Definition: eagle_parser.h:788
wxString escapeName(const wxString &aNetName)
Translates Eagle special characters to their counterparts in KiCad.
OPTIONAL_XML_ATTRIBUTE< bool > opt_bool
Definition: eagle_parser.h:383
LAYER_NUM layer
Definition: eagle_parser.h:507
opt_ecoord y
Definition: eagle_parser.h:608
int layer
Definition: eagle_parser.h:590
Eagle thru hole pad.
Definition: eagle_parser.h:694
opt_ecoord spacing
Definition: eagle_parser.h:761
wxString name
Definition: eagle_parser.h:799
ECOORD size
Definition: eagle_parser.h:545
ECOORD y1
Definition: eagle_parser.h:587
Eagle circle.
Definition: eagle_parser.h:571
ECOORD dx
Definition: eagle_parser.h:717
wxString symbol
Definition: eagle_parser.h:963
std::vector< TRIPLET > p
Definition: eagle_parser.h:114
ECOORD x
Definition: eagle_parser.h:649
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:916
Class OPTIONAL_XML_ATTRIBUTE models an optional XML attribute.
Definition: eagle_parser.h:190
ECOORD size
Definition: eagle_parser.h:651
int layer
Definition: eagle_parser.h:719
opt_int swaplevel
Definition: eagle_parser.h:969
opt_wxString value
Definition: eagle_parser.h:606
int ToPcbUnits() const
Definition: eagle_parser.h:439
int ToMils() const
Definition: eagle_parser.h:423
wxString text
Definition: eagle_parser.h:648
std::map< wxString, EINSTANCE * > EINSTANCE_MAP
Definition: eagle_parser.h:52
wxString name
Definition: eagle_parser.h:962
ECOORD x
Definition: eagle_parser.h:803
opt_int roundness
Definition: eagle_parser.h:720
mils/thous
Definition: eagle_parser.h:402
LAYER_NUM layer
Definition: eagle_parser.h:577
Eagle XML rectangle in binary.
Definition: eagle_parser.h:584
opt_int align
Definition: eagle_parser.h:671
Eagle net.
Definition: eagle_parser.h:462
opt_double curve
range is -359.9..359.9
Definition: eagle_parser.h:750
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
millimeters
Definition: eagle_parser.h:400
ECOORD y2
Definition: eagle_parser.h:505
opt_wxString prefix
Class EATTR parses an Eagle "attribute" XML element.
Definition: eagle_parser.h:603
opt_ecoord x
Definition: eagle_parser.h:607
opt_int layer
Definition: eagle_parser.h:610
Eagle via.
Definition: eagle_parser.h:556
ECOORD x1
Definition: eagle_parser.h:586
opt_wxString dimensionType
Definition: eagle_parser.h:639
opt_int addlevel
Definition: eagle_parser.h:968
opt_erot rot
Definition: eagle_parser.h:655
int netcode
Definition: eagle_parser.h:464
NODE_MAP MapChildren(wxXmlNode *aCurrentNode)
Function MapChildren provides 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:653
ECOORD x
Definition: eagle_parser.h:748
opt_ecoord diameter
Definition: eagle_parser.h:697
std::map< wxString, std::unique_ptr< EPART > > EPART_MAP
Definition: eagle_parser.h:53
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:681
T m_data
The actual data if m_isAvailable is true; otherwise, garbage.
Definition: eagle_parser.h:197
OPTIONAL_XML_ATTRIBUTE(const wxString &aData)
Constructor OPTIONAL_XML_ATTRIBUTE.
Definition: eagle_parser.h:215
T & operator*()
Operator * returns a reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:322
wxString netname
Definition: eagle_parser.h:465
ECOORD radius
Definition: eagle_parser.h:575
std::vector< ECONNECT > connects
opt_double ratio
Definition: eagle_parser.h:611
opt_erot rot
Definition: eagle_parser.h:685
ECOORD x
Definition: eagle_parser.h:965
ECOORD y
Definition: eagle_parser.h:559
opt_bool smashed
Definition: eagle_parser.h:941
The common library.
ECOORD x
Definition: eagle_parser.h:533
ECOORD(int aValue, enum EAGLE_UNIT aUnit)
Definition: eagle_parser.h:416
LAYER_NUM layer
Definition: eagle_parser.h:546
opt_bool first
Definition: eagle_parser.h:708
Eagle wire.
Definition: eagle_parser.h:500
opt_bool orphans
Definition: eagle_parser.h:777
opt_bool uservalue
ECOORD x
Definition: eagle_parser.h:558
T Convert(const wxString &aValue)
Function Convert converts a wxString to a generic type T.
Definition: eagle_parser.h:175
ECOORD y
Definition: eagle_parser.h:732
wxString name
Definition: eagle_parser.h:730
opt_wxString package
#define BOTTOM
Definition: autorout.h:50
opt_erot rot
Definition: eagle_parser.h:942
opt_int shape
Definition: eagle_parser.h:707
Eagle dimension element.
Definition: eagle_parser.h:629
wxString package
Definition: eagle_parser.h:801
bool spin
Definition: eagle_parser.h:482
ECOORD operator-(const ECOORD &aOther) const
Definition: eagle_parser.h:446
ECOORD y
Definition: eagle_parser.h:940
ECOORD y2
Definition: eagle_parser.h:589
EROT(double aDegrees)
Definition: eagle_parser.h:491
ECOORD y
Definition: eagle_parser.h:650
Eagle polygon, without vertices which are parsed as needed.
Definition: eagle_parser.h:757
opt_int display
Definition: eagle_parser.h:620
void pop()
Definition: eagle_parser.h:124
const T & CGet() const
Function CGet returns a constant reference to the value of the attribute assuming it is available...
Definition: eagle_parser.h:311
ECOORD drill
Definition: eagle_parser.h:696
ECOORD y
Definition: eagle_parser.h:789
const char * value
Definition: eagle_parser.h:89
ENET(int aNetCode, const wxString &aNetName)
Definition: eagle_parser.h:467
opt_bool stop
Definition: eagle_parser.h:686
int layer
Definition: eagle_parser.h:652
wxString device
Definition: eagle_parser.h:913
ECOORD x1
Definition: eagle_parser.h:502
const char * attribute
Definition: eagle_parser.h:88
wxString library
Definition: eagle_parser.h:800
XML_PARSER_ERROR(const wxString &aMessage) noexcept
Constructor XML_PARSER_ERROR build an XML error by just calling its parent class constructor, std::runtime_error, with the passed message.
Definition: eagle_parser.h:78
opt_wxString visible
Definition: eagle_parser.h:734
ECOORD drill
Definition: eagle_parser.h:790
wxString pin
Definition: eagle_parser.h:996
opt_wxString length
Definition: eagle_parser.h:735
int color
Definition: eagle_parser.h:817
const T * operator->() const
Operator -> returns a constant pointer to the value of the attribute assuming it is available...
Definition: eagle_parser.h:352
Class DIMENSION.
opt_bool active
Definition: eagle_parser.h:820
ECOORD x2
Definition: eagle_parser.h:504
OPTIONAL_XML_ATTRIBUTE< ECOORD > opt_ecoord
Definition: eagle_parser.h:385
std::unordered_map< wxString, wxXmlNode * > NODE_MAP
Definition: eagle_parser.h:48
long long int value
Value expressed in nanometers
Definition: eagle_parser.h:406
int ToSchUnits() const
Definition: eagle_parser.h:438
static wxXmlNode * getChildrenNodes(NODE_MAP &aMap, const wxString &aName)
Definition: eagle_parser.h:58
OPTIONAL_XML_ATTRIBUTE< EROT > opt_erot
Definition: eagle_parser.h:384
opt_ecoord size
Definition: eagle_parser.h:609
void Value(const char *aValue)
modify the last path node&#39;s value
Definition: eagle_parser.h:127
int layer_front_most
Definition: eagle_parser.h:560
ECOORD y
Definition: eagle_parser.h:966
opt_bool cream
Definition: eagle_parser.h:721
opt_bool locked
Definition: eagle_parser.h:805
opt_erot rot
Definition: eagle_parser.h:739