25#ifndef PCBEXPR_EVALUATOR_H
26#define PCBEXPR_EVALUATOR_H
28#include <unordered_map>
46 virtual std::unique_ptr<LIBEVAL::VAR_REF>
CreateVarRef(
const wxString& aVar,
47 const wxString& aField )
override;
193 wxString funcName = funcSignature.BeforeFirst(
'(' );
194 m_funcs[std::string( funcName.Lower() )] = std::move( funcPtr );
201 std::map<wxString, LIBEVAL::FUNC_CALL_REF>
m_funcs;
214 double Convert(
const wxString& aString,
int unitId )
const override;
223 double Convert(
const wxString& aString,
int unitId )
const override;
240 bool Evaluate(
const wxString& aExpr );
243 void SetErrorCallback( std::function<
void(
const wxString& aMessage,
int aOffset )> aCallback )
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Information pertinent to a Pcbnew printed circuit board.
void SetErrorCallback(std::function< void(const wxString &aMessage, int aOffset)> aCallback)
PCBEXPR_BUILTIN_FUNCTIONS()
void RegisterFunc(const wxString &funcSignature, LIBEVAL::FUNC_CALL_REF funcPtr)
void RegisterAllFunctions()
const wxArrayString GetSignatures() const
LIBEVAL::FUNC_CALL_REF Get(const wxString &name)
std::map< wxString, LIBEVAL::FUNC_CALL_REF > m_funcs
static PCBEXPR_BUILTIN_FUNCTIONS & Instance()
PCBEXPR_COMPONENT_CLASS_REF(int aItemIndex)
LIBEVAL::VALUE * GetValue(LIBEVAL::CONTEXT *aCtx) override
void SetItems(BOARD_ITEM *a, BOARD_ITEM *b=nullptr)
PCBEXPR_CONTEXT(int aConstraint=0, PCB_LAYER_ID aLayer=F_Cu)
int GetConstraint() const
PCB_LAYER_ID GetLayer() const
BOARD_ITEM * GetItem(int index) const
LIBEVAL::ERROR_STATUS m_errorStatus
bool IsErrorPending() const
PCBEXPR_COMPILER m_compiler
const LIBEVAL::ERROR_STATUS & GetError() const
bool Evaluate(const wxString &aExpr)
void SetErrorCallback(std::function< void(const wxString &aMessage, int aOffset)> aCallback)
LIBEVAL::VALUE * GetValue(LIBEVAL::CONTEXT *aCtx) override
PCBEXPR_NETCLASS_REF(int aItemIndex)
LIBEVAL::VALUE * GetValue(LIBEVAL::CONTEXT *aCtx) override
PCBEXPR_NETNAME_REF(int aItemIndex)
PCBEXPR_TYPE_REF(int aItemIndex)
LIBEVAL::VALUE * GetValue(LIBEVAL::CONTEXT *aCtx) override
virtual std::unique_ptr< LIBEVAL::VAR_REF > CreateVarRef(const wxString &aVar, const wxString &aField) override
virtual LIBEVAL::FUNC_CALL_REF CreateFuncCall(const wxString &aName) override
const std::vector< wxString > & GetSupportedUnits() const override
double Convert(const wxString &aString, int unitId) const override
double Convert(const wxString &aString, int unitId) const override
wxString GetSupportedUnitsMessage() const override
const std::vector< wxString > & GetSupportedUnits() const override
std::unordered_map< TYPE_ID, PROPERTY_BASE * > m_matchingTypes
LIBEVAL::VALUE * GetValue(LIBEVAL::CONTEXT *aCtx) override
LIBEVAL::VAR_TYPE_T GetType() const override
void SetType(LIBEVAL::VAR_TYPE_T type)
PCBEXPR_VAR_REF(int aItemIndex)
void AddAllowedClass(TYPE_ID type_hash, PROPERTY_BASE *prop)
LIBEVAL::VAR_TYPE_T m_type
BOARD_ITEM * GetObject(const LIBEVAL::CONTEXT *aCtx) const
PCB_LAYER_ID
A quick note on layer IDs:
std::function< void(CONTEXT *, void *)> FUNC_CALL_REF
size_t TYPE_ID
Unique type identifier.