Further DRC net class and component class match improvements

- Implements wildcard matching for constituent component classes
- Implements wildcard matching for effective net and component class names
This commit is contained in:
JamesJCode
2025-05-29 21:47:56 +01:00
parent ab036282d9
commit 41601e9c2f
+48 -9
View File
@@ -170,6 +170,8 @@ public:
if( b->GetType() == LIBEVAL::VT_STRING )
{
// Test constituent net class names. The effective net class name (e.g. CLASS1,CLASS2,OTHER_CLASS) is
// tested in the fallthrough condition.
for( const auto nc : m_item->GetEffectiveNetClass()->GetConstituentNetclasses() )
{
const wxString& ncName = nc->GetName();
@@ -185,8 +187,6 @@ public:
return true;
}
}
return m_item->GetEffectiveNetClass()->GetName() == b->AsString();
}
return LIBEVAL::VALUE::EqualTo( aCtx, b );
@@ -202,6 +202,7 @@ public:
if( b->GetType() == LIBEVAL::VT_STRING )
{
// Test constituent net class names
bool isInConstituents = false;
for( const auto nc : m_item->GetEffectiveNetClass()->GetConstituentNetclasses() )
@@ -226,7 +227,8 @@ public:
}
}
const bool isFullName = m_item->GetEffectiveNetClass()->GetName() == b->AsString();
// Test effective net class name
const bool isFullName = LIBEVAL::VALUE::EqualTo( aCtx, b );
return !isInConstituents && !isFullName;
}
@@ -273,10 +275,23 @@ public:
if( b->GetType() == LIBEVAL::VT_STRING )
{
if( m_item->GetComponentClass()->ContainsClassName( b->AsString() ) )
return true;
// Test constituent component class names. The effective component class name
// (e.g. CLASS1,CLASS2,OTHER_CLASS) is tested in the fallthrough condition.
for( const auto cc : m_item->GetComponentClass()->GetConstituentClasses() )
{
const wxString& ccName = cc->GetName();
return m_item->GetComponentClass()->GetName() == b->AsString();
if( b->StringIsWildcard() )
{
if( WildCompareString( b->AsString(), ccName, false ) )
return true;
}
else
{
if( ccName.IsSameAs( b->AsString(), false ) )
return true;
}
}
}
return LIBEVAL::VALUE::EqualTo( aCtx, b );
@@ -298,9 +313,33 @@ public:
if( b->GetType() == LIBEVAL::VT_STRING )
{
const bool isInConstituents =
m_item->GetComponentClass()->ContainsClassName( b->AsString() );
const bool isFullName = m_item->GetComponentClass()->GetName() == b->AsString();
// Test constituent component class names
bool isInConstituents = false;
for( const auto cc : m_item->GetComponentClass()->GetConstituentClasses() )
{
const wxString& ccName = cc->GetName();
if( b->StringIsWildcard() )
{
if( WildCompareString( b->AsString(), ccName, false ) )
{
isInConstituents = true;
break;
}
}
else
{
if( ccName.IsSameAs( b->AsString(), false ) )
{
isInConstituents = true;
break;
}
}
}
// Test effective component class name
const bool isFullName = LIBEVAL::VALUE::EqualTo( aCtx, b );
return !isInConstituents && !isFullName;
}