Coding style: put case bodies on separate lines from the case label

While the single-line-case format is more readable when consistently
applied through the whole switch, it works less well when several of
the cases are too complex to fit on a single line.

Change-Id: I6a84a3d3d1493dadddab103da0336a8ef860563c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Edward Welbourne 2019-09-03 15:37:22 +02:00
parent 41b2c477b7
commit 2767367795

View File

@ -219,7 +219,8 @@ int QDateTimeParser::absoluteMax(int s, const QDateTime &cur) const
const SectionNode &sn = sectionNode(s);
switch (sn.type) {
#if QT_CONFIG(timezone)
case TimeZoneSection: return QTimeZone::MaxUtcOffsetSecs;
case TimeZoneSection:
return QTimeZone::MaxUtcOffsetSecs;
#endif
case Hour24Section:
case Hour12Section:
@ -227,20 +228,25 @@ int QDateTimeParser::absoluteMax(int s, const QDateTime &cur) const
// We want it to be 23 for the stepBy case.
return 23;
case MinuteSection:
case SecondSection: return 59;
case MSecSection: return 999;
case SecondSection:
return 59;
case MSecSection:
return 999;
case YearSection2Digits:
case YearSection:
// sectionMaxSize will prevent people from typing in a larger number in
// count == 2 sections; stepBy() will work on real years anyway.
return 9999;
case MonthSection: return calendar.maximumMonthsInYear();
case MonthSection:
return calendar.maximumMonthsInYear();
case DaySection:
case DayOfWeekSectionShort:
case DayOfWeekSectionLong:
return cur.isValid() ? cur.date().daysInMonth(calendar) : calendar.maximumDaysInMonth();
case AmPmSection: return 1;
default: break;
case AmPmSection:
return 1;
default:
break;
}
qWarning("QDateTimeParser::absoluteMax() Internal error (%ls)",
qUtf16Printable(sn.name()));
@ -620,7 +626,8 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const
switch (s) {
case FirstSection:
case NoSection:
case LastSection: return 0;
case LastSection:
return 0;
case AmPmSection: {
const int lowerMax = qMax(getAmPmText(AmText, LowerCase).size(),
@ -634,7 +641,9 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const
case Hour12Section:
case MinuteSection:
case SecondSection:
case DaySection: return 2;
case DaySection:
return 2;
case DayOfWeekSectionShort:
case DayOfWeekSectionLong:
#if !QT_CONFIG(textdate)
@ -663,11 +672,15 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const
return ret;
}
#endif
case MSecSection: return 3;
case YearSection: return 4;
case YearSection2Digits: return 2;
case MSecSection:
return 3;
case YearSection:
return 4;
case YearSection2Digits:
return 2;
case TimeZoneSection:
// Arbitrarily many tokens (each up to 14 bytes) joined with / separators:
case TimeZoneSection: return std::numeric_limits<int>::max();
return std::numeric_limits<int>::max();
case CalendarPopupSection:
case Internal: