More elegant way for checking Spice_Netlist_Enabled value
This commit is contained in:
parent
1c74e27366
commit
01f40e258c
|
@ -249,19 +249,8 @@ void NETLIST_EXPORTER_PSPICE::ProcessNetlist( unsigned aCtl )
|
|||
|
||||
spiceItem.m_refName = comp->GetRef( &sheetList[sheet_idx] );
|
||||
|
||||
// Check to see if component should be removed from Spice Netlist:
|
||||
spiceItem.m_enabled = true; // assume yes and then verify
|
||||
|
||||
if( fieldEnabled )
|
||||
{
|
||||
wxString netlistEnabled = fieldEnabled->GetText();
|
||||
|
||||
// Different ways of saying 'disabled' (no/false/0)
|
||||
if( netlistEnabled.CmpNoCase( "N" ) == 0
|
||||
|| netlistEnabled.CmpNoCase( "F" ) == 0
|
||||
|| netlistEnabled == "0" )
|
||||
spiceItem.m_enabled = false;
|
||||
}
|
||||
// Check to see if component should be removed from Spice netlist
|
||||
spiceItem.m_enabled = fieldEnabled ? StringToBool( fieldEnabled->GetText() ) : true;
|
||||
|
||||
wxArrayString pinNames;
|
||||
|
||||
|
|
|
@ -113,6 +113,17 @@ public:
|
|||
return m_directives;
|
||||
}
|
||||
|
||||
static bool StringToBool( const wxString& aStr )
|
||||
{
|
||||
if( aStr.IsEmpty() )
|
||||
return false;
|
||||
|
||||
char c = tolower( aStr[0] );
|
||||
|
||||
// Different ways of saying false (no/false/0)
|
||||
return !( c == 'n' || c == 'f' || c == '0' );
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void writeDirectives( OUTPUTFORMATTER* aFormatter, unsigned aCtl ) const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue