Remove QTextCodec references from QString docs

Change-Id: I2882f8aed61d92ed5eff6efd2e65679e6688454f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Lars Knoll 2020-04-30 15:15:56 +02:00
parent 2b8863a98c
commit b88720eb82
2 changed files with 27 additions and 29 deletions

View File

@ -1561,7 +1561,7 @@ const QString::Null QString::null = { };
the QChar data. The pointer is guaranteed to remain valid until a the QChar data. The pointer is guaranteed to remain valid until a
non-const function is called on the QString. non-const function is called on the QString.
\section1 Converting Between 8-Bit Strings and Unicode Strings \section1 Converting Between encoded strings data and QString
QString provides the following three functions that return a QString provides the following three functions that return a
\c{const char *} version of the string as QByteArray: toUtf8(), \c{const char *} version of the string as QByteArray: toUtf8(),
@ -1573,12 +1573,13 @@ const QString::Null QString::null = { };
superset of US-ASCII (ANSI X3.4-1986) that supports the entire superset of US-ASCII (ANSI X3.4-1986) that supports the entire
Unicode character set through multibyte sequences. Unicode character set through multibyte sequences.
\li toLocal8Bit() returns an 8-bit string using the system's local \li toLocal8Bit() returns an 8-bit string using the system's local
encoding. encoding. This is the same as toUtf8() on Unix systems.
\endlist \endlist
To convert from one of these encodings, QString provides To convert from one of these encodings, QString provides
fromLatin1(), fromUtf8(), and fromLocal8Bit(). Other fromLatin1(), fromUtf8(), and fromLocal8Bit(). Other
encodings are supported through the QTextCodec class. encodings are supported through the QStringEncoder and QStringDecoder
classes.
As mentioned above, QString provides a lot of functions and As mentioned above, QString provides a lot of functions and
operators that make it easy to interoperate with \c{const char *} operators that make it easy to interoperate with \c{const char *}
@ -1613,8 +1614,7 @@ const QString::Null QString::null = { };
Similarly, you must call toLatin1(), toUtf8(), or Similarly, you must call toLatin1(), toUtf8(), or
toLocal8Bit() explicitly to convert the QString to an 8-bit toLocal8Bit() explicitly to convert the QString to an 8-bit
string. (Other encodings are supported through the QTextCodec string.
class.)
\table 100 % \table 100 %
\header \header
@ -5174,7 +5174,7 @@ QByteArray QString::toLatin1_helper_inplace(QString &s)
characters. Those characters may be suppressed or replaced with a characters. Those characters may be suppressed or replaced with a
question mark. question mark.
\sa fromLatin1(), toUtf8(), toLocal8Bit(), QTextCodec \sa fromLatin1(), toUtf8(), toLocal8Bit(), QStringEncoder
*/ */
static QByteArray qt_convert_to_local_8bit(QStringView string); static QByteArray qt_convert_to_local_8bit(QStringView string);
@ -5186,15 +5186,14 @@ static QByteArray qt_convert_to_local_8bit(QStringView string);
QByteArray. The returned byte array is undefined if the string QByteArray. The returned byte array is undefined if the string
contains characters not supported by the local 8-bit encoding. contains characters not supported by the local 8-bit encoding.
QTextCodec::codecForLocale() is used to perform the conversion from On Unix systems this is equivalen to toUtf8(), on Windows the systems
Unicode. If the locale encoding could not be determined, this function current code page is being used.
does the same as toLatin1().
If this string contains any characters that cannot be encoded in the If this string contains any characters that cannot be encoded in the
locale, the returned byte array is undefined. Those characters may be locale, the returned byte array is undefined. Those characters may be
suppressed or replaced by another. suppressed or replaced by another.
\sa fromLocal8Bit(), toLatin1(), toUtf8(), QTextCodec \sa fromLocal8Bit(), toLatin1(), toUtf8(), QStringEncoder
*/ */
QByteArray QString::toLocal8Bit_helper(const QChar *data, int size) QByteArray QString::toLocal8Bit_helper(const QChar *data, int size)
@ -5217,8 +5216,8 @@ static QByteArray qt_convert_to_local_8bit(QStringView string)
Returns a local 8-bit representation of \a string as a QByteArray. Returns a local 8-bit representation of \a string as a QByteArray.
QTextCodec::codecForLocale() is used to perform the conversion from On Unix systems this is equivalen to toUtf8(), on Windows the systems
Unicode. current code page is being used.
The behavior is undefined if \a string contains characters not The behavior is undefined if \a string contains characters not
supported by the locale's 8-bit encoding. supported by the locale's 8-bit encoding.
@ -5240,7 +5239,7 @@ static QByteArray qt_convert_to_utf8(QStringView str);
UTF-8 is a Unicode codec and can represent all characters in a Unicode UTF-8 is a Unicode codec and can represent all characters in a Unicode
string like QString. string like QString.
\sa fromUtf8(), toLatin1(), toLocal8Bit(), QTextCodec \sa fromUtf8(), toLatin1(), toLocal8Bit(), QStringEncoder
*/ */
QByteArray QString::toUtf8_helper(const QString &str) QByteArray QString::toUtf8_helper(const QString &str)
@ -5287,7 +5286,7 @@ static QVector<uint> qt_convert_to_ucs4(QStringView string);
The returned vector is not \\0'-terminated. The returned vector is not \\0'-terminated.
\sa fromUtf8(), toUtf8(), toLatin1(), toLocal8Bit(), QTextCodec, fromUcs4(), toWCharArray() \sa fromUtf8(), toUtf8(), toLatin1(), toLocal8Bit(), QStringEncoder, fromUcs4(), toWCharArray()
*/ */
QVector<uint> QString::toUcs4() const QVector<uint> QString::toUcs4() const
{ {
@ -5371,7 +5370,8 @@ QString::DataPointer QString::fromLatin1_helper(const char *str, int size)
If \a size is -1 (default), it is taken to be strlen(\a If \a size is -1 (default), it is taken to be strlen(\a
str). str).
QTextCodec::codecForLocale() is used to perform the conversion. On Unix systems this is equivalen to fromUtf8(), on Windows the systems
current code page is being used.
\sa toLocal8Bit(), fromLatin1(), fromUtf8() \sa toLocal8Bit(), fromLatin1(), fromUtf8()
*/ */
@ -12149,7 +12149,7 @@ qsizetype QtPrivate::lastIndexOf(QLatin1String haystack, qsizetype from, QLatin1
characters. Those characters may be suppressed or replaced with a characters. Those characters may be suppressed or replaced with a
question mark. question mark.
\sa toUtf8(), toLocal8Bit(), QTextCodec \sa toUtf8(), toLocal8Bit(), QStringEncoder
*/ */
QByteArray QStringRef::toLatin1() const QByteArray QStringRef::toLatin1() const
{ {
@ -12163,15 +12163,14 @@ QByteArray QStringRef::toLatin1() const
QByteArray. The returned byte array is undefined if the string QByteArray. The returned byte array is undefined if the string
contains characters not supported by the local 8-bit encoding. contains characters not supported by the local 8-bit encoding.
QTextCodec::codecForLocale() is used to perform the conversion from On Unix systems this is equivalen to toUtf8(), on Windows the systems
Unicode. If the locale encoding could not be determined, this function current code page is being used.
does the same as toLatin1().
If this string contains any characters that cannot be encoded in the If this string contains any characters that cannot be encoded in the
locale, the returned byte array is undefined. Those characters may be locale, the returned byte array is undefined. Those characters may be
suppressed or replaced by another. suppressed or replaced by another.
\sa toLatin1(), toUtf8(), QTextCodec \sa toLatin1(), toUtf8(), QStringEncoder
*/ */
QByteArray QStringRef::toLocal8Bit() const QByteArray QStringRef::toLocal8Bit() const
{ {
@ -12186,7 +12185,7 @@ QByteArray QStringRef::toLocal8Bit() const
UTF-8 is a Unicode codec and can represent all characters in a Unicode UTF-8 is a Unicode codec and can represent all characters in a Unicode
string like QString. string like QString.
\sa toLatin1(), toLocal8Bit(), QTextCodec \sa toLatin1(), toLocal8Bit(), QStringEncoder
*/ */
QByteArray QStringRef::toUtf8() const QByteArray QStringRef::toUtf8() const
{ {
@ -12205,7 +12204,7 @@ QByteArray QStringRef::toUtf8() const
The returned vector is not \\0'-terminated. The returned vector is not \\0'-terminated.
\sa toUtf8(), toLatin1(), toLocal8Bit(), QTextCodec \sa toUtf8(), toLatin1(), toLocal8Bit(), QStringEncoder
*/ */
QVector<uint> QStringRef::toUcs4() const QVector<uint> QStringRef::toUcs4() const
{ {

View File

@ -810,7 +810,7 @@ QT_BEGIN_NAMESPACE
The behavior is undefined if the string contains non-Latin1 characters. The behavior is undefined if the string contains non-Latin1 characters.
\sa toUtf8(), toLocal8Bit(), QTextCodec \sa toUtf8(), toLocal8Bit(), QStringEncoder
*/ */
/*! /*!
@ -818,14 +818,13 @@ QT_BEGIN_NAMESPACE
Returns a local 8-bit representation of the string as a QByteArray. Returns a local 8-bit representation of the string as a QByteArray.
QTextCodec::codecForLocale() is used to perform the conversion from On Unix systems this is equivalen to toUtf8(), on Windows the systems
Unicode. If the locale's encoding could not be determined, this function current code page is being used.
does the same as toLatin1().
The behavior is undefined if the string contains characters not The behavior is undefined if the string contains characters not
supported by the locale's 8-bit encoding. supported by the locale's 8-bit encoding.
\sa toLatin1(), toUtf8(), QTextCodec \sa toLatin1(), toUtf8(), QStringEncoder
*/ */
/*! /*!
@ -836,7 +835,7 @@ QT_BEGIN_NAMESPACE
UTF-8 is a Unicode codec and can represent all characters in a Unicode UTF-8 is a Unicode codec and can represent all characters in a Unicode
string like QString. string like QString.
\sa toLatin1(), toLocal8Bit(), QTextCodec \sa toLatin1(), toLocal8Bit(), QStringEncoder
*/ */
/*! /*!
@ -851,7 +850,7 @@ QT_BEGIN_NAMESPACE
The returned vector is not 0-terminated. The returned vector is not 0-terminated.
\sa toUtf8(), toLatin1(), toLocal8Bit(), QTextCodec \sa toUtf8(), toLatin1(), toLocal8Bit(), QStringEncoder
*/ */
/*! /*!