34#ifndef EAGLE_BIN_PARSER_H_
35#define EAGLE_BIN_PARSER_H_
81 std::unique_ptr<wxXmlDocument>
Parse(
const std::vector<uint8_t>& aBytes );
89 std::map<wxString, wxString>
props;
90 std::vector<std::unique_ptr<EGB_NODE>>
children;
94 bool HasProp(
const wxString& aKey )
const {
return props.count( aKey ) != 0; }
95 wxString
Prop(
const wxString& aKey )
const;
96 long PropLong(
const wxString& aKey )
const;
100 wxString
PropDoubled(
const wxString& aKey )
const;
154 uint32_t
loadU32(
size_t aOffs,
unsigned aLen )
const;
155 int32_t
loadS32(
size_t aOffs,
unsigned aLen )
const;
156 bool loadBmb(
size_t aOffs, uint32_t aMask )
const;
157 uint32_t
loadUbf(
size_t aOffs, uint32_t aField )
const;
158 wxString
loadStr(
size_t aOffs,
unsigned aLen )
const;
161 const std::vector<uint8_t>*
m_buf =
nullptr;
wxXmlNode * toXml(const EGB_NODE *aNode) const
void postprocSignals(EGB_NODE *aSignals)
std::unique_ptr< wxXmlDocument > Parse(const std::vector< uint8_t > &aBytes)
Parse a binary Eagle board into an XML DOM compatible with the XML walker.
void requireBytes(size_t aOffs, size_t aLen) const
uint32_t loadUbf(size_t aOffs, uint32_t aField) const
void postprocCircles(EGB_NODE *aRoot)
bool readDrc(DRC_CTX &aDrc)
void postprocFreeText(EGB_NODE *aRoot)
bool isRotatable(int aId) const
void postprocLibs(EGB_NODE *aLibraries)
const wxString & nextLongText()
uint32_t loadU32(size_t aOffs, unsigned aLen) const
size_t m_pos
current read cursor
void postprocUnits(EGB_NODE *aRoot)
void postprocArcs(EGB_NODE *aRoot)
wxString loadStr(size_t aOffs, unsigned aLen) const
void fixLongText(EGB_NODE *aNode, const wxString &aField)
void postProcess(EGB_NODE *aRoot, const DRC_CTX &aDrc)
int readBlock(long &aNumBlocks, EGB_NODE *aParent)
void postprocSmd(EGB_NODE *aRoot)
const std::vector< uint8_t > * m_buf
file contents, not owned
void postprocContactRefs(EGB_NODE *aSignals, EGB_NODE *aElements, EGB_NODE *aLibraries)
void postprocWires(EGB_NODE *aRoot)
std::vector< wxString > m_freeText
NUL-delimited notes strings.
void postprocLayers(EGB_NODE *aDrawing, EGB_NODE *aLayers)
bool loadBmb(size_t aOffs, uint32_t aMask) const
void postprocRotation(EGB_NODE *aRoot)
void arcDecode(EGB_NODE *aElem, int aArcType, int aLineType)
double loadDouble(size_t aOffs) const
static bool IsBinaryEagle(wxInputStream &aStream)
Probe the first two bytes for the binary magic.
void postprocDimensions(EGB_NODE *aRoot)
std::unique_ptr< EGB_NODE > m_root
wxString m_invalidText
returned when out of strings
void postprocDrc(EGB_NODE *aDrcNode, const DRC_CTX &aDrc)
void postprocVias(EGB_NODE *aRoot)
void postprocNames(EGB_NODE *aLibraries, EGB_NODE *aElements)
void postprocElements(EGB_NODE *aElements)
int32_t loadS32(size_t aOffs, unsigned aLen) const
DRC values pulled from the trailing 244-byte block (or sane defaults).
Lightweight mutable tree node for the intermediate Eagle binary tree.
std::map< wxString, wxString > props
long PropLong(const wxString &aKey) const
std::vector< std::unique_ptr< EGB_NODE > > children
EGB_NODE * FindChildById(int aId) const
bool HasProp(const wxString &aKey) const
EGB_NODE * AddChild(int aId, const wxString &aName)
wxString PropDoubled(const wxString &aKey) const
Format a property doubled in 64-bit so the half-to-full widening cannot overflow a 32-bit long.
wxString Prop(const wxString &aKey) const
EGB_NODE * FindChildByName(const wxString &aName) const