32 m_expression( aExpression ),
52 aReporter->
Report(
_(
"ERROR in expression." ) );
59 [&](
const wxString& aMessage,
int aOffset )
62 aReporter->
Report(
_(
"ERROR:" ) + wxS(
" " )+ aMessage );
65 BOARD_ITEM* a = const_cast<BOARD_ITEM*>( aItemA );
66 BOARD_ITEM* b = const_cast<BOARD_ITEM*>( aItemB );
70 if(
m_ucode->Run( &ctx )->AsDouble() != 0.0 )
78 if(
m_ucode->Run( &ctx )->AsDouble() != 0.0 )
91 [&](
const wxString& aMessage,
int aOffset )
96 wxString first = aMessage.BeforeFirst(
'|', &rest );
99 aSourceOffset + aOffset,
107 m_ucode = std::make_unique<PCB_EXPR_UCODE>();
void SetItems(BOARD_ITEM *a, BOARD_ITEM *b=nullptr)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
DRC_RULE_CONDITION(const wxString &aExpression="")
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
bool Compile(const wxString &aString, UCODE *aCode, CONTEXT *aPreflightContext)
void SetErrorCallback(std::function< void(const wxString &aMessage, int aOffset)> aCallback)
wxString GetExpression() const
PCB_LAYER_ID
A quick note on layer IDs:
std::unique_ptr< PCB_EXPR_UCODE > m_ucode
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
bool EvaluateFor(const BOARD_ITEM *aItemA, const BOARD_ITEM *aItemB, PCB_LAYER_ID aLayer, REPORTER *aReporter=nullptr)
bool Compile(REPORTER *aReporter, int aSourceLine=0, int aSourceOffset=0)
void SetErrorCallback(std::function< void(const wxString &aMessage, int aOffset)> aCallback)