Edward Welbourne 8f955142ed Straighten out QLocaleData::numberToCLocale()
It was a bit convoluted, making it hard to reason about parts. The end
of the whole number part can happen at the very end, after the loop,
or when we hit the exponent or fractional part. That means the check
of grouping rules at the end of the whole number part had to happen
after the loop as well as within it. To avoid duplication within the
loop, the handlingof exponent and fractional part was done within the
handling of grouping, reprising the exponent and fractional part after
they're handled earlier in the loop.

Package the decision-making for that handling in a lambda (and
document some relevant details there) so that the duplication is
harmless and move into the handling of the exponent and fractional
part separators, where it belongs. This lets the bulk of the loop body
simplify into a straightforward if/else-if cascade, making it easier
to reason about (in preparation for some imminent fixing of quirks and
corner cases).

Since reviewers needed to understand what the GroupSizes members mean,
in order to make sense of this, I've also added some comments to the
struct's declaration to at least let future readers know what's what.

This refactoring should be harmless and change nothing; it is also
needed by an imminent fix, that I shall pick back into LTS branches.

Pick-to: 6.8 6.5
Task-number: QTBUG-134913
Change-Id: Ib352aa9ab8341914e40d9c087b497db15a180ebb
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit cdcaaaeee3e8526faee950036bef7e8efaa60e17)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 16:33:40 +00:00
Description
Qt Base (Core, Gui, Widgets, Network, ...)
822 MiB
Languages
C++ 84.3%
HTML 4.9%
C 3.9%
CMake 3.6%
Objective-C++ 2%
Other 0.8%