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, see <https://www.gnu.org/licenses/>.
22 */
23
24
25#ifndef _EAGLE_PARSER_H_
26#define _EAGLE_PARSER_H_
27
28#include <map>
29#include <memory>
30#include <optional>
31#include <unordered_map>
32
33#include <wx/xml/xml.h>
34#include <wx/string.h>
35#include <wx/filename.h>
36
37#include <layer_ids.h>
38#include <trigo.h>
39#include <core/wx_stl_compat.h>
41
42class FOOTPRINT;
43class IO_BASE;
44
45struct EINSTANCE;
46struct EPART;
47struct ETEXT;
48struct ESEGMENT;
49
50typedef std::unordered_map<wxString, wxXmlNode*> NODE_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
64wxString convertDescription( wxString aDescr );
65
66static inline wxXmlNode* getChildrenNodes( NODE_MAP& aMap, const wxString& aName )
67{
68 auto it = aMap.find( aName );
69 return it == aMap.end() ? nullptr : it->second->GetChildren();
70}
71
72
77struct XML_PARSER_ERROR : std::runtime_error
78{
85 XML_PARSER_ERROR( const wxString& aMessage ) noexcept :
86 std::runtime_error( "XML parser failed - " + aMessage.ToStdString() )
87 {}
88};
89
90
92struct TRIPLET
93{
94 const char* element;
95 const char* attribute;
96 const char* value;
97
98 TRIPLET( const char* aElement, const char* aAttribute = "", const char* aValue = "" ) :
99 element( aElement ),
100 attribute( aAttribute ),
101 value( aValue )
102 {}
103};
104
105
119class XPATH
120{
121 std::vector<TRIPLET> p;
122
123public:
124 void push( const char* aPathSegment, const char* aAttribute="" )
125 {
126 p.emplace_back( aPathSegment, aAttribute );
127 }
128
129 void clear() { p.clear(); }
130
131 void pop() { p.pop_back(); }
132
134 void Value( const char* aValue )
135 {
136 p.back().value = aValue;
137 }
138
140 void Attribute( const char* aAttribute )
141 {
142 p.back().attribute = aAttribute;
143 }
144
146 wxString Contents()
147 {
148 typedef std::vector<TRIPLET>::const_iterator CITER_TRIPLET;
149
150 wxString ret;
151
152 for( CITER_TRIPLET it = p.begin(); it != p.end(); ++it )
153 {
154 if( it != p.begin() )
155 ret += '.';
156
157 ret += it->element;
158
159 if( it->attribute[0] && it->value[0] )
160 {
161 ret += '[';
162 ret += it->attribute;
163 ret += '=';
164 ret += it->value;
165 ret += ']';
166 }
167 }
168
169 return ret;
170 }
171};
172
173
181template<typename T>
182T Convert( const wxString& aValue )
183{
184 throw XML_PARSER_ERROR( "Conversion failed. Unknown type." );
185}
186
187template <>
188wxString Convert<wxString>( const wxString& aValue );
189
197size_t GetNodeCount( const wxXmlNode* aNode );
198
199
207NODE_MAP MapChildren( wxXmlNode* aCurrentNode );
208
210VECTOR2I ConvertArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double aAngle );
211
212// Pre-declare for typedefs
213struct EROT;
214struct ECOORD;
215struct EURN;
216
218VECTOR2I ConvertEagleTextSize( const std::optional<wxString>& font, const ECOORD& size );
219
221{
222 EAGLE_BASE( IO_BASE* aIo = nullptr ) :
223 io( aIo ) {}
224
226
232 void Report( const wxString& aMsg, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED );
233
235};
236
237
255struct EURN : public EAGLE_BASE
256{
257 EURN() {}
258
260 EURN( const wxString& aUrn );
261
262 void Parse( const wxString& aUrn );
263
270 bool IsValid() const;
271
272 wxString host;
273 wxString path;
274 wxString assetType;
275 wxString assetId;
276 wxString assetVersion;
277};
278
279
280// All of the 'E'STRUCTS below merely hold Eagle XML information verbatim, in binary.
281// For maintenance and troubleshooting purposes, it was thought that we'd need to
282// separate the conversion process into distinct steps. There is no intent to have KiCad
283// forms of information in these 'E'STRUCTS. They are only binary forms
284// of the Eagle information in the corresponding Eagle XML nodes.
285
286
288{
289 /*
290 * <!ELEMENT description (#PCDATA)>
291 * <!ATTLIST description
292 * language %String; "en"
293 * >
294 */
295
296 wxString text;
297 std::optional<wxString> language;
298
299 EDESCRIPTION( wxXmlNode* aDescription, IO_BASE* aIo = nullptr );
300};
301
302
303// Eagle coordinates
304struct ECOORD : public EAGLE_BASE
305{
313
315 long long int value;
316
318 static constexpr EAGLE_UNIT ECOORD_UNIT = EU_NM;
319
321 : value( 0 )
322 {
323 }
324
325 ECOORD( int aValue, enum EAGLE_UNIT aUnit )
326 : value( ConvertToNm( aValue, aUnit ) )
327 {
328 }
329
330 ECOORD( const wxString& aValue, enum EAGLE_UNIT aUnit );
331
332 int ToMils() const
333 {
334 return value / 25400;
335 }
336
337 int To100NanoMeters() const
338 {
339 return value / 100;
340 }
341
342 int ToNanoMeters() const
343 {
344 return value;
345 }
346
347 float ToMm() const
348 {
349 return value / 1000000.0;
350 }
351
352 int ToSchUnits() const { return To100NanoMeters(); }
353 int ToPcbUnits() const { return ToNanoMeters(); }
354
355 ECOORD operator+( const ECOORD& aOther ) const
356 {
357 return ECOORD( value + aOther.value, ECOORD_UNIT );
358 }
359
360 ECOORD operator-( const ECOORD& aOther ) const
361 {
362 return ECOORD( value - aOther.value, ECOORD_UNIT );
363 }
364
365 bool operator==( const ECOORD& aOther ) const
366 {
367 return value == aOther.value;
368 }
369
371 static long long int ConvertToNm( int aValue, enum EAGLE_UNIT aUnit );
372};
373
374
376struct ENET : public EAGLE_BASE
377{
378 /*
379 * <!ELEMENT net (segment)*>
380 * <!ATTLIST net
381 * name %String; #REQUIRED
382 * class %Class; "0"
383 * >
384 */
385 wxString netname;
387
388 std::vector<std::unique_ptr<ESEGMENT>> segments;
389
390 ENET( int aNetCode, const wxString& aNetName ) :
391 netname( aNetName ),
392 netcode( aNetCode )
393 {}
394
396 netcode( 0 )
397 {}
398
399 ENET( wxXmlNode* aNet, IO_BASE* aIo = nullptr );
400};
401
402
404struct EROT
405{
406 bool mirror;
407 bool spin;
408 double degrees;
409
411 mirror( false ),
412 spin( false ),
413 degrees( 0 )
414 {}
415
416 EROT( double aDegrees ) :
417 mirror( false ),
418 spin( false ),
419 degrees( aDegrees )
420 {}
421};
422
423
425struct EVERTEX : public EAGLE_BASE
426{
427 /*
428 * <!ELEMENT vertex EMPTY>
429 * <!ATTLIST vertex
430 * x %Coord; #REQUIRED
431 * y %Coord; #REQUIRED
432 * curve %WireCurve; "0"
433 * >
434 * <!-- curve: The curvature from this vertex to the next one -->
435 */
438 std::optional<double> curve;
439
440 EVERTEX( wxXmlNode* aVertex, IO_BASE* aIo = nullptr );
441};
442
443
445struct EWIRE : public EAGLE_BASE
446{
447 /*
448 * <!ELEMENT wire EMPTY>
449 * <!ATTLIST wire
450 * x1 %Coord; #REQUIRED
451 * y1 %Coord; #REQUIRED
452 * x2 %Coord; #REQUIRED
453 * y2 %Coord; #REQUIRED
454 * width %Dimension; #REQUIRED
455 * layer %Layer; #REQUIRED
456 * extent %Extent; #IMPLIED
457 * style %WireStyle; "continuous"
458 * curve %WireCurve; "0"
459 * cap %WireCap; "round"
460 * grouprefs IDREFS #IMPLIED
461 * >
462 * <!-- extent: Only applicable for airwires -->
463 * <!-- cap : Only applicable if 'curve' is not zero -->
464 */
470 int layer;
471
472 // for style: (continuous | longdash | shortdash | dashdot)
477
478 std::optional<wxString> extent;
479 std::optional<int> style;
480 std::optional<double> curve;
481
482 // for cap: (flat | round)
483 enum { FLAT,
485
486 std::optional<int> cap;
487
488 // TODO add grouprefs
489
490 EWIRE( wxXmlNode* aWire, IO_BASE* aIo = nullptr );
491};
492
493
495struct EJUNCTION : public EAGLE_BASE
496{
497 /*
498 * <!ELEMENT junction EMPTY>
499 * <!ATTLIST junction
500 * x %Coord; #REQUIRED
501 * y %Coord; #REQUIRED
502 * grouprefs IDREFS #IMPLIED
503 * >
504 */
505
508
509 EJUNCTION( wxXmlNode* aJunction, IO_BASE* aIo = nullptr );
510};
511
512
514struct ELABEL : public EAGLE_BASE
515{
516 /*
517 * <!ELEMENT label EMPTY>
518 * <!ATTLIST label
519 * x %Coord; #REQUIRED
520 * y %Coord; #REQUIRED
521 * size %Dimension; #REQUIRED
522 * layer %Layer; #REQUIRED
523 * font %TextFont; "proportional"
524 * ratio %Int; "8"
525 * rot %Rotation; "R0"
526 * xref %Bool; "no"
527 * align %Align; "bottom-left"
528 * grouprefs IDREFS #IMPLIED
529 * >
530 * <!-- rot: Only 0, 90, 180 or 270 -->
531 * <!-- xref: Only in <net> context -->
532 */
533
537 int layer;
538 std::optional<wxString> font;
539 std::optional<int> ratio;
540 std::optional<EROT> rot;
541 std::optional<bool> xref;
542 std::optional<wxString> align;
543
544 // TODO Add grouprefs
545
546 ELABEL( wxXmlNode* aLabel, IO_BASE* aIo = nullptr );
547};
548
549
551struct EVIA : public EAGLE_BASE
552{
553 /*
554 * <!ELEMENT via EMPTY>
555 * <!ATTLIST via
556 * x %Coord; #REQUIRED
557 * y %Coord; #REQUIRED
558 * extent %Extent; #REQUIRED
559 * drill %Dimension; #REQUIRED
560 * diameter %Dimension; "0"
561 * shape %ViaShape; "round"
562 * alwaysstop %Bool; "no"
563 * grouprefs IDREFS #IMPLIED
564 * >
565 */
571 std::optional<ECOORD> diam;
572 std::optional<wxString> shape;
573 std::optional<bool> alwaysStop;
574
575 // TODO add grouprefs
576
577 EVIA( wxXmlNode* aVia, IO_BASE* aIo = nullptr );
578};
579
580
582struct ECIRCLE : public EAGLE_BASE
583{
584 /*
585 * <!ELEMENT circle EMPTY>
586 * <!ATTLIST circle
587 * x %Coord; #REQUIRED
588 * y %Coord; #REQUIRED
589 * radius %Coord; #REQUIRED
590 * width %Dimension; #REQUIRED
591 * layer %Layer; #REQUIRED
592 * grouprefs IDREFS #IMPLIED
593 * >
594 */
599 int layer;
600
601 // TODO add grouprefs
602
603 ECIRCLE( wxXmlNode* aCircle, IO_BASE* aIo = nullptr );
604};
605
606
608struct ERECT : public EAGLE_BASE
609{
610 /*
611 * <!ELEMENT rectangle EMPTY>
612 * <!ATTLIST rectangle
613 * x1 %Coord; #REQUIRED
614 * y1 %Coord; #REQUIRED
615 * x2 %Coord; #REQUIRED
616 * y2 %Coord; #REQUIRED
617 * layer %Layer; #REQUIRED
618 * rot %Rotation; "R0"
619 * grouprefs IDREFS #IMPLIED
620 * >
621 */
626 int layer;
627 std::optional<EROT> rot;
628
629 ERECT( wxXmlNode* aRect, IO_BASE* aIo = nullptr );
630};
631
632
633struct ESPLINE : public EAGLE_BASE
634{
635 /*
636 * <!ELEMENT spline (vertex)*>
637 * <!-- Four simple (non-curve) vertices define the control points of a degree-3
638 * spline curve -->
639 * <!ATTLIST spline
640 * width %Dimension; #REQUIRED
641 * >
642 */
643 std::vector<std::unique_ptr<EVERTEX>> vertices;
644 double width;
645
646 ESPLINE( wxXmlNode* aSpline, IO_BASE* aIo = nullptr );
647};
648
649
656struct EATTR : public EAGLE_BASE
657{
658 /*
659 * <!ELEMENT attribute EMPTY>
660 * <!ATTLIST attribute
661 * name %String; #REQUIRED
662 * value %String; #IMPLIED
663 * x %Coord; #IMPLIED
664 * y %Coord; #IMPLIED
665 * size %Dimension; #IMPLIED
666 * layer %Layer; #IMPLIED
667 * font %TextFont; #IMPLIED
668 * ratio %Int; #IMPLIED
669 * rot %Rotation; "R0"
670 * display %AttributeDisplay; "value"
671 * constant %Bool; "no"
672 * align %Align; "bottom-left"
673 * grouprefs IDREFS #IMPLIED
674 * >
675 * <!-- display: Only in <element> or <instance> context -->
676 * <!-- constant:Only in <device> context -->
677 */
678 wxString name;
679 std::optional<wxString> value;
680 std::optional<ECOORD> x;
681 std::optional<ECOORD> y;
682 std::optional<ECOORD> size;
683 std::optional<int> layer;
684 std::optional<wxString> font;
685 std::optional<double> ratio;
686 std::optional<EROT> rot;
687
688 enum { // for 'display'
693 };
694
695 std::optional<bool> constant;
696 std::optional<int> display;
697 std::optional<int> align;
698
699 // TODO add groupdefs
700
701 EATTR( wxXmlNode* aTree, IO_BASE* aIo = nullptr );
702 EATTR() {}
703};
704
705
707struct EDIMENSION : public EAGLE_BASE
708{
709 /*
710 * <!ELEMENT dimension EMPTY>
711 * <!ATTLIST dimension
712 * x1 %Coord; #REQUIRED
713 * y1 %Coord; #REQUIRED
714 * x2 %Coord; #REQUIRED
715 * y2 %Coord; #REQUIRED
716 * x3 %Coord; #REQUIRED
717 * y3 %Coord; #REQUIRED
718 * layer %Layer; #REQUIRED
719 * dtype %DimensionType; "parallel"
720 * width %Dimension; "0.13"
721 * extwidth %Dimension; "0"
722 * extlength %Dimension; "0"
723 * extoffset %Dimension; "0"
724 * textsize %Dimension; #REQUIRED
725 * textratio %Int; "8"
726 * unit %GridUnit; "mm"
727 * precision %Int; "2"
728 * visible %Bool; "no"
729 * grouprefs IDREFS #IMPLIED
730 * >
731 */
738 std::optional<ECOORD> textsize;
739 int layer;
740 std::optional<wxString> dimensionType;
741 std::optional<double> width;
742 std::optional<double> extwidth;
743 std::optional<double> extlength;
744 std::optional<double> extoffset;
745 std::optional<int> textratio;
746 std::optional<wxString> unit;
747 std::optional<int> precision;
748 std::optional<bool> visible;
749
750 // TODO add grouprefs
751
752 EDIMENSION( wxXmlNode* aDimension, IO_BASE* aIo = nullptr );
753};
754
755
757struct ETEXT : public EAGLE_BASE
758{
759 /*
760 * <!ELEMENT text (#PCDATA)>
761 * <!ATTLIST text
762 * x %Coord; #REQUIRED
763 * y %Coord; #REQUIRED
764 * size %Dimension; #REQUIRED
765 * layer %Layer; #REQUIRED
766 * font %TextFont; "proportional"
767 * ratio %Int; "8"
768 * rot %Rotation; "R0"
769 * align %Align; "bottom-left"
770 * distance %Int; "50"
771 * grouprefs IDREFS #IMPLIED
772 * >
773 */
774 wxString text;
778 int layer;
779 std::optional<wxString> font;
780 std::optional<double> ratio;
781 std::optional<EROT> rot;
782
783 enum { // for align
789
790 // opposites are -1 x above, used by code tricks in here
795 };
796
797 std::optional<int> align;
798 std::optional<int> distance;
799
800 // TODO add grouprefs
801
802 ETEXT( wxXmlNode* aText, IO_BASE* aIo = nullptr );
803
805 VECTOR2I ConvertSize() const;
806};
807
808
812struct EFRAME : public EAGLE_BASE
813{
814 /*
815 * <!ELEMENT frame EMPTY>
816 * <!ATTLIST frame
817 * x1 %Coord; #REQUIRED
818 * y1 %Coord; #REQUIRED
819 * x2 %Coord; #REQUIRED
820 * y2 %Coord; #REQUIRED
821 * columns %Int; #REQUIRED
822 * rows %Int; #REQUIRED
823 * layer %Layer; #REQUIRED
824 * border-left %Bool; "yes"
825 * border-top %Bool; "yes"
826 * border-right %Bool; "yes"
827 * border-bottom %Bool; "yes"
828 * grouprefs IDREFS #IMPLIED
829 * >
830 */
836 int rows;
837 int layer;
838 std::optional<bool> border_left;
839 std::optional<bool> border_top;
840 std::optional<bool> border_right;
841 std::optional<bool> border_bottom;
842
843 EFRAME( wxXmlNode* aFrameNode, IO_BASE* aIo = nullptr );
844};
845
846
848struct EPAD_COMMON : public EAGLE_BASE
849{
850 wxString name;
853 std::optional<EROT> rot;
854 std::optional<bool> stop;
855 std::optional<bool> thermals;
856
857 EPAD_COMMON( wxXmlNode* aPad, IO_BASE* aIo = nullptr );
858};
859
860
862struct EPAD : public EPAD_COMMON
863{
864 /*
865 * <!ELEMENT pad EMPTY>
866 * <!ATTLIST pad
867 * name %String; #REQUIRED
868 * x %Coord; #REQUIRED
869 * y %Coord; #REQUIRED
870 * drill %Dimension; #REQUIRED
871 * diameter %Dimension; "0"
872 * shape %PadShape; "round"
873 * rot %Rotation; "R0"
874 * stop %Bool; "yes"
875 * thermals %Bool; "yes"
876 * first %Bool; "no"
877 * >
878 */
879 std::optional<ECOORD> drill;
880 std::optional<ECOORD> diameter;
881
882 // for shape: (square | round | octagon | long | offset)
883 enum {
884 UNDEF = -1,
890 };
891
892 std::optional<int> shape;
893 std::optional<bool> first;
894
895 EPAD( wxXmlNode* aPad, IO_BASE* aIo = nullptr );
896};
897
898
900struct ESMD : public EPAD_COMMON
901{
902 /*
903 * <!ELEMENT smd EMPTY>
904 * <!ATTLIST smd
905 * name %String; #REQUIRED
906 * x %Coord; #REQUIRED
907 * y %Coord; #REQUIRED
908 * dx %Dimension; #REQUIRED
909 * dy %Dimension; #REQUIRED
910 * layer %Layer; #REQUIRED
911 * roundness %Int; "0"
912 * rot %Rotation; "R0"
913 * stop %Bool; "yes"
914 * thermals %Bool; "yes"
915 * cream %Bool; "yes"
916 * >
917 */
920 int layer;
921 std::optional<int> roundness;
922 std::optional<bool> cream;
923
924 ESMD( wxXmlNode* aSMD, IO_BASE* aIo = nullptr );
925};
926
927
929struct EPIN : public EAGLE_BASE
930{
931 /*
932 * <!ELEMENT pin EMPTY>
933 * <!ATTLIST pin
934 * name %String; #REQUIRED
935 * x %Coord; #REQUIRED
936 * y %Coord; #REQUIRED
937 * visible %PinVisible; "both"
938 * length %PinLength; "long"
939 * direction %PinDirection; "io"
940 * function %PinFunction; "none"
941 * swaplevel %Int; "0"
942 * rot %Rotation; "R0"
943 * >
944 */
945 wxString name;
948
949 std::optional<wxString> visible;
950 std::optional<wxString> length;
951 std::optional<wxString> direction;
952 std::optional<wxString> function;
953 std::optional<int> swaplevel;
954 std::optional<EROT> rot;
955
956 EPIN( wxXmlNode* aPin, IO_BASE* aIo = nullptr );
957};
958
959
961struct EPOLYGON : public EAGLE_BASE
962{
963 /*
964 * <!ELEMENT polygon (vertex)*>
965 * <!-- the vertices must define a valid polygon; if the last vertex is the same
966 * as the first one, it is ignored -->
967 * <!ATTLIST polygon
968 * width %Dimension; #REQUIRED
969 * layer %Layer; #REQUIRED
970 * spacing %Dimension; #IMPLIED
971 * pour %PolygonPour; "solid"
972 * isolate %Dimension; #IMPLIED
973 * orphans %Bool; "no"
974 * thermals %Bool; "yes"
975 * rank %Int; "0"
976 * grouprefs IDREFS #IMPLIED
977 * >
978 * <!-- isolate: Only in <signal> or <package> context -->
979 * <!-- orphans: Only in <signal> context -->
980 * <!-- thermals:Only in <signal> context -->
981 * <!-- rank: 1..6 in <signal> context, 0 or 7 in <package> context -->
982 */
984 int layer;
985 std::optional<ECOORD> spacing;
986
987 // KiCad priority is opposite of Eagle rank, that is:
988 // - Eagle Low rank drawn first
989 // - KiCad high priority drawn first
990 // So since Eagle has an upper limit we define this, used for the cases
991 // where no rank is specified.
992 static const int max_priority = 6;
993
994 enum { // for pour
998 };
999
1000 int pour;
1001 std::optional<ECOORD> isolate;
1002 std::optional<bool> orphans;
1003 std::optional<bool> thermals;
1004 std::optional<int> rank;
1005
1006 std::vector<std::unique_ptr<EVERTEX>> vertices;
1007
1008 // TODO add grouprefs
1009
1012 bool IsValidOutline() const { return vertices.size() >= 3; }
1013
1014 EPOLYGON( wxXmlNode* aPolygon, IO_BASE* aIo = nullptr );
1015};
1016
1017
1019struct EHOLE : public EAGLE_BASE
1020{
1021 /*
1022 * <!ELEMENT hole EMPTY>
1023 * <!ATTLIST hole
1024 * x %Coord; #REQUIRED
1025 * y %Coord; #REQUIRED
1026 * drill %Dimension; #REQUIRED
1027 * grouprefs IDREFS #IMPLIED
1028 * >
1029 */
1033
1034 EHOLE( wxXmlNode* aHole, IO_BASE* aIo = nullptr );
1035};
1036
1037
1038struct EVARIANT : public EAGLE_BASE
1039{
1040 /*
1041 * <!ELEMENT variant EMPTY>
1042 * <!ATTLIST variant
1043 * name %String; #REQUIRED
1044 * populate %Bool; "yes"
1045 * value %String; #IMPLIED
1046 * technology %String; #IMPLIED
1047 * >
1048 * <!-- technology: Only in part context -->
1049 */
1050 wxString name;
1051 std::optional<bool> populate;
1052 std::optional<wxString> value;
1053 std::optional<wxString> technology;
1054
1055 EVARIANT( wxXmlNode* aVariant, IO_BASE* aIo = nullptr );
1056};
1057
1058
1059struct EPINMAP : public EAGLE_BASE
1060{
1061 /*
1062 * <!ELEMENT pinmap EMPTY>
1063 * <!ATTLIST pinmap
1064 * gate %String; #REQUIRED
1065 * pin %String; #REQUIRED
1066 * pinorder %String; #REQUIRED
1067 * >
1068 */
1069 wxString gate;
1070 wxString pin;
1071 wxString pinorder;
1072
1073 EPINMAP( wxXmlNode* aPinMap, IO_BASE* aIo = nullptr );
1074};
1075
1076
1078{
1079 /*
1080 * <!ELEMENT pinmapping (pinmap+)>
1081 * <!ATTLIST pinmapping
1082 * isusermap %Bool; "no"
1083 * iddevicewide %Bool; "yes"
1084 * spiceprefix %String; ""
1085 * >
1086 */
1087 std::vector<std::unique_ptr<EPINMAP>> pinmaps;
1088 std::optional<bool> isusermap;
1089 std::optional<bool> iddevicewide;
1090 std::optional<wxString> spiceprefix;
1091
1092 EPINMAPPING( wxXmlNode* aPinMap, IO_BASE* aIo = nullptr );
1093};
1094
1095
1096struct EMODEL : public EAGLE_BASE
1097{
1098 /*
1099 * <!ELEMENT model (#PCDATA)>
1100 * <!ATTLIST model
1101 * name %String; #REQUIRED
1102 * >
1103 */
1104 wxString name;
1105 wxString model;
1106
1107 EMODEL( wxXmlNode* aModel, IO_BASE* aIo = nullptr );
1108};
1109
1110
1111struct ESPICE : public EAGLE_BASE
1112{
1113 /*
1114 * <!ELEMENT spice (pinmapping, model)>
1115 */
1116 std::unique_ptr<EPINMAPPING> pinmapping;
1117 std::unique_ptr<EMODEL> model;
1118
1119 ESPICE( wxXmlNode* aSpice, IO_BASE* aIo = nullptr );
1120};
1121
1122
1124struct EELEMENT : public EAGLE_BASE
1125{
1126 /*
1127 * <!ELEMENT element (attribute*, variant*)>
1128 * <!-- variant* is accepted only for compatibility with EAGLE 6.x files -->
1129 * <!ATTLIST element
1130 * name %String; #REQUIRED
1131 * library %String; #REQUIRED
1132 * library_urn %Urn; ""
1133 * package %String; #REQUIRED
1134 * package3d_urn %Urn; ""
1135 * override_package3d_urn %Urn; ""
1136 * override_package_urn %Urn; ""
1137 * override_locally_modified %Bool; "no"
1138 * value %String; #REQUIRED
1139 * x %Coord; #REQUIRED
1140 * y %Coord; #REQUIRED
1141 * locked %Bool; "no"
1142 * populate %Bool; "yes"
1143 * smashed %Bool; "no"
1144 * rot %Rotation; "R0"
1145 * grouprefs IDREFS #IMPLIED
1146 * >
1147 * <!-- library_urn: Only in parts from online libraries -->
1148 */
1149 std::map<wxString, std::unique_ptr<EATTR>> attributes;
1150 std::map<wxString, std::unique_ptr<EVARIANT>> variants;
1151
1152 wxString name;
1153 wxString library;
1154 std::optional<EURN> library_urn;
1155 wxString package;
1156 std::optional<wxString> package3d_urn;
1157 std::optional<wxString> override_package3d_urn;
1158 std::optional<bool> override_locally_modified;
1159 wxString value;
1162 std::optional<bool> locked;
1163 std::optional<bool> smashed;
1164 std::optional<EROT> rot;
1165
1166 // TODO add grouprefs
1167
1168 EELEMENT( wxXmlNode* aElement, IO_BASE* aIo = nullptr );
1169};
1170
1171
1172struct ELAYER : public EAGLE_BASE
1173{
1174 /*
1175 * <!ELEMENT layer EMPTY>
1176 * <!ATTLIST layer
1177 * number %Layer; #REQUIRED
1178 * name %String; #REQUIRED
1179 * color %Int; #REQUIRED
1180 * fill %Int; #REQUIRED
1181 * visible %Bool; "yes"
1182 * active %Bool; "yes"
1183 * >
1184 */
1186 wxString name;
1188 int fill;
1189 std::optional<bool> visible;
1190 std::optional<bool> active;
1191
1192 ELAYER( wxXmlNode* aLayer, IO_BASE* aIo = nullptr );
1193};
1194
1195
1275
1276
1277struct EGATE : public EAGLE_BASE
1278{
1279 /*
1280 * <!ELEMENT gate EMPTY>
1281 * <!ATTLIST gate
1282 * name %String; #REQUIRED
1283 * symbol %String; #REQUIRED
1284 * x %Coord; #REQUIRED
1285 * y %Coord; #REQUIRED
1286 * addlevel %GateAddLevel; "next"
1287 * swaplevel %Int; "0"
1288 * >
1289 */
1290
1291 wxString name;
1292 wxString symbol;
1293
1296
1297 std::optional<int> addlevel;
1298 std::optional<int> swaplevel;
1299
1300 enum
1301 {
1307 };
1308
1309 EGATE( wxXmlNode* aGate, IO_BASE* aIo = nullptr );
1310};
1311
1312
1313struct EPART : public EAGLE_BASE
1314{
1315 /*
1316 * <!ELEMENT part (attribute*, variant*, spice?)>
1317 * <!ATTLIST part
1318 * name %String; #REQUIRED
1319 * library %String; #REQUIRED
1320 * library_urn %Urn; ""
1321 * deviceset %String; #REQUIRED
1322 * device %String; #REQUIRED
1323 * package3d_urn %Urn; ""
1324 * override_package3d_urn %Urn; ""
1325 * override_package_urn %Urn; ""
1326 * override_locally_modified %Bool; "no"
1327 * technology %String; ""
1328 * value %String; #IMPLIED
1329 * >
1330 * <!-- library_urn: Only in parts from online libraries -->
1331 */
1332 std::map<wxString, std::unique_ptr<EATTR>> attributes;
1333 std::map<wxString, std::unique_ptr<EVARIANT>> variants;
1334 std::unique_ptr<ESPICE> spice;
1335
1336 wxString name;
1337 wxString library;
1338 std::optional<EURN> libraryUrn;
1339 wxString deviceset;
1340 wxString device;
1341 std::optional<wxString> package3d_urn;
1342 std::optional<wxString> override_package3d_urn;
1343 std::optional<wxString> override_package_urn;
1344 std::optional<bool> override_locally_modified;
1345 std::optional<wxString> technology;
1346 std::optional<wxString> value;
1347
1348 EPART( wxXmlNode* aPart, IO_BASE* aIo = nullptr );
1349};
1350
1351
1352struct EINSTANCE : public EAGLE_BASE
1353{
1354 /*
1355 * <!ELEMENT instance (attribute)*>
1356 * <!ATTLIST instance
1357 * part %String; #REQUIRED
1358 * gate %String; #REQUIRED
1359 * x %Coord; #REQUIRED
1360 * y %Coord; #REQUIRED
1361 * smashed %Bool; "no"
1362 * rot %Rotation; "R0"
1363 * grouprefs IDREFS #IMPLIED
1364 * >
1365 * <!-- rot: Only 0, 90, 180 or 270 -->
1366 */
1367
1368 wxString part;
1369 wxString gate;
1372 std::optional<bool> smashed;
1373 std::optional<EROT> rot;
1374
1375 // TODO: add grouprefs
1376
1377 std::map<wxString, std::unique_ptr<EATTR>> attributes;
1378
1379 EINSTANCE( wxXmlNode* aInstance, IO_BASE* aIo = nullptr );
1380};
1381
1382
1383struct ECONNECT : public EAGLE_BASE
1384{
1385 /*
1386 * <!ELEMENT connect EMPTY>
1387 * <!ATTLIST connect
1388 * gate %String; #REQUIRED
1389 * pin %String; #REQUIRED
1390 * pad %String; #REQUIRED
1391 * route %ContactRoute; "all"
1392 * >
1393 */
1394 wxString gate;
1395 wxString pin;
1396 wxString pad;
1397 std::optional<wxString> contactroute;
1398
1399 ECONNECT( wxXmlNode* aConnect, IO_BASE* aIo = nullptr );
1400};
1401
1402
1404{
1405 /*
1406 * <!ELEMENT technology (attribute)*>
1407 * <!ATTLIST technology
1408 * name %String; #REQUIRED
1409 * >
1410 */
1411 wxString name;
1412
1413 std::vector<std::unique_ptr<EATTR>> attributes;
1414
1415 ETECHNOLOGY( wxXmlNode* aTechnology, IO_BASE* aIo = nullptr );
1416};
1417
1418
1420{
1421 /*
1422 * <!ELEMENT package3dinstance EMPTY>
1423 * <!ATTLIST package3dinstance
1424 * package3d_urn %Urn; #REQUIRED
1425 * >
1426 */
1428
1429 EPACKAGE3DINST( wxXmlNode* aPackage3dInst, IO_BASE* aIo = nullptr );
1430};
1431
1432
1433struct EDEVICE : public EAGLE_BASE
1434{
1435 /*
1436 * <!ELEMENT device (connects?, package3dinstances?, technologies?)>
1437 * <!ATTLIST device
1438 * name %String; ""
1439 * package %String; #IMPLIED
1440 * >
1441 */
1442 wxString name;
1443 std::optional<wxString> package;
1444
1445 std::vector<std::unique_ptr<ECONNECT>> connects;
1446 std::vector<std::unique_ptr<EPACKAGE3DINST>> package3dinstances;
1447 std::map<wxString, std::unique_ptr<ETECHNOLOGY>> technologies;
1448
1449 EDEVICE( wxXmlNode* aDevice, IO_BASE* aIo = nullptr );
1450};
1451
1452
1454{
1455 /*
1456 * <!ELEMENT deviceset (description?, gates, devices, spice?)>
1457 * <!ATTLIST deviceset
1458 * name %String; #REQUIRED
1459 * urn %Urn; ""
1460 * locally_modified %Bool; "no"
1461 * prefix %String; ""
1462 * uservalue %Bool; "no"
1463 * library_version %Int; ""
1464 * library_locally_modified %Bool; "no"
1465 * >
1466 * <!-- library_version and library_locally_modified: Only in managed libraries
1467 * inside boards or schematics -->
1468 */
1469
1470 wxString name;
1471 std::optional<EURN> urn;
1472 std::optional<bool> locally_modified;
1473 std::optional<wxString> prefix;
1474 std::optional<bool> uservalue;
1475 std::optional<int> library_version;
1476 std::optional<bool> library_locally_modified;
1477
1478 std::optional<EDESCRIPTION> description;
1479 std::map<wxString, std::unique_ptr<EGATE>> gates;
1480 std::map<wxString, std::unique_ptr<EDEVICE>> devices;
1481 std::optional<ESPICE> spice;
1482
1483 EDEVICE_SET( wxXmlNode* aDeviceSet, IO_BASE* aIo = nullptr );
1484};
1485
1486
1487struct ECLASS : public EAGLE_BASE
1488{
1489 /*
1490 * <!ELEMENT class (clearance)*>
1491 * <!ATTLIST class
1492 * number %Class; #REQUIRED
1493 * name %String; #REQUIRED
1494 * width %Dimension; "0"
1495 * drill %Dimension; "0"
1496 * >
1497 */
1498
1499 wxString number;
1500 wxString name;
1501 std::optional<ECOORD> width;
1502 std::optional<ECOORD> drill;
1503
1504 std::map<wxString, ECOORD> clearanceMap;
1505
1506 ECLASS( wxXmlNode* aClass, IO_BASE* aIo = nullptr );
1507};
1508
1509
1510struct EPORT : public EAGLE_BASE
1511{
1512 /*
1513 * <!ELEMENT port EMPTY>
1514 * <!ATTLIST port
1515 * name %String; #REQUIRED
1516 * side %String; #REQUIRED
1517 * coord %Coord; #REQUIRED
1518 * direction %PortDirection; "io"
1519 * >
1520 *
1521 * The eagle.dtd is incorrect for the EPORT side attribute. It is not an integer, it is a
1522 * string that defines the side of the module rectangle the port is located. Valid values
1523 * are "top", "bottom", "right", and "left".
1524 */
1525 wxString name;
1526 wxString side;
1528 std::optional<wxString> direction;
1529
1530 EPORT( wxXmlNode* aPort, IO_BASE* aIo = nullptr );
1531};
1532
1533
1535{
1536 /*
1537 * <!ELEMENT variantdef EMPTY>
1538 * <!ATTLIST variantdef
1539 * name %String; #REQUIRED
1540 * current %Bool; "no"
1541 * >
1542 */
1543 wxString name;
1544 std::optional<bool> current;
1545
1546 EVARIANTDEF( wxXmlNode* aVariantDef, IO_BASE* aIo = nullptr );
1547};
1548
1549
1551{
1552 /*
1553 * <!ELEMENT schematic_group (attribute*, description?)>
1554 * <!ATTLIST schematic_group
1555 * name ID #REQUIRED
1556 * selectable %Bool; #IMPLIED
1557 * width %Dimension; #IMPLIED
1558 * titleSize %Dimension; #IMPLIED
1559 * titleFont %TextFont; #IMPLIED
1560 * style %WireStyle; #IMPLIED
1561 * showAnnotations %Bool; #IMPLIED
1562 * layer %Layer; #IMPLIED
1563 * grouprefs IDREFS #IMPLIED
1564 * >
1565 */
1566 wxString name;
1567 std::optional<bool> selectable;
1568 std::optional<ECOORD> width;
1569 std::optional<ECOORD> titleSize;
1570 std::optional<wxString> titleFont;
1571 std::optional<wxString> wireStyle;
1572 std::optional<bool> showAnnotations;
1573 std::optional<int> layer;
1574 std::optional<wxString> grouprefs;
1575
1576 std::optional<EDESCRIPTION> description;
1577 std::vector<std::unique_ptr<EATTR>> attributes;
1578
1579 ESCHEMATIC_GROUP( wxXmlNode* aSchematicGroup, IO_BASE* aIo = nullptr );
1580};
1581
1582
1583struct EPLAIN : public EAGLE_BASE
1584{
1585 /*
1586 * <!ELEMENT plain (polygon | wire | text | dimension | circle | spline | rectangle |
1587 * frame | hole)*>
1588 */
1589
1590 std::vector<std::unique_ptr<EPOLYGON>> polygons;
1591 std::vector<std::unique_ptr<EWIRE>> wires;
1592 std::vector<std::unique_ptr<ETEXT>> texts;
1593 std::vector<std::unique_ptr<EDIMENSION>> dimensions;
1594 std::vector<std::unique_ptr<ECIRCLE>> circles;
1595 std::vector<std::unique_ptr<ESPLINE>> splines;
1596 std::vector<std::unique_ptr<ERECT>> rectangles;
1597 std::vector<std::unique_ptr<EFRAME>> frames;
1598 std::vector<std::unique_ptr<EHOLE>> holes;
1599
1600 EPLAIN( wxXmlNode* aPlain, IO_BASE* aIo = nullptr );
1601};
1602
1603
1605{
1606 /*
1607 * <!ELEMENT moduleinst (attribute)*>
1608 * <!ATTLIST moduleinst
1609 * name %String; #REQUIRED
1610 * module %String; #REQUIRED
1611 * modulevariant %String; ""
1612 * x %Coord; #REQUIRED
1613 * y %Coord; #REQUIRED
1614 * offset %Int; "0"
1615 * smashed %Bool; "no"
1616 * rot %Rotation; "R0"
1617 * >
1618 * <!-- rot: Only 0, 90, 180 or 270 -->
1619 */
1620
1621 wxString name;
1622 wxString moduleinst;
1623 std::optional<wxString> moduleVariant;
1626 std::optional<int> offset;
1627 std::optional<bool> smashed;
1628 std::optional<EROT> rotation;
1629
1630 EMODULEINST( wxXmlNode* aModuleInst, IO_BASE* aIo = nullptr );
1631};
1632
1633
1634struct EPINREF : public EAGLE_BASE
1635{
1636 /*
1637 * <!ELEMENT pinref EMPTY>
1638 * <!ATTLIST pinref
1639 * part %String; #REQUIRED
1640 * gate %String; #REQUIRED
1641 * pin %String; #REQUIRED
1642 * >
1643 */
1644 wxString part;
1645 wxString gate;
1646 wxString pin;
1647
1648 EPINREF( wxXmlNode* aPinRef, IO_BASE* aIo = nullptr );
1649};
1650
1651
1652struct EPORTREF : public EAGLE_BASE
1653{
1654 /*
1655 * <!ELEMENT portref EMPTY>
1656 * <!ATTLIST portref
1657 * moduleinst %String; #REQUIRED
1658 * port %String; #REQUIRED
1659 * >
1660 */
1661 wxString moduleinst;
1662 wxString port;
1663
1664 EPORTREF( wxXmlNode* aPortRef, IO_BASE* aIo = nullptr );
1665};
1666
1667
1668struct EPROBE : public EAGLE_BASE
1669{
1670 /*
1671 * <!ELEMENT probe EMPTY>
1672 * <!ATTLIST probe
1673 * x %Coord; #REQUIRED
1674 * y %Coord; #REQUIRED
1675 * size %Dimension; #REQUIRED
1676 * layer %Layer; #REQUIRED
1677 * font %TextFont; "proportional"
1678 * ratio %Int; "8"
1679 * rot %Rotation; "R0"
1680 * xref %Bool; "no"
1681 * grouprefs IDREFS #IMPLIED
1682 * >
1683 * <!-- rot: Only 0, 90, 180 or 270 -->
1684 * <!-- xref: Only in <net> context -->
1685 */
1688 double size;
1690 std::optional<wxString> font;
1691 std::optional<int> ratio;
1692 std::optional<EROT> rot;
1693 std::optional<bool> xref;
1694
1695 // TODO add grouprefs
1696
1697 EPROBE( wxXmlNode* aProbe, IO_BASE* aIo = nullptr );
1698};
1699
1700
1701struct ESEGMENT : public EAGLE_BASE
1702{
1703 /*
1704 * <!ELEMENT segment (pinref | portref | wire | junction | label | probe)*>
1705 * <!-- 'pinref' and 'junction' are only valid in a <net> context -->
1706 */
1707 std::vector<std::unique_ptr<EPINREF>> pinRefs;
1708 std::vector<std::unique_ptr<EPORTREF>> portRefs;
1709 std::vector<std::unique_ptr<EWIRE>> wires;
1710 std::vector<std::unique_ptr<EJUNCTION>> junctions;
1711 std::vector<std::unique_ptr<ELABEL>> labels;
1712 std::vector<std::unique_ptr<EPROBE>> probes;
1713
1714 ESEGMENT( wxXmlNode* aSegment, IO_BASE* aIo = nullptr );
1715};
1716
1717
1718struct EBUS : public EAGLE_BASE
1719{
1720 /*
1721 * <!ELEMENT bus (segment)*>
1722 * <!ATTLIST bus
1723 * name %String; #REQUIRED
1724 * >
1725 */
1726
1727 wxString name;
1728 std::vector<std::unique_ptr<ESEGMENT>> segments;
1729
1730 EBUS( wxXmlNode* aBus, IO_BASE* aIo = nullptr );
1731};
1732
1733
1734struct ESHEET : public EAGLE_BASE
1735{
1736 /*
1737 * <!ELEMENT sheet (description?, plain?, moduleinsts?, instances?, busses?, nets?)>
1738 */
1739
1740 std::optional<EDESCRIPTION> description;
1741 std::unique_ptr<EPLAIN> plain;
1742 std::map<wxString, std::unique_ptr<EMODULEINST>> moduleinsts;
1743 std::vector<std::unique_ptr<EINSTANCE>> instances;
1744 std::vector<std::unique_ptr<EBUS>> busses;
1745 std::vector<std::unique_ptr<ENET>> nets;
1746
1747 ESHEET( wxXmlNode* aSheet, IO_BASE* aIo = nullptr );
1748};
1749
1750
1751struct EMODULE : public EAGLE_BASE
1752{
1753 /*
1754 * <!ELEMENT module (description?, ports?, variantdefs?, groups?, parts?, sheets?)>
1755 * <!ATTLIST module
1756 * name %String; #REQUIRED
1757 * prefix %String; ""
1758 * dx %Coord; #REQUIRED
1759 * dy %Coord; #REQUIRED
1760 * >
1761 */
1762 wxString name;
1763 std::optional<wxString> prefix;
1766
1767 std::optional<EDESCRIPTION> description;
1768 std::map<wxString, std::unique_ptr<EPORT>> ports;
1769 std::map<wxString, std::unique_ptr<EVARIANTDEF>> variantdefs;
1770 std::map<wxString, std::unique_ptr<ESCHEMATIC_GROUP>> groups;
1771 std::map<wxString, std::unique_ptr<EPART>> parts;
1772 std::vector<std::unique_ptr<ESHEET>> sheets;
1773
1774 EMODULE( wxXmlNode* aModule, IO_BASE* aIo = nullptr );
1775};
1776
1777
1778struct ENOTE : public EAGLE_BASE
1779{
1780 /*
1781 * <!ELEMENT note (#PCDATA)>
1782 * <!ATTLIST note
1783 * version %Real; #REQUIRED
1784 * severity %Severity; #REQUIRED
1785 * >
1786 * <!-- version: The EAGLE program version that introduced this compatibility note -->
1787 */
1788 double version;
1789 wxString severity;
1790 wxString note;
1791
1792 ENOTE( wxXmlNode* aNote, IO_BASE* aIo = nullptr );
1793};
1794
1795
1797{
1798 /*
1799 * <!ELEMENT compatibility (note)*>
1800 */
1801 std::vector<std::unique_ptr<ENOTE>> notes;
1802
1803 ECOMPATIBILITY( wxXmlNode* aCompatibility, IO_BASE* aIo = nullptr );
1804};
1805
1806
1807struct ESETTING : public EAGLE_BASE
1808{
1809 /*
1810 * <!ELEMENT setting EMPTY>
1811 * <!ATTLIST setting
1812 * alwaysvectorfont %Bool; #IMPLIED
1813 * verticaltext %VerticalText; "up"
1814 * keepoldvectorfont %Bool; "no"
1815 * >
1816 */
1817 std::optional<bool> alwaysvectorfont;
1818 std::optional<wxString> verticaltext;
1819 std::optional<bool> keepoldvectorfont;
1820
1821 ESETTING( wxXmlNode* aSetting, IO_BASE* aIo = nullptr );
1822};
1823
1824
1825struct EGRID : public EAGLE_BASE
1826{
1827 /*
1828 * <!ELEMENT grid EMPTY>
1829 * <!ATTLIST grid
1830 * distance %Real; #IMPLIED
1831 * unitdist %GridUnit; #IMPLIED
1832 * unit %GridUnit; #IMPLIED
1833 * style %GridStyle; "lines"
1834 * multiple %Int; "1"
1835 * display %Bool; "no"
1836 * altdistance %Real; #IMPLIED
1837 * altunitdist %GridUnit; #IMPLIED
1838 * altunit %GridUnit; #IMPLIED
1839 * >
1840 */
1841 std::optional<double> distance;
1842 std::optional<wxString> unitdist;
1843 std::optional<wxString> unit;
1844 std::optional<wxString> style;
1845 std::optional<int> multiple;
1846 std::optional<bool> display;
1847 std::optional<double> altdistance;
1848 std::optional<wxString> altunitdist;
1849 std::optional<wxString> altunit;
1850
1851 EGRID( wxXmlNode* aGrid, IO_BASE* aIo = nullptr );
1852};
1853
1854
1855struct EFILTER : public EAGLE_BASE
1856{
1857 /*
1858 * <!ELEMENT filter EMPTY>
1859 * <!ATTLIST filter
1860 * name %String; #REQUIRED
1861 * expression %String; #REQUIRED
1862 * >
1863 */
1864 wxString name;
1865 wxString expression;
1866
1867 EFILTER( wxXmlNode* aGrid, IO_BASE* aIo = nullptr );
1868};
1869
1870
1871struct EPACKAGE : public EAGLE_BASE
1872{
1873 /*
1874 * <!ELEMENT package (description?, (polygon | wire | text | dimension | circle |
1875 * rectangle | frame | hole | pad | smd)*)>
1876 * <!ATTLIST package
1877 * name %String; #REQUIRED
1878 * urn %Urn; ""
1879 * locally_modified %Bool; "no"
1880 * library_version %Int; ""
1881 * library_locally_modified %Bool; "no"
1882 * >
1883 * <!-- library_version and library_locally_modified: Only in managed libraries
1884 * inside boards or schematics -->
1885 */
1886 wxString name;
1887 std::optional<EURN> urn;
1888 std::optional<bool> locally_modified;
1889 std::optional<int> library_version;
1890 std::optional<bool> library_locally_modified;
1891
1892 std::optional<EDESCRIPTION> description;
1893 std::vector<std::unique_ptr<EPOLYGON>> polygons;
1894 std::vector<std::unique_ptr<EWIRE>> wires;
1895 std::vector<std::unique_ptr<ETEXT>> texts;
1896 std::vector<std::unique_ptr<EDIMENSION>> dimensions;
1897 std::vector<std::unique_ptr<ECIRCLE>> circles;
1898 std::vector<std::unique_ptr<ERECT>> rectangles;
1899 std::vector<std::unique_ptr<EFRAME>> frames;
1900 std::vector<std::unique_ptr<EHOLE>> holes;
1901 std::vector<std::unique_ptr<EPAD>> thtpads;
1902 std::vector<std::unique_ptr<ESMD>> smdpads;
1903
1904 EPACKAGE( wxXmlNode* aPackage, IO_BASE* aIo = nullptr );
1905};
1906
1907
1909{
1910 /*
1911 * <!ELEMENT packageinstance EMPTY>
1912 * <!ATTLIST packageinstance
1913 * name %String; #REQUIRED
1914 * >
1915 */
1916 wxString name;
1917
1918 EPACKAGEINSTANCE( wxXmlNode* aPackageInstance, IO_BASE* aIo = nullptr );
1919};
1920
1921
1922struct EPACKAGE3D : public EAGLE_BASE
1923{
1924 /*
1925 * <!ELEMENT package3d (description?, packageinstances?)>
1926 * <!ATTLIST package3d
1927 * name %String; ""
1928 * urn %Urn; #REQUIRED
1929 * type %Package3dType; #REQUIRED
1930 * library_version %Int; ""
1931 * library_locally_modified %Bool; "no"
1932 * >
1933 * <!-- library_version and library_locally_modified: Only in managed libraries
1934 * inside boards or schematics -->
1935 */
1936 wxString name;
1938 wxString type;
1939 std::optional<int> library_version;
1940 std::optional<bool> library_locally_modified;
1941
1942 std::optional<EDESCRIPTION> description;
1943 std::vector<std::unique_ptr<EPACKAGEINSTANCE>> packageinstances;
1944
1945 EPACKAGE3D( wxXmlNode* aPackage3d, IO_BASE* aIo = nullptr );
1946};
1947
1948
1949struct ESYMBOL : public EAGLE_BASE
1950{
1951 /*
1952 * <!ELEMENT symbol (description?, (polygon | wire | text | dimension | pin | circle |
1953 * rectangle | frame)*)>
1954 * <!ATTLIST symbol
1955 * name %String; #REQUIRED
1956 * urn %Urn; ""
1957 * locally_modified %Bool; "no"
1958 * library_version %Int; ""
1959 * library_locally_modified %Bool; "no"
1960 * >
1961 * <!-- library_version and library_locally_modified: Only in managed libraries
1962 * inside boards or schematics -->
1963 */
1964
1965 wxString name;
1966 std::optional<EURN> urn;
1967 std::optional<bool> locally_modified;
1968 std::optional<int> library_version;
1969 std::optional<bool> library_locally_modified;
1970
1971 std::optional<EDESCRIPTION> description;
1972 std::vector<std::unique_ptr<EPOLYGON>> polygons;
1973 std::vector<std::unique_ptr<EWIRE>> wires;
1974 std::vector<std::unique_ptr<ETEXT>> texts;
1975 std::vector<std::unique_ptr<EDIMENSION>> dimensions;
1976 std::vector<std::unique_ptr<EPIN>> pins;
1977 std::vector<std::unique_ptr<ECIRCLE>> circles;
1978 std::vector<std::unique_ptr<ERECT>> rectangles;
1979 std::vector<std::unique_ptr<EFRAME>> frames;
1980
1981 ESYMBOL( wxXmlNode* aSymbol, IO_BASE* aIo = nullptr );
1982};
1983
1984
1985struct ELIBRARY : public EAGLE_BASE
1986{
1987 /*
1988 * <!ELEMENT library (description?, packages?, packages3d?, symbols?, devicesets?)>
1989 * <!ATTLIST library
1990 * name %String; #REQUIRED
1991 * urn %Urn; ""
1992 * >
1993 * <!-- name: Only in libraries used inside boards or schematics -->
1994 * <!-- urn: Only in online libraries used inside boards or schematics -->
1995 */
1996 wxString name;
1997 std::optional<EURN> urn;
1998
1999 std::optional<EDESCRIPTION> description;
2000 std::map<wxString, std::unique_ptr<EPACKAGE>> packages;
2001 std::map<wxString, std::unique_ptr<EPACKAGE3D>> packages3d;
2002 std::map<wxString, std::unique_ptr<ESYMBOL>> symbols;
2003 std::map<wxString, std::unique_ptr<EDEVICE_SET>> devicesets;
2004
2010 wxString GetName() const;
2011 ELIBRARY( wxXmlNode* aLibrary, IO_BASE* aIo = nullptr );
2012};
2013
2014
2015struct EAPPROVED : public EAGLE_BASE
2016{
2017 /*
2018 * <!ELEMENT approved EMPTY>
2019 * <!ATTLIST approved
2020 * hash %String; #REQUIRED
2021 * >
2022 */
2023 wxString hash;
2024
2025 EAPPROVED( wxXmlNode* aApproved, IO_BASE* aIo = nullptr );
2026};
2027
2028
2029struct ESCHEMATIC : public EAGLE_BASE
2030{
2031 /*
2032 * <!ELEMENT schematic (description?, libraries?, attributes?, variantdefs?, classes?,
2033 * modules?, groups?, parts?, sheets?, errors?)>
2034 * <!ATTLIST schematic
2035 * xreflabel %String; #IMPLIED
2036 * xrefpart %String; #IMPLIED
2037 * >
2038 */
2039 std::optional<wxString> xreflabel;
2040 std::optional<wxString> xrefpart;
2041
2042 std::optional<EDESCRIPTION> description;
2043 std::map<wxString, std::unique_ptr<ELIBRARY>> libraries;
2044 std::map<wxString, std::unique_ptr<EATTR>> attributes;
2045 std::map<wxString, std::unique_ptr<EVARIANTDEF>> variantdefs;
2046 std::map<wxString, std::unique_ptr<ECLASS>> classes;
2047 std::map<wxString, std::unique_ptr<EMODULE>> modules;
2048 std::map<wxString, std::unique_ptr<ESCHEMATIC_GROUP>> groups;
2049 std::map<wxString, std::unique_ptr<EPART>> parts;
2050 std::vector<std::unique_ptr<ESHEET>> sheets;
2051 std::vector<std::unique_ptr<EAPPROVED>> errors;
2052
2053 ESCHEMATIC( wxXmlNode* aSchematic, IO_BASE* aIo = nullptr );
2054};
2055
2056
2057struct EDRAWING : public EAGLE_BASE
2058{
2059 /*
2060 * <!ELEMENT drawing (settings?, grid?, filters?, layers, (library | schematic | board))>
2061 */
2062 std::vector<std::unique_ptr<ESETTING>> settings;
2063 std::optional<EGRID> grid;
2064 std::vector<std::unique_ptr<EFILTER>> filters;
2065 std::vector<std::unique_ptr<ELAYER>> layers;
2066 std::optional<ESCHEMATIC> schematic;
2067 std::optional<ELIBRARY> library;
2068 // std::optional<std::unique_ptr<EBOARD>> board;
2069
2070 EDRAWING( wxXmlNode* aDrawing, IO_BASE* aIo = nullptr );
2071};
2072
2073
2074struct EAGLE_DOC : public EAGLE_BASE
2075{
2076 /*
2077 * <!ELEMENT eagle (compatibility?, drawing, compatibility?)>
2078 * <!ATTLIST eagle
2079 * version %Real; #REQUIRED
2080 * >
2081 * <!-- version: The EAGLE program version that generated this file, in the
2082 * form V.RR -->
2083 */
2084
2092 wxString version;
2093
2094 std::unique_ptr<EDRAWING> drawing;
2095 std::optional<ECOMPATIBILITY> compatibility;
2096
2097 EAGLE_DOC( wxXmlNode* aEagleDoc, IO_BASE* aIo = nullptr );
2098};
2099
2100
2101#endif // _EAGLE_PARSER_H_
Keep track of what we are working on within a PTREE.
void pop()
void clear()
void Value(const char *aValue)
modify the last path node's value
std::vector< TRIPLET > p
void Attribute(const char *aAttribute)
Modify the last path node's attribute.
void push(const char *aPathSegment, const char *aAttribute="")
wxString Contents()
Return the contents of the XPATH as a single string.
T Convert(const wxString &aValue)
Convert a wxString to a generic type T.
static wxXmlNode * getChildrenNodes(NODE_MAP &aMap, const wxString &aName)
NODE_MAP MapChildren(wxXmlNode *aCurrentNode)
Provide an easy access to the children of an XML node via their names.
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.
std::map< wxString, EINSTANCE * > EINSTANCE_MAP
std::unordered_map< wxString, wxXmlNode * > NODE_MAP
VECTOR2I ConvertEagleTextSize(const std::optional< wxString > &font, const ECOORD &size)
Converts Eagle's text size to KiCad text size depending on the font used.
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
SEVERITY
@ RPT_SEVERITY_UNDEFINED
EAGLE_BASE(IO_BASE *aIo=nullptr)
IO_BASE * io
void AdvanceProgressPhase()
void Report(const wxString &aMsg, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Send a message to the IO_BASE REPORTER object if one exists.
EAGLE_DOC(wxXmlNode *aEagleDoc, IO_BASE *aIo=nullptr)
std::optional< ECOMPATIBILITY > compatibility
wxString version
The Eagle XML file version.
std::unique_ptr< EDRAWING > drawing
EAPPROVED(wxXmlNode *aApproved, IO_BASE *aIo=nullptr)
wxString hash
std::optional< int > layer
std::optional< ECOORD > y
std::optional< wxString > value
std::optional< bool > constant
wxString name
std::optional< wxString > font
std::optional< ECOORD > size
std::optional< int > align
std::optional< EROT > rot
std::optional< double > ratio
std::optional< int > display
EATTR(wxXmlNode *aTree, IO_BASE *aIo=nullptr)
std::optional< ECOORD > x
EBUS(wxXmlNode *aBus, IO_BASE *aIo=nullptr)
wxString name
std::vector< std::unique_ptr< ESEGMENT > > segments
ECOORD x
ECOORD radius
ECOORD y
ECIRCLE(wxXmlNode *aCircle, IO_BASE *aIo=nullptr)
ECOORD width
wxString number
std::optional< ECOORD > width
std::map< wxString, ECOORD > clearanceMap
std::optional< ECOORD > drill
ECLASS(wxXmlNode *aClass, IO_BASE *aIo=nullptr)
wxString name
std::vector< std::unique_ptr< ENOTE > > notes
ECOMPATIBILITY(wxXmlNode *aCompatibility, IO_BASE *aIo=nullptr)
std::optional< wxString > contactroute
wxString pad
ECONNECT(wxXmlNode *aConnect, IO_BASE *aIo=nullptr)
wxString gate
wxString pin
int ToNanoMeters() const
ECOORD operator+(const ECOORD &aOther) const
@ EU_NM
nanometers
@ EU_MM
millimeters
@ EU_MIL
mils/thous
@ EU_INCH
inches
int ToSchUnits() const
float ToMm() const
ECOORD operator-(const ECOORD &aOther) const
int ToMils() const
int To100NanoMeters() const
ECOORD(int aValue, enum EAGLE_UNIT aUnit)
long long int value
Value expressed in nanometers.
bool operator==(const ECOORD &aOther) const
static long long int ConvertToNm(int aValue, enum EAGLE_UNIT aUnit)
Converts a size expressed in a certain unit to nanometers.
int ToPcbUnits() const
static constexpr EAGLE_UNIT ECOORD_UNIT
Unit used for the value field.
wxString text
std::optional< wxString > language
EDESCRIPTION(wxXmlNode *aDescription, IO_BASE *aIo=nullptr)
std::map< wxString, std::unique_ptr< EDEVICE > > devices
std::optional< wxString > prefix
std::optional< EURN > urn
std::optional< EDESCRIPTION > description
EDEVICE_SET(wxXmlNode *aDeviceSet, IO_BASE *aIo=nullptr)
std::optional< bool > locally_modified
std::map< wxString, std::unique_ptr< EGATE > > gates
std::optional< int > library_version
std::optional< ESPICE > spice
std::optional< bool > uservalue
std::optional< bool > library_locally_modified
wxString name
std::optional< wxString > package
wxString name
std::vector< std::unique_ptr< EPACKAGE3DINST > > package3dinstances
std::vector< std::unique_ptr< ECONNECT > > connects
EDEVICE(wxXmlNode *aDevice, IO_BASE *aIo=nullptr)
std::map< wxString, std::unique_ptr< ETECHNOLOGY > > technologies
std::optional< wxString > unit
std::optional< wxString > dimensionType
std::optional< double > extlength
std::optional< ECOORD > textsize
std::optional< bool > visible
std::optional< int > textratio
std::optional< int > precision
EDIMENSION(wxXmlNode *aDimension, IO_BASE *aIo=nullptr)
std::optional< double > width
std::optional< double > extoffset
std::optional< double > extwidth
std::optional< ESCHEMATIC > schematic
std::optional< ELIBRARY > library
EDRAWING(wxXmlNode *aDrawing, IO_BASE *aIo=nullptr)
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
EELEMENT(wxXmlNode *aElement, IO_BASE *aIo=nullptr)
std::optional< wxString > override_package3d_urn
wxString name
std::optional< bool > locked
std::optional< bool > smashed
wxString library
wxString package
std::optional< wxString > package3d_urn
std::optional< bool > override_locally_modified
std::optional< EROT > rot
wxString value
std::optional< EURN > library_urn
std::map< wxString, std::unique_ptr< EATTR > > attributes
std::map< wxString, std::unique_ptr< EVARIANT > > variants
wxString expression
EFILTER(wxXmlNode *aGrid, IO_BASE *aIo=nullptr)
wxString name
std::optional< bool > border_bottom
ECOORD x1
std::optional< bool > border_top
ECOORD y1
int columns
ECOORD y2
EFRAME(wxXmlNode *aFrameNode, IO_BASE *aIo=nullptr)
std::optional< bool > border_left
std::optional< bool > border_right
ECOORD x2
ECOORD x
ECOORD y
wxString symbol
std::optional< int > addlevel
std::optional< int > swaplevel
EGATE(wxXmlNode *aGate, IO_BASE *aIo=nullptr)
wxString name
std::optional< double > distance
std::optional< int > multiple
std::optional< bool > display
std::optional< wxString > altunitdist
EGRID(wxXmlNode *aGrid, IO_BASE *aIo=nullptr)
std::optional< wxString > unit
std::optional< wxString > altunit
std::optional< double > altdistance
std::optional< wxString > unitdist
std::optional< wxString > style
ECOORD y
ECOORD drill
ECOORD x
EHOLE(wxXmlNode *aHole, IO_BASE *aIo=nullptr)
std::optional< EROT > rot
wxString part
std::map< wxString, std::unique_ptr< EATTR > > attributes
std::optional< bool > smashed
wxString gate
EINSTANCE(wxXmlNode *aInstance, IO_BASE *aIo=nullptr)
EJUNCTION(wxXmlNode *aJunction, IO_BASE *aIo=nullptr)
std::optional< EROT > rot
std::optional< int > ratio
std::optional< bool > xref
ELABEL(wxXmlNode *aLabel, IO_BASE *aIo=nullptr)
ECOORD size
std::optional< wxString > font
std::optional< wxString > align
ECOORD y
ECOORD x
wxString name
std::optional< bool > active
std::optional< bool > visible
ELAYER(wxXmlNode *aLayer, IO_BASE *aIo=nullptr)
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::optional< EURN > urn
std::map< wxString, std::unique_ptr< EPACKAGE > > packages
wxString name
std::optional< EDESCRIPTION > description
std::map< wxString, std::unique_ptr< ESYMBOL > > symbols
ELIBRARY(wxXmlNode *aLibrary, IO_BASE *aIo=nullptr)
wxString name
wxString model
EMODEL(wxXmlNode *aModel, IO_BASE *aIo=nullptr)
wxString name
EMODULEINST(wxXmlNode *aModuleInst, IO_BASE *aIo=nullptr)
std::optional< wxString > moduleVariant
std::optional< int > offset
std::optional< EROT > rotation
std::optional< bool > smashed
wxString moduleinst
std::map< wxString, std::unique_ptr< EPART > > parts
std::optional< wxString > prefix
ECOORD dy
std::map< wxString, std::unique_ptr< ESCHEMATIC_GROUP > > groups
std::vector< std::unique_ptr< ESHEET > > sheets
std::optional< EDESCRIPTION > description
EMODULE(wxXmlNode *aModule, IO_BASE *aIo=nullptr)
std::map< wxString, std::unique_ptr< EVARIANTDEF > > variantdefs
ECOORD dx
wxString name
std::map< wxString, std::unique_ptr< EPORT > > ports
int netcode
wxString netname
std::vector< std::unique_ptr< ESEGMENT > > segments
ENET(int aNetCode, const wxString &aNetName)
ENOTE(wxXmlNode *aNote, IO_BASE *aIo=nullptr)
wxString note
double version
wxString severity
EPACKAGE3DINST(wxXmlNode *aPackage3dInst, IO_BASE *aIo=nullptr)
wxString package3d_urn
wxString name
std::optional< bool > library_locally_modified
std::optional< EDESCRIPTION > description
std::vector< std::unique_ptr< EPACKAGEINSTANCE > > packageinstances
std::optional< int > library_version
wxString type
EPACKAGE3D(wxXmlNode *aPackage3d, IO_BASE *aIo=nullptr)
EPACKAGEINSTANCE(wxXmlNode *aPackageInstance, IO_BASE *aIo=nullptr)
std::vector< std::unique_ptr< EPOLYGON > > polygons
std::optional< int > library_version
std::vector< std::unique_ptr< EPAD > > thtpads
std::vector< std::unique_ptr< ECIRCLE > > circles
std::vector< std::unique_ptr< ESMD > > smdpads
std::optional< bool > library_locally_modified
std::vector< std::unique_ptr< EDIMENSION > > dimensions
std::optional< EURN > urn
std::vector< std::unique_ptr< EHOLE > > holes
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
EPACKAGE(wxXmlNode *aPackage, IO_BASE *aIo=nullptr)
std::optional< bool > locally_modified
EPAD_COMMON(wxXmlNode *aPad, IO_BASE *aIo=nullptr)
std::optional< bool > thermals
wxString name
std::optional< EROT > rot
std::optional< bool > stop
std::optional< bool > first
std::optional< ECOORD > diameter
std::optional< int > shape
EPAD(wxXmlNode *aPad, IO_BASE *aIo=nullptr)
std::optional< ECOORD > drill
wxString device
std::optional< wxString > technology
std::optional< wxString > value
std::unique_ptr< ESPICE > spice
wxString library
std::optional< bool > override_locally_modified
std::map< wxString, std::unique_ptr< EATTR > > attributes
std::optional< EURN > libraryUrn
EPART(wxXmlNode *aPart, IO_BASE *aIo=nullptr)
wxString deviceset
std::optional< wxString > override_package_urn
std::optional< wxString > override_package3d_urn
std::optional< wxString > package3d_urn
std::map< wxString, std::unique_ptr< EVARIANT > > variants
wxString name
EPINMAPPING(wxXmlNode *aPinMap, IO_BASE *aIo=nullptr)
std::optional< bool > iddevicewide
std::optional< wxString > spiceprefix
std::vector< std::unique_ptr< EPINMAP > > pinmaps
std::optional< bool > isusermap
wxString pinorder
wxString gate
wxString pin
EPINMAP(wxXmlNode *aPinMap, IO_BASE *aIo=nullptr)
wxString gate
EPINREF(wxXmlNode *aPinRef, IO_BASE *aIo=nullptr)
wxString pin
wxString part
std::optional< wxString > length
std::optional< wxString > function
std::optional< wxString > visible
EPIN(wxXmlNode *aPin, IO_BASE *aIo=nullptr)
ECOORD x
std::optional< int > swaplevel
wxString name
std::optional< EROT > rot
std::optional< wxString > direction
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
EPLAIN(wxXmlNode *aPlain, IO_BASE *aIo=nullptr)
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
std::optional< ECOORD > isolate
static const int max_priority
std::vector< std::unique_ptr< EVERTEX > > vertices
bool IsValidOutline() const
Fewer than three vertices cannot bound an area; such polygons (which pre-v6 binary files can carry) w...
EPOLYGON(wxXmlNode *aPolygon, IO_BASE *aIo=nullptr)
ECOORD width
std::optional< int > rank
std::optional< ECOORD > spacing
std::optional< bool > thermals
std::optional< bool > orphans
wxString port
EPORTREF(wxXmlNode *aPortRef, IO_BASE *aIo=nullptr)
wxString moduleinst
wxString name
std::optional< wxString > direction
EPORT(wxXmlNode *aPort, IO_BASE *aIo=nullptr)
wxString side
ECOORD coord
double size
ECOORD y
std::optional< int > ratio
std::optional< EROT > rot
std::optional< bool > xref
std::optional< wxString > font
ECOORD x
EPROBE(wxXmlNode *aProbe, IO_BASE *aIo=nullptr)
std::optional< EROT > rot
ECOORD x2
ECOORD y1
int layer
ERECT(wxXmlNode *aRect, IO_BASE *aIo=nullptr)
ECOORD y2
ECOORD x1
Eagle rotation.
double degrees
bool spin
EROT(double aDegrees)
bool mirror
std::optional< ECOORD > width
std::vector< std::unique_ptr< EATTR > > attributes
ESCHEMATIC_GROUP(wxXmlNode *aSchematicGroup, IO_BASE *aIo=nullptr)
std::optional< ECOORD > titleSize
std::optional< bool > selectable
std::optional< EDESCRIPTION > description
std::optional< wxString > wireStyle
std::optional< int > layer
std::optional< bool > showAnnotations
std::optional< wxString > grouprefs
std::optional< wxString > titleFont
std::optional< wxString > xreflabel
std::map< wxString, std::unique_ptr< EMODULE > > modules
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
ESCHEMATIC(wxXmlNode *aSchematic, IO_BASE *aIo=nullptr)
std::map< wxString, std::unique_ptr< ELIBRARY > > libraries
std::map< wxString, std::unique_ptr< EVARIANTDEF > > variantdefs
std::optional< wxString > xrefpart
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
ESEGMENT(wxXmlNode *aSegment, IO_BASE *aIo=nullptr)
std::vector< std::unique_ptr< EWIRE > > wires
std::vector< std::unique_ptr< EJUNCTION > > junctions
std::vector< std::unique_ptr< ELABEL > > labels
std::optional< bool > alwaysvectorfont
std::optional< bool > keepoldvectorfont
std::optional< wxString > verticaltext
ESETTING(wxXmlNode *aSetting, IO_BASE *aIo=nullptr)
ESHEET(wxXmlNode *aSheet, IO_BASE *aIo=nullptr)
std::unique_ptr< EPLAIN > plain
std::vector< std::unique_ptr< ENET > > nets
std::vector< std::unique_ptr< EBUS > > busses
std::vector< std::unique_ptr< EINSTANCE > > instances
std::optional< EDESCRIPTION > description
std::map< wxString, std::unique_ptr< EMODULEINST > > moduleinsts
std::optional< bool > cream
ECOORD dx
int layer
ECOORD dy
ESMD(wxXmlNode *aSMD, IO_BASE *aIo=nullptr)
std::optional< int > roundness
ESPICE(wxXmlNode *aSpice, IO_BASE *aIo=nullptr)
std::unique_ptr< EMODEL > model
std::unique_ptr< EPINMAPPING > pinmapping
std::vector< std::unique_ptr< EVERTEX > > vertices
double width
ESPLINE(wxXmlNode *aSpline, IO_BASE *aIo=nullptr)
std::vector< std::unique_ptr< EFRAME > > frames
std::optional< EDESCRIPTION > description
std::optional< bool > locally_modified
std::optional< bool > library_locally_modified
std::optional< int > library_version
std::vector< std::unique_ptr< EPIN > > pins
std::vector< std::unique_ptr< ECIRCLE > > circles
std::vector< std::unique_ptr< ETEXT > > texts
std::vector< std::unique_ptr< EPOLYGON > > polygons
std::vector< std::unique_ptr< ERECT > > rectangles
std::vector< std::unique_ptr< EWIRE > > wires
ESYMBOL(wxXmlNode *aSymbol, IO_BASE *aIo=nullptr)
std::optional< EURN > urn
wxString name
std::vector< std::unique_ptr< EDIMENSION > > dimensions
wxString name
std::vector< std::unique_ptr< EATTR > > attributes
ETECHNOLOGY(wxXmlNode *aTechnology, IO_BASE *aIo=nullptr)
Eagle text element.
wxString text
@ BOTTOM_CENTER
@ BOTTOM_RIGHT
@ CENTER_RIGHT
@ CENTER_LEFT
@ BOTTOM_LEFT
ECOORD y
std::optional< wxString > font
std::optional< int > distance
ECOORD size
ETEXT(wxXmlNode *aText, IO_BASE *aIo=nullptr)
std::optional< EROT > rot
ECOORD x
std::optional< int > align
VECTOR2I ConvertSize() const
Calculate text size based on font type and size.
std::optional< double > ratio
int layer
Container that parses Eagle library file "urn" definitions.
bool IsValid() const
Check if the string passed to the ctor was a valid Eagle urn.
wxString host
Should always be "urn".
void Parse(const wxString &aUrn)
wxString assetVersion
May be empty depending on the asset type.
wxString assetId
The unique asset identifier for the asset type.
wxString assetType
Must be "symbol", "footprint", "package", "component", or "library".
wxString path
Path to the asset type below.
EVARIANTDEF(wxXmlNode *aVariantDef, IO_BASE *aIo=nullptr)
std::optional< bool > current
wxString name
EVARIANT(wxXmlNode *aVariant, IO_BASE *aIo=nullptr)
wxString name
std::optional< bool > populate
std::optional< wxString > technology
std::optional< wxString > value
EVERTEX(wxXmlNode *aVertex, IO_BASE *aIo=nullptr)
std::optional< double > curve
range is -359.9..359.9
ECOORD y
ECOORD x
ECOORD drill
< inclusive
std::optional< wxString > shape
ECOORD y
std::optional< bool > alwaysStop
EVIA(wxXmlNode *aVia, IO_BASE *aIo=nullptr)
int layer_front_most
std::optional< ECOORD > diam
int layer_back_most
< extent
ECOORD x
ECOORD width
std::optional< wxString > extent
int layer
EWIRE(wxXmlNode *aWire, IO_BASE *aIo=nullptr)
std::optional< int > cap
std::optional< int > style
ECOORD x2
ECOORD y2
ECOORD x1
ECOORD y1
std::optional< double > curve
range is -359.9..359.9
TRIPLET(const char *aElement, const char *aAttribute="", const char *aValue="")
const char * value
const char * attribute
const char * element
Implement a simple wrapper around runtime_error to isolate the errors thrown by the Eagle XML parser.
XML_PARSER_ERROR(const wxString &aMessage) noexcept
Build an XML error by just calling its parent class constructor, std::runtime_error,...
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683