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-2021 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
57static 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
68struct 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
83struct 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
110class XPATH
111{
112 std::vector<TRIPLET> p;
113
114public:
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
172template<typename T>
173T Convert( const wxString& aValue )
174{
175 throw XML_PARSER_ERROR( "Conversion failed. Unknown type." );
176}
177
178template <>
179wxString Convert<wxString>( const wxString& aValue );
180
187template <typename T>
189{
190private:
193
196
197public:
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
358NODE_MAP MapChildren( wxXmlNode* aCurrentNode );
359
361VECTOR2I ConvertArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double aAngle );
362
363// Pre-declare for typedefs
364struct EROT;
365struct 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
381struct 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
453struct ENET
454{
456 wxString netname;
457
458 ENET( int aNetCode, const wxString& aNetName ) :
459 netcode( aNetCode ),
460 netname( aNetName )
461 {}
462
464 netcode( 0 )
465 {}
466};
467
468
470struct EROT
471{
472 bool mirror;
473 bool spin;
474 double degrees;
475
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
491struct EWIRE
492{
498 int layer;
499
500 // for style: (continuous | longdash | shortdash | dashdot)
505
508
509 // for cap: (flat | round)
510 enum { FLAT,
512
514
515 EWIRE( wxXmlNode* aWire );
516};
517
518
521{
524
525 EJUNCTION( wxXmlNode* aJunction);
526};
527
528
530struct ELABEL
531{
535 int layer;
538 wxString netname;
539
540 ELABEL( wxXmlNode* aLabel, const wxString& aNetName );
541};
542
543
545struct EVIA
546{
554
555 EVIA( wxXmlNode* aVia );
556};
557
558
561{
566 int layer;
567
568 ECIRCLE( wxXmlNode* aCircle );
569};
570
571
573struct ERECT
574{
579 int layer;
581
582 ERECT( wxXmlNode* aRect );
583};
584
585
592struct EATTR
593{
594 wxString name;
602
603 enum { // for 'display'
608 };
611
612 EATTR( wxXmlNode* aTree );
613 EATTR() {}
614};
615
616
619{
627 int layer;
629
630 EDIMENSION( wxXmlNode* aDimension );
631};
632
633
635struct ETEXT
636{
637 wxString text;
641 int layer;
645
646 enum { // for align
652
653 // opposites are -1 x above, used by code tricks in here
658 };
659
661
662 ETEXT( wxXmlNode* aText );
663
665 wxSize ConvertSize() const;
666};
667
668
672struct EFRAME
673{
679 int rows;
680 int layer;
685
686 EFRAME( wxXmlNode* aFrameNode );
687};
688
689
692{
693 wxString name;
698
699 EPAD_COMMON( wxXmlNode* aPad );
700};
701
702
704struct EPAD : public EPAD_COMMON
705{
708
709 // for shape: (square | round | octagon | long | offset)
710 enum {
711 UNDEF = -1,
717 };
720
721 EPAD( wxXmlNode* aPad );
722};
723
724
726struct ESMD : public EPAD_COMMON
727{
730 int layer;
733
734 ESMD( wxXmlNode* aSMD );
735};
736
737
739struct EPIN
740{
741 wxString name;
744
751
752 EPIN( wxXmlNode* aPin );
753};
754
755
758{
762
763 EVERTEX( wxXmlNode* aVertex );
764};
765
766
769{
771 int layer;
773
774 // KiCad priority is opposite of Eagle rank, that is:
775 // - Eagle Low rank drawn first
776 // - KiCad high priority drawn first
777 // So since Eagle has an upper limit we define this, used for the cases
778 // where no rank is specified.
779 static const int max_priority = 6;
780
781 enum { // for pour
785 };
786 int pour;
791
792 EPOLYGON( wxXmlNode* aPolygon );
793};
794
795
797struct EHOLE
798{
802
803 EHOLE( wxXmlNode* aHole );
804};
805
806
809{
810 wxString name;
811 wxString library;
812 wxString package;
813 wxString value;
819
820 EELEMENT( wxXmlNode* aElement );
821};
822
823
824struct ELAYER
825{
827 wxString name;
828 int color;
829 int fill;
832
833 ELAYER( wxXmlNode* aLayer );
834};
835
836
838{
839 enum
840 {
841 TOP = 1,
856 BOTTOM = 16,
857 PADS = 17,
858 VIAS = 18,
861 TPLACE = 21,
862 BPLACE = 22,
865 TNAMES = 25,
866 BNAMES = 26,
869 TSTOP = 29,
870 BSTOP = 30,
871 TCREAM = 31,
872 BCREAM = 32,
875 TGLUE = 35,
876 BGLUE = 36,
877 TTEST = 37,
878 BTEST = 38,
884 DRILLS = 44,
885 HOLES = 45,
891 TDOCU = 51,
892 BDOCU = 52,
893 NETS = 91,
894 BUSSES = 92,
895 PINS = 93,
897 NAMES = 95,
898 VALUES = 96,
899 INFO = 97,
900 GUIDE = 98,
902 USERLAYER2 = 161
903 };
904};
905
906
907struct EPART
908{
909 /*
910 * <!ELEMENT part (attribute*, variant*)>
911 * <!ATTLIST part
912 * name %String; #REQUIRED
913 * library %String; #REQUIRED
914 * deviceset %String; #REQUIRED
915 * device %String; #REQUIRED
916 * technology %String; ""
917 * value %String; #IMPLIED
918 * >
919 */
920
921 wxString name;
922 wxString library;
923 wxString deviceset;
924 wxString device;
927 std::map<std::string,std::string> attribute;
928 std::map<std::string,std::string> variant;
929
930 EPART( wxXmlNode* aPart );
931};
932
933
935{
936 /*
937 * <!ELEMENT instance (attribute)*>
938 * <!ATTLIST instance
939 * part %String; #REQUIRED
940 * gate %String; #REQUIRED
941 * x %Coord; #REQUIRED
942 * y %Coord; #REQUIRED
943 * smashed %Bool; "no"
944 * rot %Rotation; "R0"
945 * >
946 */
947
948 wxString part;
949 wxString gate;
954
955 EINSTANCE( wxXmlNode* aInstance );
956};
957
958
959struct EGATE
960{
961 /*
962 * <!ELEMENT gate EMPTY>
963 * <!ATTLIST gate
964 * name %String; #REQUIRED
965 * symbol %String; #REQUIRED
966 * x %Coord; #REQUIRED
967 * y %Coord; #REQUIRED
968 * addlevel %GateAddLevel; "next"
969 * swaplevel %Int; "0"
970 * >
971 */
972
973 wxString name;
974 wxString symbol;
975
978
981
982 enum
983 {
988 ALWAYS
989 };
990
991 EGATE( wxXmlNode* aGate );
992};
993
994
996{
997 /*
998 * <!ELEMENT connect EMPTY>
999 * <!ATTLIST connect
1000 * gate %String; #REQUIRED
1001 * pin %String; #REQUIRED
1002 * pad %String; #REQUIRED
1003 * route %ContactRoute; "all"
1004 * >
1005 */
1006 wxString gate;
1007 wxString pin;
1008 wxString pad;
1009 //int contactroute; // TODO
1010
1011 ECONNECT( wxXmlNode* aConnect );
1012};
1013
1014
1016{
1017 /*
1018 * <!ELEMENT device (connects?, technologies?)>
1019 * <!ATTLIST device
1020 * name %String; ""
1021 * package %String; #IMPLIED
1022 * >
1023 */
1024 wxString name;
1026
1027 std::vector<ECONNECT> connects;
1028
1029 EDEVICE( wxXmlNode* aDevice );
1030};
1031
1032
1034{
1035 /*
1036 <!ELEMENT deviceset (description?, gates, devices)>
1037 <!ATTLIST deviceset
1038 name %String; #REQUIRED
1039 prefix %String; ""
1040 uservalue %Bool; "no"
1041 >
1042 */
1043
1044 wxString name;
1047 //std::vector<EDEVICE> devices;
1048 //std::vector<EGATE> gates;
1049
1050
1051 EDEVICE_SET( wxXmlNode* aDeviceSet );
1052};
1053
1054
1056{
1057 wxString number;
1058 wxString name;
1059 std::map<wxString, ECOORD> clearanceMap;
1060
1061 ECLASS( wxXmlNode* aClass );
1062};
1063
1064
1065#endif // _EAGLE_PARSER_H_
Model an optional XML attribute.
Definition: eagle_parser.h:189
bool operator==(const T &aOther) const
Definition: eagle_parser.h:271
const T * operator->() const
Return a constant pointer to the value of the attribute assuming it is available.
Definition: eagle_parser.h:344
OPTIONAL_XML_ATTRIBUTE< T > & operator=(const wxString &aData)
Assign to a string (optionally) containing the data.
Definition: eagle_parser.h:244
T * operator->()
Return a pointer to the value of the attribute assuming it is available.
Definition: eagle_parser.h:334
const T & operator*() const
Return a constant reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:324
OPTIONAL_XML_ATTRIBUTE(const wxString &aData)
Definition: eagle_parser.h:211
bool m_isAvailable
A boolean indicating if the data is present or not.
Definition: eagle_parser.h:192
const T & CGet() const
Return a constant reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:303
T m_data
The actual data if m_isAvailable is true; otherwise, garbage.
Definition: eagle_parser.h:195
void Set(const wxString &aString)
Attempt to convert a string to the base type.
Definition: eagle_parser.h:281
T & operator*()
Return a reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:314
T & Get()
Return a reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:292
OPTIONAL_XML_ATTRIBUTE(T aData)
Definition: eagle_parser.h:225
OPTIONAL_XML_ATTRIBUTE()
Construct a default OPTIONAL_XML_ATTRIBUTE, whose data is not available.
Definition: eagle_parser.h:201
Keep track of what we are working on within a PTREE.
Definition: eagle_parser.h:111
void pop()
Definition: eagle_parser.h:122
void clear()
Definition: eagle_parser.h:120
void Value(const char *aValue)
modify the last path node's value
Definition: eagle_parser.h:125
std::vector< TRIPLET > p
Definition: eagle_parser.h:112
void Attribute(const char *aAttribute)
modify the last path node's attribute
Definition: eagle_parser.h:131
void push(const char *aPathSegment, const char *aAttribute="")
Definition: eagle_parser.h:115
wxString Contents()
return the contents of the XPATH as a single string
Definition: eagle_parser.h:137
OPTIONAL_XML_ATTRIBUTE< ECOORD > opt_ecoord
Definition: eagle_parser.h:371
T Convert(const wxString &aValue)
Convert a wxString to a generic type T.
Definition: eagle_parser.h:173
OPTIONAL_XML_ATTRIBUTE< int > opt_int
Definition: eagle_parser.h:367
static wxXmlNode * getChildrenNodes(NODE_MAP &aMap, const wxString &aName)
Definition: eagle_parser.h:57
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:370
wxString escapeName(const wxString &aNetName)
wxString Convert< wxString >(const wxString &aValue)
OPTIONAL_XML_ATTRIBUTE< wxString > opt_wxString
Definition: eagle_parser.h:366
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:369
OPTIONAL_XML_ATTRIBUTE< double > opt_double
Definition: eagle_parser.h:368
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:593
opt_double ratio
Definition: eagle_parser.h:600
opt_wxString value
Definition: eagle_parser.h:595
opt_ecoord size
Definition: eagle_parser.h:598
opt_ecoord y
Definition: eagle_parser.h:597
wxString name
Definition: eagle_parser.h:594
opt_erot rot
Definition: eagle_parser.h:601
opt_int align
Definition: eagle_parser.h:610
opt_int display
Definition: eagle_parser.h:609
opt_ecoord x
Definition: eagle_parser.h:596
opt_int layer
Definition: eagle_parser.h:599
Eagle circle.
Definition: eagle_parser.h:561
ECOORD x
Definition: eagle_parser.h:562
ECOORD radius
Definition: eagle_parser.h:564
ECOORD y
Definition: eagle_parser.h:563
ECIRCLE(wxXmlNode *aCircle)
ECOORD width
Definition: eagle_parser.h:565
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:419
ECOORD operator+(const ECOORD &aOther) const
Definition: eagle_parser.h:432
@ EU_NM
nanometers
Definition: eagle_parser.h:385
@ EU_MM
millimeters
Definition: eagle_parser.h:386
@ EU_MIL
mils/thous
Definition: eagle_parser.h:388
@ EU_INCH
inches
Definition: eagle_parser.h:387
int ToSchUnits() const
Definition: eagle_parser.h:429
float ToMm() const
Definition: eagle_parser.h:424
ECOORD operator-(const ECOORD &aOther) const
Definition: eagle_parser.h:437
int ToMils() const
Definition: eagle_parser.h:409
int To100NanoMeters() const
Definition: eagle_parser.h:414
ECOORD(int aValue, enum EAGLE_UNIT aUnit)
Definition: eagle_parser.h:402
long long int value
Unit used for the value field.
Definition: eagle_parser.h:392
bool operator==(const ECOORD &aOther) const
Converts a size expressed in a certain unit to nanometers.
Definition: eagle_parser.h:442
static long long int ConvertToNm(int aValue, enum EAGLE_UNIT aUnit)
int ToPcbUnits() const
Definition: eagle_parser.h:430
static constexpr EAGLE_UNIT ECOORD_UNIT
Definition: eagle_parser.h:395
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:619
EDIMENSION(wxXmlNode *aDimension)
opt_wxString dimensionType
Definition: eagle_parser.h:628
opt_ecoord textsize
Definition: eagle_parser.h:626
Eagle element element.
Definition: eagle_parser.h:809
opt_erot rot
Definition: eagle_parser.h:818
wxString name
Definition: eagle_parser.h:810
wxString library
Definition: eagle_parser.h:811
wxString package
Definition: eagle_parser.h:812
ECOORD y
Definition: eagle_parser.h:815
EELEMENT(wxXmlNode *aElement)
opt_bool smashed
Definition: eagle_parser.h:817
ECOORD x
Definition: eagle_parser.h:814
wxString value
Definition: eagle_parser.h:813
opt_bool locked
Definition: eagle_parser.h:816
Parse an Eagle frame element.
Definition: eagle_parser.h:673
ECOORD x1
Definition: eagle_parser.h:674
EFRAME(wxXmlNode *aFrameNode)
opt_bool border_bottom
Definition: eagle_parser.h:684
opt_bool border_left
Definition: eagle_parser.h:681
opt_bool border_right
Definition: eagle_parser.h:683
ECOORD y1
Definition: eagle_parser.h:675
int layer
Definition: eagle_parser.h:680
opt_bool border_top
Definition: eagle_parser.h:682
int columns
Definition: eagle_parser.h:678
ECOORD y2
Definition: eagle_parser.h:677
int rows
Definition: eagle_parser.h:679
ECOORD x2
Definition: eagle_parser.h:676
opt_int swaplevel
Definition: eagle_parser.h:980
ECOORD x
Definition: eagle_parser.h:976
ECOORD y
Definition: eagle_parser.h:977
wxString symbol
Definition: eagle_parser.h:974
EGATE(wxXmlNode *aGate)
wxString name
Definition: eagle_parser.h:973
opt_int addlevel
Definition: eagle_parser.h:979
Eagle hole element.
Definition: eagle_parser.h:798
ECOORD y
Definition: eagle_parser.h:800
EHOLE(wxXmlNode *aHole)
ECOORD drill
Definition: eagle_parser.h:801
ECOORD x
Definition: eagle_parser.h:799
wxString part
Definition: eagle_parser.h:948
ECOORD x
Definition: eagle_parser.h:950
opt_erot rot
Definition: eagle_parser.h:953
EINSTANCE(wxXmlNode *aInstance)
wxString gate
Definition: eagle_parser.h:949
ECOORD y
Definition: eagle_parser.h:951
opt_bool smashed
Definition: eagle_parser.h:952
Eagle Junction.
Definition: eagle_parser.h:521
ECOORD y
Definition: eagle_parser.h:523
ECOORD x
Definition: eagle_parser.h:522
EJUNCTION(wxXmlNode *aJunction)
Eagle label.
Definition: eagle_parser.h:531
opt_erot rot
Definition: eagle_parser.h:536
ECOORD size
Definition: eagle_parser.h:534
wxString netname
Definition: eagle_parser.h:538
opt_wxString xref
Definition: eagle_parser.h:537
int layer
Definition: eagle_parser.h:535
ECOORD y
Definition: eagle_parser.h:533
ECOORD x
Definition: eagle_parser.h:532
ELABEL(wxXmlNode *aLabel, const wxString &aNetName)
wxString name
Definition: eagle_parser.h:827
opt_bool visible
Definition: eagle_parser.h:830
opt_bool active
Definition: eagle_parser.h:831
int color
Definition: eagle_parser.h:828
ELAYER(wxXmlNode *aLayer)
int fill
Definition: eagle_parser.h:829
int number
Definition: eagle_parser.h:826
Eagle net.
Definition: eagle_parser.h:454
int netcode
Definition: eagle_parser.h:455
wxString netname
Definition: eagle_parser.h:456
ENET(int aNetCode, const wxString &aNetName)
Definition: eagle_parser.h:458
Structure holding common properties for through-hole and SMD pads.
Definition: eagle_parser.h:692
opt_bool thermals
Definition: eagle_parser.h:697
EPAD_COMMON(wxXmlNode *aPad)
opt_bool stop
Definition: eagle_parser.h:696
wxString name
Definition: eagle_parser.h:693
opt_erot rot
Definition: eagle_parser.h:695
Eagle thru hole pad.
Definition: eagle_parser.h:705
ECOORD drill
Definition: eagle_parser.h:706
opt_ecoord diameter
Definition: eagle_parser.h:707
opt_bool first
Definition: eagle_parser.h:719
EPAD(wxXmlNode *aPad)
@ OCTAGON
Definition: eagle_parser.h:714
@ SQUARE
Definition: eagle_parser.h:712
@ OFFSET
Definition: eagle_parser.h:716
opt_int shape
Definition: eagle_parser.h:718
wxString device
Definition: eagle_parser.h:924
std::map< std::string, std::string > variant
Definition: eagle_parser.h:928
wxString library
Definition: eagle_parser.h:922
opt_wxString technology
Definition: eagle_parser.h:925
EPART(wxXmlNode *aPart)
wxString deviceset
Definition: eagle_parser.h:923
std::map< std::string, std::string > attribute
Definition: eagle_parser.h:927
opt_wxString value
Definition: eagle_parser.h:926
wxString name
Definition: eagle_parser.h:921
Eagle pin element.
Definition: eagle_parser.h:740
ECOORD x
Definition: eagle_parser.h:742
wxString name
Definition: eagle_parser.h:741
opt_int swaplevel
Definition: eagle_parser.h:749
opt_wxString visible
Definition: eagle_parser.h:745
opt_wxString direction
Definition: eagle_parser.h:747
opt_wxString length
Definition: eagle_parser.h:746
opt_wxString function
Definition: eagle_parser.h:748
EPIN(wxXmlNode *aPin)
opt_erot rot
Definition: eagle_parser.h:750
ECOORD y
Definition: eagle_parser.h:743
Eagle polygon, without vertices which are parsed as needed.
Definition: eagle_parser.h:769
opt_bool orphans
Definition: eagle_parser.h:788
opt_int rank
Definition: eagle_parser.h:790
opt_bool thermals
Definition: eagle_parser.h:789
opt_ecoord spacing
Definition: eagle_parser.h:772
static const int max_priority
Definition: eagle_parser.h:779
ECOORD width
Definition: eagle_parser.h:770
EPOLYGON(wxXmlNode *aPolygon)
opt_ecoord isolate
Definition: eagle_parser.h:787
Eagle XML rectangle in binary.
Definition: eagle_parser.h:574
ECOORD x2
Definition: eagle_parser.h:577
ERECT(wxXmlNode *aRect)
ECOORD y1
Definition: eagle_parser.h:576
opt_erot rot
Definition: eagle_parser.h:580
int layer
Definition: eagle_parser.h:579
ECOORD y2
Definition: eagle_parser.h:578
ECOORD x1
Definition: eagle_parser.h:575
Eagle rotation.
Definition: eagle_parser.h:471
double degrees
Definition: eagle_parser.h:474
bool spin
Definition: eagle_parser.h:473
EROT(double aDegrees)
Definition: eagle_parser.h:482
bool mirror
Definition: eagle_parser.h:472
Eagle SMD pad.
Definition: eagle_parser.h:727
opt_int roundness
Definition: eagle_parser.h:731
ESMD(wxXmlNode *aSMD)
ECOORD dx
Definition: eagle_parser.h:728
int layer
Definition: eagle_parser.h:730
opt_bool cream
Definition: eagle_parser.h:732
ECOORD dy
Definition: eagle_parser.h:729
Eagle text element.
Definition: eagle_parser.h:636
opt_double ratio
Definition: eagle_parser.h:643
wxString text
Definition: eagle_parser.h:637
@ BOTTOM_CENTER
Definition: eagle_parser.h:655
@ BOTTOM_RIGHT
Definition: eagle_parser.h:657
@ TOP_CENTER
Definition: eagle_parser.h:649
@ TOP_LEFT
Definition: eagle_parser.h:650
@ TOP_RIGHT
Definition: eagle_parser.h:651
@ CENTER_RIGHT
Definition: eagle_parser.h:654
@ CENTER_LEFT
Definition: eagle_parser.h:648
@ BOTTOM_LEFT
Definition: eagle_parser.h:656
ECOORD y
Definition: eagle_parser.h:639
ECOORD size
Definition: eagle_parser.h:640
opt_erot rot
Definition: eagle_parser.h:644
opt_int align
Definition: eagle_parser.h:660
ETEXT(wxXmlNode *aText)
wxSize ConvertSize() const
Calculate text size based on font type and size.
ECOORD x
Definition: eagle_parser.h:638
opt_wxString font
Definition: eagle_parser.h:642
int layer
Definition: eagle_parser.h:641
Eagle vertex.
Definition: eagle_parser.h:758
EVERTEX(wxXmlNode *aVertex)
ECOORD y
Definition: eagle_parser.h:760
ECOORD x
Definition: eagle_parser.h:759
opt_double curve
range is -359.9..359.9
Definition: eagle_parser.h:761
Eagle via.
Definition: eagle_parser.h:546
opt_ecoord diam
Definition: eagle_parser.h:552
ECOORD drill
< inclusive
Definition: eagle_parser.h:551
ECOORD y
Definition: eagle_parser.h:548
EVIA(wxXmlNode *aVia)
opt_wxString shape
Definition: eagle_parser.h:553
int layer_front_most
Definition: eagle_parser.h:549
int layer_back_most
< extent
Definition: eagle_parser.h:550
ECOORD x
Definition: eagle_parser.h:547
Eagle wire.
Definition: eagle_parser.h:492
ECOORD width
Definition: eagle_parser.h:497
int layer
Definition: eagle_parser.h:498
@ LONGDASH
Definition: eagle_parser.h:502
@ CONTINUOUS
Definition: eagle_parser.h:501
@ SHORTDASH
Definition: eagle_parser.h:503
ECOORD x2
Definition: eagle_parser.h:495
opt_int cap
Definition: eagle_parser.h:513
opt_int style
Definition: eagle_parser.h:506
ECOORD y2
Definition: eagle_parser.h:496
ECOORD x1
Definition: eagle_parser.h:493
ECOORD y1
Definition: eagle_parser.h:494
EWIRE(wxXmlNode *aWire)
opt_double curve
range is -359.9..359.9
Definition: eagle_parser.h:507
segment (element) of our XPATH into the Eagle XML document tree in PTREE form.
Definition: eagle_parser.h:84
TRIPLET(const char *aElement, const char *aAttribute="", const char *aValue="")
Definition: eagle_parser.h:89
const char * value
Definition: eagle_parser.h:87
const char * attribute
Definition: eagle_parser.h:86
const char * element
Definition: eagle_parser.h:85
Implement a simple wrapper around runtime_error to isolate the errors thrown by the Eagle XML parser.
Definition: eagle_parser.h:69
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