Method GetParametrBool() should allow convert strings "1" and "0" to boolean.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-11-10 12:51:06 +02:00
parent df20415e9e
commit de6015de4d

View File

@ -246,7 +246,10 @@ bool VDomDocument::GetParametrBool(const QDomElement &domElement, const QString
{ {
parametr = GetParametrString(domElement, name, defValue); 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)) switch (bools.indexOf(parametr))
{ {
case 0: // true case 0: // true
@ -255,6 +258,12 @@ bool VDomDocument::GetParametrBool(const QDomElement &domElement, const QString
case 1: // false case 1: // false
val = false; val = false;
break; break;
case 2: // 1
val = true;
break;
case 3: // 0
val = false;
break;
default:// others default:// others
throw VExceptionConversionError(message, name); throw VExceptionConversionError(message, name);
break; break;