53 wxRegEx reOrcad( wxT(
"(?i)[ ]*\\([ \t]+{+" ), wxRE_ADVANCED );
54 wxASSERT( reOrcad.IsValid() );
57 wxRegEx reLegacy( wxT(
"(?i)#[ \t]+EESchema[ \t]+Netlist[ \t]+" ), wxRE_ADVANCED );
58 wxASSERT( reLegacy.IsValid() );
61 wxRegEx reKicad( wxT(
"[ ]*\\(export[ ]+" ), wxRE_ADVANCED );
62 wxASSERT( reKicad.IsValid() );
70 if( reLegacy.Matches( line ) )
72 else if( reKicad.Matches( line ) )
74 else if( reOrcad.Matches( line ) )
83 const wxString& aNetlistFileName,
84 const wxString& aCompFootprintFileName )
86 wxASSERT( aNetlist !=
nullptr );
88 std::unique_ptr<FILE_LINE_READER> file_rdr =
89 std::make_unique<FILE_LINE_READER>( aNetlistFileName );
95 std::unique_ptr<CMP_READER> cmp_rdr( aCompFootprintFileName.IsEmpty() ?
128 wxCHECK_MSG( aNetlist !=
nullptr,
true, wxT(
"No netlist passed to CMP_READER::Load()" ) );
142 if( !buffer.StartsWith( wxT(
"BeginCmp" ) ) )
154 if( buffer.StartsWith( wxT(
"EndCmp" ) ) )
158 value = buffer.AfterFirst(
'=' );
159 value = value.BeforeLast(
';' );
163 if( buffer.StartsWith( wxT(
"Reference" ) ) )
169 if( buffer.StartsWith( wxT(
"IdModule =" ) ) )
175 if( buffer.StartsWith( wxT(
"TimeStamp =" ) ) )
192 if( !footprint.IsEmpty() && fpid.
Parse( footprint,
true ) >= 0 )
195 error.Printf(
_(
"Invalid footprint ID in\nfile: '%s'\nline: %d" ),
Read a component footprint link file (*.cmp) format.
bool Load(NETLIST *aNetlist)
Read the *.cmp file format contains the component footprint assignments created by CvPcb into aNetlis...
LINE_READER * m_lineReader
The line reader to read.
Store all of the related footprint information found in a netlist.
void SetAltFPID(const LIB_ID &aFPID)
void SetFPID(const LIB_ID &aFPID)
const LIB_ID & GetFPID() const
A LINE_READER that reads from an open file.
Read the new s-expression based KiCad netlist format.
Read the KiCad legacy and the old Orcad netlist formats.
A logical library item identifier and consists of various portions much like a URI.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
virtual char * ReadLine()=0
Read a line of text into the buffer and increments the line number counter.
virtual const wxString & GetSource() const
Returns the name of the source of the lines in an abstract sense.
virtual unsigned LineNumber() const
Return the line number of the last line read from this LINE_READER.
char * Line() const
Return a pointer to the last line that was read in.
A pure virtual class to derive a specific type of netlist reader from.
static NETLIST_READER * GetNetlistReader(NETLIST *aNetlist, const wxString &aNetlistFileName, const wxString &aCompFootprintFileName=wxEmptyString)
Attempt to determine the net list file type of aNetlistFileName and return the appropriate NETLIST_RE...
static NETLIST_FILE_T GuessNetlistFileType(LINE_READER *aLineReader)
Look at aFileHeaderLine to see if it matches any of the netlist file types it knows about.
LINE_READER * m_lineReader
The line reader of the netlist.
CMP_READER * m_footprintReader
The reader used to load the footprint links. If NULL, footprint links are not read.
virtual ~NETLIST_READER()
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
COMPONENT * GetComponentByReference(const wxString &aReference)
Return a COMPONENT by aReference.
#define THROW_IO_ERROR(msg)
wxString From_UTF8(const char *cstring)