KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eagle_parser.cpp File Reference
#include <io/eagle/eagle_parser.h>
#include <string_utils.h>
#include <richio.h>
#include <wx/log.h>
#include <wx/regex.h>
#include <functional>
#include <cstdio>

Go to the source code of this file.

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)
 
template<>
wxString Convert< wxString > (const wxString &aValue)
 
template<>
std::string Convert< std::string > (const wxString &aValue)
 
template<>
double Convert< double > (const wxString &aValue)
 
template<>
int Convert< int > (const wxString &aValue)
 
template<>
bool Convert< bool > (const wxString &aValue)
 
template<>
EROT Convert< EROT > (const wxString &aRot)
 parse an Eagle XML "rot" field.
 
template<>
ECOORD Convert< ECOORD > (const wxString &aCoord)
 
template<typename T >
parseRequiredAttribute (wxXmlNode *aNode, const wxString &aAttribute)
 Parse aAttribute of the XML node aNode.
 
template<typename T >
OPTIONAL_XML_ATTRIBUTE< T > parseOptionalAttribute (wxXmlNode *aNode, const wxString &aAttribute)
 Parse option aAttribute of the XML node 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)
 
static int parseAlignment (const wxString &aAlignment)
 

Variables

constexpr auto DEFAULT_ALIGNMENT = ETEXT::BOTTOM_LEFT
 

Function Documentation

◆ Convert< bool >()

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

Definition at line 302 of file eagle_parser.cpp.

◆ Convert< double >()

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

Definition at line 279 of file eagle_parser.cpp.

◆ Convert< ECOORD >()

template<>
ECOORD Convert< ECOORD > ( const wxString &  aCoord)

Definition at line 333 of file eagle_parser.cpp.

References ECOORD::EU_MM.

◆ Convert< EROT >()

template<>
EROT Convert< EROT > ( const wxString &  aRot)

parse an Eagle XML "rot" field.

Unfortunately the DTD seems not to explain this format very well. [S][M]R<degrees>. Examples: "R90", "MR180", "SR180"

Definition at line 316 of file eagle_parser.cpp.

References EROT::degrees, EROT::mirror, and EROT::spin.

◆ Convert< int >()

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

Definition at line 292 of file eagle_parser.cpp.

◆ Convert< std::string >()

template<>
std::string Convert< std::string > ( const wxString &  aValue)

Definition at line 272 of file eagle_parser.cpp.

◆ 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().

◆ 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().

◆ parseAlignment()

static int parseAlignment ( const wxString &  aAlignment)
static

◆ parseOptionalAttribute()

template<typename T >
OPTIONAL_XML_ATTRIBUTE< T > parseOptionalAttribute ( wxXmlNode *  aNode,
const wxString &  aAttribute 
)

Parse option aAttribute of the XML node aNode.

Parameters
aNodeis the node whose attribute will be parsed.
aAttributeis the attribute that will be parsed.
Returns
OPTIONAL_XML_ATTRIBUTE<T> - an optional XML attribute, parsed as the specified type if found.

Definition at line 369 of file eagle_parser.cpp.

◆ parseRequiredAttribute()

template<typename T >
T parseRequiredAttribute ( wxXmlNode *  aNode,
const wxString &  aAttribute 
)

Parse aAttribute of the XML node aNode.

Parameters
aNodeis the node whose attribute will be parsed.
aAttributeis the attribute that will be parsed.
Exceptions
XML_PARSER_ERROR- exception thrown if the required attribute is missing
Returns
T - the attributed parsed as the specified type.

Definition at line 349 of file eagle_parser.cpp.

◆ 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().

Variable Documentation

◆ DEFAULT_ALIGNMENT

constexpr auto DEFAULT_ALIGNMENT = ETEXT::BOTTOM_LEFT
constexpr

Definition at line 38 of file eagle_parser.cpp.

Referenced by EATTR::EATTR(), ETEXT::ETEXT(), and parseAlignment().