support more bool options

This commit is contained in:
Lee Thomason
2019-08-10 17:40:19 -07:00
parent 1675bec2f2
commit 7fd646a8a2

View File

@@ -612,13 +612,20 @@ bool XMLUtil::ToBool( const char* str, bool* value )
*value = (ival==0) ? false : true; *value = (ival==0) ? false : true;
return true; return true;
} }
if ( StringEqual( str, "true" ) ) { static const char* TRUE[] = { "true", "True", "TRUE", 0 };
*value = true; static const char* FALSE[] = { "false", "False", "FALSE", 0 };
return true;
for (int i = 0; TRUE[i]; ++i) {
if (StringEqual(str, TRUE[i])) {
*value = true;
return true;
}
} }
else if ( StringEqual( str, "false" ) ) { for (int i = 0; FALSE[i]; ++i) {
*value = false; if (StringEqual(str, FALSE[i])) {
return true; *value = false;
return true;
}
} }
return false; return false;
} }