diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2020-05-12 15:07:16 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2020-05-15 05:01:00 +0200 |
commit | c5f7cb7e1427470256eeec65b82c29e47e461f22 (patch) | |
tree | 0416ac6ea0803c396931082fc9f6ccef47d6ba8a | |
parent | b655734965155146290f3f3a9205243af11e42fb (diff) |
QString: remove more functions overloaded on char
These functions mess in bad ways with the overload set (they, fatally,
attract char16_t, e.g.).
The no-ascii warning now comes from the QChar(char) constructor, so
it's not lost.
[ChangeLog][QtCore][QString] Also removed op=(char), op+(char,
QString), op+(QString, char).
Change-Id: I1471c9ddb4c6869aff6e527516e2c78b80b7d7d3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r-- | src/corelib/text/qstring.cpp | 32 | ||||
-rw-r--r-- | src/corelib/text/qstring.h | 6 |
2 files changed, 0 insertions, 38 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 631b279332..c22dd0bd91 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -2425,22 +2425,6 @@ QString &QString::operator=(QLatin1String other) \sa QT_NO_CAST_FROM_ASCII, QT_RESTRICTED_CAST_FROM_ASCII */ -/*! \fn QString &QString::operator=(char ch) - - \overload operator=() - - Assigns character \a ch to this string. Note that the character is - converted to Unicode using the fromLatin1() function, unlike other 8-bit - functions that operate on UTF-8 data. - - You can disable this operator by defining \c - QT_NO_CAST_FROM_ASCII when you compile your applications. This - can be useful if you want to ensure that all user-visible strings - go through QObject::tr(), for example. - - \sa QT_NO_CAST_FROM_ASCII -*/ - /*! \overload operator=() @@ -5714,22 +5698,6 @@ QString& QString::fill(QChar ch, int size) */ /*! - \fn const QString operator+(const QString &s, char ch) - \relates QString - - Returns a string which is the result of concatenating the string - \a s and the character \a ch. -*/ - -/*! - \fn const QString operator+(char ch, const QString &s) - \relates QString - - Returns a string which is the result of concatenating the - character \a ch and the string \a s. -*/ - -/*! \fn int QString::compare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs) \since 4.2 diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index c1da39c3b6..733d796e81 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -805,8 +805,6 @@ public: { return (*this = fromUtf8(ch)); } inline QT_ASCII_CAST_WARN QString &operator=(const QByteArray &a) { return (*this = fromUtf8(a)); } - inline QT_ASCII_CAST_WARN QString &operator=(char c) - { return (*this = QChar::fromLatin1(c)); } // these are needed, so it compiles with STL support enabled inline QT_ASCII_CAST_WARN QString &prepend(const char *s) @@ -1360,10 +1358,6 @@ inline QT_ASCII_CAST_WARN const QString operator+(const QString &s1, const char { QString t(s1); t += QString::fromUtf8(s2); return t; } inline QT_ASCII_CAST_WARN const QString operator+(const char *s1, const QString &s2) { QString t = QString::fromUtf8(s1); t += s2; return t; } -inline QT_ASCII_CAST_WARN const QString operator+(char c, const QString &s) -{ QString t = s; t.prepend(QChar::fromLatin1(c)); return t; } -inline QT_ASCII_CAST_WARN const QString operator+(const QString &s, char c) -{ QString t = s; t += QChar::fromLatin1(c); return t; } inline QT_ASCII_CAST_WARN const QString operator+(const QByteArray &ba, const QString &s) { QString t = QString::fromUtf8(ba); t += s; return t; } inline QT_ASCII_CAST_WARN const QString operator+(const QString &s, const QByteArray &ba) |