Method GetParametrBool() should allow convert strings "1" and "0" to boolean.
--HG-- branch : feature
This commit is contained in:
parent
df20415e9e
commit
de6015de4d
|
@ -246,7 +246,10 @@ bool VDomDocument::GetParametrBool(const QDomElement &domElement, const QString
|
|||
{
|
||||
parametr = GetParametrString(domElement, name, defValue);
|
||||
|
||||
QStringList bools = QStringList() << QLatin1String("true") << QLatin1String("false");
|
||||
const QStringList bools = QStringList() << QLatin1String("true")
|
||||
<< QLatin1String("false")
|
||||
<< QLatin1String("1")
|
||||
<< QLatin1String("0");
|
||||
switch (bools.indexOf(parametr))
|
||||
{
|
||||
case 0: // true
|
||||
|
@ -255,6 +258,12 @@ bool VDomDocument::GetParametrBool(const QDomElement &domElement, const QString
|
|||
case 1: // false
|
||||
val = false;
|
||||
break;
|
||||
case 2: // 1
|
||||
val = true;
|
||||
break;
|
||||
case 3: // 0
|
||||
val = false;
|
||||
break;
|
||||
default:// others
|
||||
throw VExceptionConversionError(message, name);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue
Block a user