KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eagle_parser.h File Reference
#include <map>
#include <memory>
#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>

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  ECOORD
 
struct  ENET
 Eagle net. More...
 
struct  EROT
 Eagle rotation. 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  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  EVERTEX
 Eagle vertex. More...
 
struct  EPOLYGON
 Eagle polygon, without vertices which are parsed as needed. More...
 
struct  EHOLE
 Eagle hole element. More...
 
struct  EELEMENT
 Eagle element element. More...
 
struct  ELAYER
 
struct  EAGLE_LAYER
 
struct  EPART
 
struct  EINSTANCE
 
struct  EGATE
 
struct  ECONNECT
 
struct  EDEVICE
 
struct  EDEVICE_SET
 
struct  ECLASS
 

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. More...
 
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. More...
 
wxString interpretText (const wxString &aText)
 Translates Eagle special text reference to a KiCad variable reference. More...
 
bool substituteVariable (wxString *aText)
 Converts Eagle's HTML description into KiCad description format. More...
 
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. More...
 
template<>
wxString Convert< wxString > (const wxString &aValue)
 
NODE_MAP MapChildren (wxXmlNode *aCurrentNode)
 Provide an easy access to the children of an XML node via their names. More...
 
VECTOR2I ConvertArcCenter (const VECTOR2I &aStart, const VECTOR2I &aEnd, double aAngle)
 

Typedef Documentation

◆ EINSTANCE_MAP

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

Definition at line 50 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 51 of file eagle_parser.h.

◆ NODE_MAP

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

Definition at line 49 of file eagle_parser.h.

◆ opt_bool

Definition at line 377 of file eagle_parser.h.

◆ opt_double

Definition at line 376 of file eagle_parser.h.

◆ opt_ecoord

Definition at line 379 of file eagle_parser.h.

◆ opt_erot

Definition at line 378 of file eagle_parser.h.

◆ opt_int

Definition at line 375 of file eagle_parser.h.

◆ opt_wxString

Definition at line 374 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 181 of file eagle_parser.h.

◆ Convert< wxString >()

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

Definition at line 265 of file eagle_parser.cpp.

◆ ConvertArcCenter()

◆ convertDescription()

wxString convertDescription ( wxString  aDescr)

Definition at line 149 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 41 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

◆ interpretText()

wxString interpretText ( const wxString &  aText)

Translates Eagle special text reference to a KiCad variable reference.

Definition at line 51 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 375 of file eagle_parser.cpp.

Referenced by PCB_IO_EAGLE::cacheLib(), SCH_IO_EAGLE::countNets(), EDEVICE::EDEVICE(), SCH_IO_EAGLE::ensureLoadedLibrary(), PCB_IO_EAGLE::loadAllSections(), SCH_IO_EAGLE::loadDrawing(), PCB_IO_EAGLE::loadLibrary(), SCH_IO_EAGLE::loadLibrary(), SCH_IO_EAGLE::loadSchematic(), SCH_IO_EAGLE::LoadSchematicFile(), SCH_IO_EAGLE::loadSegments(), and SCH_IO_EAGLE::loadSheet().

◆ substituteVariable()

bool substituteVariable ( wxString *  aText)

Converts Eagle's HTML description into KiCad description format.

Definition at line 118 of file eagle_parser.cpp.

Referenced by interpretText().