KiCad PCB EDA Suite
PCB_EXPR_BUILTIN_FUNCTIONS Class Reference

#include <pcb_expr_evaluator.h>

Public Member Functions

 PCB_EXPR_BUILTIN_FUNCTIONS ()
 
LIBEVAL::FUNC_CALL_REF Get (const wxString &name)
 
const wxArrayString GetSignatures () const
 
void RegisterFunc (const wxString &funcSignature, LIBEVAL::FUNC_CALL_REF funcPtr)
 
void RegisterAllFunctions ()
 

Static Public Member Functions

static PCB_EXPR_BUILTIN_FUNCTIONSInstance ()
 

Private Attributes

std::map< wxString, LIBEVAL::FUNC_CALL_REFm_funcs
 
wxArrayString m_funcSigs
 

Detailed Description

Definition at line 166 of file pcb_expr_evaluator.h.

Constructor & Destructor Documentation

◆ PCB_EXPR_BUILTIN_FUNCTIONS()

PCB_EXPR_BUILTIN_FUNCTIONS::PCB_EXPR_BUILTIN_FUNCTIONS ( )

Definition at line 859 of file pcb_expr_evaluator.cpp.

860 {
862 }

References RegisterAllFunctions().

Member Function Documentation

◆ Get()

LIBEVAL::FUNC_CALL_REF PCB_EXPR_BUILTIN_FUNCTIONS::Get ( const wxString &  name)
inline

Definition at line 177 of file pcb_expr_evaluator.h.

178  {
179  return m_funcs[ name ];
180  }
std::map< wxString, LIBEVAL::FUNC_CALL_REF > m_funcs
const char * name
Definition: DXF_plotter.cpp:56

References m_funcs, and name.

Referenced by PCB_EXPR_UCODE::CreateFuncCall().

◆ GetSignatures()

const wxArrayString PCB_EXPR_BUILTIN_FUNCTIONS::GetSignatures ( ) const
inline

Definition at line 182 of file pcb_expr_evaluator.h.

183  {
184  return m_funcSigs;
185  }

References m_funcSigs.

Referenced by PANEL_SETUP_RULES::onScintillaCharAdded().

◆ Instance()

static PCB_EXPR_BUILTIN_FUNCTIONS& PCB_EXPR_BUILTIN_FUNCTIONS::Instance ( )
inlinestatic

Definition at line 171 of file pcb_expr_evaluator.h.

172  {
173  static PCB_EXPR_BUILTIN_FUNCTIONS self;
174  return self;
175  }

Referenced by PCB_EXPR_UCODE::CreateFuncCall(), and PANEL_SETUP_RULES::onScintillaCharAdded().

◆ RegisterAllFunctions()

void PCB_EXPR_BUILTIN_FUNCTIONS::RegisterAllFunctions ( )

Definition at line 865 of file pcb_expr_evaluator.cpp.

866 {
867  m_funcs.clear();
868  RegisterFunc( "existsOnLayer('x')", existsOnLayer );
869  RegisterFunc( "isPlated()", isPlated );
870  RegisterFunc( "insideCourtyard('x')", insideCourtyard );
871  RegisterFunc( "insideFrontCourtyard('x')", insideFrontCourtyard );
872  RegisterFunc( "insideBackCourtyard('x')", insideBackCourtyard );
873  RegisterFunc( "insideArea('x')", insideArea );
874  RegisterFunc( "isMicroVia()", isMicroVia );
875  RegisterFunc( "isBlindBuriedVia()", isBlindBuriedVia );
876  RegisterFunc( "memberOf('x')", memberOf );
877  RegisterFunc( "fromTo('x','y')", exprFromTo );
878  RegisterFunc( "isCoupledDiffPair()", isCoupledDiffPair );
879  RegisterFunc( "inDiffPair('x')", inDiffPair );
880 }
void RegisterFunc(const wxString &funcSignature, LIBEVAL::FUNC_CALL_REF funcPtr)
static void isPlated(LIBEVAL::CONTEXT *aCtx, void *self)
bool exprFromTo(LIBEVAL::CONTEXT *aCtx, void *self)
static void inDiffPair(LIBEVAL::CONTEXT *aCtx, void *self)
static void insideFrontCourtyard(LIBEVAL::CONTEXT *aCtx, void *self)
std::map< wxString, LIBEVAL::FUNC_CALL_REF > m_funcs
static void isBlindBuriedVia(LIBEVAL::CONTEXT *aCtx, void *self)
static void existsOnLayer(LIBEVAL::CONTEXT *aCtx, void *self)
static void insideArea(LIBEVAL::CONTEXT *aCtx, void *self)
static void insideBackCourtyard(LIBEVAL::CONTEXT *aCtx, void *self)
static void memberOf(LIBEVAL::CONTEXT *aCtx, void *self)
static void insideCourtyard(LIBEVAL::CONTEXT *aCtx, void *self)
static void isMicroVia(LIBEVAL::CONTEXT *aCtx, void *self)
static void isCoupledDiffPair(LIBEVAL::CONTEXT *aCtx, void *self)

References existsOnLayer(), exprFromTo(), inDiffPair(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), isBlindBuriedVia(), isCoupledDiffPair(), isMicroVia(), isPlated(), m_funcs, memberOf(), and RegisterFunc().

Referenced by PCB_EXPR_BUILTIN_FUNCTIONS().

◆ RegisterFunc()

void PCB_EXPR_BUILTIN_FUNCTIONS::RegisterFunc ( const wxString &  funcSignature,
LIBEVAL::FUNC_CALL_REF  funcPtr 
)
inline

Definition at line 187 of file pcb_expr_evaluator.h.

188  {
189  wxString funcName = funcSignature.BeforeFirst( '(' );
190  m_funcs[std::string( funcName.Lower() )] = std::move( funcPtr );
191  m_funcSigs.Add( funcSignature );
192  }
std::map< wxString, LIBEVAL::FUNC_CALL_REF > m_funcs

References m_funcs, and m_funcSigs.

Referenced by RegisterAllFunctions().

Member Data Documentation

◆ m_funcs

std::map<wxString, LIBEVAL::FUNC_CALL_REF> PCB_EXPR_BUILTIN_FUNCTIONS::m_funcs
private

Definition at line 197 of file pcb_expr_evaluator.h.

Referenced by Get(), RegisterAllFunctions(), and RegisterFunc().

◆ m_funcSigs

wxArrayString PCB_EXPR_BUILTIN_FUNCTIONS::m_funcSigs
private

Definition at line 199 of file pcb_expr_evaluator.h.

Referenced by GetSignatures(), and RegisterFunc().


The documentation for this class was generated from the following files: