QDateTimeParser::parse(): improve readability

A switch (was inconsistent about whether enum members need casts and)
made it less obvious, rather than more, what was going on; so changed
it to a nested if.

Change-Id: I9af322d9dd17aa08cac5003eff2c8eaa73b50d45
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Edward Welbourne 2016-01-18 13:00:32 +01:00
parent b2c0e5af18
commit ee22fe13cd

View File

@ -977,22 +977,17 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos
if (state != Invalid) {
if (parserType != QVariant::Time) {
if (year % 100 != year2digits) {
switch (isSet & (YearSection2Digits|YearSection)) {
case YearSection2Digits:
if (year % 100 != year2digits && (isSet & YearSection2Digits)) {
if (!(isSet & YearSection)) {
year = (year / 100) * 100;
year += year2digits;
break;
case ((uint)YearSection2Digits|(uint)YearSection): {
} else {
conflicts = true;
const SectionNode &sn = sectionNode(currentSectionIndex);
if (sn.type == YearSection2Digits) {
year = (year / 100) * 100;
year += year2digits;
}
break; }
default:
break;
}
}