48 aReporter->
Report(
_(
"ERROR in expression." ) );
60 thread_local bool tlsCtxBusy =
false;
65 ~TLS_RELEASE() {
if( busy ) *busy =
false; }
68 std::unique_ptr<PCBEXPR_CONTEXT> ownedCtx;
71 if( aReporter || tlsCtxBusy )
73 ownedCtx = std::make_unique<PCBEXPR_CONTEXT>( aConstraint, aLayer );
79 [&](
const wxString& aMessage,
int aOffset )
81 aReporter->
Report(
_(
"ERROR:" ) + wxS(
" " ) + aMessage );
88 tlsRelease.busy = &tlsCtxBusy;
107 if(
m_ucode->Run( ctx )->AsDouble() != 0.0 )
115 if(
m_ucode->Run( ctx )->AsDouble() != 0.0 )
130 [&](
const wxString& aMessage,
int aOffset )
133 wxString first = aMessage.BeforeFirst(
'|', &rest );
134 wxString msg = wxString::Format(
_(
"ERROR: <a href='%d:%d'>%s</a>%s" ),
136 aSourceOffset + aOffset,
144 m_ucode = std::make_unique<PCBEXPR_UCODE>();
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
std::unique_ptr< PCBEXPR_UCODE > m_ucode
DRC_RULE_CONDITION(const wxString &aExpression="")
bool Compile(REPORTER *aReporter, int aSourceLine=0, int aSourceOffset=0)
bool HasGeometryDependentFunctions() const
wxString GetExpression() const
bool EvaluateFor(const BOARD_ITEM *aItemA, const BOARD_ITEM *aItemB, int aConstraint, PCB_LAYER_ID aLayer, REPORTER *aReporter=nullptr)
KICAD_T Type() const
Returns the type of object.
void SetErrorCallback(std::function< void(const wxString &aMessage, int aOffset)> aCallback)
bool Compile(const wxString &aString, UCODE *aCode, CONTEXT *aPreflightContext)
void SetErrorCallback(std::function< void(const wxString &aMessage, int aOffset)> aCallback)
void SetConstraint(int aConstraint)
void SetLayer(PCB_LAYER_ID aLayer)
void SetItems(BOARD_ITEM *a, BOARD_ITEM *b=nullptr)
void Reset() override
Rewind for reuse on the next evaluation (see LIBEVAL::CONTEXT::Reset()).
void SetTypeOverride(const BOARD_ITEM *aItem, KICAD_T aType)
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
Handle a list of polygons defining a copper zone.
bool IsTeardropArea() const
PCB_LAYER_ID
A quick note on layer IDs:
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)