SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
Loading...
Searching...
No Matches
numericparsing.h
Go to the documentation of this file.
1// SedSAT3 – Sediment Source Assessment Tool, version 3
2// U.S. Geological Survey. See LICENSE.md and DISCLAIMER.md in the repository root.
3
4#pragma once
5
6#include <QString>
7#include <cmath>
8#include <vector>
9
10class QVariant;
11class QJsonValue;
12
32
40bool parseNumericCell(const QString& text, double& out, QString& error);
41
48bool parseNumericValue(const QVariant& value, double& out, QString& error);
49
57bool parseNumericJson(const QJsonValue& value, double& out, QString& error);
58
60inline bool AllFinite(const std::vector<double>& values)
61{
62 for (double value : values)
63 if (!std::isfinite(value))
64 return false;
65 return true;
66}
bool AllFinite(const std::vector< double > &values)
Whether every value is finite. Data imported through the functions above always is.
bool parseNumericJson(const QJsonValue &value, double &out, QString &error)
Parses a project-file value as a finite number.
bool parseNumericValue(const QVariant &value, double &out, QString &error)
Parses a spreadsheet cell value as a finite number.
bool parseNumericCell(const QString &text, double &out, QString &error)
Parses text as a finite number.