KiCad PCB EDA Suite
|
#include <io/eagle/eagle_parser.h>
#include <core/profile.h>
#include <io/io_base.h>
#include <string_utils.h>
#include <richio.h>
#include <trace_helpers.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) |
size_t | GetNodeCount (const wxXmlNode *aNode) |
Fetch the number of XML nodes within aNode. | |
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 > | |
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 |
bool Convert< bool > | ( | const wxString & | aValue | ) |
Definition at line 341 of file eagle_parser.cpp.
double Convert< double > | ( | const wxString & | aValue | ) |
Definition at line 318 of file eagle_parser.cpp.
Definition at line 372 of file eagle_parser.cpp.
References ECOORD::EU_MM.
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 355 of file eagle_parser.cpp.
References EROT::degrees, EROT::mirror, and EROT::spin.
int Convert< int > | ( | const wxString & | aValue | ) |
Definition at line 331 of file eagle_parser.cpp.
std::string Convert< std::string > | ( | const wxString & | aValue | ) |
Definition at line 311 of file eagle_parser.cpp.
wxString Convert< wxString > | ( | const wxString & | aValue | ) |
Definition at line 304 of file eagle_parser.cpp.
Definition at line 440 of file eagle_parser.cpp.
References _, DEG2RAD(), THROW_IO_ERROR, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by PCB_IO_EAGLE::loadPlain(), PCB_IO_EAGLE::loadPolygon(), PCB_IO_EAGLE::loadSignals(), SCH_IO_EAGLE::loadSymbolWire(), SCH_IO_EAGLE::loadWire(), PCB_IO_EAGLE::packagePolygon(), and PCB_IO_EAGLE::packageWire().
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().
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().
size_t GetNodeCount | ( | const wxXmlNode * | aNode | ) |
Fetch the number of XML nodes within aNode.
aNode | is the parent node of the children to count. |
Definition at line 183 of file eagle_parser.cpp.
References PROF_TIMER::msecs(), PROF_TIMER::Stop(), and traceEagleIo.
Referenced by SCH_IO_EAGLE::LoadSchematicFile().
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().
NODE_MAP MapChildren | ( | wxXmlNode * | aCurrentNode | ) |
Provide an easy access to the children of an XML node via their names.
currentNode | is a pointer to a wxXmlNode, whose children will be mapped. |
Definition at line 416 of file eagle_parser.cpp.
Referenced by PCB_IO_EAGLE::cacheLib(), PCB_IO_EAGLE::loadAllSections(), and PCB_IO_EAGLE::loadLibrary().
|
static |
Definition at line 467 of file eagle_parser.cpp.
References ETEXT::BOTTOM_CENTER, ETEXT::BOTTOM_LEFT, ETEXT::BOTTOM_RIGHT, ETEXT::CENTER, ETEXT::CENTER_LEFT, ETEXT::CENTER_RIGHT, DEFAULT_ALIGNMENT, ETEXT::TOP_CENTER, ETEXT::TOP_LEFT, and ETEXT::TOP_RIGHT.
Referenced by EATTR::EATTR(), and ETEXT::ETEXT().
OPTIONAL_XML_ATTRIBUTE< T > parseOptionalAttribute | ( | wxXmlNode * | aNode, |
const wxString & | aAttribute | ||
) |
Parse option aAttribute of the XML node aNode.
aNode | is the node whose attribute will be parsed. |
aAttribute | is the attribute that will be parsed. |
Definition at line 410 of file eagle_parser.cpp.
T parseRequiredAttribute | ( | wxXmlNode * | aNode, |
const wxString & | aAttribute | ||
) |
Parse aAttribute of the XML node aNode.
aNode | is the node whose attribute will be parsed. |
aAttribute | is the attribute that will be parsed. |
XML_PARSER_ERROR | - exception thrown if the required attribute is missing |
Definition at line 388 of file eagle_parser.cpp.
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().
|
constexpr |
Definition at line 42 of file eagle_parser.cpp.
Referenced by EATTR::EATTR(), ETEXT::ETEXT(), and parseAlignment().