本文整理汇总了C++中COMPONENT::AddNet方法的典型用法代码示例。如果您正苦于以下问题:C++ COMPONENT::AddNet方法的具体用法?C++ COMPONENT::AddNet怎么用?C++ COMPONENT::AddNet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COMPONENT
的用法示例。
在下文中一共展示了COMPONENT::AddNet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseNet
void KICAD_NETLIST_PARSER::parseNet() throw( IO_ERROR, PARSE_ERROR )
{
/* Parses a section like
* (net (code 20) (name /PC-A0)
* (node (ref BUS1) (pin 62))
* (node (ref U3) (pin 3))
* (node (ref U9) (pin M6)))
*/
COMPONENT* component = NULL;
wxString code;
wxString name;
wxString reference;
wxString pin;
int nodecount = 0;
// The token net was read, so the next data is (code <number>)
while( (token = NextTok()) != T_RIGHT )
{
if( token == T_LEFT )
token = NextTok();
switch( token )
{
case T_code:
NeedSYMBOLorNUMBER();
code = FROM_UTF8( CurText() );
NeedRIGHT();
break;
case T_name:
NeedSYMBOLorNUMBER();
name = FROM_UTF8( CurText() );
NeedRIGHT();
if( name.IsEmpty() ) // Give a dummy net name like N-000109
name = wxT("N-00000") + code;
break;
case T_node:
while( (token = NextTok()) != T_RIGHT )
{
if( token == T_LEFT )
token = NextTok();
switch( token )
{
case T_ref:
NeedSYMBOLorNUMBER();
reference = FROM_UTF8( CurText() );
NeedRIGHT();
break;
case T_pin:
NeedSYMBOLorNUMBER();
pin = FROM_UTF8( CurText() );
NeedRIGHT();
break;
default:
skipCurrent();
break;
}
}
component = m_netlist->GetComponentByReference( reference );
// Cannot happen if the netlist is valid.
if( component == NULL )
{
wxString msg;
msg.Printf( _( "Cannot find component with reference \"%s\" in netlist." ),
GetChars( reference ) );
THROW_PARSE_ERROR( msg, m_lineReader->GetSource(), m_lineReader->Line(),
m_lineReader->LineNumber(), m_lineReader->Length() );
}
component->AddNet( pin, name );
nodecount++;
break;
default:
skipCurrent();
break;
}
}
}