KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eagle_parser.h File Reference
#include <map>
#include <memory>
#include <optional>
#include <unordered_map>
#include <wx/xml/xml.h>
#include <wx/string.h>
#include <wx/filename.h>
#include <layer_ids.h>
#include <trigo.h>
#include <core/wx_stl_compat.h>
#include <widgets/report_severity.h>

Go to the source code of this file.

Classes

struct  XML_PARSER_ERROR
 Implement a simple wrapper around runtime_error to isolate the errors thrown by the Eagle XML parser. More...
 
struct  TRIPLET
 segment (element) of our XPATH into the Eagle XML document tree in PTREE form. More...
 
class  XPATH
 Keep track of what we are working on within a PTREE. More...
 
class  OPTIONAL_XML_ATTRIBUTE< T >
 Model an optional XML attribute. More...
 
struct  EAGLE_BASE
 
struct  EDESCRIPTION
 
struct  ECOORD
 
struct  ENET
 Eagle net. More...
 
struct  EROT
 Eagle rotation. More...
 
struct  EVERTEX
 Eagle vertex. More...
 
struct  EWIRE
 Eagle wire. More...
 
struct  EJUNCTION
 Eagle Junction. More...
 
struct  ELABEL
 Eagle label. More...
 
struct  EVIA
 Eagle via. More...
 
struct  ECIRCLE
 Eagle circle. More...
 
struct  ERECT
 Eagle XML rectangle in binary. More...
 
struct  ESPLINE
 
struct  EATTR
 Parse an Eagle "attribute" XML element. More...
 
struct  EDIMENSION
 Eagle dimension element. More...
 
struct  ETEXT
 Eagle text element. More...
 
struct  EFRAME
 Parse an Eagle frame element. More...
 
struct  EPAD_COMMON
 Structure holding common properties for through-hole and SMD pads. More...
 
struct  EPAD
 Eagle thru hole pad. More...
 
struct  ESMD
 Eagle SMD pad. More...
 
struct  EPIN
 Eagle pin element. More...
 
struct  EPOLYGON
 Eagle polygon, without vertices which are parsed as needed. More...
 
struct  EHOLE
 Eagle hole element. More...
 
struct  EVARIANT
 
struct  EPINMAP
 
struct  EPINMAPPING
 
struct  EMODEL
 
struct  ESPICE
 
struct  EELEMENT
 Eagle element element. More...
 
struct  ELAYER
 
struct  EAGLE_LAYER
 
struct  EGATE
 
struct  EPART
 
struct  EINSTANCE
 
struct  ECONNECT
 
struct  ETECHNOLOGY
 
struct  EPACKAGE3DINST
 
struct  EDEVICE
 
struct  EDEVICE_SET
 
struct  ECLASS
 
struct  EPORT
 
struct  EVARIANTDEF
 
struct  ESCHEMATIC_GROUP
 
struct  EPLAIN
 
struct  EMODULEINST
 
struct  EPINREF
 
struct  EPORTREF
 
struct  EPROBE
 
struct  ESEGMENT
 
struct  EBUS
 
struct  ESHEET
 
struct  EMODULE
 
struct  ENOTE
 
struct  ECOMPATIBILITY
 
struct  ESETTING
 
struct  EGRID
 
struct  EFILTER
 
struct  EPACKAGE
 
struct  EPACKAGEINSTANCE
 
struct  EPACKAGE3D
 
struct  ESYMBOL
 
struct  ELIBRARY
 
struct  EAPPROVED
 
struct  ESCHEMATIC
 
struct  EDRAWING
 
struct  EAGLE_DOC
 

Typedefs

typedef std::unordered_map< wxString, wxXmlNode * > NODE_MAP
 
typedef std::map< wxString, EINSTANCE * > EINSTANCE_MAP
 
typedef std::map< wxString, std::unique_ptr< EPART > > EPART_MAP
 Translates Eagle special characters to their counterparts in KiCad.
 
typedef OPTIONAL_XML_ATTRIBUTE< wxString > opt_wxString
 
typedef OPTIONAL_XML_ATTRIBUTE< int > opt_int
 
typedef OPTIONAL_XML_ATTRIBUTE< double > opt_double
 
typedef OPTIONAL_XML_ATTRIBUTE< bool > opt_bool
 
typedef OPTIONAL_XML_ATTRIBUTE< EROTopt_erot
 
typedef OPTIONAL_XML_ATTRIBUTE< ECOORDopt_ecoord
 

Functions

wxString escapeName (const wxString &aNetName)
 Interprets special characters in Eagle text and converts them to KiCAD notation.
 
wxString interpretText (const wxString &aText)
 Translates Eagle special text reference to a KiCad variable reference.
 
bool substituteVariable (wxString *aText)
 Converts Eagle's HTML description into KiCad description format.
 
wxString convertDescription (wxString aDescr)
 
static wxXmlNode * getChildrenNodes (NODE_MAP &aMap, const wxString &aName)
 
