31#ifndef LMMS_LOCALEHELPER_H
32#define LMMS_LOCALEHELPER_H
42inline double toDouble(
const QString& str,
bool* ok =
nullptr)
45 QLocale
c(QLocale::C);
46 c.setNumberOptions(QLocale::RejectGroupSeparator);
47 double value =
c.toDouble(str, &isOkay);
50 QLocale german(QLocale::German);
51 german.setNumberOptions(QLocale::RejectGroupSeparator);
52 value = german.toDouble(str, &isOkay);
54 if (ok !=
nullptr) { *ok = isOkay; }
58inline float toFloat(
const QString& str,
bool* ok =
nullptr)
61 if (!std::isinf(
d) && std::fabs(
d) > std::numeric_limits<float>::max())
63 if (ok !=
nullptr) { *ok =
false; }
66 return static_cast<float>(
d);
unsigned d
Definition inflate.c:940
static PuglViewHint int value
Definition pugl.h:1708
Definition LocaleHelper.h:40
float toFloat(const QString &str, bool *ok=nullptr)
Definition LocaleHelper.h:58
double toDouble(const QString &str, bool *ok=nullptr)
Definition LocaleHelper.h:42
return c
Definition crypt.c:175