本文整理汇总了C++中COMPONENT::SetAltFPID方法的典型用法代码示例。如果您正苦于以下问题:C++ COMPONENT::SetAltFPID方法的具体用法?C++ COMPONENT::SetAltFPID怎么用?C++ COMPONENT::SetAltFPID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COMPONENT
的用法示例。
在下文中一共展示了COMPONENT::SetAltFPID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
bool CMP_READER::Load( NETLIST* aNetlist ) throw( IO_ERROR, PARSE_ERROR )
{
wxCHECK_MSG( aNetlist != NULL,true, wxT( "No netlist passed to CMP_READER::Load()" ) );
wxString reference; // Stores value read from line like Reference = BUS1;
wxString timestamp; // Stores value read from line like TimeStamp = /32307DE2/AA450F67;
wxString footprint; // Stores value read from line like IdModule = CP6;
wxString buffer;
wxString value;
bool ok = true;
while( m_lineReader->ReadLine() )
{
buffer = FROM_UTF8( m_lineReader->Line() );
if( !buffer.StartsWith( wxT( "BeginCmp" ) ) )
continue;
// Begin component description.
reference.Empty();
footprint.Empty();
timestamp.Empty();
while( m_lineReader->ReadLine() )
{
buffer = FROM_UTF8( m_lineReader->Line() );
if( buffer.StartsWith( wxT( "EndCmp" ) ) )
break;
// store string value, stored between '=' and ';' delimiters.
value = buffer.AfterFirst( '=' );
value = value.BeforeLast( ';' );
value.Trim( true );
value.Trim( false );
if( buffer.StartsWith( wxT( "Reference" ) ) )
{
reference = value;
continue;
}
if( buffer.StartsWith( wxT( "IdModule =" ) ) )
{
footprint = value;
continue;
}
if( buffer.StartsWith( wxT( "TimeStamp =" ) ) )
{
timestamp = value;
continue;
}
}
// Find the corresponding item in component list:
COMPONENT* component = aNetlist->GetComponentByReference( reference );
// The corresponding component could no longer existing in the netlist. This
// can happen when it is removed from schematic and still exists in footprint
// assignment list. This is an usual case during the life of a design.
if( component )
{
FPID fpid;
if( !footprint.IsEmpty() && fpid.Parse( footprint ) >= 0 )
{
wxString error;
error.Printf( _( "invalid footprint ID in\nfile: <%s>\nline: %d" ),
GetChars( m_lineReader->GetSource() ),
m_lineReader->LineNumber() );
THROW_IO_ERROR( error );
}
// For checking purpose, store the existing FPID (if any) in the alternate fpid copy
// if this existing FPID differs from the FPID read from the .cmp file.
// CvPcb can ask for user to chose the right FPID.
// It happens if the FPID was modified outside CvPcb.
if( fpid != component->GetFPID() && !component->GetFPID().empty() )
component->SetAltFPID( component->GetFPID() );
component->SetFPID( fpid );
}
else
{
ok = false; // can be used to display a warning in Pcbnew.
}
}
return ok;
}