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 <[email protected]>
5 * Copyright (C) 2012-2023 KiCad Developers, see AUTHORS.txt for contributors.
6 * Copyright (C) 2017 CERN
7 *
8 * @author Alejandro GarcĂ­a Montoro <[email protected]>
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
44class FOOTPRINT;
45struct EINSTANCE;
46struct EPART;
47struct ETEXT;
48
49typedef std::unordered_map<wxString, wxXmlNode*> NODE_MAP;
50typedef std::map<wxString, FOOTPRINT*> FOOTPRINT_MAP;
51typedef std::map<wxString, EINSTANCE*> EINSTANCE_MAP;
52typedef std::map<wxString, std::unique_ptr<EPART>> EPART_MAP;
53
55wxString escapeName( const wxString& aNetName );
56
58wxString interpretText( const wxString& aText );
59
61bool substituteVariable( wxString* aText );
62
63static inline wxXmlNode* getChildrenNodes( NODE_MAP& aMap, const wxString& aName )
64{
65 auto it = aMap.find( aName );
66 return it == aMap.end() ? nullptr : it->second->GetChildren();
67}
68
69
74struct XML_PARSER_ERROR : std::runtime_error
75{
82 XML_PARSER_ERROR( const wxString& aMessage ) noexcept :
83 std::runtime_error( "XML parser failed - " + aMessage.ToStdString() )
84 {}
85};
86
87
89struct TRIPLET
90{
91 const char* element;
92 const char* attribute;
93 const char* value;
94
95 TRIPLET( const char* aElement, const char* aAttribute = "", const char* aValue = "" ) :
96 element( aElement ),
97 attribute( aAttribute ),
98 value( aValue )
99 {}
100};
101
102
116class XPATH
117{
118 std::vector<TRIPLET> p;
119
120public:
121 void push( const char* aPathSegment, const char* aAttribute="" )
122 {
123 p.emplace_back( aPathSegment, aAttribute );
124 }
125
126 void clear() { p.clear(); }
127
128 void pop() { p.pop_back(); }
129
131 void Value( const char* aValue )
132 {
133 p.back().value = aValue;
134 }
135
137 void Attribute( const char* aAttribute )
138 {
139 p.back().attribute = aAttribute;
140 }
141
143 wxString Contents()
144 {
145 typedef std::vector<TRIPLET>::const_iterator CITER_TRIPLET;
146
147 wxString ret;
148
149 for( CITER_TRIPLET it = p.begin(); it != p.end(); ++it )
150 {
151 if( it != p.begin() )
152 ret += '.';
153
154 ret += it->element;
155
156 if( it->attribute[0] && it->value[0] )
157 {
158 ret += '[';
159 ret += it->attribute;
160 ret += '=';
161 ret += it->value;
162 ret += ']';
163 }
164 }
165
166 return ret;
167 }
168};
169
170
178template<typename T>
179T Convert( const wxString& aValue )
180{
181 throw XML_PARSER_ERROR( "Conversion failed. Unknown type." );
182}
183
184template <>
185wxString Convert<wxString>( const wxString& aValue );
186
193template <typename T>
195{
196private:
199
202
203public:
208 m_isAvailable( false ),
209 m_data( T() )
210 {}
211
217 OPTIONAL_XML_ATTRIBUTE( const wxString& aData )
218 {
219 m_data = T();
220 m_isAvailable = !aData.IsEmpty();
221
222 if( m_isAvailable )
223 Set( aData );
224 }
225
230 template<typename V = T>
232 m_isAvailable( true ),
233 m_data( aData )
234 {}
235
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
267 {
268 m_data = aData;
269 m_isAvailable = true;
270
271 return *this;
272 }
273
277 bool operator ==( const T& aOther ) const
278 {
279 return m_isAvailable && ( aOther == m_data );
280 }
281
287 void Set( const wxString& aString )
288 {
289 m_data = Convert<T>( aString );
290 m_isAvailable = !aString.IsEmpty();
291 }
292
298 T& Get()
299 {
300 assert( m_isAvailable );
301 return m_data;
302 }
303
309 const T& CGet() const
310 {
311 assert( m_isAvailable );
312 return m_data;
313 }
314
321 {
322 return Get();
323 }
324
330 const T& operator*() const
331 {
332 return CGet();
333 }
334
341 {
342 return &Get();
343 }
344
350 const T* operator->() const
351 {
352 return &CGet();
353 }
354};
355
356
364NODE_MAP MapChildren( wxXmlNode* aCurrentNode );
365
367VECTOR2I ConvertArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double aAngle );
368
369// Pre-declare for typedefs
370struct EROT;
371struct ECOORD;
378
379
380// All of the 'E'STRUCTS below merely hold Eagle XML information verbatim, in binary.
381// For maintenance and troubleshooting purposes, it was thought that we'd need to
382// separate the conversion process into distinct steps. There is no intent to have KiCad
383// forms of information in these 'E'STRUCTS. They are only binary forms
384// of the Eagle information in the corresponding Eagle XML nodes.
385
386// Eagle coordinates
387struct ECOORD
388{
390 {
395 };
396
398 long long int value;
399
401 static constexpr EAGLE_UNIT ECOORD_UNIT = EU_NM;
402
404 : value( 0 )
405 {
406 }
407
408 ECOORD( int aValue, enum EAGLE_UNIT aUnit )
409 : value( ConvertToNm( aValue, aUnit ) )
410 {
411 }
412
413 ECOORD( const wxString& aValue, enum EAGLE_UNIT aUnit );
414
415 int ToMils() const
416 {
417 return value / 25400;
418 }
419
420 int To100NanoMeters() const
421 {
422 return value / 100;
423 }
424
425 int ToNanoMeters() const
426 {
427 return value;
428 }
429
430 float ToMm() const
431 {
432 return value / 1000000.0;
433 }
434
435 int ToSchUnits() const { return To100NanoMeters(); }
436 int ToPcbUnits() const { return ToNanoMeters(); }
437
438 ECOORD operator+( const ECOORD& aOther ) const
439 {
440 return ECOORD( value + aOther.value, ECOORD_UNIT );
441 }
442
443 ECOORD operator-( const ECOORD& aOther ) const
444 {
445 return ECOORD( value - aOther.value, ECOORD_UNIT );
446 }
447
448 bool operator==( const ECOORD& aOther ) const
449 {
450 return value == aOther.value;
451 }
452
454 static long long int ConvertToNm( int aValue, enum EAGLE_UNIT aUnit );
455};
456
457
459struct ENET
460{
462 wxString netname;
463
464 ENET( int aNetCode, const wxString& aNetName ) :
465 netcode( aNetCode ),
466 netname( aNetName )
467 {}
468
470 netcode( 0 )
471 {}
472};
473
474
476struct EROT
477{
478 bool mirror;
479 bool spin;
480 double degrees;
481
483 mirror( false ),
484 spin( false ),
485 degrees( 0 )
486 {}
487
488 EROT( double aDegrees ) :
489 mirror( false ),
490 spin( false ),
491 degrees( aDegrees )
492 {}
493};
494
495
497struct EWIRE
498{
504 int layer;
505
506 // for style: (continuous | longdash | shortdash | dashdot)
511
514
515 // for cap: (flat | round)
516 enum { FLAT,
518
520
521 EWIRE( wxXmlNode* aWire );
522};
523
524
527{
530
531 EJUNCTION( wxXmlNode* aJunction);
532};
533
534
536struct ELABEL
537{
541 int layer;
544 wxString netname;
545
546 ELABEL( wxXmlNode* aLabel, const wxString& aNetName );
547};
548
549
551struct EVIA
552{
560
561 EVIA( wxXmlNode* aVia );
562};
563
564
567{
572 int layer;
573
574 ECIRCLE( wxXmlNode* aCircle );
575};
576
577
579struct ERECT
580{
585 int layer;
587
588 ERECT( wxXmlNode* aRect );
589};
590
591
598struct EATTR
599{
600 wxString name;
608
609 enum { // for 'display'
614 };
617
618 EATTR( wxXmlNode* aTree );
619 EATTR() {}
620};
621
622
625{
633 int layer;
635
636 EDIMENSION( wxXmlNode* aDimension );
637};
638
639
641struct ETEXT
642{
643 wxString text;
647 int layer;
651
652 enum { // for align
658
659 // opposites are -1 x above, used by code tricks in here
664 };
665
667
668 ETEXT( wxXmlNode* aText );
669
671 wxSize ConvertSize() const;
672};
673
674
678struct EFRAME
679{
685 int rows;
686 int layer;
691
692 EFRAME( wxXmlNode* aFrameNode );
693};
694
695
698{
699 wxString name;
704
705 EPAD_COMMON( wxXmlNode* aPad );
706};
707
708
710struct EPAD : public EPAD_COMMON
711{
714
715 // for shape: (square | round | octagon | long | offset)
716 enum {
717 UNDEF = -1,
723 };
726
727 EPAD( wxXmlNode* aPad );
728};
729
730
732struct ESMD : public EPAD_COMMON
733{
736 int layer;
739
740 ESMD( wxXmlNode* aSMD );
741};
742
743
745struct EPIN
746{
747 wxString name;
750
757
758 EPIN( wxXmlNode* aPin );
759};
760
761
764{
768
769 EVERTEX( wxXmlNode* aVertex );
770};
771
772
775{
777 int layer;
779
780 // KiCad priority is opposite of Eagle rank, that is:
781 // - Eagle Low rank drawn first
782 // - KiCad high priority drawn first
783 // So since Eagle has an upper limit we define this, used for the cases
784 // where no rank is specified.
785 static const int max_priority = 6;
786
787 enum { // for pour
791 };
792 int pour;
797
798 EPOLYGON( wxXmlNode* aPolygon );
799};
800
801
803struct EHOLE
804{
808
809 EHOLE( wxXmlNode* aHole );
810};
811
812
815{
816 wxString name;
817 wxString library;
818 wxString package;
819 wxString value;
825
826 EELEMENT( wxXmlNode* aElement );
827};
828
829
830struct ELAYER
831{
833 wxString name;
834 int color;
835 int fill;
838
839 ELAYER( wxXmlNode* aLayer );
840};
841
842
844{
845 enum
846 {
847 TOP = 1,
862 BOTTOM = 16,
863 PADS = 17,
864 VIAS = 18,
867 TPLACE = 21,
868 BPLACE = 22,
871 TNAMES = 25,
872 BNAMES = 26,
875 TSTOP = 29,
876 BSTOP = 30,
877 TCREAM = 31,
878 BCREAM = 32,
881 TGLUE = 35,
882 BGLUE = 36,
883 TTEST = 37,
884 BTEST = 38,
890 DRILLS = 44,
891 HOLES = 45,
897 TDOCU = 51,
898 BDOCU = 52,
899 NETS = 91,
900 BUSSES = 92,
901 PINS = 93,
903 NAMES = 95,
904 VALUES = 96,
905 INFO = 97,
906 GUIDE = 98,
908 USERLAYER2 = 161
909 };
910};
911
912
913struct EPART
914{
915 /*
916 * <!ELEMENT part (attribute*, variant*)>
917 * <!ATTLIST part
918 * name %String; #REQUIRED
919 * library %String; #REQUIRED
920 * deviceset %String; #REQUIRED
921 * device %String; #REQUIRED
922 * technology %String; ""
923 * value %String; #IMPLIED
924 * >
925 */
926
927 wxString name;
928 wxString library;
929 wxString deviceset;
930 wxString device;
933 std::map<std::string,std::string> attribute;
934 std::map<std::string,std::string> variant;
935
936 EPART( wxXmlNode* aPart );
937};
938
939
941{
942 /*
943 * <!ELEMENT instance (attribute)*>
944 * <!ATTLIST instance
945 * part %String; #REQUIRED
946 * gate %String; #REQUIRED
947 * x %Coord; #REQUIRED
948 * y %Coord; #REQUIRED
949 * smashed %Bool; "no"
950 * rot %Rotation; "R0"
951 * >
952 */
953
954 wxString part;
955 wxString gate;
960
961 EINSTANCE( wxXmlNode* aInstance );
962};
963
964
965struct EGATE
966{
967 /*
968 * <!ELEMENT gate EMPTY>
969 * <!ATTLIST gate
970 * name %String; #REQUIRED
971 * symbol %String; #REQUIRED
972 * x %Coord; #REQUIRED
973 * y %Coord; #REQUIRED
974 * addlevel %GateAddLevel; "next"
975 * swaplevel %Int; "0"
976 * >
977 */
978
979 wxString name;
980 wxString symbol;
981
984
987
988 enum
989 {
994 ALWAYS
995 };
996
997 EGATE( wxXmlNode* aGate );
998};
999
1000
1002{
1003 /*
1004 * <!ELEMENT connect EMPTY>
1005 * <!ATTLIST connect
1006 * gate %String; #REQUIRED
1007 * pin %String; #REQUIRED
1008 * pad %String; #REQUIRED
1009 * route %ContactRoute; "all"
1010 * >
1011 */
1012 wxString gate;
1013 wxString pin;
1014 wxString pad;
1015 //int contactroute; // TODO
1016
1017 ECONNECT( wxXmlNode* aConnect );
1018};
1019
1020
1022{
1023 /*
1024 * <!ELEMENT device (connects?, technologies?)>
1025 * <!ATTLIST device
1026 * name %String; ""
1027 * package %String; #IMPLIED
1028 * >
1029 */
1030 wxString name;
1032
1033 std::vector<ECONNECT> connects;
1034
1035 EDEVICE( wxXmlNode* aDevice );
1036};
1037
1038
1040{
1041 /*
1042 <!ELEMENT deviceset (description?, gates, devices)>
1043 <!ATTLIST deviceset
1044 name %String; #REQUIRED
1045 prefix %String; ""
1046 uservalue %Bool; "no"
1047 >
1048 */
1049
1050 wxString name;
1053 //std::vector<EDEVICE> devices;
1054 //std::vector<EGATE> gates;
1055
1056
1057 EDEVICE_SET( wxXmlNode* aDeviceSet );
1058};
1059
1060
1062{
1063 wxString number;
1064 wxString name;
1065 std::map<wxString, ECOORD> clearanceMap;
1066
1067 ECLASS( wxXmlNode* aClass );
1068};
1069
1070
1071#endif // _EAGLE_PARSER_H_
Model an optional XML attribute.
Definition: eagle_parser.h:195
bool operator==(const T &aOther) const
Definition: eagle_parser.h:277
const T * operator->() const
Return a constant pointer to the value of the attribute assuming it is available.
Definition: eagle_parser.h:350
OPTIONAL_XML_ATTRIBUTE< T > & operator=(const wxString &aData)
Assign to a string (optionally) containing the data.
Definition: eagle_parser.h:250
T * operator->()
Return a pointer to the value of the attribute assuming it is available.
Definition: eagle_parser.h:340
const T & operator*() const
Return a constant reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:330
OPTIONAL_XML_ATTRIBUTE(const wxString &aData)
Definition: eagle_parser.h:217
bool m_isAvailable
A boolean indicating if the data is present or not.
Definition: eagle_parser.h:198
const T & CGet() const
Return a constant reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:309
T m_data
The actual data if m_isAvailable is true; otherwise, garbage.
Definition: eagle_parser.h:201
void Set(const wxString &aString)
Attempt to convert a string to the base type.
Definition: eagle_parser.h:287
T & operator*()
Return a reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:320
T & Get()
Return a reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:298
OPTIONAL_XML_ATTRIBUTE(T aData)
Definition: eagle_parser.h:231
OPTIONAL_XML_ATTRIBUTE()
Construct a default OPTIONAL_XML_ATTRIBUTE, whose data is not available.
Definition: eagle_parser.h:207
Keep track of what we are working on within a PTREE.
Definition: eagle_parser.h:117
void pop()
Definition: eagle_parser.h:128
void clear()
Definition: eagle_parser.h:126
void Value(const char *aValue)
modify the last path node's value
Definition: eagle_parser.h:131
std::vector< TRIPLET > p
Definition: eagle_parser.h:118
void Attribute(const char *aAttribute)
modify the last path node's attribute
Definition: eagle_parser.h:137
void push(const char *aPathSegment, const char *aAttribute="")
Definition: eagle_parser.h:121
wxString Contents()
return the contents of the XPATH as a single string
Definition: eagle_parser.h:143
OPTIONAL_XML_ATTRIBUTE< ECOORD > opt_ecoord
Definition: eagle_parser.h:377
T Convert(const wxString &aValue)
Convert a wxString to a generic type T.
Definition: eagle_parser.h:179
OPTIONAL_XML_ATTRIBUTE< int > opt_int
Definition: eagle_parser.h:373
static wxXmlNode * getChildrenNodes(NODE_MAP &aMap, const wxString &aName)
Definition: eagle_parser.h:63
NODE_MAP MapChildren(wxXmlNode *aCurrentNode)
Provide an easy access to the children of an XML node via their names.
OPTIONAL_XML_ATTRIBUTE< EROT > opt_erot
Definition: eagle_parser.h:376
wxString escapeName(const wxString &aNetName)
Interprets special characters in Eagle text and converts them to KiCAD notation.
wxString interpretText(const wxString &aText)
Translates Eagle special text reference to a KiCad variable reference.
bool substituteVariable(wxString *aText)
wxString Convert< wxString >(const wxString &aValue)
OPTIONAL_XML_ATTRIBUTE< wxString > opt_wxString
Definition: eagle_parser.h:372
std::map< wxString, FOOTPRINT * > FOOTPRINT_MAP
Definition: eagle_parser.h:50
std::map< wxString, EINSTANCE * > EINSTANCE_MAP
Definition: eagle_parser.h:51
std::unordered_map< wxString, wxXmlNode * > NODE_MAP
Definition: eagle_parser.h:49
OPTIONAL_XML_ATTRIBUTE< bool > opt_bool
Definition: eagle_parser.h:375
OPTIONAL_XML_ATTRIBUTE< double > opt_double
Definition: eagle_parser.h:374
VECTOR2I ConvertArcCenter(const VECTOR2I &aStart, const VECTOR2I &aEnd, double aAngle)
std::map< wxString, std::unique_ptr< EPART > > EPART_MAP
Translates Eagle special characters to their counterparts in KiCad.
Definition: eagle_parser.h:52
Parse an Eagle "attribute" XML element.
Definition: eagle_parser.h:599
opt_double ratio
Definition: eagle_parser.h:606
opt_wxString value
Definition: eagle_parser.h:601
opt_ecoord size
Definition: eagle_parser.h:604
opt_ecoord y
Definition: eagle_parser.h:603
wxString name
Definition: eagle_parser.h:600
opt_erot rot
Definition: eagle_parser.h:607
opt_int align
Definition: eagle_parser.h:616
opt_int display
Definition: eagle_parser.h:615
opt_ecoord x
Definition: eagle_parser.h:602
opt_int layer
Definition: eagle_parser.h:605
Eagle circle.
Definition: eagle_parser.h:567
ECOORD x
Definition: eagle_parser.h:568
ECOORD radius
Definition: eagle_parser.h:570
ECOORD y
Definition: eagle_parser.h:569
ECIRCLE(wxXmlNode *aCircle)
ECOORD width
Definition: eagle_parser.h:571
wxString number
std::map< wxString, ECOORD > clearanceMap
ECLASS(wxXmlNode *aClass)
wxString name
ECONNECT(wxXmlNode *aConnect)
wxString pad
wxString gate
wxString pin
int ToNanoMeters() const
Definition: eagle_parser.h:425
ECOORD operator+(const ECOORD &aOther) const
Definition: eagle_parser.h:438
@ EU_NM
nanometers
Definition: eagle_parser.h:391
@ EU_MM
millimeters
Definition: eagle_parser.h:392
@ EU_MIL
mils/thous
Definition: eagle_parser.h:394
@ EU_INCH
inches
Definition: eagle_parser.h:393
int ToSchUnits() const
Definition: eagle_parser.h:435
float ToMm() const
Definition: eagle_parser.h:430
ECOORD operator-(const ECOORD &aOther) const
Definition: eagle_parser.h:443
int ToMils() const
Definition: eagle_parser.h:415
int To100NanoMeters() const
Definition: eagle_parser.h:420
ECOORD(int aValue, enum EAGLE_UNIT aUnit)
Definition: eagle_parser.h:408
long long int value
Unit used for the value field.
Definition: eagle_parser.h:398
bool operator==(const ECOORD &aOther) const
Converts a size expressed in a certain unit to nanometers.
Definition: eagle_parser.h:448
static long long int ConvertToNm(int aValue, enum EAGLE_UNIT aUnit)
int ToPcbUnits() const
Definition: eagle_parser.h:436
static constexpr EAGLE_UNIT ECOORD_UNIT
Definition: eagle_parser.h:401
opt_bool uservalue
opt_wxString prefix
EDEVICE_SET(wxXmlNode *aDeviceSet)
wxString name
std::vector< ECONNECT > connects
wxString name
opt_wxString package
EDEVICE(wxXmlNode *aDevice)
Eagle dimension element.
Definition: eagle_parser.h:625
EDIMENSION(wxXmlNode *aDimension)
opt_wxString dimensionType
Definition: eagle_parser.h:634
opt_ecoord textsize
Definition: eagle_parser.h:632
Eagle element element.
Definition: eagle_parser.h:815
opt_erot rot
Definition: eagle_parser.h:824
wxString name
Definition: eagle_parser.h:816
wxString library
Definition: eagle_parser.h:817
wxString package
Definition: eagle_parser.h:818
ECOORD y
Definition: eagle_parser.h:821
EELEMENT(wxXmlNode *aElement)
opt_bool smashed
Definition: eagle_parser.h:823
ECOORD x
Definition: eagle_parser.h:820
wxString value
Definition: eagle_parser.h:819
opt_bool locked
Definition: eagle_parser.h:822
Parse an Eagle frame element.
Definition: eagle_parser.h:679
ECOORD x1
Definition: eagle_parser.h:680
EFRAME(wxXmlNode *aFrameNode)
opt_bool border_bottom
Definition: eagle_parser.h:690
opt_bool border_left
Definition: eagle_parser.h:687
opt_bool border_right
Definition: eagle_parser.h:689
ECOORD y1
Definition: eagle_parser.h:681
int layer
Definition: eagle_parser.h:686
opt_bool border_top
Definition: eagle_parser.h:688
int columns
Definition: eagle_parser.h:684
ECOORD y2
Definition: eagle_parser.h:683
int rows
Definition: eagle_parser.h:685
ECOORD x2
Definition: eagle_parser.h:682
opt_int swaplevel
Definition: eagle_parser.h:986
ECOORD x
Definition: eagle_parser.h:982
ECOORD y
Definition: eagle_parser.h:983
wxString symbol
Definition: eagle_parser.h:980
EGATE(wxXmlNode *aGate)
wxString name
Definition: eagle_parser.h:979
opt_int addlevel
Definition: eagle_parser.h:985
Eagle hole element.
Definition: eagle_parser.h:804
ECOORD y
Definition: eagle_parser.h:806
EHOLE(wxXmlNode *aHole)
ECOORD drill
Definition: eagle_parser.h:807
ECOORD x
Definition: eagle_parser.h:805
wxString part
Definition: eagle_parser.h:954
ECOORD x
Definition: eagle_parser.h:956
opt_erot rot
Definition: eagle_parser.h:959
EINSTANCE(wxXmlNode *aInstance)
wxString gate
Definition: eagle_parser.h:955
ECOORD y
Definition: eagle_parser.h:957
opt_bool smashed
Definition: eagle_parser.h:958
Eagle Junction.
Definition: eagle_parser.h:527
ECOORD y
Definition: eagle_parser.h:529
ECOORD x
Definition: eagle_parser.h:528
EJUNCTION(wxXmlNode *aJunction)
Eagle label.
Definition: eagle_parser.h:537
opt_erot rot
Definition: eagle_parser.h:542
ECOORD size
Definition: eagle_parser.h:540
wxString netname
Definition: eagle_parser.h:544
opt_wxString xref
Definition: eagle_parser.h:543
int layer
Definition: eagle_parser.h:541
ECOORD y
Definition: eagle_parser.h:539
ECOORD x
Definition: eagle_parser.h:538
ELABEL(wxXmlNode *aLabel, const wxString &aNetName)
wxString name
Definition: eagle_parser.h:833
opt_bool visible
Definition: eagle_parser.h:836
opt_bool active
Definition: eagle_parser.h:837
int color
Definition: eagle_parser.h:834
ELAYER(wxXmlNode *aLayer)
int fill
Definition: eagle_parser.h:835
int number
Definition: eagle_parser.h:832
Eagle net.
Definition: eagle_parser.h:460
int netcode
Definition: eagle_parser.h:461
wxString netname
Definition: eagle_parser.h:462
ENET(int aNetCode, const wxString &aNetName)
Definition: eagle_parser.h:464
Structure holding common properties for through-hole and SMD pads.
Definition: eagle_parser.h:698
opt_bool thermals
Definition: eagle_parser.h:703
EPAD_COMMON(wxXmlNode *aPad)
opt_bool stop
Definition: eagle_parser.h:702
wxString name
Definition: eagle_parser.h:699
opt_erot rot
Definition: eagle_parser.h:701
Eagle thru hole pad.
Definition: eagle_parser.h:711
ECOORD drill
Definition: eagle_parser.h:712
opt_ecoord diameter
Definition: eagle_parser.h:713
opt_bool first
Definition: eagle_parser.h:725
EPAD(wxXmlNode *aPad)
@ OCTAGON
Definition: eagle_parser.h:720
@ SQUARE
Definition: eagle_parser.h:718
@ OFFSET
Definition: eagle_parser.h:722
opt_int shape
Definition: eagle_parser.h:724
wxString device
Definition: eagle_parser.h:930
std::map< std::string, std::string > variant
Definition: eagle_parser.h:934
wxString library
Definition: eagle_parser.h:928
opt_wxString technology
Definition: eagle_parser.h:931
EPART(wxXmlNode *aPart)
wxString deviceset
Definition: eagle_parser.h:929
std::map< std::string, std::string > attribute
Definition: eagle_parser.h:933
opt_wxString value
Definition: eagle_parser.h:932
wxString name
Definition: eagle_parser.h:927
Eagle pin element.
Definition: eagle_parser.h:746
ECOORD x
Definition: eagle_parser.h:748
wxString name
Definition: eagle_parser.h:747
opt_int swaplevel
Definition: eagle_parser.h:755
opt_wxString visible
Definition: eagle_parser.h:751
opt_wxString direction
Definition: eagle_parser.h:753
opt_wxString length
Definition: eagle_parser.h:752
opt_wxString function
Definition: eagle_parser.h:754
EPIN(wxXmlNode *aPin)
opt_erot rot
Definition: eagle_parser.h:756
ECOORD y
Definition: eagle_parser.h:749
Eagle polygon, without vertices which are parsed as needed.
Definition: eagle_parser.h:775
opt_bool orphans
Definition: eagle_parser.h:794
opt_int rank
Definition: eagle_parser.h:796
opt_bool thermals
Definition: eagle_parser.h:795
opt_ecoord spacing
Definition: eagle_parser.h:778
static const int max_priority
Definition: eagle_parser.h:785
ECOORD width
Definition: eagle_parser.h:776
EPOLYGON(wxXmlNode *aPolygon)
opt_ecoord isolate
Definition: eagle_parser.h:793
Eagle XML rectangle in binary.
Definition: eagle_parser.h:580
ECOORD x2
Definition: eagle_parser.h:583
ERECT(wxXmlNode *aRect)
ECOORD y1
Definition: eagle_parser.h:582
opt_erot rot
Definition: eagle_parser.h:586
int layer
Definition: eagle_parser.h:585
ECOORD y2
Definition: eagle_parser.h:584
ECOORD x1
Definition: eagle_parser.h:581
Eagle rotation.
Definition: eagle_parser.h:477
double degrees
Definition: eagle_parser.h:480
bool spin
Definition: eagle_parser.h:479
EROT(double aDegrees)
Definition: eagle_parser.h:488
bool mirror
Definition: eagle_parser.h:478
Eagle SMD pad.
Definition: eagle_parser.h:733
opt_int roundness
Definition: eagle_parser.h:737
ESMD(wxXmlNode *aSMD)
ECOORD dx
Definition: eagle_parser.h:734
int layer
Definition: eagle_parser.h:736
opt_bool cream
Definition: eagle_parser.h:738
ECOORD dy
Definition: eagle_parser.h:735
Eagle text element.
Definition: eagle_parser.h:642
opt_double ratio
Definition: eagle_parser.h:649
wxString text
Definition: eagle_parser.h:643
@ BOTTOM_CENTER
Definition: eagle_parser.h:661
@ BOTTOM_RIGHT
Definition: eagle_parser.h:663
@ TOP_CENTER
Definition: eagle_parser.h:655
@ TOP_LEFT
Definition: eagle_parser.h:656
@ TOP_RIGHT
Definition: eagle_parser.h:657
@ CENTER_RIGHT
Definition: eagle_parser.h:660
@ CENTER_LEFT
Definition: eagle_parser.h:654
@ BOTTOM_LEFT
Definition: eagle_parser.h:662
ECOORD y
Definition: eagle_parser.h:645
ECOORD size
Definition: eagle_parser.h:646
opt_erot rot
Definition: eagle_parser.h:650
opt_int align
Definition: eagle_parser.h:666
ETEXT(wxXmlNode *aText)
wxSize ConvertSize() const
Calculate text size based on font type and size.
ECOORD x
Definition: eagle_parser.h:644
opt_wxString font
Definition: eagle_parser.h:648
int layer
Definition: eagle_parser.h:647
Eagle vertex.
Definition: eagle_parser.h:764
EVERTEX(wxXmlNode *aVertex)
ECOORD y
Definition: eagle_parser.h:766
ECOORD x
Definition: eagle_parser.h:765
opt_double curve
range is -359.9..359.9
Definition: eagle_parser.h:767
Eagle via.
Definition: eagle_parser.h:552
opt_ecoord diam
Definition: eagle_parser.h:558
ECOORD drill
< inclusive
Definition: eagle_parser.h:557
ECOORD y
Definition: eagle_parser.h:554
EVIA(wxXmlNode *aVia)
opt_wxString shape
Definition: eagle_parser.h:559
int layer_front_most
Definition: eagle_parser.h:555
int layer_back_most
< extent
Definition: eagle_parser.h:556
ECOORD x
Definition: eagle_parser.h:553
Eagle wire.
Definition: eagle_parser.h:498
ECOORD width
Definition: eagle_parser.h:503
int layer
Definition: eagle_parser.h:504
@ LONGDASH
Definition: eagle_parser.h:508
@ CONTINUOUS
Definition: eagle_parser.h:507
@ SHORTDASH
Definition: eagle_parser.h:509
ECOORD x2
Definition: eagle_parser.h:501
opt_int cap
Definition: eagle_parser.h:519
opt_int style
Definition: eagle_parser.h:512
ECOORD y2
Definition: eagle_parser.h:502
ECOORD x1
Definition: eagle_parser.h:499
ECOORD y1
Definition: eagle_parser.h:500
EWIRE(wxXmlNode *aWire)
opt_double curve
range is -359.9..359.9
Definition: eagle_parser.h:513
segment (element) of our XPATH into the Eagle XML document tree in PTREE form.
Definition: eagle_parser.h:90
TRIPLET(const char *aElement, const char *aAttribute="", const char *aValue="")
Definition: eagle_parser.h:95
const char * value
Definition: eagle_parser.h:93
const char * attribute
Definition: eagle_parser.h:92
const char * element
Definition: eagle_parser.h:91
Implement a simple wrapper around runtime_error to isolate the errors thrown by the Eagle XML parser.
Definition: eagle_parser.h:75
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:82