|
SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
|
The one place where data values entering SedSAT3 are checked. More...
#include <QString>#include <cmath>#include <vector>

Go to the source code of this file.
Functions | |
| bool | parseNumericCell (const QString &text, double &out, QString &error) |
| Parses text as a finite number. | |
| bool | parseNumericValue (const QVariant &value, double &out, QString &error) |
| Parses a spreadsheet cell value as a finite number. | |
| bool | parseNumericJson (const QJsonValue &value, double &out, QString &error) |
| Parses a project-file value as a finite number. | |
| bool | AllFinite (const std::vector< double > &values) |
| Whether every value is finite. Data imported through the functions above always is. | |
The one place where data values entering SedSAT3 are checked.
Every concentration, ratio and option read from an Excel file, a project file, the command line or the element table goes through these functions, so the rest of the program can rely on every stored value being a finite number. A value that fails is not stored: the import or load stops and reports where the value is (sheet, row and column, or group, sample and constituent) and why it was refused. This is the same treatment empty and non-numeric Excel cells have always had; SedSAT3 has no missing-data value.
Accepted: an optional sign, digits with '.' as the decimal separator, and an optional exponent, with surrounding spaces ignored ("12", "-0.5", "1.5e-3"). Refused: empty text; NaN, Inf and Infinity in any case; numbers too large for a double; anything else, including "1,5" (a decimal comma) and "1,234" (a thousands separator), which are reported as such.
Definition in file numericparsing.h.
|
inline |
Whether every value is finite. Data imported through the functions above always is.
Definition at line 60 of file numericparsing.h.
Referenced by ConcentrationSet::FindOptimalBoxCoxParameter().
| bool parseNumericCell | ( | const QString & | text, |
| double & | out, | ||
| QString & | error ) |
Parses text as a finite number.
| text | Text to parse |
| out | Set to the value if the text is accepted; unchanged otherwise |
| error | Set to the reason if the text is refused |
Definition at line 10 of file numericparsing.cpp.
References number.
Referenced by parseNumericJson(), parseNumericValue(), and Elemental_Profile::Read().
| bool parseNumericJson | ( | const QJsonValue & | value, |
| double & | out, | ||
| QString & | error ) |
Parses a project-file value as a finite number.
JSON numbers are accepted if finite; strings go through parseNumericCell(); null, which is how Qt writes NaN and infinity to a project file, and any other type are refused.
Definition at line 79 of file numericparsing.cpp.
References number, and parseNumericCell().
Referenced by Elemental_Profile::ReadFromJsonObject().
| bool parseNumericValue | ( | const QVariant & | value, |
| double & | out, | ||
| QString & | error ) |
Parses a spreadsheet cell value as a finite number.
Numeric cells are accepted if finite; text cells go through parseNumericCell(); anything else (dates, booleans, errors) is refused.
Definition at line 48 of file numericparsing.cpp.
References number, and parseNumericCell().
Referenced by ReadBracketTolerance(), and ElementTableModel::setData().