QStringEn/Decoder: port (name, Flags) ctors to QAnyStringView
This reverts commit f8359084b9.
Lookup-by-string functions should be all taking QAnyStringView, not be
overloaded on QString/const char*.
Found in API-review.
[ChangeLog][QtCore][QStringEncoder/QStringDecoder] The (name, flags)
constructor now takes QAnyStringView (was: const char*).
Fixes: QTBUG-126108
Change-Id: If68343ce5ec2ff60ce55156f9f2dc2bb6938e07f
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit d4c4e6b876b948c1a34abdd46cf7f5be1c302137)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
bb10
parent
0026955270
commit
23013db675
|
|
@ -2523,20 +2523,13 @@ const char *QStringConverter::nameForEncoding(QStringConverter::Encoding e)
|
|||
*/
|
||||
|
||||
/*!
|
||||
\fn constexpr QStringEncoder::QStringEncoder(const char *name, Flags flags = Flag::Default)
|
||||
\fn QStringEncoder::QStringEncoder(QAnyStringView name, Flags flags = Flag::Default)
|
||||
|
||||
Creates an encoder object using \a name and \a flags.
|
||||
If \a name is not the name of a known encoding an invalid converter will get created.
|
||||
|
||||
\sa isValid()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn constexpr QStringEncoder::QStringEncoder(const QString &name, Flags flags = Flag::Default)
|
||||
\since 6.8
|
||||
|
||||
Creates an encoder object using \a name and \a flags.
|
||||
If \a name is not the name of a known encoding an invalid converter will get created.
|
||||
\note In Qt versions prior to 6.8, this function took only a \c{const char *},
|
||||
which was expected to be UTF-8-encoded.
|
||||
|
||||
\sa isValid()
|
||||
*/
|
||||
|
|
@ -2624,20 +2617,13 @@ const char *QStringConverter::nameForEncoding(QStringConverter::Encoding e)
|
|||
*/
|
||||
|
||||
/*!
|
||||
\fn constexpr QStringDecoder::QStringDecoder(const char *name, Flags flags = Flag::Default)
|
||||
\fn QStringDecoder::QStringDecoder(QAnyStringView name, Flags flags = Flag::Default)
|
||||
|
||||
Creates an decoder object using \a name and \a flags.
|
||||
If \a name is not the name of a known encoding an invalid converter will get created.
|
||||
|
||||
\sa isValid()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn constexpr QStringDecoder::QStringDecoder(const QString &name, Flags flags = Flag::Default)
|
||||
\since 6.8
|
||||
|
||||
Creates an decoder object using \a name and \a flags.
|
||||
If \a name is not the name of a known encoding an invalid converter will get created.
|
||||
\note In Qt versions prior to 6.8, this function took only a \c{const char *},
|
||||
which was expected to be UTF-8-encoded.
|
||||
|
||||
\sa isValid()
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -30,12 +30,9 @@ public:
|
|||
constexpr explicit QStringEncoder(Encoding encoding, Flags flags = Flag::Default)
|
||||
: QStringConverter(encoding, flags)
|
||||
{}
|
||||
explicit QStringEncoder(const char *name, Flags flags = Flag::Default)
|
||||
explicit QStringEncoder(QAnyStringView name, Flags flags = Flag::Default)
|
||||
: QStringConverter(name, flags)
|
||||
{}
|
||||
Q_WEAK_OVERLOAD explicit QStringEncoder(const QString &name, Flags flags = Flag::Default)
|
||||
: QStringEncoder(name.toLatin1().constData(), flags)
|
||||
{}
|
||||
|
||||
template<typename T>
|
||||
struct DecodedData
|
||||
|
|
@ -95,12 +92,9 @@ public:
|
|||
constexpr QStringDecoder() noexcept
|
||||
: QStringConverter()
|
||||
{}
|
||||
explicit QStringDecoder(const char *name, Flags f = Flag::Default)
|
||||
explicit QStringDecoder(QAnyStringView name, Flags f = Flag::Default)
|
||||
: QStringConverter(name, f)
|
||||
{}
|
||||
Q_WEAK_OVERLOAD explicit QStringDecoder(const QString &name, Flags f = Flag::Default)
|
||||
: QStringDecoder(name.toLatin1().constData(), f)
|
||||
{}
|
||||
|
||||
template<typename T>
|
||||
struct EncodedData
|
||||
|
|
|
|||
Loading…
Reference in New Issue