diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2011-07-12 08:22:33 (GMT) |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2011-07-12 09:53:17 (GMT) |
commit | da0e1e101bb4c44c25b6523357fa81ad1b2d6539 (patch) | |
tree | 6867b437b279e74d147c17a71a9789ca2bd5cc54 /src/corelib/tools/qstring.cpp | |
parent | 693e39f3b630afa44cd1bd8d942825922a5d59fe (diff) | |
download | Qt-da0e1e101bb4c44c25b6523357fa81ad1b2d6539.zip Qt-da0e1e101bb4c44c25b6523357fa81ad1b2d6539.tar.gz Qt-da0e1e101bb4c44c25b6523357fa81ad1b2d6539.tar.bz2 |
Add QLocale::toUpper/Lower
The toUpper/Lower() methods in QString should not
be locale dependent, as this can lead to rather
hard to find bugs in at least a turkish locale.
Rather have explicit, locale dependend case conversions
available in QLocale.
Reviewed-by: Denis Dzyubenko
Diffstat (limited to 'src/corelib/tools/qstring.cpp')
-rw-r--r-- | src/corelib/tools/qstring.cpp | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index ee45cfd..c303c00 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -109,8 +109,6 @@ static QHash<void *, QByteArray> *asciiCache = 0; #ifdef QT_USE_ICU // qlocale_icu.cpp extern bool qt_ucol_strcoll(const QChar *source, int sourceLength, const QChar *target, int targetLength, int *result); -extern bool qt_u_strToUpper(const QString &str, QString *out, const QLocale &locale); -extern bool qt_u_strToLower(const QString &str, QString *out, const QLocale &locale); #endif @@ -5012,7 +5010,10 @@ QString QString::rightJustified(int width, QChar fill, bool truncate) const \snippet doc/src/snippets/qstring/main.cpp 75 - \sa toUpper() + The case conversion will always happen in the 'C' locale. For locale dependent + case folding use QLocale::toLower() + + \sa toUpper(), QLocale::toLower() */ QString QString::toLower() const @@ -5023,15 +5024,6 @@ QString QString::toLower() const if (!d->size) return *this; -#ifdef QT_USE_ICU - { - QString result; - if (qt_u_strToLower(*this, &result, QLocale())) - return result; - // else fall through and use Qt's toUpper - } -#endif - const ushort *e = d->data + d->size; // this avoids one out of bounds check in the loop @@ -5112,7 +5104,10 @@ QString QString::toCaseFolded() const \snippet doc/src/snippets/qstring/main.cpp 81 - \sa toLower() + The case conversion will always happen in the 'C' locale. For locale dependent + case folding use QLocale::toUpper() + + \sa toLower(), QLocale::toLower() */ QString QString::toUpper() const @@ -5123,15 +5118,6 @@ QString QString::toUpper() const if (!d->size) return *this; -#ifdef QT_USE_ICU - { - QString result; - if (qt_u_strToUpper(*this, &result, QLocale())) - return result; - // else fall through and use Qt's toUpper - } -#endif - const ushort *e = d->data + d->size; // this avoids one out of bounds check in the loop |