qmake: QMakeProject::intValue added
For variables that are supposed to contain a single int, this method returns the numeric value. Only the first value of the variable is taken into account. Change-Id: Ifa11ba5ac044e0a4703a387a9bcf02043e4681d8 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
parent
65425be8fe
commit
ee4d723ecc
@ -156,6 +156,7 @@ public:
|
|||||||
bool isEmpty(const QString &v); // With compat mapping, but no magic variables
|
bool isEmpty(const QString &v); // With compat mapping, but no magic variables
|
||||||
QStringList &values(const QString &v); // With compat mapping and magic variables
|
QStringList &values(const QString &v); // With compat mapping and magic variables
|
||||||
QString first(const QString &v); // ditto
|
QString first(const QString &v); // ditto
|
||||||
|
int intValue(const QString &v, int defaultValue = 0); // ditto
|
||||||
QHash<QString, QStringList> &variables(); // No compat mapping and magic, obviously
|
QHash<QString, QStringList> &variables(); // No compat mapping and magic, obviously
|
||||||
|
|
||||||
bool isRecursive() const { return recursive; }
|
bool isRecursive() const { return recursive; }
|
||||||
@ -189,6 +190,18 @@ inline QString QMakeProject::first(const QString &v)
|
|||||||
return vals.first();
|
return vals.first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline int QMakeProject::intValue(const QString &v, int defaultValue)
|
||||||
|
{
|
||||||
|
const QString str = first(v);
|
||||||
|
if (!str.isEmpty()) {
|
||||||
|
bool ok;
|
||||||
|
int i = str.toInt(&ok);
|
||||||
|
if (ok)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
inline QHash<QString, QStringList> &QMakeProject::variables()
|
inline QHash<QString, QStringList> &QMakeProject::variables()
|
||||||
{ return vars; }
|
{ return vars; }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user