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>
This commit is contained in:
Marc Mutz 2020-05-12 15:07:16 +02:00
parent b655734965
commit c5f7cb7e14
2 changed files with 0 additions and 38 deletions

View File

@ -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=()
@ -5713,22 +5697,6 @@ QString& QString::fill(QChar ch, int size)
\sa QString::fromUtf8()
*/
/*!
\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

View File

@ -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)