SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
Loading...
Searching...
No Matches
numericparsing.cpp File Reference
#include "numericparsing.h"
#include <QJsonValue>
#include <QRegularExpression>
#include <QVariant>
Include dependency graph for numericparsing.cpp:

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.

Function Documentation

◆ parseNumericCell()

bool parseNumericCell ( const QString & text,
double & out,
QString & error )

Parses text as a finite number.

Parameters
textText to parse
outSet to the value if the text is accepted; unchanged otherwise
errorSet to the reason if the text is refused
Returns
true if accepted
Examples
/home/runner/work/SedSat3/SedSat3/src/elemental_profile.cpp.

Definition at line 10 of file numericparsing.cpp.

References number.

Referenced by parseNumericJson(), parseNumericValue(), and Elemental_Profile::Read().

◆ parseNumericJson()

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.

Examples
/home/runner/work/SedSat3/SedSat3/src/elemental_profile.cpp.

Definition at line 79 of file numericparsing.cpp.

References number, and parseNumericCell().

Referenced by Elemental_Profile::ReadFromJsonObject().

◆ parseNumericValue()

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().