mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[apps] Factorize portions checking whether text approximates to double
This commit is contained in:
committed by
Émilie Feral
parent
5e5e07e963
commit
82685cb371
@@ -41,6 +41,15 @@ bool TextFieldDelegateApp::isAcceptableText(const char * text) {
|
||||
return isAcceptableExpression(exp);
|
||||
}
|
||||
|
||||
bool TextFieldDelegateApp::hasUndefinedValue(const char * text, double & value) {
|
||||
value = PoincareHelpers::ApproximateToScalar<double>(text, *localContext());
|
||||
bool isUndefined = std::isnan(value) || std::isinf(value);
|
||||
if (isUndefined) {
|
||||
displayWarning(I18n::Message::UndefinedValue);
|
||||
}
|
||||
return isUndefined;
|
||||
}
|
||||
|
||||
/* Protected */
|
||||
|
||||
TextFieldDelegateApp::TextFieldDelegateApp(Container * container, Snapshot * snapshot, ViewController * rootViewController) :
|
||||
|
||||
Reference in New Issue
Block a user