KiCad PCB EDA Suite
Loading...
Searching...
No Matches
EDA_PATTERN_MATCH_RELATIONAL Class Reference

Relational match. More...

#include <eda_pattern_match.h>

Inheritance diagram for EDA_PATTERN_MATCH_RELATIONAL:
EDA_PATTERN_MATCH

Public Member Functions

virtual bool SetPattern (const wxString &aPattern) override
 Set the pattern against which candidates will be matched.
 
virtual wxString const & GetPattern () const override
 Return the pattern passed to SetPattern().
 
virtual FIND_RESULT Find (const wxString &aCandidate) const override
 Return the location and possibly length of a match iff a given candidate string matches the set pattern.
 
int FindOne (const wxString &aCandidate) const
 

Protected Types

enum  RELATION {
  LT , LE , EQ , GE ,
  GT , ANY
}
 

Protected Attributes

wxString m_pattern
 
wxString m_key
 
RELATION m_relation
 
double m_value
 

Static Protected Attributes

static const std::map< wxString, double > m_units
 

Detailed Description

Relational match.

Matches tokens of the format:

 key:value       or      key=value

with search patterns of the format:

 key<value, key<=value, key=value, key>=value, key>value

by parsing the value numerically and comparing.

Definition at line 178 of file eda_pattern_match.h.

Member Enumeration Documentation

◆ RELATION

Enumerator
LT 
LE 
EQ 
GE 
GT 
ANY 

Definition at line 188 of file eda_pattern_match.h.

Member Function Documentation

◆ Find()

EDA_PATTERN_MATCH::FIND_RESULT EDA_PATTERN_MATCH_RELATIONAL::Find ( const wxString &  aCandidate) const
overridevirtual

Return the location and possibly length of a match iff a given candidate string matches the set pattern.

Otherwise, return an invalid FIND_RESULT.

Implements EDA_PATTERN_MATCH.

Definition at line 306 of file eda_pattern_match.cpp.

References CLAMPED_VAL_INT_MAX, EDA_PATTERN_NOT_FOUND, and FindOne().

◆ FindOne()

int EDA_PATTERN_MATCH_RELATIONAL::FindOne ( const wxString &  aCandidate) const

Definition at line 329 of file eda_pattern_match.cpp.

References ANY, CLAMPED_VAL_INT_MAX, EDA_PATTERN_NOT_FOUND, EQ, GE, GT, LE, LT, m_key, m_relation, m_units, and m_value.

Referenced by Find().

◆ GetPattern()

wxString const & EDA_PATTERN_MATCH_RELATIONAL::GetPattern ( ) const
overridevirtual

Return the pattern passed to SetPattern().

Implements EDA_PATTERN_MATCH.

Definition at line 300 of file eda_pattern_match.cpp.

References m_pattern.

◆ SetPattern()

bool EDA_PATTERN_MATCH_RELATIONAL::SetPattern ( const wxString &  aPattern)
overridevirtual

Set the pattern against which candidates will be matched.

If the pattern can not be processed, returns false.

Implements EDA_PATTERN_MATCH.

Definition at line 246 of file eda_pattern_match.cpp.

References ANY, EQ, GE, GT, LE, LT, m_key, m_pattern, m_relation, m_units, and m_value.

Member Data Documentation

◆ m_key

wxString EDA_PATTERN_MATCH_RELATIONAL::m_key
protected

Definition at line 191 of file eda_pattern_match.h.

Referenced by FindOne(), and SetPattern().

◆ m_pattern

wxString EDA_PATTERN_MATCH_RELATIONAL::m_pattern
protected

Definition at line 190 of file eda_pattern_match.h.

Referenced by GetPattern(), and SetPattern().

◆ m_relation

RELATION EDA_PATTERN_MATCH_RELATIONAL::m_relation
protected

Definition at line 192 of file eda_pattern_match.h.

Referenced by FindOne(), and SetPattern().

◆ m_units

const std::map< wxString, double > EDA_PATTERN_MATCH_RELATIONAL::m_units
staticprotected
Initial value:
= {
{ wxS( "p" ), 1e-12 },
{ wxS( "n" ), 1e-9 },
{ wxS( "u" ), 1e-6 },
{ wxS( "m" ), 1e-3 },
{ wxS( "" ), 1. },
{ wxS( "k" ), 1e3 },
{ wxS( "meg" ), 1e6 },
{ wxS( "g" ), 1e9 },
{ wxS( "t" ), 1e12 },
{ wxS( "ki" ), 1024. },
{ wxS( "mi" ), 1048576. },
{ wxS( "gi" ), 1073741824. },
{ wxS( "ti" ), 1099511627776. } }

Definition at line 195 of file eda_pattern_match.h.

Referenced by FindOne(), and SetPattern().

◆ m_value

double EDA_PATTERN_MATCH_RELATIONAL::m_value
protected

Definition at line 193 of file eda_pattern_match.h.

Referenced by FindOne(), and SetPattern().


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