KiCad PCB EDA Suite
|
#include <numeric_evaluator.h>
Classes | |
struct | Token |
struct | TokenStat |
Public Member Functions | |
NUMERIC_EVALUATOR (EDA_UNITS aUnits) | |
~NUMERIC_EVALUATOR () | |
void | Clear () |
void | SetDefaultUnits (EDA_UNITS aUnits) |
void | LocaleChanged () |
void | parseError (const char *s) |
void | parseOk () |
void | parseSetResult (double) |
bool | IsValid () const |
wxString | Result () const |
bool | Process (const wxString &aString) |
wxString | OriginalText () const |
void | SetVar (const wxString &aString, double aValue) |
double | GetVar (const wxString &aString) |
void | RemoveVar (const wxString &aString) |
void | ClearVar () |
Protected Member Functions | |
void | newString (const wxString &aString) |
Token | getToken () |
void | parse (int token, numEval::TokenType value) |
Private Types | |
enum class | Unit { Invalid , UM , MM , CM , Inch , Mil , Degrees , SI } |
Private Attributes | |
void * | m_parser |
struct NUMERIC_EVALUATOR::TokenStat | m_token |
char | m_localeDecimalSeparator |
bool | m_parseError |
bool | m_parseFinished |
Unit | m_defaultUnits |
wxString | m_originalText |
std::map< wxString, double > | m_varMap |
Definition at line 93 of file numeric_evaluator.h.
|
strongprivate |
Enumerator | |
---|---|
Invalid | |
UM | |
MM | |
CM | |
Inch | |
Mil | |
Degrees | |
SI |
Definition at line 95 of file numeric_evaluator.h.
NUMERIC_EVALUATOR::NUMERIC_EVALUATOR | ( | EDA_UNITS | aUnits | ) |
Definition at line 47 of file numeric_evaluator.cpp.
References LocaleChanged(), m_parseError, m_parseFinished, m_parser, and SetDefaultUnits().
NUMERIC_EVALUATOR::~NUMERIC_EVALUATOR | ( | ) |
Definition at line 60 of file numeric_evaluator.cpp.
void NUMERIC_EVALUATOR::Clear | ( | ) |
Definition at line 71 of file numeric_evaluator.cpp.
References NUMERIC_EVALUATOR::TokenStat::input, m_originalText, m_parseError, m_token, and NUMERIC_EVALUATOR::TokenStat::token.
Referenced by UNIT_BINDER::ChangeValue(), newString(), UNIT_BINDER::SetValue(), TEXT_CTRL_EVAL::SetValue(), and ~NUMERIC_EVALUATOR().
|
inline |
Definition at line 140 of file numeric_evaluator.h.
|
protected |
Definition at line 190 of file numeric_evaluator.cpp.
References CM, Degrees, dummy, numEval::TokenType::dValue, Inch, NUMERIC_EVALUATOR::TokenStat::input, NUMERIC_EVALUATOR::TokenStat::inputLen, Invalid, m_defaultUnits, m_localeDecimalSeparator, m_parseError, m_token, Mil, MM, NUMERIC_EVALUATOR::TokenStat::pos, SI, numEval::TokenType::text, NUMERIC_EVALUATOR::Token::token, NUMERIC_EVALUATOR::TokenStat::token, UM, numEval::TokenType::valid, and NUMERIC_EVALUATOR::Token::value.
Referenced by Process().
double NUMERIC_EVALUATOR::GetVar | ( | const wxString & | aString | ) |
Definition at line 492 of file numeric_evaluator.cpp.
References m_parseError, and m_varMap.
|
inline |
Definition at line 116 of file numeric_evaluator.h.
void NUMERIC_EVALUATOR::LocaleChanged | ( | ) |
Definition at line 95 of file numeric_evaluator.cpp.
References m_localeDecimalSeparator.
Referenced by NUMERIC_EVALUATOR(), and UNIT_BINDER::SetUnits().
|
protected |
Definition at line 174 of file numeric_evaluator.cpp.
References Clear(), NUMERIC_EVALUATOR::TokenStat::input, NUMERIC_EVALUATOR::TokenStat::inputLen, m_originalText, m_parseFinished, m_token, NUMERIC_EVALUATOR::TokenStat::outputLen, NUMERIC_EVALUATOR::TokenStat::pos, and NUMERIC_EVALUATOR::TokenStat::token.
Referenced by Process().
wxString NUMERIC_EVALUATOR::OriginalText | ( | ) | const |
Definition at line 136 of file numeric_evaluator.cpp.
References m_originalText.
Referenced by SIM_STRING_PROPERTY::OnEvent(), UNIT_BINDER::onSetFocus(), and TEXT_CTRL_EVAL::onTextFocusGet().
|
protected |
void NUMERIC_EVALUATOR::parseError | ( | const char * | s | ) |
Definition at line 103 of file numeric_evaluator.cpp.
References m_parseError.
void NUMERIC_EVALUATOR::parseOk | ( | ) |
Definition at line 110 of file numeric_evaluator.cpp.
References m_parseFinished.
void NUMERIC_EVALUATOR::parseSetResult | ( | double | val | ) |
Definition at line 117 of file numeric_evaluator.cpp.
References m_token, NUMERIC_EVALUATOR::TokenStat::outputLen, NUMERIC_EVALUATOR::TokenStat::token, and UIDouble2Str().
bool NUMERIC_EVALUATOR::Process | ( | const wxString & | aString | ) |
Definition at line 142 of file numeric_evaluator.cpp.
References getToken(), m_parseError, m_parseFinished, m_parser, newString(), NUMERIC_EVALUATOR::Token::token, and NUMERIC_EVALUATOR::Token::value.
Referenced by TEXT_CTRL_EVAL::evaluate(), UNIT_BINDER::GetDoubleValue(), UNIT_BINDER::GetValue(), SIM_STRING_PROPERTY::OnEvent(), UNIT_BINDER::onKillFocus(), and SIM_STRING_PROPERTY::StringToValue().
|
inline |
Definition at line 137 of file numeric_evaluator.h.
|
inline |
Definition at line 119 of file numeric_evaluator.h.
Referenced by TEXT_CTRL_EVAL::evaluate(), UNIT_BINDER::GetDoubleValue(), UNIT_BINDER::GetValue(), SIM_STRING_PROPERTY::OnEvent(), UNIT_BINDER::onKillFocus(), and SIM_STRING_PROPERTY::StringToValue().
void NUMERIC_EVALUATOR::SetDefaultUnits | ( | EDA_UNITS | aUnits | ) |
Definition at line 81 of file numeric_evaluator.cpp.
References Degrees, Inch, m_defaultUnits, Mil, MM, and SI.
Referenced by NUMERIC_EVALUATOR(), and UNIT_BINDER::SetUnits().
void NUMERIC_EVALUATOR::SetVar | ( | const wxString & | aString, |
double | aValue | ||
) |
Definition at line 487 of file numeric_evaluator.cpp.
References m_varMap.
|
private |
Definition at line 186 of file numeric_evaluator.h.
Referenced by getToken(), and SetDefaultUnits().
|
private |
Definition at line 180 of file numeric_evaluator.h.
Referenced by getToken(), and LocaleChanged().
|
private |
Definition at line 188 of file numeric_evaluator.h.
Referenced by Clear(), newString(), and OriginalText().
|
private |
Definition at line 183 of file numeric_evaluator.h.
Referenced by Clear(), getToken(), GetVar(), NUMERIC_EVALUATOR(), parseError(), and Process().
|
private |
Definition at line 184 of file numeric_evaluator.h.
Referenced by newString(), NUMERIC_EVALUATOR(), parseOk(), and Process().
|
private |
Definition at line 160 of file numeric_evaluator.h.
Referenced by NUMERIC_EVALUATOR(), Process(), and ~NUMERIC_EVALUATOR().
|
private |
Referenced by Clear(), getToken(), newString(), and parseSetResult().
|
private |
Definition at line 190 of file numeric_evaluator.h.