KiCad PCB EDA Suite
LIBEVAL::VALUE Class Reference

#include <libeval_compiler.h>

Inheritance diagram for LIBEVAL::VALUE:
PCB_LAYER_VALUE

Public Member Functions

 VALUE ()
 
 VALUE (const wxString &aStr, bool aIsWildcard=false)
 
 VALUE (const double aVal)
 
virtual ~VALUE ()
 
virtual double AsDouble () const
 
virtual const wxString & AsString () const
 
virtual bool EqualTo (const VALUE *b) const
 
VAR_TYPE_T GetType () const
 
void Set (double aValue)
 
void Set (const wxString &aValue)
 
void Set (const VALUE &val)
 

Private Attributes

VAR_TYPE_T m_type
 
double m_valueDbl
 
wxString m_valueStr
 
bool m_stringIsWildcard
 

Detailed Description

Definition at line 184 of file libeval_compiler.h.

Constructor & Destructor Documentation

◆ VALUE() [1/3]

LIBEVAL::VALUE::VALUE ( )
inline

Definition at line 187 of file libeval_compiler.h.

187  :
188  m_type( VT_UNDEFINED ),
189  m_valueDbl( 0 ),
190  m_stringIsWildcard( false )
191  {};

◆ VALUE() [2/3]

LIBEVAL::VALUE::VALUE ( const wxString &  aStr,
bool  aIsWildcard = false 
)
inline

Definition at line 193 of file libeval_compiler.h.

193  :
194  m_type( VT_STRING ),
195  m_valueDbl( 0 ),
196  m_valueStr( aStr ),
197  m_stringIsWildcard( aIsWildcard )
198  {};

◆ VALUE() [3/3]

LIBEVAL::VALUE::VALUE ( const double  aVal)
inline

Definition at line 200 of file libeval_compiler.h.

200  :
201  m_type( VT_NUMERIC ),
202  m_valueDbl( aVal ),
203  m_stringIsWildcard( false )
204  {};

◆ ~VALUE()

virtual LIBEVAL::VALUE::~VALUE ( )
inlinevirtual

Definition at line 206 of file libeval_compiler.h.

207  {};

Member Function Documentation

◆ AsDouble()

virtual double LIBEVAL::VALUE::AsDouble ( ) const
inlinevirtual

Definition at line 209 of file libeval_compiler.h.

210  {
211  return m_valueDbl;
212  }

References m_valueDbl.

Referenced by PCB_LAYER_VALUE::EqualTo(), PCB_EXPR_EVALUATOR::Evaluate(), LIBEVAL::UOP::Exec(), and testEvalExpr().

◆ AsString()

virtual const wxString& LIBEVAL::VALUE::AsString ( ) const
inlinevirtual

Definition at line 214 of file libeval_compiler.h.

215  {
216  return m_valueStr;
217  }

References m_valueStr.

Referenced by existsOnLayer(), exprFromTo(), insideArea(), insideCourtyard(), memberOf(), and testEvalExpr().

◆ EqualTo()

bool LIBEVAL::VALUE::EqualTo ( const VALUE b) const
virtual

Definition at line 110 of file libeval_compiler.cpp.

111 {
112  if( m_type == VT_NUMERIC && b->m_type == VT_NUMERIC )
113  return m_valueDbl == b->m_valueDbl;
114  else if( m_type == VT_STRING && b->m_type == VT_STRING )
115  {
116  if( b->m_stringIsWildcard )
117  {
118  return WildCompareString( b->m_valueStr, m_valueStr, false );
119  }
120  else
121  return !m_valueStr.CmpNoCase( b->m_valueStr );
122  }
123 
124  return false;
125 }
bool WildCompareString(const wxString &pattern, const wxString &string_to_tst, bool case_sensitive)
Compare a string against wild card (* and ?) pattern using the usual rules.
Definition: string.cpp:488

References m_stringIsWildcard, m_type, m_valueDbl, m_valueStr, LIBEVAL::VT_NUMERIC, LIBEVAL::VT_STRING, and WildCompareString().

Referenced by LIBEVAL::UOP::Exec(), and testEvalExpr().

◆ GetType()

VAR_TYPE_T LIBEVAL::VALUE::GetType ( ) const
inline

Definition at line 221 of file libeval_compiler.h.

221 { return m_type; };

References m_type.

Referenced by PCB_EXPR_EVALUATOR::Evaluate(), and testEvalExpr().

◆ Set() [1/3]

void LIBEVAL::VALUE::Set ( double  aValue)
inline

◆ Set() [2/3]

void LIBEVAL::VALUE::Set ( const wxString &  aValue)
inline

Definition at line 229 of file libeval_compiler.h.

230  {
231  m_type = VT_STRING;
232  m_valueStr = aValue;
233  }

References m_type, m_valueStr, and LIBEVAL::VT_STRING.

◆ Set() [3/3]

void LIBEVAL::VALUE::Set ( const VALUE val)
inline

Definition at line 235 of file libeval_compiler.h.

236  {
237  m_type = val.m_type;
238  m_valueDbl = val.m_valueDbl;
239 
240  if( m_type == VT_STRING )
241  m_valueStr = val.m_valueStr;
242  }

References m_type, m_valueDbl, m_valueStr, and LIBEVAL::VT_STRING.

Member Data Documentation

◆ m_stringIsWildcard

bool LIBEVAL::VALUE::m_stringIsWildcard
private

Definition at line 248 of file libeval_compiler.h.

Referenced by EqualTo().

◆ m_type

VAR_TYPE_T LIBEVAL::VALUE::m_type
private

Definition at line 245 of file libeval_compiler.h.

Referenced by EqualTo(), GetType(), and Set().

◆ m_valueDbl

double LIBEVAL::VALUE::m_valueDbl
private

Definition at line 246 of file libeval_compiler.h.

Referenced by AsDouble(), EqualTo(), and Set().

◆ m_valueStr

wxString LIBEVAL::VALUE::m_valueStr
private

Definition at line 247 of file libeval_compiler.h.

Referenced by AsString(), EqualTo(), and Set().


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