KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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 <optional>
35#include <unordered_map>
36
37#include <wx/xml/xml.h>
38#include <wx/string.h>
39#include <wx/filename.h>
40
41#include <layer_ids.h>
42#include <trigo.h>
43#include <core/wx_stl_compat.h>
45
46class FOOTPRINT;
47class IO_BASE;
48
49struct EINSTANCE;
50struct EPART;
51struct ETEXT;
52struct ESEGMENT;
53
54typedef std::unordered_map<wxString, wxXmlNode*> NODE_MAP;
55typedef std::map<wxString, EINSTANCE*> EINSTANCE_MAP;
56typedef std::map<wxString, std::unique_ptr<EPART>> EPART_MAP;
57
59wxString escapeName( const wxString& aNetName );
60
62wxString interpretText( const wxString& aText );
63
65bool substituteVariable( wxString* aText );
66
68wxString convertDescription( wxString aDescr );
69
70static inline wxXmlNode* getChildrenNodes( NODE_MAP& aMap, const wxString& aName )
71{
72 auto it = aMap.find( aName );
73 return it == aMap.end() ? nullptr : it->second->GetChildren();
74}
75
76
81struct XML_PARSER_ERROR : std::runtime_error
82{
89 XML_PARSER_ERROR( const wxString& aMessage ) noexcept :
90 std::runtime_error( "XML parser failed - " + aMessage.ToStdString() )
91 {}
92};
93
94
96struct TRIPLET
97{
98 const char* element;
99 const char* attribute;
100 const char* value;
101
102 TRIPLET( const char* aElement, const char* aAttribute = "", const char* aValue = "" ) :
103 element( aElement ),
104 attribute( aAttribute ),
105 value( aValue )
106 {}
107};
108
109
123class XPATH
124{
125 std::vector<TRIPLET> p;
126
127public:
128 void push( const char* aPathSegment, const char* aAttribute="" )
129 {
130 p.emplace_back( aPathSegment, aAttribute );
131 }
132
133 void clear() { p.clear(); }
134
135 void pop() { p.pop_back(); }
136
138 void Value( const char* aValue )
139 {
140 p.back().value = aValue;
141 }
142
144 void Attribute( const char* aAttribute )
145 {
146 p.back().attribute = aAttribute;
147 }
148
150 wxString Contents()
151 {
152 typedef std::vector<TRIPLET>::const_iterator CITER_TRIPLET;
153
154 wxString ret;
155
156 for( CITER_TRIPLET it = p.begin(); it != p.end(); ++it )
157 {
158 if( it != p.begin() )
159 ret += '.';
160
161 ret += it->element;
162
163 if( it->attribute[0] && it->value[0] )
164 {
165 ret += '[';
166 ret += it->attribute;
167 ret += '=';
168 ret += it->value;
169 ret += ']';
170 }
171 }
172
173 return ret;
174 }
175};
176
177
185template<typename T>
186T Convert( const wxString& aValue )
187{
188 throw XML_PARSER_ERROR( "Conversion failed. Unknown type." );
189}
190
191template <>
192wxString Convert<wxString>( const wxString& aValue );
193
200template <typename T>
202{
203private:
206
209
210public:
215 m_isAvailable( false ),
216 m_data( T() )
217 {}
218
224 OPTIONAL_XML_ATTRIBUTE( const wxString& aData )
225 {
226 m_data = T();
227 m_isAvailable = !aData.IsEmpty();
228
229 if( m_isAvailable )
230 Set( aData );
231 }
232
237 template<typename V = T>
239 m_isAvailable( true ),
240 m_data( aData )
241 {}
242
246 operator bool() const
247 {
248 return m_isAvailable;
249 }
250
257 OPTIONAL_XML_ATTRIBUTE<T>& operator =( const wxString& aData )
258 {
259 m_isAvailable = !aData.IsEmpty();
260
261 if( m_isAvailable )
262 Set( aData );
263
264 return *this;
265 }
266
274 {
275 m_data = aData;
276 m_isAvailable = true;
277
278 return *this;
279 }
280
284 bool operator ==( const T& aOther ) const
285 {
286 return m_isAvailable && ( aOther == m_data );
287 }
288
294 void Set( const wxString& aString )
295 {
296 m_data = Convert<T>( aString );
297 m_isAvailable = !aString.IsEmpty();
298 }
299
305 T& Get()
306 {
307 assert( m_isAvailable );
308 return m_data;
309 }
310
316 const T& CGet() const
317 {
318 assert( m_isAvailable );
319 return m_data;
320 }
321
328 {
329 return Get();
330 }
331
337 const T& operator*() const
338 {
339 return CGet();
340 }
341
348 {
349 return &Get();
350 }
351
357 const T* operator->() const
358 {
359 return &CGet();
360 }
361};
362
363
371size_t GetNodeCount( const wxXmlNode* aNode );
372
373
381NODE_MAP MapChildren( wxXmlNode* aCurrentNode );
382
384VECTOR2I ConvertArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double aAngle );
385
386// Pre-declare for typedefs
387struct EROT;
388struct ECOORD;
389struct EURN;
390
398
399
401{
402 EAGLE_BASE( IO_BASE* aIo = nullptr ) :
403 io( aIo ) {}
404
406
412 void Report( const wxString& aMsg, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED );
413
415};
416
417
432struct EURN : public EAGLE_BASE
433{
434 EURN() {}
435
437 EURN( const wxString& aUrn );
438
439 void Parse( const wxString& aUrn );
440
447 bool IsValid() const;
448
449 wxString host;
450 wxString path;
451 wxString assetType;
452 wxString assetId;
453 wxString assetVersion;
454};
455
456
457// All of the 'E'STRUCTS below merely hold Eagle XML information verbatim, in binary.
458// For maintenance and troubleshooting purposes, it was thought that we'd need to
459// separate the conversion process into distinct steps. There is no intent to have KiCad
460// forms of information in these 'E'STRUCTS. They are only binary forms
461// of the Eagle information in the corresponding Eagle XML nodes.
462
463
465{
466 /*
467 * <!ELEMENT description (#PCDATA)>
468 * <!ATTLIST description
469 * language %String; "en"
470 * >
471 */
472
473 wxString text;
475
476 EDESCRIPTION( wxXmlNode* aDescription, IO_BASE* aIo = nullptr );
477};
478
479
480// Eagle coordinates
481struct ECOORD : public EAGLE_BASE
482{
484 {
489 };
490
492 long long int value;
493
495 static constexpr EAGLE_UNIT ECOORD_UNIT = EU_NM;
496
498 : value( 0 )
499 {
500 }
501
502 ECOORD( int aValue, enum EAGLE_UNIT aUnit )
503 : value( ConvertToNm( aValue, aUnit ) )
504 {
505 }
506
507 ECOORD( const wxString& aValue, enum EAGLE_UNIT aUnit );
508
509 int ToMils() const
510 {
511 return value / 25400;
512 }
513
514 int To100NanoMeters() const
515 {
516 return value / 100;
517 }
518
519 int ToNanoMeters() const
520 {
521 return value;
522 }
523
524 float ToMm() const
525 {
526 return value / 1000000.0;
527 }
528
529 int ToSchUnits() const { return To100NanoMeters(); }
530 int ToPcbUnits() const { return ToNanoMeters(); }
531
532 ECOORD operator+( const ECOORD& aOther ) const
533 {
534 return ECOORD( value + aOther.value, ECOORD_UNIT );
535 }
536
537 ECOORD operator-( const ECOORD& aOther ) const
538 {
539 return ECOORD( value - aOther.value, ECOORD_UNIT );
540 }
541
542 bool operator==( const ECOORD& aOther ) const
543 {
544 return value == aOther.value;
545 }
546
548 static long long int ConvertToNm( int aValue, enum EAGLE_UNIT aUnit );
549};
550
551
553struct ENET : public EAGLE_BASE
554{
555 /*
556 * <!ELEMENT net (segment)*>
557 * <!ATTLIST net
558 * name %String; #REQUIRED
559 * class %Class; "0"
560 * >
561 */
562 wxString netname;
564
565 std::vector<std::unique_ptr<ESEGMENT>> segments;
566
567 ENET( int aNetCode, const wxString& aNetName ) :
568 netname( aNetName ),
569 netcode( aNetCode )
570 {}
571
573 netcode( 0 )
574 {}
575
576 ENET( wxXmlNode* aNet, IO_BASE* aIo = nullptr );
577};
578
579
581struct EROT
582{
583 bool mirror;
584 bool spin;
585 double degrees;
586
588 mirror( false ),
589 spin( false ),
590 degrees( 0 )
591 {}
592
593 EROT( double aDegrees ) :
594 mirror( false ),
595 spin( false ),
596 degrees( aDegrees )
597 {}
598};
599
600
602struct EVERTEX : public EAGLE_BASE
603{
604 /*
605 * <!ELEMENT vertex EMPTY>
606 * <!ATTLIST vertex
607 * x %Coord; #REQUIRED
608 * y %Coord; #REQUIRED
609 * curve %WireCurve; "0"
610 * >
611 * <!-- curve: The curvature from this vertex to the next one -->
612 */
616
617 EVERTEX( wxXmlNode* aVertex, IO_BASE* aIo = nullptr );
618};
619
620
622struct EWIRE : public EAGLE_BASE
623{
624 /*
625 * <!ELEMENT wire EMPTY>
626 * <!ATTLIST wire
627 * x1 %Coord; #REQUIRED
628 * y1 %Coord; #REQUIRED
629 * x2 %Coord; #REQUIRED
630 * y2 %Coord; #REQUIRED
631 * width %Dimension; #REQUIRED
632 * layer %Layer; #REQUIRED
633 * extent %Extent; #IMPLIED
634 * style %WireStyle; "continuous"
635 * curve %WireCurve; "0"
636 * cap %WireCap; "round"
637 * grouprefs IDREFS #IMPLIED
638 * >
639 * <!-- extent: Only applicable for airwires -->
640 * <!-- cap : Only applicable if 'curve' is not zero -->
641 */
647 int layer;
648
649 // for style: (continuous | longdash | shortdash | dashdot)
654
658
659 // for cap: (flat | round)
660 enum { FLAT,
662
664
665 // TODO add grouprefs
666
667 EWIRE( wxXmlNode* aWire, IO_BASE* aIo = nullptr );
668};
669
670
672struct EJUNCTION : public EAGLE_BASE
673{
674 /*
675 * <!ELEMENT junction EMPTY>
676 * <!ATTLIST junction
677 * x %Coord; #REQUIRED
678 * y %Coord; #REQUIRED
679 * grouprefs IDREFS #IMPLIED
680 * >
681 */
682
685
686 EJUNCTION( wxXmlNode* aJunction, IO_BASE* aIo = nullptr );
687};
688
689
691struct ELABEL : public EAGLE_BASE
692{
693 /*
694 * <!ELEMENT label EMPTY>
695 * <!ATTLIST label
696 * x %Coord; #REQUIRED
697 * y %Coord; #REQUIRED
698 * size %Dimension; #REQUIRED
699 * layer %Layer; #REQUIRED
700 * font %TextFont; "proportional"
701 * ratio %Int; "8"
702 * rot %Rotation; "R0"
703 * xref %Bool; "no"
704 * align %Align; "bottom-left"
705 * grouprefs IDREFS #IMPLIED
706 * >
707 * <!-- rot: Only 0, 90, 180 or 270 -->
708 * <!-- xref: Only in <net> context -->
709 */
710
714 int layer;
720
721 // TODO Add grouprefs
722
723 ELABEL( wxXmlNode* aLabel, IO_BASE* aIo = nullptr );
724};
725
726
728struct EVIA : public EAGLE_BASE
729{
730 /*
731 * <!ELEMENT via EMPTY>
732 * <!ATTLIST via
733 * x %Coord; #REQUIRED
734 * y %Coord; #REQUIRED
735 * extent %Extent; #REQUIRED
736 * drill %Dimension; #REQUIRED
737 * diameter %Dimension; "0"
738 * shape %ViaShape; "round"
739 * alwaysstop %Bool; "no"
740 * grouprefs IDREFS #IMPLIED
741 * >
742 */
751
752 // TODO add grouprefs
753
754 EVIA( wxXmlNode* aVia, IO_BASE* aIo = nullptr );
755};
756
757
759struct ECIRCLE : public EAGLE_BASE
760{
761 /*
762 * <!ELEMENT circle EMPTY>
763 * <!ATTLIST circle
764 * x %Coord; #REQUIRED
765 * y %Coord; #REQUIRED
766 * radius %Coord; #REQUIRED
767 * width %Dimension; #REQUIRED
768 * layer %Layer; #REQUIRED
769 * grouprefs IDREFS #IMPLIED
770 * >
771 */
776 int layer;
777
778 // TODO add grouprefs
779
780 ECIRCLE( wxXmlNode* aCircle, IO_BASE* aIo = nullptr );
781};
782
783
785struct ERECT : public EAGLE_BASE
786{
787 /*
788 * <!ELEMENT rectangle EMPTY>
789 * <!ATTLIST rectangle
790 * x1 %Coord; #REQUIRED
791 * y1 %Coord; #REQUIRED
792 * x2 %Coord; #REQUIRED
793 * y2 %Coord; #REQUIRED
794 * layer %Layer; #REQUIRED
795 * rot %Rotation; "R0"
796 * grouprefs IDREFS #IMPLIED
797 * >
798 */
803 int layer;
805
806 ERECT( wxXmlNode* aRect, IO_BASE* aIo = nullptr );
807};
808
809
810struct ESPLINE : public EAGLE_BASE
811{
812 /*
813 * <!ELEMENT spline (vertex)*>
814 * <!-- Four simple (non-curve) vertices define the control points of a degree-3
815 * spline curve -->
816 * <!ATTLIST spline
817 * width %Dimension; #REQUIRED
818 * >
819 */
820 std::vector<std::unique_ptr<EVERTEX>> vertices;
821 double width;
822
823 ESPLINE( wxXmlNode* aSpline, IO_BASE* aIo = nullptr );
824};
825
826
833struct EATTR : public EAGLE_BASE
834{
835 /*
836 * <!ELEMENT attribute EMPTY>
837 * <!ATTLIST attribute
838 * name %String; #REQUIRED
839 * value %String; #IMPLIED
840 * x %Coord; #IMPLIED
841 * y %Coord; #IMPLIED
842 * size %Dimension; #IMPLIED
843 * layer %Layer; #IMPLIED
844 * font %TextFont; #IMPLIED
845 * ratio %Int; #IMPLIED
846 * rot %Rotation; "R0"
847 * display %AttributeDisplay; "value"
848 * constant %Bool; "no"
849 * align %Align; "bottom-left"
850 * grouprefs IDREFS #IMPLIED
851 * >
852 * <!-- display: Only in <element> or <instance> context -->
853 * <!-- constant:Only in <device> context -->
854 */
855 wxString name;
864
865 enum { // for 'display'
870 };
871
875
876 // TODO add groupdefs
877
878 EATTR( wxXmlNode* aTree, IO_BASE* aIo = nullptr );
879 EATTR() {}
880};
881
882
884struct EDIMENSION : public EAGLE_BASE
885{
886 /*
887 * <!ELEMENT dimension EMPTY>
888 * <!ATTLIST dimension
889 * x1 %Coord; #REQUIRED
890 * y1 %Coord; #REQUIRED
891 * x2 %Coord; #REQUIRED
892 * y2 %Coord; #REQUIRED
893 * x3 %Coord; #REQUIRED
894 * y3 %Coord; #REQUIRED
895 * layer %Layer; #REQUIRED
896 * dtype %DimensionType; "parallel"
897 * width %Dimension; "0.13"
898 * extwidth %Dimension; "0"
899 * extlength %Dimension; "0"
900 * extoffset %Dimension; "0"
901 * textsize %Dimension; #REQUIRED
902 * textratio %Int; "8"
903 * unit %GridUnit; "mm"
904 * precision %Int; "2"
905 * visible %Bool; "no"
906 * grouprefs IDREFS #IMPLIED
907 * >
908 */
916 int layer;
926
927 // TODO add grouprefs
928
929 EDIMENSION( wxXmlNode* aDimension, IO_BASE* aIo = nullptr );
930};
931
932
934struct ETEXT : public EAGLE_BASE
935{
936 /*
937 * <!ELEMENT text (#PCDATA)>
938 * <!ATTLIST text
939 * x %Coord; #REQUIRED
940 * y %Coord; #REQUIRED
941 * size %Dimension; #REQUIRED
942 * layer %Layer; #REQUIRED
943 * font %TextFont; "proportional"
944 * ratio %Int; "8"
945 * rot %Rotation; "R0"
946 * align %Align; "bottom-left"
947 * distance %Int; "50"
948 * grouprefs IDREFS #IMPLIED
949 * >
950 */
951 wxString text;
955 int layer;
959
960 enum { // for align
966
967 // opposites are -1 x above, used by code tricks in here
972 };
973
976
977 // TODO add grouprefs
978
979 ETEXT( wxXmlNode* aText, IO_BASE* aIo = nullptr );
980
982 VECTOR2I ConvertSize() const;
983};
984
985
989struct EFRAME : public EAGLE_BASE
990{
991 /*
992 * <!ELEMENT frame EMPTY>
993 * <!ATTLIST frame
994 * x1 %Coord; #REQUIRED
995 * y1 %Coord; #REQUIRED
996 * x2 %Coord; #REQUIRED
997 * y2 %Coord; #REQUIRED
998 * columns %Int; #REQUIRED
999 * rows %Int; #REQUIRED
1000 * layer %Layer; #REQUIRED
1001 * border-left %Bool; "yes"
1002 * border-top %Bool; "yes"
1003 * border-right %Bool; "yes"
1004 * border-bottom %Bool; "yes"
1005 * grouprefs IDREFS #IMPLIED
1006 * >
1007 */
1013 int rows;
1019
1020 EFRAME( wxXmlNode* aFrameNode, IO_BASE* aIo = nullptr );
1021};
1022
1023
1026{
1027 wxString name;
1032
1033 EPAD_COMMON( wxXmlNode* aPad, IO_BASE* aIo = nullptr );
1034};
1035
1036
1038struct EPAD : public EPAD_COMMON
1039{
1040 /*
1041 * <!ELEMENT pad EMPTY>
1042 * <!ATTLIST pad
1043 * name %String; #REQUIRED
1044 * x %Coord; #REQUIRED
1045 * y %Coord; #REQUIRED
1046 * drill %Dimension; #REQUIRED
1047 * diameter %Dimension; "0"
1048 * shape %PadShape; "round"
1049 * rot %Rotation; "R0"
1050 * stop %Bool; "yes"
1051 * thermals %Bool; "yes"
1052 * first %Bool; "no"
1053 * >
1054 */
1057
1058 // for shape: (square | round | octagon | long | offset)
1059 enum {
1060 UNDEF = -1,
1066 };
1067
1070
1071 EPAD( wxXmlNode* aPad, IO_BASE* aIo = nullptr );
1072};
1073
1074
1076struct ESMD : public EPAD_COMMON
1077{
1078 /*
1079 * <!ELEMENT smd EMPTY>
1080 * <!ATTLIST smd
1081 * name %String; #REQUIRED
1082 * x %Coord; #REQUIRED
1083 * y %Coord; #REQUIRED
1084 * dx %Dimension; #REQUIRED
1085 * dy %Dimension; #REQUIRED
1086 * layer %Layer; #REQUIRED
1087 * roundness %Int; "0"
1088 * rot %Rotation; "R0"
1089 * stop %Bool; "yes"
1090 * thermals %Bool; "yes"
1091 * cream %Bool; "yes"
1092 * >
1093 */
1099
1100 ESMD( wxXmlNode* aSMD, IO_BASE* aIo = nullptr );
1101};
1102
1103
1105struct EPIN : public EAGLE_BASE
1106{
1107 /*
1108 * <!ELEMENT pin EMPTY>
1109 * <!ATTLIST pin
1110 * name %String; #REQUIRED
1111 * x %Coord; #REQUIRED
1112 * y %Coord; #REQUIRED
1113 * visible %PinVisible; "both"
1114 * length %PinLength; "long"
1115 * direction %PinDirection; "io"
1116 * function %PinFunction; "none"
1117 * swaplevel %Int; "0"
1118 * rot %Rotation; "R0"
1119 * >
1120 */
1121 wxString name;
1124
1131
1132 EPIN( wxXmlNode* aPin, IO_BASE* aIo = nullptr );
1133};
1134
1135
1137struct EPOLYGON : public EAGLE_BASE
1138{
1139 /*
1140 * <!ELEMENT polygon (vertex)*>
1141 * <!-- the vertices must define a valid polygon; if the last vertex is the same
1142 * as the first one, it is ignored -->
1143 * <!ATTLIST polygon
1144 * width %Dimension; #REQUIRED
1145 * layer %Layer; #REQUIRED
1146 * spacing %Dimension; #IMPLIED
1147 * pour %PolygonPour; "solid"
1148 * isolate %Dimension; #IMPLIED
1149 * orphans %Bool; "no"
1150 * thermals %Bool; "yes"
1151 * rank %Int; "0"
1152 * grouprefs IDREFS #IMPLIED
1153 * >
1154 * <!-- isolate: Only in <signal> or <package> context -->
1155 * <!-- orphans: Only in <signal> context -->
1156 * <!-- thermals:Only in <signal> context -->
1157 * <!-- rank: 1..6 in <signal> context, 0 or 7 in <package> context -->
1158 */
1162
1163 // KiCad priority is opposite of Eagle rank, that is:
1164 // - Eagle Low rank drawn first
1165 // - KiCad high priority drawn first
1166 // So since Eagle has an upper limit we define this, used for the cases
1167 // where no rank is specified.
1168 static const int max_priority = 6;
1169
1170 enum { // for pour
1174 };
1175
1176 int pour;
1181
1182 std::vector<std::unique_ptr<EVERTEX>> vertices;
1183
1184 // TODO add grouprefs
1185
1186 EPOLYGON( wxXmlNode* aPolygon, IO_BASE* aIo = nullptr );
1187};
1188
1189
1191struct EHOLE : public EAGLE_BASE
1192{
1193 /*
1194 * <!ELEMENT hole EMPTY>
1195 * <!ATTLIST hole
1196 * x %Coord; #REQUIRED
1197 * y %Coord; #REQUIRED
1198 * drill %Dimension; #REQUIRED
1199 * grouprefs IDREFS #IMPLIED
1200 * >
1201 */
1205
1206 EHOLE( wxXmlNode* aHole, IO_BASE* aIo = nullptr );
1207};
1208
1209
1210struct EVARIANT : public EAGLE_BASE
1211{
1212 /*
1213 * <!ELEMENT variant EMPTY>
1214 * <!ATTLIST variant
1215 * name %String; #REQUIRED
1216 * populate %Bool; "yes"
1217 * value %String; #IMPLIED
1218 * technology %String; #IMPLIED
1219 * >
1220 * <!-- technology: Only in part context -->
1221 */
1222 wxString name;
1226
1227 EVARIANT( wxXmlNode* aVariant, IO_BASE* aIo = nullptr );
1228};
1229
1230
1231struct EPINMAP : public EAGLE_BASE
1232{
1233 /*
1234 * <!ELEMENT pinmap EMPTY>
1235 * <!ATTLIST pinmap
1236 * gate %String; #REQUIRED
1237 * pin %String; #REQUIRED
1238 * pinorder %String; #REQUIRED
1239 * >
1240 */
1241 wxString gate;
1242 wxString pin;
1243 wxString pinorder;
1244
1245 EPINMAP( wxXmlNode* aPinMap, IO_BASE* aIo = nullptr );
1246};
1247
1248
1250{
1251 /*
1252 * <!ELEMENT pinmapping (pinmap+)>
1253 * <!ATTLIST pinmapping
1254 * isusermap %Bool; "no"
1255 * iddevicewide %Bool; "yes"
1256 * spiceprefix %String; ""
1257 * >
1258 */
1259 std::vector<std::unique_ptr<EPINMAP>> pinmaps;
1263
1264 EPINMAPPING( wxXmlNode* aPinMap, IO_BASE* aIo = nullptr );
1265};
1266
1267
1268struct EMODEL : public EAGLE_BASE
1269{
1270 /*
1271 * <!ELEMENT model (#PCDATA)>
1272 * <!ATTLIST model
1273 * name %String; #REQUIRED
1274 * >
1275 */
1276 wxString name;
1277 wxString model;
1278
1279 EMODEL( wxXmlNode* aModel, IO_BASE* aIo = nullptr );
1280};
1281
1282
1283struct ESPICE : public EAGLE_BASE
1284{
1285 /*
1286 * <!ELEMENT spice (pinmapping, model)>
1287 */
1288 std::unique_ptr<EPINMAPPING> pinmapping;
1289 std::unique_ptr<EMODEL> model;
1290
1291 ESPICE( wxXmlNode* aSpice, IO_BASE* aIo = nullptr );
1292};
1293
1294
1296struct EELEMENT : public EAGLE_BASE
1297{
1298 /*
1299 * <!ELEMENT element (attribute*, variant*)>
1300 * <!-- variant* is accepted only for compatibility with EAGLE 6.x files -->
1301 * <!ATTLIST element
1302 * name %String; #REQUIRED
1303 * library %String; #REQUIRED
1304 * library_urn %Urn; ""
1305 * package %String; #REQUIRED
1306 * package3d_urn %Urn; ""
1307 * override_package3d_urn %Urn; ""
1308 * override_package_urn %Urn; ""
1309 * override_locally_modified %Bool; "no"
1310 * value %String; #REQUIRED
1311 * x %Coord; #REQUIRED
1312 * y %Coord; #REQUIRED
1313 * locked %Bool; "no"
1314 * populate %Bool; "yes"
1315 * smashed %Bool; "no"
1316 * rot %Rotation; "R0"
1317 * grouprefs IDREFS #IMPLIED
1318 * >
1319 * <!-- library_urn: Only in parts from online libraries -->
1320 */
1321 std::map<wxString, std::unique_ptr<EATTR>> attributes;
1322 std::map<wxString, std::unique_ptr<EVARIANT>> variants;
1323
1324 wxString name;
1325 wxString library;
1327 wxString package;
1331 wxString value;
1337
1338 // TODO add grouprefs
1339
1340 EELEMENT( wxXmlNode* aElement, IO_BASE* aIo = nullptr );
1341};
1342
1343
1344struct ELAYER : public EAGLE_BASE
1345{
1346 /*
1347 * <!ELEMENT layer EMPTY>
1348 * <!ATTLIST layer
1349 * number %Layer; #REQUIRED
1350 * name %String; #REQUIRED
1351 * color %Int; #REQUIRED
1352 * fill %Int; #REQUIRED
1353 * visible %Bool; "yes"
1354 * active %Bool; "yes"
1355 * >
1356 */
1358 wxString name;
1360 int fill;
1363
1364 ELAYER( wxXmlNode* aLayer, IO_BASE* aIo = nullptr );
1365};
1366
1367
1369{
1370 enum
1371 {
1372 TOP = 1,
1388 PADS = 17,
1389 VIAS = 18,
1400 TSTOP = 29,
1401 BSTOP = 30,
1406 TGLUE = 35,
1407 BGLUE = 36,
1408 TTEST = 37,
1409 BTEST = 38,
1416 HOLES = 45,
1422 TDOCU = 51,
1423 BDOCU = 52,
1424 NETS = 91,
1426 PINS = 93,
1428 NAMES = 95,
1430 INFO = 97,
1431 GUIDE = 98,
1433 USERLAYER2 = 161
1435};
1436
1437
1438struct EGATE : public EAGLE_BASE
1439{
1440 /*
1441 * <!ELEMENT gate EMPTY>
1442 * <!ATTLIST gate
1443 * name %String; #REQUIRED
1444 * symbol %String; #REQUIRED
1445 * x %Coord; #REQUIRED
1446 * y %Coord; #REQUIRED
1447 * addlevel %GateAddLevel; "next"
1448 * swaplevel %Int; "0"
1449 * >
1450 */
1451
1452 wxString name;
1453 wxString symbol;
1454
1457
1460
1461 enum
1462 {
1467 ALWAYS
1469
1470 EGATE( wxXmlNode* aGate, IO_BASE* aIo = nullptr );
1471};
1472
1473
1474struct EPART : public EAGLE_BASE
1475{
1476 /*
1477 * <!ELEMENT part (attribute*, variant*, spice?)>
1478 * <!ATTLIST part
1479 * name %String; #REQUIRED
1480 * library %String; #REQUIRED
1481 * library_urn %Urn; ""
1482 * deviceset %String; #REQUIRED
1483 * device %String; #REQUIRED
1484 * package3d_urn %Urn; ""
1485 * override_package3d_urn %Urn; ""
1486 * override_package_urn %Urn; ""
1487 * override_locally_modified %Bool; "no"
1488 * technology %String; ""
1489 * value %String; #IMPLIED
1490 * >
1491 * <!-- library_urn: Only in parts from online libraries -->
1492 */
1493 std::map<wxString, std::unique_ptr<EATTR>> attributes;
1494 std::map<wxString, std::unique_ptr<EVARIANT>> variants;
1495 std::unique_ptr<ESPICE> spice;
1496
1497 wxString name;
1498 wxString library;
1500 wxString deviceset;
1501 wxString device;
1508
1509 EPART( wxXmlNode* aPart, IO_BASE* aIo = nullptr );
1510};
1511
1512
1513struct EINSTANCE : public EAGLE_BASE
1514{
1515 /*
1516 * <!ELEMENT instance (attribute)*>
1517 * <!ATTLIST instance
1518 * part %String; #REQUIRED
1519 * gate %String; #REQUIRED
1520 * x %Coord; #REQUIRED
1521 * y %Coord; #REQUIRED
1522 * smashed %Bool; "no"
1523 * rot %Rotation; "R0"
1524 * grouprefs IDREFS #IMPLIED
1525 * >
1526 * <!-- rot: Only 0, 90, 180 or 270 -->
1527 */
1528
1529 wxString part;
1530 wxString gate;
1535
1536 // TODO: add grouprefs
1537
1538 std::map<wxString, std::unique_ptr<EATTR>> attributes;
1539
1540 EINSTANCE( wxXmlNode* aInstance, IO_BASE* aIo = nullptr );
1541};
1542
1543
1544struct ECONNECT : public EAGLE_BASE
1545{
1546 /*
1547 * <!ELEMENT connect EMPTY>
1548 * <!ATTLIST connect
1549 * gate %String; #REQUIRED
1550 * pin %String; #REQUIRED
1551 * pad %String; #REQUIRED
1552 * route %ContactRoute; "all"
1553 * >
1554 */
1555 wxString gate;
1556 wxString pin;
1557 wxString pad;
1559
1560 ECONNECT( wxXmlNode* aConnect, IO_BASE* aIo = nullptr );
1561};
1562
1563
1565{
1566 /*
1567 * <!ELEMENT technology (attribute)*>
1568 * <!ATTLIST technology
1569 * name %String; #REQUIRED
1570 * >
1571 */
1572 wxString name;
1573
1574 std::vector<std::unique_ptr<EATTR>> attributes;
1575
1576 ETECHNOLOGY( wxXmlNode* aTechnology, IO_BASE* aIo = nullptr );
1577};
1578
1579
1581{
1582 /*
1583 * <!ELEMENT package3dinstance EMPTY>
1584 * <!ATTLIST package3dinstance
1585 * package3d_urn %Urn; #REQUIRED
1586 * >
1587 */
1589
1590 EPACKAGE3DINST( wxXmlNode* aPackage3dInst, IO_BASE* aIo = nullptr );
1591};
1592
1593
1594struct EDEVICE : public EAGLE_BASE
1595{
1596 /*
1597 * <!ELEMENT device (connects?, package3dinstances?, technologies?)>
1598 * <!ATTLIST device
1599 * name %String; ""
1600 * package %String; #IMPLIED
1601 * >
1602 */
1603 wxString name;
1605
1606 std::vector<std::unique_ptr<ECONNECT>> connects;
1607 std::vector < std::unique_ptr<EPACKAGE3DINST>> package3dinstances;
1608 std::vector < std::unique_ptr<ETECHNOLOGY>> technologies;
1609
1610 EDEVICE( wxXmlNode* aDevice, IO_BASE* aIo = nullptr );
1611};
1612
1613
1615{
1616 /*
1617 * <!ELEMENT deviceset (description?, gates, devices, spice?)>
1618 * <!ATTLIST deviceset
1619 * name %String; #REQUIRED
1620 * urn %Urn; ""
1621 * locally_modified %Bool; "no"
1622 * prefix %String; ""
1623 * uservalue %Bool; "no"
1624 * library_version %Int; ""
1625 * library_locally_modified %Bool; "no"
1626 * >
1627 * <!-- library_version and library_locally_modified: Only in managed libraries
1628 * inside boards or schematics -->
1629 */
1630
1631 wxString name;
1638
1639 std::optional<EDESCRIPTION> description;
1640 std::map<wxString, std::unique_ptr<EGATE>> gates;
1641 std::vector<std::unique_ptr<EDEVICE>> devices;
1642 std::optional<ESPICE> spice;
1643
1644 EDEVICE_SET( wxXmlNode* aDeviceSet, IO_BASE* aIo = nullptr );
1645};
1646
1647
1648struct ECLASS : public EAGLE_BASE
1649{
1650 /*
1651 * <!ELEMENT class (clearance)*>
1652 * <!ATTLIST class
1653 * number %Class; #REQUIRED
1654 * name %String; #REQUIRED
1655 * width %Dimension; "0"
1656 * drill %Dimension; "0"
1657 * >
1658 */
1659
1660 wxString number;
1661 wxString name;
1664
1665 std::map<wxString, ECOORD> clearanceMap;
1666
1667 ECLASS( wxXmlNode* aClass, IO_BASE* aIo = nullptr );
1668};
1669
1670
1671struct EPORT : public EAGLE_BASE
1672{
1673 /*
1674 * <!ELEMENT port EMPTY>
1675 * <!ATTLIST port
1676 * name %String; #REQUIRED
1677 * side %String; #REQUIRED
1678 * coord %Coord; #REQUIRED
1679 * direction %PortDirection; "io"
1680 * >
1681 *
1682 * The eagle.dtd is incorrect for the EPORT side attribute. It is not an integer, it is a
1683 * string that defines the side of the module rectangle the port is located. Valid values
1684 * are "top", "bottom", "right", and "left".
1685 */
1686 wxString name;
1687 wxString side;
1690
1691 EPORT( wxXmlNode* aPort, IO_BASE* aIo = nullptr );
1692};
1693
1694
1696{
1697 /*
1698 * <!ELEMENT variantdef EMPTY>
1699 * <!ATTLIST variantdef
1700 * name %String; #REQUIRED
1701 * current %Bool; "no"
1702 * >
1703 */
1704 wxString name;
1706
1707 EVARIANTDEF( wxXmlNode* aVariantDef, IO_BASE* aIo = nullptr );
1708};
1709
1710
1712{
1713 /*
1714 * <!ELEMENT schematic_group (attribute*, description?)>
1715 * <!ATTLIST schematic_group
1716 * name ID #REQUIRED
1717 * selectable %Bool; #IMPLIED
1718 * width %Dimension; #IMPLIED
1719 * titleSize %Dimension; #IMPLIED
1720 * titleFont %TextFont; #IMPLIED
1721 * style %WireStyle; #IMPLIED
1722 * showAnnotations %Bool; #IMPLIED
1723 * layer %Layer; #IMPLIED
1724 * grouprefs IDREFS #IMPLIED
1725 * >
1726 */
1727 wxString name;
1736
1737 std::optional<EDESCRIPTION> description;
1738 std::vector<std::unique_ptr<EATTR>> attributes;
1739
1740 ESCHEMATIC_GROUP( wxXmlNode* aSchematicGroup, IO_BASE* aIo = nullptr );
1741};
1742
1743
1744struct EPLAIN : public EAGLE_BASE
1745{
1746 /*
1747 * <!ELEMENT plain (polygon | wire | text | dimension | circle | spline | rectangle |
1748 * frame | hole)*>
1749 */
1750
1751 std::vector<std::unique_ptr<EPOLYGON>> polygons;
1752 std::vector<std::unique_ptr<EWIRE>> wires;
1753 std::vector<std::unique_ptr<ETEXT>> texts;
1754 std::vector<std::unique_ptr<EDIMENSION>> dimensions;
1755 std::vector<std::unique_ptr<ECIRCLE>> circles;
1756 std::vector<std::unique_ptr<ESPLINE>> splines;
1757 std::vector<std::unique_ptr<ERECT>> rectangles;
1758 std::vector<std::unique_ptr<EFRAME>> frames;
1759 std::vector<std::unique_ptr<EHOLE>> holes;
1760
1761 EPLAIN( wxXmlNode* aPlain, IO_BASE* aIo = nullptr );
1762};
1763
1764
1766{
1767 /*
1768 * <!ELEMENT moduleinst (attribute)*>
1769 * <!ATTLIST moduleinst
1770 * name %String; #REQUIRED
1771 * module %String; #REQUIRED
1772 * modulevariant %String; ""
1773 * x %Coord; #REQUIRED
1774 * y %Coord; #REQUIRED
1775 * offset %Int; "0"
1776 * smashed %Bool; "no"
1777 * rot %Rotation; "R0"
1778 * >
1779 * <!-- rot: Only 0, 90, 180 or 270 -->
1780 */
1781
1782 wxString name;
1783 wxString moduleinst;
1790
1791 EMODULEINST( wxXmlNode* aModuleInst, IO_BASE* aIo = nullptr );
1792};
1793
1794
1795struct EPINREF : public EAGLE_BASE
1796{
1797 /*
1798 * <!ELEMENT pinref EMPTY>
1799 * <!ATTLIST pinref
1800 * part %String; #REQUIRED
1801 * gate %String; #REQUIRED
1802 * pin %String; #REQUIRED
1803 * >
1804 */
1805 wxString part;
1806 wxString gate;
1807 wxString pin;
1808
1809 EPINREF( wxXmlNode* aPinRef, IO_BASE* aIo = nullptr );
1810};
1811
1812
1813struct EPORTREF : public EAGLE_BASE
1814{
1815 /*
1816 * <!ELEMENT portref EMPTY>
1817 * <!ATTLIST portref
1818 * moduleinst %String; #REQUIRED
1819 * port %String; #REQUIRED
1820 * >
1821 */
1822 wxString moduleinst;
1823 wxString port;
1824
1825 EPORTREF( wxXmlNode* aPortRef, IO_BASE* aIo = nullptr );
1826};
1827
1828
1829struct EPROBE : public EAGLE_BASE
1830{
1831 /*
1832 * <!ELEMENT probe EMPTY>
1833 * <!ATTLIST probe
1834 * x %Coord; #REQUIRED
1835 * y %Coord; #REQUIRED
1836 * size %Dimension; #REQUIRED
1837 * layer %Layer; #REQUIRED
1838 * font %TextFont; "proportional"
1839 * ratio %Int; "8"
1840 * rot %Rotation; "R0"
1841 * xref %Bool; "no"
1842 * grouprefs IDREFS #IMPLIED
1843 * >
1844 * <!-- rot: Only 0, 90, 180 or 270 -->
1845 * <!-- xref: Only in <net> context -->
1846 */
1849 double size;
1855
1856 // TODO add grouprefs
1857
1858 EPROBE( wxXmlNode* aProbe, IO_BASE* aIo = nullptr );
1859};
1860
1861
1862struct ESEGMENT : public EAGLE_BASE
1863{
1864 /*
1865 * <!ELEMENT segment (pinref | portref | wire | junction | label | probe)*>
1866 * <!-- 'pinref' and 'junction' are only valid in a <net> context -->
1867 */
1868 std::vector<std::unique_ptr<EPINREF>> pinRefs;
1869 std::vector<std::unique_ptr<EPORTREF>> portRefs;
1870 std::vector<std::unique_ptr<EWIRE>> wires;
1871 std::vector<std::unique_ptr<EJUNCTION>> junctions;
1872 std::vector<std::unique_ptr<ELABEL>> labels;
1873 std::vector<std::unique_ptr<EPROBE>> probes;
1874
1875 ESEGMENT( wxXmlNode* aSegment, IO_BASE* aIo = nullptr );
1876};
1877
1878
1879struct EBUS : public EAGLE_BASE
1880{
1881 /*
1882 * <!ELEMENT bus (segment)*>
1883 * <!ATTLIST bus
1884 * name %String; #REQUIRED
1885 * >
1886 */
1887
1888 wxString name;
1889 std::vector<std::unique_ptr<ESEGMENT>> segments;
1890
1891 EBUS( wxXmlNode* aBus, IO_BASE* aIo = nullptr );
1892};
1893
1894
1895struct ESHEET : public EAGLE_BASE
1896{
1897 /*
1898 * <!ELEMENT sheet (description?, plain?, moduleinsts?, instances?, busses?, nets?)>
1899 */
1900
1902 std::unique_ptr<EPLAIN> plain;
1903 std::map<wxString, std::unique_ptr<EMODULEINST>> moduleinsts;
1904 std::vector<std::unique_ptr<EINSTANCE>> instances;
1905 std::vector<std::unique_ptr<EBUS>> busses;
1906 std::vector<std::unique_ptr<ENET>> nets;
1907
1908 ESHEET( wxXmlNode* aSheet, IO_BASE* aIo = nullptr );
1909};
1910
1911
1912struct EMODULE : public EAGLE_BASE
1913{
1914 /*
1915 * <!ELEMENT module (description?, ports?, variantdefs?, groups?, parts?, sheets?)>
1916 * <!ATTLIST module
1917 * name %String; #REQUIRED
1918 * prefix %String; ""
1919 * dx %Coord; #REQUIRED
1920 * dy %Coord; #REQUIRED
1921 * >
1922 */
1923 wxString name;
1927
1928 std::optional<EDESCRIPTION> description;
1929
1930 std::map<wxString, std::unique_ptr<EPORT>> ports;
1931 std::map<wxString, std::unique_ptr<EVARIANTDEF>> variantdefs;
1932 std::map<wxString, std::unique_ptr<ESCHEMATIC_GROUP>> groups;
1933 std::map<wxString, std::unique_ptr<EPART>> parts;
1934 std::vector<std::unique_ptr<ESHEET>> sheets;
1935
1936 EMODULE( wxXmlNode* aModule, IO_BASE* aIo = nullptr );
1937};
1938
1939
1940struct ENOTE : public EAGLE_BASE
1941{
1942 /*
1943 * <!ELEMENT note (#PCDATA)>
1944 * <!ATTLIST note
1945 * version %Real; #REQUIRED
1946 * severity %Severity; #REQUIRED
1947 * >
1948 * <!-- version: The EAGLE program version that introduced this compatibility note -->
1949 */
1950 double version;
1951 wxString severity;
1952 wxString note;
1953
1954 ENOTE( wxXmlNode* aNote, IO_BASE* aIo = nullptr );
1955};
1956
1957
1959{
1960 /*
1961 * <!ELEMENT compatibility (note)*>
1962 */
1963 std::vector<std::unique_ptr<ENOTE>> notes;
1964
1965 ECOMPATIBILITY( wxXmlNode* aCompatibility, IO_BASE* aIo = nullptr );
1966};
1967
1968
1969struct ESETTING : public EAGLE_BASE
1970{
1971 /*
1972 * <!ELEMENT setting EMPTY>
1973 * <!ATTLIST setting
1974 * alwaysvectorfont %Bool; #IMPLIED
1975 * verticaltext %VerticalText; "up"
1976 * keepoldvectorfont %Bool; "no"
1977 * >
1978 */
1982
1983 ESETTING( wxXmlNode* aSetting, IO_BASE* aIo = nullptr );
1984};
1985
1986
1987struct EGRID : public EAGLE_BASE
1988{
1989 /*
1990 * <!ELEMENT grid EMPTY>
1991 * <!ATTLIST grid
1992 * distance %Real; #IMPLIED
1993 * unitdist %GridUnit; #IMPLIED
1994 * unit %GridUnit; #IMPLIED
1995 * style %GridStyle; "lines"
1996 * multiple %Int; "1"
1997 * display %Bool; "no"
1998 * altdistance %Real; #IMPLIED
1999 * altunitdist %GridUnit; #IMPLIED
2000 * altunit %GridUnit; #IMPLIED
2001 * >
2002 */
2012
2013 EGRID( wxXmlNode* aGrid, IO_BASE* aIo = nullptr );
2014};
2015
2016
2017struct EFILTER : public EAGLE_BASE
2018{
2019 /*
2020 * <!ELEMENT filter EMPTY>
2021 * <!ATTLIST filter
2022 * name %String; #REQUIRED
2023 * expression %String; #REQUIRED
2024 * >
2025 */
2026 wxString name;
2027 wxString expression;
2028
2029 EFILTER( wxXmlNode* aGrid, IO_BASE* aIo = nullptr );
2030};
2031
2032
2033struct EPACKAGE : public EAGLE_BASE
2034{
2035 /*
2036 * <!ELEMENT package (description?, (polygon | wire | text | dimension | circle |
2037 * rectangle | frame | hole | pad | smd)*)>
2038 * <!ATTLIST package
2039 * name %String; #REQUIRED
2040 * urn %Urn; ""
2041 * locally_modified %Bool; "no"
2042 * library_version %Int; ""
2043 * library_locally_modified %Bool; "no"
2044 * >
2045 * <!-- library_version and library_locally_modified: Only in managed libraries
2046 * inside boards or schematics -->
2047 */
2048 wxString name;
2053
2054 std::optional<EDESCRIPTION> description;
2055 std::vector<std::unique_ptr<EPOLYGON>> polygons;
2056 std::vector<std::unique_ptr<EWIRE>> wires;
2057 std::vector<std::unique_ptr<ETEXT>> texts;
2058 std::vector<std::unique_ptr<EDIMENSION>> dimensions;
2059 std::vector<std::unique_ptr<ECIRCLE>> circles;
2060 std::vector<std::unique_ptr<ERECT>> rectangles;
2061 std::vector<std::unique_ptr<EFRAME>> frames;
2062 std::vector<std::unique_ptr<EHOLE>> holes;
2063 std::vector<std::unique_ptr<EPAD>> thtpads;
2064 std::vector<std::unique_ptr<ESMD>> smdpads;
2065
2066 EPACKAGE( wxXmlNode* aPackage, IO_BASE* aIo = nullptr );
2067};
2068
2069
2071{
2072 /*
2073 * <!ELEMENT packageinstance EMPTY>
2074 * <!ATTLIST packageinstance
2075 * name %String; #REQUIRED
2076 * >
2077 */
2078 wxString name;
2079
2080 EPACKAGEINSTANCE( wxXmlNode* aPackageInstance, IO_BASE* aIo = nullptr );
2081};
2082
2083
2084struct EPACKAGE3D : public EAGLE_BASE
2085{
2086 /*
2087 * <!ELEMENT package3d (description?, packageinstances?)>
2088 * <!ATTLIST package3d
2089 * name %String; ""
2090 * urn %Urn; #REQUIRED
2091 * type %Package3dType; #REQUIRED
2092 * library_version %Int; ""
2093 * library_locally_modified %Bool; "no"
2094 * >
2095 * <!-- library_version and library_locally_modified: Only in managed libraries
2096 * inside boards or schematics -->
2097 */
2098 wxString name;
2100 wxString type;
2103
2104 std::optional<EDESCRIPTION> description;
2105 std::vector<std::unique_ptr<EPACKAGEINSTANCE>> packageinstances;
2106
2107 EPACKAGE3D( wxXmlNode* aPackage3d, IO_BASE* aIo = nullptr );
2108};
2109
2110
2111struct ESYMBOL : public EAGLE_BASE
2112{
2113 /*
2114 * <!ELEMENT symbol (description?, (polygon | wire | text | dimension | pin | circle |
2115 * rectangle | frame)*)>
2116 * <!ATTLIST symbol
2117 * name %String; #REQUIRED
2118 * urn %Urn; ""
2119 * locally_modified %Bool; "no"
2120 * library_version %Int; ""
2121 * library_locally_modified %Bool; "no"
2122 * >
2123 * <!-- library_version and library_locally_modified: Only in managed libraries
2124 * inside boards or schematics -->
2125 */
2126
2127 wxString name;
2132
2133 std::optional<EDESCRIPTION> description;
2134 std::vector<std::unique_ptr<EPOLYGON>> polygons;
2135 std::vector<std::unique_ptr<EWIRE>> wires;
2136 std::vector<std::unique_ptr<ETEXT>> texts;
2137 std::vector<std::unique_ptr<EDIMENSION>> dimensions;
2138 std::vector<std::unique_ptr<EPIN>> pins;
2139 std::vector<std::unique_ptr<ECIRCLE>> circles;
2140 std::vector<std::unique_ptr<ERECT>> rectangles;
2141 std::vector<std::unique_ptr<EFRAME>> frames;
2142
2143 ESYMBOL( wxXmlNode* aSymbol, IO_BASE* aIo = nullptr );
2144};
2145
2146
2147struct ELIBRARY : public EAGLE_BASE
2148{
2149 /*
2150 * <!ELEMENT library (description?, packages?, packages3d?, symbols?, devicesets?)>
2151 * <!ATTLIST library
2152 * name %String; #REQUIRED
2153 * urn %Urn; ""
2154 * >
2155 * <!-- name: Only in libraries used inside boards or schematics -->
2156 * <!-- urn: Only in online libraries used inside boards or schematics -->
2157 */
2158 wxString name;
2160
2161 std::optional<EDESCRIPTION> description;
2162 std::map<wxString, std::unique_ptr<EPACKAGE>> packages;
2163 std::map<wxString, std::unique_ptr<EPACKAGE3D>> packages3d;
2164 std::map<wxString, std::unique_ptr<ESYMBOL>> symbols;
2165 std::map<wxString, std::unique_ptr<EDEVICE_SET>> devicesets;
2166
2172 wxString GetName() const;
2173 ELIBRARY( wxXmlNode* aLibrary, IO_BASE* aIo = nullptr );
2174};
2175
2176
2177struct EAPPROVED : public EAGLE_BASE
2178{
2179 /*
2180 * <!ELEMENT approved EMPTY>
2181 * <!ATTLIST approved
2182 * hash %String; #REQUIRED
2183 * >
2184 */
2185 wxString hash;
2186
2187 EAPPROVED( wxXmlNode* aApproved, IO_BASE* aIo = nullptr );
2188};
2189
2190
2191struct ESCHEMATIC : public EAGLE_BASE
2192{
2193 /*
2194 * <!ELEMENT schematic (description?, libraries?, attributes?, variantdefs?, classes?,
2195 * modules?, groups?, parts?, sheets?, errors?)>
2196 * <!ATTLIST schematic
2197 * xreflabel %String; #IMPLIED
2198 * xrefpart %String; #IMPLIED
2199 * >
2200 */
2203
2204 std::optional<EDESCRIPTION> description;
2205 std::map<wxString, std::unique_ptr<ELIBRARY>> libraries;
2206 std::map<wxString, std::unique_ptr<EATTR>> attributes;
2207 std::map<wxString, std::unique_ptr<EVARIANTDEF>> variantdefs;
2208 std::map<wxString, std::unique_ptr<ECLASS>> classes;
2209 std::map<wxString, std::unique_ptr<EMODULE>> modules;
2210 std::map<wxString, std::unique_ptr<ESCHEMATIC_GROUP>> groups;
2211 std::map<wxString, std::unique_ptr<EPART>> parts;
2212 std::vector<std::unique_ptr<ESHEET>> sheets;
2213 std::vector<std::unique_ptr<EAPPROVED>> errors;
2214
2215 ESCHEMATIC( wxXmlNode* aSchematic, IO_BASE* aIo = nullptr );
2216};
2217
2218
2219struct EDRAWING : public EAGLE_BASE
2220{
2221 /*
2222 * <!ELEMENT drawing (settings?, grid?, filters?, layers, (library | schematic | board))>
2223 */
2224 std::vector<std::unique_ptr<ESETTING>> settings;
2225 std::optional<EGRID> grid;
2226 std::vector<std::unique_ptr<EFILTER>> filters;
2227 std::vector<std::unique_ptr<ELAYER>> layers;
2228 std::optional<ESCHEMATIC> schematic;
2229 std::optional<ELIBRARY> library;
2230 // std::optional<std::unique_ptr<EBOARD>> board;
2231
2232 EDRAWING( wxXmlNode* aDrawing, IO_BASE* aIo = nullptr );
2233};
2234
2235
2236struct EAGLE_DOC : public EAGLE_BASE
2237{
2238 /*
2239 * <!ELEMENT eagle (compatibility?, drawing, compatibility?)>
2240 * <!ATTLIST eagle
2241 * version %Real; #REQUIRED
2242 * >
2243 * <!-- version: The EAGLE program version that generated this file, in the
2244 * form V.RR -->
2245 */
2246
2254 wxString version;
2255
2256 std::unique_ptr<EDRAWING> drawing;
2257 std::optional<ECOMPATIBILITY> compatibility;
2258
2259 EAGLE_DOC( wxXmlNode* aEagleDoc, IO_BASE* aIo = nullptr );
2260};
2261
2262
2263#endif // _EAGLE_PARSER_H_
Model an optional XML attribute.
Definition: eagle_parser.h:202
bool operator==(const T &aOther) const
Definition: eagle_parser.h:284
const T * operator->() const
Return a constant pointer to the value of the attribute assuming it is available.
Definition: eagle_parser.h:357
OPTIONAL_XML_ATTRIBUTE< T > & operator=(const wxString &aData)
Assign to a string (optionally) containing the data.
Definition: eagle_parser.h:257
T * operator->()
Return a pointer to the value of the attribute assuming it is available.
Definition: eagle_parser.h:347
const T & operator*() const
Return a constant reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:337
OPTIONAL_XML_ATTRIBUTE(const wxString &aData)
Definition: eagle_parser.h:224
bool m_isAvailable
A boolean indicating if the data is present or not.
Definition: eagle_parser.h:205
const T & CGet() const
Return a constant reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:316
T m_data
The actual data if m_isAvailable is true; otherwise, garbage.
Definition: eagle_parser.h:208
void Set(const wxString &aString)
Attempt to convert a string to the base type.
Definition: eagle_parser.h:294
T & operator*()
Return a reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:327
T & Get()
Return a reference to the value of the attribute assuming it is available.
Definition: eagle_parser.h:305
OPTIONAL_XML_ATTRIBUTE(T aData)
Definition: eagle_parser.h:238
OPTIONAL_XML_ATTRIBUTE()
Construct a default OPTIONAL_XML_ATTRIBUTE, whose data is not available.
Definition: eagle_parser.h:214
Keep track of what we are working on within a PTREE.
Definition: eagle_parser.h:124
void pop()
Definition: eagle_parser.h:135
void clear()
Definition: eagle_parser.h:133
void Value(const char *aValue)
modify the last path node's value
Definition: eagle_parser.h:138
std::vector< TRIPLET > p
Definition: eagle_parser.h:125
void Attribute(const char *aAttribute)
Modify the last path node's attribute.
Definition: eagle_parser.h:144
void push(const char *aPathSegment, const char *aAttribute="")
Definition: eagle_parser.h:128
wxString Contents()
Return the contents of the XPATH as a single string.
Definition: eagle_parser.h:150
OPTIONAL_XML_ATTRIBUTE< EURN > opt_eurn
Definition: eagle_parser.h:397
OPTIONAL_XML_ATTRIBUTE< ECOORD > opt_ecoord
Definition: eagle_parser.h:396
T Convert(const wxString &aValue)
Convert a wxString to a generic type T.
Definition: eagle_parser.h:186
OPTIONAL_XML_ATTRIBUTE< int > opt_int
Definition: eagle_parser.h:392
static wxXmlNode * getChildrenNodes(NODE_MAP &aMap, const wxString &aName)
Definition: eagle_parser.h:70
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:395
wxString escapeName(const wxString &aNetName)
Translates Eagle special characters to their counterparts in KiCad.
wxString interpretText(const wxString &aText)
Interprets special characters in Eagle text and converts them to KiCAD notation.
bool substituteVariable(wxString *aText)
Translates Eagle special text reference to a KiCad variable reference.
wxString Convert< wxString >(const wxString &aValue)
size_t GetNodeCount(const wxXmlNode *aNode)
Fetch the number of XML nodes within aNode.
OPTIONAL_XML_ATTRIBUTE< wxString > opt_wxString
Definition: eagle_parser.h:391
std::map< wxString, EINSTANCE * > EINSTANCE_MAP
Definition: eagle_parser.h:55
std::unordered_map< wxString, wxXmlNode * > NODE_MAP
Definition: eagle_parser.h:54
OPTIONAL_XML_ATTRIBUTE< bool > opt_bool
Definition: eagle_parser.h:394
OPTIONAL_XML_ATTRIBUTE< double > opt_double
Definition: eagle_parser.h:393
VECTOR2I ConvertArcCenter(const VECTOR2I &aStart, const VECTOR2I &aEnd, double aAngle)
Convert an Eagle curve end to a KiCad center for S_ARC.
wxString convertDescription(wxString aDescr)
Converts Eagle's HTML description into KiCad description format.
std::map< wxString, std::unique_ptr< EPART > > EPART_MAP
Definition: eagle_parser.h:56
SEVERITY
@ RPT_SEVERITY_UNDEFINED
EAGLE_BASE(IO_BASE *aIo=nullptr)
Definition: eagle_parser.h:402
IO_BASE * io
Definition: eagle_parser.h:405
void AdvanceProgressPhase()
void Report(const wxString &aMsg, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Send a message to the IO_BASE REPORTER object if one exists.
std::optional< ECOMPATIBILITY > compatibility
wxString version
The Eagle XML file version.
std::unique_ptr< EDRAWING > drawing
wxString hash
Parse an Eagle "attribute" XML element.
Definition: eagle_parser.h:834
opt_wxString font
Definition: eagle_parser.h:861
opt_double ratio
Definition: eagle_parser.h:862
opt_wxString value
Definition: eagle_parser.h:856
opt_ecoord size
Definition: eagle_parser.h:859
opt_ecoord y
Definition: eagle_parser.h:858
wxString name
Definition: eagle_parser.h:855
opt_erot rot
Definition: eagle_parser.h:863
opt_int align
Definition: eagle_parser.h:874
opt_int display
Definition: eagle_parser.h:873
opt_ecoord x
Definition: eagle_parser.h:857
opt_bool constant
Definition: eagle_parser.h:872
opt_int layer
Definition: eagle_parser.h:860
wxString name
std::vector< std::unique_ptr< ESEGMENT > > segments
Eagle circle.
Definition: eagle_parser.h:760
ECOORD x
Definition: eagle_parser.h:772
ECOORD radius
Definition: eagle_parser.h:774
ECOORD y
Definition: eagle_parser.h:773
ECOORD width
Definition: eagle_parser.h:775
wxString number
opt_ecoord drill
std::map< wxString, ECOORD > clearanceMap
opt_ecoord width
wxString name
std::vector< std::unique_ptr< ENOTE > > notes
opt_wxString contactroute
wxString pad
wxString gate
wxString pin
int ToNanoMeters() const
Definition: eagle_parser.h:519
ECOORD operator+(const ECOORD &aOther) const
Definition: eagle_parser.h:532
@ EU_NM
nanometers
Definition: eagle_parser.h:485
@ EU_MM
millimeters
Definition: eagle_parser.h:486
@ EU_MIL
mils/thous
Definition: eagle_parser.h:488
@ EU_INCH
inches
Definition: eagle_parser.h:487
int ToSchUnits() const
Definition: eagle_parser.h:529
float ToMm() const
Definition: eagle_parser.h:524
ECOORD operator-(const ECOORD &aOther) const
Definition: eagle_parser.h:537
int ToMils() const
Definition: eagle_parser.h:509
int To100NanoMeters() const
Definition: eagle_parser.h:514
ECOORD(int aValue, enum EAGLE_UNIT aUnit)
Definition: eagle_parser.h:502
long long int value
Value expressed in nanometers.
Definition: eagle_parser.h:492
bool operator==(const ECOORD &aOther) const
Definition: eagle_parser.h:542
static long long int ConvertToNm(int aValue, enum EAGLE_UNIT aUnit)
Converts a size expressed in a certain unit to nanometers.
int ToPcbUnits() const
Definition: eagle_parser.h:530
static constexpr EAGLE_UNIT ECOORD_UNIT
Unit used for the value field.
Definition: eagle_parser.h:495
opt_wxString language
Definition: eagle_parser.h:474
wxString text
Definition: eagle_parser.h:473
opt_eurn urn
opt_bool uservalue
opt_bool library_locally_modified
std::vector< std::unique_ptr< EDEVICE > > devices
opt_bool locally_modified
std::optional< EDESCRIPTION > description
opt_int library_version
opt_wxString prefix
std::map< wxString, std::unique_ptr< EGATE > > gates
std::optional< ESPICE > spice
wxString name
std::vector< std::unique_ptr< EPACKAGE3DINST > > package3dinstances
wxString name
std::vector< std::unique_ptr< ECONNECT > > connects
opt_wxString package
std::vector< std::unique_ptr< ETECHNOLOGY > > technologies
Eagle dimension element.
Definition: eagle_parser.h:885
opt_double extwidth
Definition: eagle_parser.h:919
opt_int precision
Definition: eagle_parser.h:924
opt_wxString dimensionType
Definition: eagle_parser.h:917
opt_int textratio
Definition: eagle_parser.h:922
opt_double width
Definition: eagle_parser.h:918
opt_double extoffset
Definition: eagle_parser.h:921
opt_ecoord textsize
Definition: eagle_parser.h:915
opt_double extlength
Definition: eagle_parser.h:920
opt_wxString unit
Definition: eagle_parser.h:923
opt_bool visible
Definition: eagle_parser.h:925
std::optional< ESCHEMATIC > schematic
std::optional< ELIBRARY > library
std::vector< std::unique_ptr< ESETTING > > settings
std::vector< std::unique_ptr< ELAYER > > layers
std::optional< EGRID > grid
std::vector< std::unique_ptr< EFILTER > > filters
Eagle element element.
opt_erot rot
wxString name
wxString library
wxString package
opt_wxString package3d_urn
ECOORD y
opt_bool smashed
opt_wxString override_package3d_urn
ECOORD x
wxString value
opt_bool override_locally_modified
opt_bool locked
std::map< wxString, std::unique_ptr< EATTR > > attributes
std::map< wxString, std::unique_ptr< EVARIANT > > variants
opt_eurn library_urn
wxString expression
wxString name
Parse an Eagle frame element.
Definition: eagle_parser.h:990
ECOORD x1
opt_bool border_bottom
opt_bool border_left
opt_bool border_right
ECOORD y1
opt_bool border_top
int columns
ECOORD y2
ECOORD x2
opt_int swaplevel
ECOORD x
ECOORD y
wxString symbol
wxString name
opt_int addlevel
opt_wxString style
opt_int multiple
opt_wxString unit
opt_bool display
opt_wxString altunit
opt_wxString unitdist
opt_wxString altunitdist
opt_double altdistance
opt_double distance
Eagle hole element.
ECOORD y
ECOORD drill
ECOORD x
wxString part
std::map< wxString, std::unique_ptr< EATTR > > attributes
opt_erot rot
wxString gate
opt_bool smashed
Eagle Junction.
Definition: eagle_parser.h:673
ECOORD y
Definition: eagle_parser.h:684
ECOORD x
Definition: eagle_parser.h:683
Eagle label.
Definition: eagle_parser.h:692
opt_erot rot
Definition: eagle_parser.h:717
opt_wxString font
Definition: eagle_parser.h:715
opt_int ratio
Definition: eagle_parser.h:716
ECOORD size
Definition: eagle_parser.h:713
opt_wxString align
Definition: eagle_parser.h:719
opt_bool xref
Definition: eagle_parser.h:718
int layer
Definition: eagle_parser.h:714
ECOORD y
Definition: eagle_parser.h:712
ECOORD x
Definition: eagle_parser.h:711
wxString name
opt_bool visible
opt_bool active
int number
std::map< wxString, std::unique_ptr< EDEVICE_SET > > devicesets
wxString GetName() const
Fetch the fully unique library name.
std::map< wxString, std::unique_ptr< EPACKAGE3D > > packages3d
std::map< wxString, std::unique_ptr< EPACKAGE > > packages
wxString name
std::optional< EDESCRIPTION > description
std::map< wxString, std::unique_ptr< ESYMBOL > > symbols
opt_eurn urn
wxString name
wxString model
opt_bool smashed
wxString name
opt_erot rotation
opt_int offset
opt_wxString moduleVariant
wxString moduleinst
std::map< wxString, std::unique_ptr< EPART > > parts
ECOORD dy
std::map< wxString, std::unique_ptr< ESCHEMATIC_GROUP > > groups
std::vector< std::unique_ptr< ESHEET > > sheets
std::optional< EDESCRIPTION > description
opt_wxString prefix
std::map< wxString, std::unique_ptr< EVARIANTDEF > > variantdefs
ECOORD dx
wxString name
std::map< wxString, std::unique_ptr< EPORT > > ports
Eagle net.
Definition: eagle_parser.h:554
int netcode
Definition: eagle_parser.h:563
wxString netname
Definition: eagle_parser.h:562
std::vector< std::unique_ptr< ESEGMENT > > segments
Definition: eagle_parser.h:565
ENET(int aNetCode, const wxString &aNetName)
Definition: eagle_parser.h:567
wxString note
double version
wxString severity
wxString package3d_urn
opt_bool library_locally_modified
wxString name
std::optional< EDESCRIPTION > description
opt_int library_version
std::vector< std::unique_ptr< EPACKAGEINSTANCE > > packageinstances
wxString type
std::vector< std::unique_ptr< EPOLYGON > > polygons
std::vector< std::unique_ptr< EPAD > > thtpads
std::vector< std::unique_ptr< ECIRCLE > > circles
std::vector< std::unique_ptr< ESMD > > smdpads
std::vector< std::unique_ptr< EDIMENSION > > dimensions
opt_bool library_locally_modified
std::vector< std::unique_ptr< EHOLE > > holes
opt_int library_version
wxString name
std::vector< std::unique_ptr< EFRAME > > frames
std::vector< std::unique_ptr< ERECT > > rectangles
std::vector< std::unique_ptr< ETEXT > > texts
std::vector< std::unique_ptr< EWIRE > > wires
std::optional< EDESCRIPTION > description
opt_eurn urn
opt_bool locally_modified
Structure holding common properties for through-hole and SMD pads.
opt_bool thermals
opt_bool stop
wxString name
opt_erot rot
Eagle thru hole pad.
opt_ecoord diameter
opt_bool first
opt_ecoord drill
opt_int shape
wxString device
std::unique_ptr< ESPICE > spice
opt_bool override_locally_modified
wxString library
opt_wxString override_package_urn
opt_wxString technology
std::map< wxString, std::unique_ptr< EATTR > > attributes
opt_eurn libraryUrn
opt_wxString override_package3d_urn
wxString deviceset
opt_wxString package3d_urn
opt_wxString value
std::map< wxString, std::unique_ptr< EVARIANT > > variants
wxString name
opt_bool iddevicewide
opt_wxString spiceprefix
opt_bool isusermap
std::vector< std::unique_ptr< EPINMAP > > pinmaps
wxString pinorder
wxString gate
wxString pin
wxString gate
wxString pin
wxString part
Eagle pin element.
ECOORD x
wxString name
opt_int swaplevel
opt_wxString visible
opt_wxString direction
opt_wxString length
opt_wxString function
opt_erot rot
ECOORD y
std::vector< std::unique_ptr< EWIRE > > wires
std::vector< std::unique_ptr< EPOLYGON > > polygons
std::vector< std::unique_ptr< ETEXT > > texts
std::vector< std::unique_ptr< ECIRCLE > > circles
std::vector< std::unique_ptr< EFRAME > > frames
std::vector< std::unique_ptr< ESPLINE > > splines
std::vector< std::unique_ptr< ERECT > > rectangles
std::vector< std::unique_ptr< EDIMENSION > > dimensions
std::vector< std::unique_ptr< EHOLE > > holes
Eagle polygon, without vertices which are parsed as needed.
opt_bool orphans
opt_int rank
opt_bool thermals
opt_ecoord spacing
static const int max_priority
std::vector< std::unique_ptr< EVERTEX > > vertices
ECOORD width
opt_ecoord isolate
wxString port
wxString moduleinst
opt_wxString direction
wxString name
wxString side
ECOORD coord
double size
ECOORD y
opt_erot rot
opt_wxString font
ECOORD x
opt_bool xref
Eagle XML rectangle in binary.
Definition: eagle_parser.h:786
ECOORD x2
Definition: eagle_parser.h:801
ECOORD y1
Definition: eagle_parser.h:800
opt_erot rot
Definition: eagle_parser.h:804
int layer
Definition: eagle_parser.h:803
ECOORD y2
Definition: eagle_parser.h:802
ECOORD x1
Definition: eagle_parser.h:799
Eagle rotation.
Definition: eagle_parser.h:582
double degrees
Definition: eagle_parser.h:585
bool spin
Definition: eagle_parser.h:584
EROT(double aDegrees)
Definition: eagle_parser.h:593
bool mirror
Definition: eagle_parser.h:583
std::vector< std::unique_ptr< EATTR > > attributes
opt_bool showAnnotations
std::optional< EDESCRIPTION > description
opt_wxString titleFont
opt_wxString grouprefs
opt_wxString wireStyle
opt_ecoord titleSize
opt_ecoord width
std::map< wxString, std::unique_ptr< EMODULE > > modules
opt_wxString xreflabel
opt_wxString xrefpart
std::map< wxString, std::unique_ptr< EATTR > > attributes
std::vector< std::unique_ptr< EAPPROVED > > errors
std::optional< EDESCRIPTION > description
std::map< wxString, std::unique_ptr< ECLASS > > classes
std::vector< std::unique_ptr< ESHEET > > sheets
std::map< wxString, std::unique_ptr< EPART > > parts
std::map< wxString, std::unique_ptr< ELIBRARY > > libraries
std::map< wxString, std::unique_ptr< EVARIANTDEF > > variantdefs
std::map< wxString, std::unique_ptr< ESCHEMATIC_GROUP > > groups
std::vector< std::unique_ptr< EPORTREF > > portRefs
std::vector< std::unique_ptr< EPROBE > > probes
std::vector< std::unique_ptr< EPINREF > > pinRefs
std::vector< std::unique_ptr< EWIRE > > wires
std::vector< std::unique_ptr< EJUNCTION > > junctions
std::vector< std::unique_ptr< ELABEL > > labels
opt_bool alwaysvectorfont
opt_bool keepoldvectorfont
opt_wxString verticaltext
std::unique_ptr< EPLAIN > plain
std::vector< std::unique_ptr< ENET > > nets
std::vector< std::unique_ptr< EBUS > > busses
opt_wxString description
std::vector< std::unique_ptr< EINSTANCE > > instances
std::map< wxString, std::unique_ptr< EMODULEINST > > moduleinsts
Eagle SMD pad.
opt_int roundness
ECOORD dx
int layer
opt_bool cream
ECOORD dy
std::unique_ptr< EMODEL > model
std::unique_ptr< EPINMAPPING > pinmapping
std::vector< std::unique_ptr< EVERTEX > > vertices
Definition: eagle_parser.h:820
double width
Definition: eagle_parser.h:821
std::vector< std::unique_ptr< EFRAME > > frames
opt_int library_version
std::optional< EDESCRIPTION > description
std::vector< std::unique_ptr< EPIN > > pins
std::vector< std::unique_ptr< ECIRCLE > > circles
opt_bool library_locally_modified
std::vector< std::unique_ptr< ETEXT > > texts
std::vector< std::unique_ptr< EPOLYGON > > polygons
opt_eurn urn
std::vector< std::unique_ptr< ERECT > > rectangles
std::vector< std::unique_ptr< EWIRE > > wires
opt_bool locally_modified
wxString name
std::vector< std::unique_ptr< EDIMENSION > > dimensions
wxString name
std::vector< std::unique_ptr< EATTR > > attributes
Eagle text element.
Definition: eagle_parser.h:935
opt_double ratio
Definition: eagle_parser.h:957
wxString text
Definition: eagle_parser.h:951
@ BOTTOM_CENTER
Definition: eagle_parser.h:969
@ BOTTOM_RIGHT
Definition: eagle_parser.h:971
@ TOP_CENTER
Definition: eagle_parser.h:963
@ TOP_LEFT
Definition: eagle_parser.h:964
@ TOP_RIGHT
Definition: eagle_parser.h:965
@ CENTER_RIGHT
Definition: eagle_parser.h:968
@ CENTER_LEFT
Definition: eagle_parser.h:962
@ BOTTOM_LEFT
Definition: eagle_parser.h:970
ECOORD y
Definition: eagle_parser.h:953
opt_int distance
Definition: eagle_parser.h:975
ECOORD size
Definition: eagle_parser.h:954
opt_erot rot
Definition: eagle_parser.h:958
opt_int align
Definition: eagle_parser.h:974
ECOORD x
Definition: eagle_parser.h:952
VECTOR2I ConvertSize() const
Calculate text size based on font type and size.
opt_wxString font
Definition: eagle_parser.h:956
int layer
Definition: eagle_parser.h:955
Container that parses Eagle library file "urn" definitions.
Definition: eagle_parser.h:433
bool IsValid() const
Check if the string passed to the ctor was a valid Eagle urn.
wxString host
Should always be "urn".
Definition: eagle_parser.h:449
void Parse(const wxString &aUrn)
wxString assetVersion
May be empty depending on the asset type.
Definition: eagle_parser.h:453
wxString assetId
The unique asset identifier for the asset type.
Definition: eagle_parser.h:452
wxString assetType
Must be "symbol", "footprint", "package", "component", or "library".
Definition: eagle_parser.h:451
wxString path
Path to the asset type below.
Definition: eagle_parser.h:450
opt_bool current
wxString name
opt_bool populate
opt_wxString technology
wxString name
opt_wxString value
Eagle vertex.
Definition: eagle_parser.h:603
ECOORD y
Definition: eagle_parser.h:614
ECOORD x
Definition: eagle_parser.h:613
opt_double curve
range is -359.9..359.9
Definition: eagle_parser.h:615
Eagle via.
Definition: eagle_parser.h:729
opt_ecoord diam
Definition: eagle_parser.h:748
ECOORD drill
< inclusive
Definition: eagle_parser.h:747
ECOORD y
Definition: eagle_parser.h:744
opt_wxString shape
Definition: eagle_parser.h:749
int layer_front_most
Definition: eagle_parser.h:745
int layer_back_most
< extent
Definition: eagle_parser.h:746
ECOORD x
Definition: eagle_parser.h:743
opt_bool alwaysStop
Definition: eagle_parser.h:750
Eagle wire.
Definition: eagle_parser.h:623
ECOORD width
Definition: eagle_parser.h:646
int layer
Definition: eagle_parser.h:647
opt_wxString extent
Definition: eagle_parser.h:655
@ LONGDASH
Definition: eagle_parser.h:651
@ CONTINUOUS
Definition: eagle_parser.h:650
@ SHORTDASH
Definition: eagle_parser.h:652
ECOORD x2
Definition: eagle_parser.h:644
opt_int cap
Definition: eagle_parser.h:663
opt_int style
Definition: eagle_parser.h:656
ECOORD y2
Definition: eagle_parser.h:645
ECOORD x1
Definition: eagle_parser.h:642
ECOORD y1
Definition: eagle_parser.h:643
opt_double curve
range is -359.9..359.9
Definition: eagle_parser.h:657
segment (element) of our XPATH into the Eagle XML document tree in PTREE form.
Definition: eagle_parser.h:97
TRIPLET(const char *aElement, const char *aAttribute="", const char *aValue="")
Definition: eagle_parser.h:102
const char * value
Definition: eagle_parser.h:100
const char * attribute
Definition: eagle_parser.h:99
const char * element
Definition: eagle_parser.h:98
Implement a simple wrapper around runtime_error to isolate the errors thrown by the Eagle XML parser.
Definition: eagle_parser.h:82
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:89