7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 16:23:44 +00:00

Mirror netclass DRC expression semantics for component classes

With this change, "A.Component_Class == 'SOME_CLASS'" will return
true if either SOME_CLASS exists in the list of component classes
attached o the footprint, or if SOME_CLASS is the full component
class name.
This commit is contained in:
JamesJCode 2025-03-08 22:18:22 +00:00
parent 50174ec528
commit 85e6978aa2

View File

@ -236,10 +236,16 @@ public:
// of all unique component class objects
return aClass == bClass;
}
else
if( b->GetType() == LIBEVAL::VT_STRING )
{
return LIBEVAL::VALUE::EqualTo( aCtx, b );
if( m_item->GetComponentClass()->ContainsClassName( b->AsString() ) )
return true;
return m_item->GetComponentClass()->GetFullName() == b->AsString();
}
return LIBEVAL::VALUE::EqualTo( aCtx, b );
}
bool NotEqualTo( LIBEVAL::CONTEXT* aCtx, const LIBEVAL::VALUE* b ) const override
@ -257,10 +263,17 @@ public:
// of all unique component class objects
return aClass != bClass;
}
else
if( b->GetType() == LIBEVAL::VT_STRING )
{
return LIBEVAL::VALUE::NotEqualTo( aCtx, b );
const bool isInConstituents =
m_item->GetComponentClass()->ContainsClassName( b->AsString() );
const bool isFullName = m_item->GetComponentClass()->GetFullName() == b->AsString();
return !isInConstituents && !isFullName;
}
return LIBEVAL::VALUE::NotEqualTo( aCtx, b );
}
protected: