diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2021-08-12 16:20:57 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2021-08-21 01:28:27 +0200 |
commit | d07742f333df89dc399fc5d9cabf2bdef0b346c5 (patch) | |
tree | 0f7f6ca843b695effc6e2fdabd06e5e55ac3496a /src/3rdparty/harfbuzz-ng/src/hb-subset-input.hh | |
parent | bd52059eef7c96031972b5bee03067f3cb0f038d (diff) |
QLibrary: use QStringTokenizer in isLibrary()
Rewrite the whole function for readability _and_ performance:
- Extract Method isValidSuffix() as a lambda
- Extract Method isNumeric() as a lambda
- Use a C array of QLatin1String instead of a QStringList to hold the
statically-sized list of candidate suffixes. This has the nice
side-effect that the compiler will now throw an error in case the
#ifdef'ery yields zero candidates (C arrays cannot have no
elements), e.g. when porting to a new platform.
- Last, not least, replace the parsing with a loop that makes clear
what's going on and which is forward-iteration-only-compatible, so
we can use QStringTokenizer directly, without toContainer() to get a
random-access sequence.
Need to use the C++20 version of all_of(), since QStringTokenizer uses
sentinels instead of end-iterators.
Even though we use higher-level constructs now, the code is still more
efficient than the index-twisting we had before.
Change-Id: I9f3faf3e30f58c9eb8a1487a7ca190681e87767b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-subset-input.hh')
0 files changed, 0 insertions, 0 deletions