template<typename T >
Convert (const wxString &aValue)
 Convert a wxString to a generic type T.
 
template<>
wxString Convert< wxString > (const wxString &aValue)
 
size_t GetNodeCount (const wxXmlNode *aNode)
 Fetch the number of XML nodes within aNode.
 
NODE_MAP MapChildren (wxXmlNode *aCurrentNode)
 Provide an easy access to the children of an XML node via their names.
 
VECTOR2I ConvertArcCenter (const VECTOR2I &aStart, const VECTOR2I &aEnd, double aAngle)
 

Typedef Documentation

◆ EINSTANCE_MAP

typedef std::map<wxString, EINSTANCE*> EINSTANCE_MAP

Definition at line 55 of file eagle_parser.h.

◆ EPART_MAP

typedef std::map<wxString, std::unique_ptr<EPART> > EPART_MAP

Translates Eagle special characters to their counterparts in KiCad.

Definition at line 56 of file eagle_parser.h.

◆ NODE_MAP

typedef std::unordered_map<wxString, wxXmlNode*> NODE_MAP

Definition at line 54 of file eagle_parser.h.

◆ opt_bool

Definition at line 393 of file eagle_parser.h.

◆ opt_double

Definition at line 392 of file eagle_parser.h.

◆ opt_ecoord

Definition at line 395 of file eagle_parser.h.

◆ opt_erot

Definition at line 394 of file eagle_parser.h.

◆ opt_int

Definition at line 391 of file eagle_parser.h.

◆ opt_wxString

Definition at line 390 of file eagle_parser.h.

Function Documentation

◆ Convert()

template<typename T >
T Convert ( const wxString &  aValue)

Convert a wxString to a generic type T.

Parameters
aValueis a wxString containing the value that will be converted to type T.
Exceptions
XML_PARSER_ERROR- an exception is thrown if the parsing fails or if the conversion to type T is unknown.

Definition at line 186 of file eagle_parser.h.

◆ Convert< wxString >()

template<>
wxString Convert< wxString > ( const wxString &  aValue)

Definition at line 304 of file eagle_parser.cpp.

◆ ConvertArcCenter()

◆ convertDescription()

wxString convertDescription ( wxString  aDescr)

Definition at line 153 of file eagle_parser.cpp.

References RemoveHTMLTags().

Referenced by SCH_IO_EAGLE::loadLibrary(), and PCB_IO_EAGLE::makeFootprint().

◆ escapeName()

wxString escapeName ( const wxString &  aNetName)

Interprets special characters in Eagle text and converts them to KiCAD notation.

Definition at line 45 of file eagle_parser.cpp.

References ConvertToNewOverbarNotation().

Referenced by SCH_IO_EAGLE::loadLabel(), SCH_IO_EAGLE::loadPlainText(), SCH_IO_EAGLE::loadSegments(), PCB_IO_EAGLE::loadSignals(), and SCH_IO_EAGLE::loadSymbol().

◆ getChildrenNodes()

static wxXmlNode * getChildrenNodes ( NODE_MAP aMap,
const wxString &  aName 
)
inlinestatic

Definition at line 70 of file eagle_parser.h.

◆ GetNodeCount()

size_t GetNodeCount ( const wxXmlNode *  aNode)

Fetch the number of XML nodes within aNode.

Parameters
aNodeis the parent node of the children to count.
Returns
the count of all child XML nodes below aNode.

Definition at line 183 of file eagle_parser.cpp.

References PROF_TIMER::msecs(), PROF_TIMER::Stop(), and traceEagleIo.

Referenced by SCH_IO_EAGLE::LoadSchematicFile().

◆ interpretText()

wxString interpretText ( const wxString &  aText)

Translates Eagle special text reference to a KiCad variable reference.

Definition at line 55 of file eagle_parser.cpp.

References substituteVariable(), and text.

Referenced by PCB_IO_EAGLE::loadPlain(), SCH_IO_EAGLE::loadPlainText(), SCH_IO_EAGLE::loadSymbolText(), and PCB_IO_EAGLE::packageText().

◆ MapChildren()

NODE_MAP MapChildren ( wxXmlNode *  aCurrentNode)

Provide an easy access to the children of an XML node via their names.

Parameters
currentNodeis a pointer to a wxXmlNode, whose children will be mapped.
Returns
NODE_MAP is a map linking the name of each children to the children itself (via a wxXmlNode*) Convert an Eagle curve end to a KiCad center for S_ARC

Definition at line 416 of file eagle_parser.cpp.

Referenced by PCB_IO_EAGLE::cacheLib(), PCB_IO_EAGLE::loadAllSections(), and PCB_IO_EAGLE::loadLibrary().

◆ substituteVariable()

bool substituteVariable ( wxString *  aText)

Converts Eagle's HTML description into KiCad description format.

Definition at line 122 of file eagle_parser.cpp.

Referenced by interpretText().