Mantid
Loading...
Searching...
No Matches
qt
widgets
common
src
ParseNumerics.cpp
Go to the documentation of this file.
1
// Mantid Repository : https://github.com/mantidproject/mantid
2
//
3
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4
// NScD Oak Ridge National Laboratory, European Spallation Source,
5
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6
// SPDX - License - Identifier: GPL - 3.0 +
7
#include "
MantidQtWidgets/Common/ParseNumerics.h
"
8
#include <stdexcept>
9
namespace
MantidQt
{
10
namespace
MantidWidgets {
11
double
parseDouble
(QString
const
&in) {
12
static
auto
ok =
false
;
13
auto
out = in.toDouble(&ok);
14
if
(ok)
15
return
out;
16
else
17
throw
std::runtime_error(
"Failed to parse '"
+ in.toStdString() +
"' as a double numerical value."
);
18
}
19
20
int
parseDenaryInteger
(QString
const
&in) {
21
static
auto
ok =
false
;
22
auto
constexpr
BASE = 10;
23
auto
out = in.toInt(&ok, BASE);
24
if
(ok)
25
return
out;
26
else
27
throw
std::runtime_error(
"Failed to parse '"
+ in.toStdString() +
"' as a denary integer."
);
28
}
29
}
// namespace MantidWidgets
30
}
// namespace MantidQt
ParseNumerics.h
MantidQt::MantidWidgets::parseDenaryInteger
int EXPORT_OPT_MANTIDQT_COMMON parseDenaryInteger(QString const &in)
Converts a string denoting a denary integer to it.
Definition
ParseNumerics.cpp:20
MantidQt::MantidWidgets::parseDouble
double EXPORT_OPT_MANTIDQT_COMMON parseDouble(QString const &in)
Definition
ParseNumerics.cpp:11
MantidQt
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
Definition
AddWorkspaceDialog.h:18
Generated by
1.9.8