KiCad PCB EDA Suite
Loading...
Searching...
No Matches
AUTOTRAX_PARSER Class Reference

Line-oriented parser for Protel Autotrax / Easytrax PCB files. More...

#include <autotrax_parser.h>

Public Member Functions

 AUTOTRAX_PARSER (REPORTER *aReporter)
 
bool Parse (const wxString &aContents, AUTOTRAX::BOARD_DATA &aBoard)
 Parse aContents into aBoard.
 

Static Public Member Functions

static bool Sniff (const wxString &aContents)
 Cheap content sniff: the first non-blank, non-comment line is the magic header "PCB FILE 4" (Autotrax) or "PCB FILE 5" (Easytrax).
 

Private Member Functions

bool nextLine (wxString &aLine)
 Return the next line trimmed of surrounding whitespace, or false at end of input.
 
void warn (const wxString &aMsg) const
 
bool parseTrack (AUTOTRAX::TRACK &aOut)
 
bool parseArc (AUTOTRAX::ARC &aOut)
 
bool parseVia (AUTOTRAX::VIA &aOut)
 
bool parsePad (AUTOTRAX::PAD &aOut)
 
bool parseFill (AUTOTRAX::FILL &aOut)
 
bool parseText (AUTOTRAX::TEXT &aOut)
 
void parseComponent (AUTOTRAX::COMPONENT &aOut)
 
void parseNetDef ()
 

Static Private Member Functions

static wxArrayString tokenize (const wxString &aLine)
 Tokenize a whitespace-separated data line into C-locale-parseable tokens.
 

Private Attributes

REPORTERm_reporter = nullptr
 
AUTOTRAX::BOARD_DATAm_board = nullptr
 
wxArrayString m_lines
 
size_t m_index = 0
 
int m_lineNo = 0
 

Detailed Description

Line-oriented parser for Protel Autotrax / Easytrax PCB files.

The format is a flat state machine: a two-letter record keyword on its own line is followed by one or more data lines. Free primitives use F-prefixed keywords (FT/FA/FV/FF/FP/FS); the same primitives inside a COMP block use C-prefixed keywords. The parser emits an intermediate model rather than touching any KiCad object.

Parsing is tolerant. A malformed record is reported and skipped instead of aborting the import, so partially corrupt files still yield a usable board.

Definition at line 52 of file autotrax_parser.h.

Constructor & Destructor Documentation

◆ AUTOTRAX_PARSER()

AUTOTRAX_PARSER::AUTOTRAX_PARSER ( REPORTER * aReporter)
inlineexplicit

Definition at line 55 of file autotrax_parser.h.

References m_reporter.

Member Function Documentation

◆ nextLine()

bool AUTOTRAX_PARSER::nextLine ( wxString & aLine)
private

Return the next line trimmed of surrounding whitespace, or false at end of input.

Advances m_lineNo.

Definition at line 84 of file autotrax_parser.cpp.

References m_index, m_lineNo, and m_lines.

Referenced by Parse(), parseArc(), parseComponent(), parseFill(), parseNetDef(), parsePad(), parseText(), parseTrack(), and parseVia().

◆ Parse()

◆ parseArc()

◆ parseComponent()

◆ parseFill()

bool AUTOTRAX_PARSER::parseFill ( AUTOTRAX::FILL & aOut)
private

◆ parseNetDef()

void AUTOTRAX_PARSER::parseNetDef ( )
private

Definition at line 353 of file autotrax_parser.cpp.

References m_board, m_index, and nextLine().

Referenced by Parse().

◆ parsePad()

◆ parseText()

◆ parseTrack()

◆ parseVia()

bool AUTOTRAX_PARSER::parseVia ( AUTOTRAX::VIA & aOut)
private

◆ Sniff()

bool AUTOTRAX_PARSER::Sniff ( const wxString & aContents)
static

Cheap content sniff: the first non-blank, non-comment line is the magic header "PCB FILE 4" (Autotrax) or "PCB FILE 5" (Easytrax).

Definition at line 58 of file autotrax_parser.cpp.

Referenced by PCB_IO_AUTOTRAX::CanReadBoard().

◆ tokenize()

wxArrayString AUTOTRAX_PARSER::tokenize ( const wxString & aLine)
staticprivate

Tokenize a whitespace-separated data line into C-locale-parseable tokens.

Definition at line 99 of file autotrax_parser.cpp.

Referenced by parseArc(), parseComponent(), parseFill(), parsePad(), parseText(), parseTrack(), and parseVia().

◆ warn()

void AUTOTRAX_PARSER::warn ( const wxString & aMsg) const
private

Member Data Documentation

◆ m_board

AUTOTRAX::BOARD_DATA* AUTOTRAX_PARSER::m_board = nullptr
private

Definition at line 93 of file autotrax_parser.h.

Referenced by Parse(), and parseNetDef().

◆ m_index

size_t AUTOTRAX_PARSER::m_index = 0
private

Definition at line 96 of file autotrax_parser.h.

Referenced by nextLine(), Parse(), and parseNetDef().

◆ m_lineNo

int AUTOTRAX_PARSER::m_lineNo = 0
private

Definition at line 97 of file autotrax_parser.h.

Referenced by nextLine(), Parse(), and warn().

◆ m_lines

wxArrayString AUTOTRAX_PARSER::m_lines
private

Definition at line 95 of file autotrax_parser.h.

Referenced by nextLine(), and Parse().

◆ m_reporter

REPORTER* AUTOTRAX_PARSER::m_reporter = nullptr
private

Definition at line 92 of file autotrax_parser.h.

Referenced by AUTOTRAX_PARSER(), and warn().


The documentation for this class was generated from the following files: