diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2021-08-13 16:22:38 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2021-08-16 18:53:56 +0200 |
commit | 9009a36c01a5539d9a4f21242feaab86c90eaf01 (patch) | |
tree | 8f9953c2a8906852b4e59d44d6b81c5b1a2c9711 /src | |
parent | 06235d36ae9d00366215e748d80ff0faed3c2124 (diff) |
Fix some errors in docs of string-related classes
- Fixed various texts in docs for QStringView, QUtf8StringView and
QAnyStringView copied from QString, that are still talking about string
or string reference instead of string view.
- Replaced 'string-view' with 'string view', which is the more commonly
used form.
- Fixed the wrong usage of uppercase 'If' in some places.
- Did minor adjusments, to make the docs consistent with docs of
QByteArray/QByteArrayView.
Change-Id: Ifb905e00957e869a8befad5a36d6b00b6e621a04
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/text/qanystringview.qdoc | 8 | ||||
-rw-r--r-- | src/corelib/text/qstring.cpp | 30 | ||||
-rw-r--r-- | src/corelib/text/qstringview.cpp | 133 | ||||
-rw-r--r-- | src/corelib/text/qutf8stringview.qdoc | 28 |
4 files changed, 100 insertions, 99 deletions
diff --git a/src/corelib/text/qanystringview.qdoc b/src/corelib/text/qanystringview.qdoc index cb98fb0052..3ac5aafbd4 100644 --- a/src/corelib/text/qanystringview.qdoc +++ b/src/corelib/text/qanystringview.qdoc @@ -263,7 +263,7 @@ /*! \fn const void *QAnyStringView::data() const - Returns a const pointer to the first character in the string. + Returns a const pointer to the first character in the string view. \note The character array represented by the return value is \e not null-terminated. @@ -333,7 +333,7 @@ /*! \fn QChar QAnyStringView::front() const - Returns the first character in the string. + Returns the first character in the string view. This function is provided for STL compatibility. @@ -346,7 +346,7 @@ /*! \fn QChar QAnyStringView::back() const - Returns the last character in the string. + Returns the last character in the string view. This function is provided for STL compatibility. @@ -387,7 +387,7 @@ Convert \a s to a QAnyStringView ignoring \c{s.isNull()}. - Returns a string-view that references \a{s}'s data, but is never null. + Returns a string view that references \a{s}'s data, but is never null. This is a faster way to convert a QString or QByteArray to a QAnyStringView, if null QStrings or QByteArrays can legitimately be treated as empty ones. diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index ddb12effd0..042b97d1cf 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -6871,8 +6871,8 @@ QString QString::vasprintf(const char *cformat, va_list ap) If \a ok is not \nullptr, failure is reported by setting *\a{ok} to \c false, and success by setting *\a{ok} to \c true. - If \a base is 0, the C language convention is used: If the string - begins with "0x", base 16 is used; if the string begins with "0", + If \a base is 0, the C language convention is used: if the string + begins with "0x", base 16 is used; otherwise, if the string begins with "0", base 8 is used; otherwise, base 10 is used. The string conversion will always happen in the 'C' locale. For @@ -6913,8 +6913,8 @@ qlonglong QString::toIntegral_helper(QStringView string, bool *ok, int base) If \a ok is not \nullptr, failure is reported by setting *\a{ok} to \c false, and success by setting *\a{ok} to \c true. - If \a base is 0, the C language convention is used: If the string - begins with "0x", base 16 is used; if the string begins with "0", + If \a base is 0, the C language convention is used: if the string + begins with "0x", base 16 is used; otherwise, if the string begins with "0", base 8 is used; otherwise, base 10 is used. The string conversion will always happen in the 'C' locale. For @@ -6956,8 +6956,8 @@ qulonglong QString::toIntegral_helper(QStringView string, bool *ok, uint base) If \a ok is not \nullptr, failure is reported by setting *\a{ok} to \c false, and success by setting *\a{ok} to \c true. - If \a base is 0, the C language convention is used: If the string - begins with "0x", base 16 is used; if the string begins with "0", + If \a base is 0, the C language convention is used: if the string + begins with "0x", base 16 is used; otherwise, if the string begins with "0", base 8 is used; otherwise, base 10 is used. The string conversion will always happen in the 'C' locale. For @@ -6982,8 +6982,8 @@ qulonglong QString::toIntegral_helper(QStringView string, bool *ok, uint base) If \a ok is not \nullptr, failure is reported by setting *\a{ok} to \c false, and success by setting *\a{ok} to \c true. - If \a base is 0, the C language convention is used: If the string - begins with "0x", base 16 is used; if the string begins with "0", + If \a base is 0, the C language convention is used: if the string + begins with "0x", base 16 is used; otherwise, if the string begins with "0", base 8 is used; otherwise, base 10 is used. The string conversion will always happen in the 'C' locale. For @@ -7007,8 +7007,8 @@ qulonglong QString::toIntegral_helper(QStringView string, bool *ok, uint base) If \a ok is not \nullptr, failure is reported by setting *\a{ok} to \c false, and success by setting *\a{ok} to \c true. - If \a base is 0, the C language convention is used: If the string - begins with "0x", base 16 is used; if the string begins with "0", + If \a base is 0, the C language convention is used: if the string + begins with "0x", base 16 is used; otherwise, if the string begins with "0", base 8 is used; otherwise, base 10 is used. The string conversion will always happen in the 'C' locale. For @@ -7032,8 +7032,8 @@ qulonglong QString::toIntegral_helper(QStringView string, bool *ok, uint base) If \a ok is not \nullptr, failure is reported by setting *\a{ok} to \c false, and success by setting *\a{ok} to \c true. - If \a base is 0, the C language convention is used: If the string - begins with "0x", base 16 is used; if the string begins with "0", + If \a base is 0, the C language convention is used: if the string + begins with "0x", base 16 is used; otherwise, if the string begins with "0", base 8 is used; otherwise, base 10 is used. The string conversion will always happen in the 'C' locale. For @@ -7058,8 +7058,8 @@ qulonglong QString::toIntegral_helper(QStringView string, bool *ok, uint base) If \a ok is not \nullptr, failure is reported by setting *\a{ok} to \c false, and success by setting *\a{ok} to \c true. - If \a base is 0, the C language convention is used: If the string - begins with "0x", base 16 is used; if the string begins with "0", + If \a base is 0, the C language convention is used: if the string + begins with "0x", base 16 is used; otherwise, if the string begins with "0", base 8 is used; otherwise, base 10 is used. The string conversion will always happen in the 'C' locale. For @@ -7084,7 +7084,7 @@ qulonglong QString::toIntegral_helper(QStringView string, bool *ok, uint base) If \a ok is not \nullptr, failure is reported by setting *\a{ok} to \c false, and success by setting *\a{ok} to \c true. - If \a base is 0, the C language convention is used: If the string + If \a base is 0, the C language convention is used: if the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used. diff --git a/src/corelib/text/qstringview.cpp b/src/corelib/text/qstringview.cpp index eb141ca303..d1b01934ff 100644 --- a/src/corelib/text/qstringview.cpp +++ b/src/corelib/text/qstringview.cpp @@ -352,7 +352,7 @@ QT_BEGIN_NAMESPACE /*! \fn const QChar *QStringView::data() const - Returns a const pointer to the first character in the string. + Returns a const pointer to the first character in the string view. \note The character array represented by the return value is \e not null-terminated. @@ -363,7 +363,7 @@ QT_BEGIN_NAMESPACE \fn const QChar *QStringView::constData() const \since 6.0 - Returns a const pointer to the first character in the string. + Returns a const pointer to the first character in the string view. \note The character array represented by the return value is \e not null-terminated. @@ -373,7 +373,7 @@ QT_BEGIN_NAMESPACE /*! \fn const storage_type *QStringView::utf16() const - Returns a const pointer to the first character in the string. + Returns a const pointer to the first character in the string view. \c{storage_type} is \c{char16_t}. @@ -386,7 +386,7 @@ QT_BEGIN_NAMESPACE \fn QStringView::const_iterator QStringView::begin() const Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first character in - the string. + the string view. This function is provided for STL compatibility. @@ -444,7 +444,7 @@ QT_BEGIN_NAMESPACE \fn QStringView::const_reverse_iterator QStringView::rbegin() const Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first - character in the string, in reverse order. + character in the string view, in reverse order. This function is provided for STL compatibility. @@ -465,7 +465,7 @@ QT_BEGIN_NAMESPACE \fn QStringView::const_reverse_iterator QStringView::rend() const Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past - the last character in the string, in reverse order. + the last character in the string view, in reverse order. This function is provided for STL compatibility. @@ -574,7 +574,7 @@ QT_BEGIN_NAMESPACE /*! \fn QChar QStringView::front() const - Returns the first character in the string. Same as first(). + Returns the first character in the string view. Same as first(). This function is provided for STL compatibility. @@ -587,7 +587,7 @@ QT_BEGIN_NAMESPACE /*! \fn QChar QStringView::back() const - Returns the last character in the string. Same as last(). + Returns the last character in the string view. Same as last(). This function is provided for STL compatibility. @@ -600,7 +600,7 @@ QT_BEGIN_NAMESPACE /*! \fn QChar QStringView::first() const - Returns the first character in the string. Same as front(). + Returns the first character in the string view. Same as front(). This function is provided for compatibility with other Qt containers. @@ -613,7 +613,7 @@ QT_BEGIN_NAMESPACE /*! \fn QChar QStringView::last() const - Returns the last character in the string. Same as back(). + Returns the last character in the string view. Same as back(). This function is provided for compatibility with other Qt containers. @@ -632,8 +632,8 @@ QT_BEGIN_NAMESPACE \deprecated Use sliced() instead in new code. Returns an empty string view if \a start exceeds the - length of the string. If there are less than \a length characters - available in the string starting at \a start, or if + length of the string view. If there are less than \a length characters + available in the string view starting at \a start, or if \a length is negative (default), the function returns all characters that are available from \a start. @@ -648,7 +648,7 @@ QT_BEGIN_NAMESPACE Returns the substring of length \a length starting at position 0 in this object. - The entire string is returned if \a length is greater than or equal + The entire string view is returned if \a length is greater than or equal to size(), or less than zero. \sa first(), last(), sliced(), startsWith(), chopped(), chop(), truncate() @@ -662,7 +662,7 @@ QT_BEGIN_NAMESPACE Returns the substring of length \a length starting at position size() - \a length in this object. - The entire string is returned if \a length is greater than or equal + The entire string view is returned if \a length is greater than or equal to size(), or less than zero. \sa first(), last(), sliced(), endsWith(), chopped(), chop(), truncate() @@ -673,7 +673,7 @@ QT_BEGIN_NAMESPACE \since 6.0 Returns a string view that points to the first \a n characters - of this string. + of this string view. \note The behavior is undefined when \a n < 0 or \a n > size(). @@ -684,7 +684,8 @@ QT_BEGIN_NAMESPACE \fn QStringView QStringView::last(qsizetype n) const \since 6.0 - Returns a string view that points to the last \a n characters of this string. + Returns a string view that points to the last \a n characters of this string + view. \note The behavior is undefined when \a n < 0 or \a n > size(). @@ -695,7 +696,7 @@ QT_BEGIN_NAMESPACE \fn QStringView QStringView::sliced(qsizetype pos, qsizetype n) const \since 6.0 - Returns a string view that points to \a n characters of this string, + Returns a string view that points to \a n characters of this string view, starting at position \a pos. \note The behavior is undefined when \a pos < 0, \a n < 0, @@ -768,8 +769,8 @@ QT_BEGIN_NAMESPACE \fn int QStringView::compare(QStringView str, Qt::CaseSensitivity cs) const \since 5.12 - Returns an integer that compares to zero as this string-view compares to the - string-view \a str. + Returns an integer that compares to zero as this string view compares to the + string view \a str. If \a cs is Qt::CaseSensitive (the default), the comparison is case sensitive; otherwise the comparison is case-insensitive. @@ -783,7 +784,7 @@ QT_BEGIN_NAMESPACE \fn int QStringView::compare(QChar ch, Qt::CaseSensitivity cs) const \since 5.15 - Returns an integer that compares to zero as this string-view compares to the + Returns an integer that compares to zero as this string view compares to the Latin-1 string \a l1, or character \a ch, respectively. If \a cs is Qt::CaseSensitive (the default), the comparison is case sensitive; @@ -811,7 +812,7 @@ QT_BEGIN_NAMESPACE \fn bool QStringView::startsWith(QChar ch) const \fn bool QStringView::startsWith(QChar ch, Qt::CaseSensitivity cs) const - Returns \c true if this string-view starts with string-view \a str, + Returns \c true if this string view starts with string view \a str, Latin-1 string \a l1, or character \a ch, respectively; otherwise returns \c false. @@ -827,7 +828,7 @@ QT_BEGIN_NAMESPACE \fn bool QStringView::endsWith(QChar ch) const \fn bool QStringView::endsWith(QChar ch, Qt::CaseSensitivity cs) const - Returns \c true if this string-view ends with string-view \a str, + Returns \c true if this string view ends with string view \a str, Latin-1 string \a l1, or character \a ch, respectively; otherwise returns \c false. @@ -843,8 +844,8 @@ QT_BEGIN_NAMESPACE \fn qsizetype QStringView::indexOf(QChar c, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const \since 5.14 - Returns the index position of the first occurrence of the string-view \a str, - Latin-1 string \a l1, or character \a ch, respectively, in this string-view, + Returns the index position of the first occurrence of the string view \a str, + Latin-1 string \a l1, or character \a ch, respectively, in this string view, searching forward from index position \a from. Returns -1 if \a str is not found. If \a cs is Qt::CaseSensitive (default), the search is case @@ -862,7 +863,7 @@ QT_BEGIN_NAMESPACE \fn bool QStringView::contains(QChar c, Qt::CaseSensitivity cs) const \since 5.14 - Returns \c true if this string-view contains an occurrence of the string-view + Returns \c true if this string view contains an occurrence of the string view \a str, Latin-1 string \a l1, or character \a ch; otherwise returns \c false. If \a cs is Qt::CaseSensitive (the default), the search is @@ -877,8 +878,8 @@ QT_BEGIN_NAMESPACE \fn qsizetype QStringView::lastIndexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs) const \since 5.14 - Returns the index position of the last occurrence of the string-view \a str, - Latin-1 string \a l1, or character \a ch, respectively, in this string-view, + Returns the index position of the last occurrence of the string view \a str, + Latin-1 string \a l1, or character \a ch, respectively, in this string view, searching backward from index position \a from. If \a from is -1 (default), the search starts at the last character; if \a from is -2, at the next to last character and so on. Returns -1 if \a str is not found. @@ -943,7 +944,7 @@ QT_BEGIN_NAMESPACE For historical reasons, this function counts overlapping matches. This behavior is different from simply iterating over the matches - in the string using QRegularExpressionMatchIterator. + in the string view using QRegularExpressionMatchIterator. \sa QRegularExpression::globalMatch() @@ -977,7 +978,7 @@ QT_BEGIN_NAMESPACE /*! \fn QByteArray QStringView::toUtf8() const - Returns a UTF-8 representation of the string as a QByteArray. + Returns a UTF-8 representation of the string view as a QByteArray. UTF-8 is a Unicode codec and can represent all characters in a Unicode string like QString. @@ -988,11 +989,11 @@ QT_BEGIN_NAMESPACE /*! \fn QList<uint> QStringView::toUcs4() const - Returns a UCS-4/UTF-32 representation of the string as a QList<uint>. + Returns a UCS-4/UTF-32 representation of the string view as a QList<uint>. UCS-4 is a Unicode codec and therefore it is lossless. All characters from - this string will be encoded in UCS-4. Any invalid sequence of code units in - this string is replaced by the Unicode replacement character + this string view will be encoded in UCS-4. Any invalid sequence of code units in + this string view is replaced by the Unicode replacement character (QChar::ReplacementCharacter, which corresponds to \c{U+FFFD}). The returned list is not 0-terminated. @@ -1007,7 +1008,7 @@ QT_BEGIN_NAMESPACE Convert \a s to a QStringView ignoring \c{s.isNull()}. - Returns a string-view that references \a{s}' data, but is never null. + Returns a string view that references \a{s}' data, but is never null. This is a faster way to convert a QString to a QStringView, if null QStrings can legitimately be treated as empty ones. @@ -1019,7 +1020,7 @@ QT_BEGIN_NAMESPACE \fn bool QStringView::isRightToLeft() const \since 5.11 - Returns \c true if the string is read right to left. + Returns \c true if the string view is read right to left. \sa QString::isRightToLeft() */ @@ -1028,7 +1029,7 @@ QT_BEGIN_NAMESPACE \fn bool QStringView::isValidUtf16() const \since 5.15 - Returns \c true if the string contains valid UTF-16 encoded data, + Returns \c true if the string view contains valid UTF-16 encoded data, or \c false otherwise. Note that this function does not perform any special validation of the @@ -1043,11 +1044,11 @@ QT_BEGIN_NAMESPACE \fn QStringView::toWCharArray(wchar_t *array) const \since 5.14 - Transcribes this string into the given \a array. + Transcribes this string view into the given \a array. The caller is responsible for ensuring \a array is large enough to hold the - \c wchar_t encoding of this string (allocating the array with the same length - as the string is always sufficient). The array is encoded in UTF-16 on + \c wchar_t encoding of this string view (allocating the array with the same length + as the string view is always sufficient). The array is encoded in UTF-16 on platforms where \c wchar_t is 2 bytes wide (e.g. Windows); otherwise (Unix systems), \c wchar_t is assumed to be 4 bytes wide and the data is written in UCS-4. @@ -1066,7 +1067,7 @@ QT_BEGIN_NAMESPACE \overload count() Returns the number of occurrences of the character \a ch in the - string reference. + string view. If \a cs is Qt::CaseSensitive (default), the search is case sensitive; otherwise the search is case insensitive. @@ -1081,7 +1082,7 @@ QT_BEGIN_NAMESPACE \overload count() Returns the number of (potentially overlapping) occurrences of the - string reference \a str in this string reference. + string view \a str in this string view. If \a cs is Qt::CaseSensitive (default), the search is case sensitive; otherwise the search is case insensitive. @@ -1092,15 +1093,15 @@ QT_BEGIN_NAMESPACE /*! \fn qint64 QStringView::toLongLong(bool *ok, int base) const - Returns the string converted to a \c{long long} using base \a + Returns the string view converted to a \c{long long} using base \a base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. If \a ok is not \nullptr, failure is reported by setting *\a{ok} to \c false, and success by setting *\a{ok} to \c true. - If \a base is 0, the C language convention is used: If the string - begins with "0x", base 16 is used; if the string begins with "0", + If \a base is 0, the C language convention is used: if the string view + begins with "0x", base 16 is used; otherwise, if the string view begins with "0", base 8 is used; otherwise, base 10 is used. The string conversion will always happen in the 'C' locale. For locale @@ -1114,15 +1115,15 @@ QT_BEGIN_NAMESPACE /*! \fn quint64 QStringView::toULongLong(bool *ok, int base) const - Returns the string converted to an \c{unsigned long long} using base \a + Returns the string view converted to an \c{unsigned long long} using base \a base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. If \a ok is not \nullptr, failure is reported by setting *\a{ok} to \c false, and success by setting *\a{ok} to \c true. - If \a base is 0, the C language convention is used: If the string - begins with "0x", base 16 is used; if the string begins with "0", + If \a base is 0, the C language convention is used: if the string view + begins with "0x", base 16 is used; otherwise, if the string view begins with "0", base 8 is used; otherwise, base 10 is used. The string conversion will always happen in the 'C' locale. For locale @@ -1136,15 +1137,15 @@ QT_BEGIN_NAMESPACE /*! \fn long QStringView::toLong(bool *ok, int base) const - Returns the string converted to a \c long using base \a + Returns the string view converted to a \c long using base \a base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. If \a ok is not \nullptr, failure is reported by setting *\a{ok} to \c false, and success by setting *\a{ok} to \c true. - If \a base is 0, the C language convention is used: If the string - begins with "0x", base 16 is used; if the string begins with "0", + If \a base is 0, the C language convention is used: if the string view + begins with "0x", base 16 is used; otherwise, if the string view begins with "0", base 8 is used; otherwise, base 10 is used. The string conversion will always happen in the 'C' locale. For locale @@ -1158,15 +1159,15 @@ QT_BEGIN_NAMESPACE /*! \fn ulong QStringView::toULong(bool *ok, int base) const - Returns the string converted to an \c{unsigned long} using base \a + Returns the string view converted to an \c{unsigned long} using base \a base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. If \a ok is not \nullptr, failure is reported by setting *\a{ok} to \c false, and success by setting *\a{ok} to \c true. - If \a base is 0, the C language convention is used: If the string - begins with "0x", base 16 is used; if the string begins with "0", + If \a base is 0, the C language convention is used: if the string view + begins with "0x", base 16 is used; otherwise, if the string view begins with "0", base 8 is used; otherwise, base 10 is used. The string conversion will always happen in the 'C' locale. For locale @@ -1180,15 +1181,15 @@ QT_BEGIN_NAMESPACE /*! \fn int QStringView::toInt(bool *ok, int base) const - Returns the string converted to an \c int using base \a + Returns the string view converted to an \c int using base \a base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. If \a ok is not \nullptr, failure is reported by setting *\a{ok} to \c false, and success by setting *\a{ok} to \c true. - If \a base is 0, the C language convention is used: If the string - begins with "0x", base 16 is used; if the string begins with "0", + If \a base is 0, the C language convention is used: if the string view + begins with "0x", base 16 is used; otherwise, if the string view begins with "0", base 8 is used; otherwise, base 10 is used. The string conversion will always happen in the 'C' locale. For locale @@ -1202,15 +1203,15 @@ QT_BEGIN_NAMESPACE /*! \fn uint QStringView::toUInt(bool *ok, int base) const - Returns the string converted to an \c{unsigned int} using base \a + Returns the string view converted to an \c{unsigned int} using base \a base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. If \a ok is not \nullptr, failure is reported by setting *\a{ok} to \c false, and success by setting *\a{ok} to \c true. - If \a base is 0, the C language convention is used: If the string - begins with "0x", base 16 is used; if the string begins with "0", + If \a base is 0, the C language convention is used: if the string view + begins with "0x", base 16 is used; otherwise, if the string view begins with "0", base 8 is used; otherwise, base 10 is used. The string conversion will always happen in the 'C' locale. For locale @@ -1224,15 +1225,15 @@ QT_BEGIN_NAMESPACE /*! \fn short QStringView::toShort(bool *ok, int base) const - Returns the string converted to a \c short using base \a + Returns the string view converted to a \c short using base \a base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. If \a ok is not \nullptr, failure is reported by setting *\a{ok} to \c false, and success by setting *\a{ok} to \c true. - If \a base is 0, the C language convention is used: If the string - begins with "0x", base 16 is used; if the string begins with "0", + If \a base is 0, the C language convention is used: if the string view + begins with "0x", base 16 is used; otherwise, if the string view begins with "0", base 8 is used; otherwise, base 10 is used. The string conversion will always happen in the 'C' locale. For locale @@ -1246,15 +1247,15 @@ QT_BEGIN_NAMESPACE /*! \fn ushort QStringView::toUShort(bool *ok, int base) const - Returns the string converted to an \c{unsigned short} using base \a + Returns the string view converted to an \c{unsigned short} using base \a base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. If \a ok is not \nullptr, failure is reported by setting *\a{ok} to \c false, and success by setting *\a{ok} to \c true. - If \a base is 0, the C language convention is used: If the string - begins with "0x", base 16 is used; if the string begins with "0", + If \a base is 0, the C language convention is used: if the string view + begins with "0x", base 16 is used; otherwise, if the string view begins with "0", base 8 is used; otherwise, base 10 is used. The string conversion will always happen in the 'C' locale. For locale @@ -1268,7 +1269,7 @@ QT_BEGIN_NAMESPACE /*! \fn double QStringView::toDouble(bool *ok) const - Returns the string converted to a \c double value. + Returns the string view converted to a \c double value. Returns an infinity if the conversion overflows or 0.0 if the conversion fails for other reasons (e.g. underflow). @@ -1291,7 +1292,7 @@ QT_BEGIN_NAMESPACE /*! \fn float QStringView::toFloat(bool *ok) const - Returns the string converted to a \c float value. + Returns the string view converted to a \c float value. Returns an infinity if the conversion overflows or 0.0 if the conversion fails for other reasons (e.g. underflow). diff --git a/src/corelib/text/qutf8stringview.qdoc b/src/corelib/text/qutf8stringview.qdoc index 25048ab424..683af4e423 100644 --- a/src/corelib/text/qutf8stringview.qdoc +++ b/src/corelib/text/qutf8stringview.qdoc @@ -353,7 +353,7 @@ /*! \fn QUtf8StringView::data() const - Returns a const pointer to the first code point in the string. + Returns a const pointer to the first code point in the string view. \note The character array represented by the return value is \e not null-terminated. @@ -363,7 +363,7 @@ /*! \fn QUtf8StringView::utf8() const - Returns a const pointer to the first code point in the string. + Returns a const pointer to the first code point in the string view. The result is returned as a \c{const char8_t*}, so this function is only available when compiling in C++20 mode. @@ -377,7 +377,7 @@ \fn QUtf8StringView::const_iterator QUtf8StringView::begin() const Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first code point in - the string. + the string view. This function is provided for STL compatibility. @@ -418,7 +418,7 @@ \fn QUtf8StringView::const_reverse_iterator QUtf8StringView::rbegin() const Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first - code point in the string, in reverse order. + code point in the string view, in reverse order. This function is provided for STL compatibility. @@ -439,7 +439,7 @@ \fn QUtf8StringView::const_reverse_iterator QUtf8StringView::rend() const Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past - the last code point in the string, in reverse order. + the last code point in the string view, in reverse order. This function is provided for STL compatibility. @@ -529,7 +529,7 @@ /*! \fn QUtf8StringView::front() const - Returns the first code point in the string. Same as first(). + Returns the first code point in the string view. Same as first(). This function is provided for STL compatibility. @@ -542,7 +542,7 @@ /*! \fn QUtf8StringView::back() const - Returns the last code point in the string. Same as last(). + Returns the last code point in the string view. Same as last(). This function is provided for STL compatibility. @@ -561,8 +561,8 @@ \deprecated Use sliced() instead in new code. Returns an empty string view if \a n exceeds the - length of the string. If there are less than \a n code points - available in the string starting at \a pos, or if + length of the string view. If there are less than \a n code points + available in the string view starting at \a pos, or if \a n is negative (default), the function returns all code points that are available from \a pos. @@ -577,7 +577,7 @@ Returns the substring of length \a n starting at position 0 in this object. - The entire string is returned if \a n is greater than or equal + The entire string view is returned if \a n is greater than or equal to size(), or less than zero. \sa first(), last(), sliced(), chopped(), chop(), truncate() @@ -591,7 +591,7 @@ Returns the substring of length \a n starting at position size() - \a n in this object. - The entire string is returned if \a n is greater than or equal + The entire string view is returned if \a n is greater than or equal to size(), or less than zero. \sa first(), last(), sliced(), chopped(), chop(), truncate() @@ -601,7 +601,7 @@ \fn QUtf8StringView::first(qsizetype n) const Returns a string view that contains the first \a n code points - of this string. + of this string view. \note The behavior is undefined when \a n < 0 or \a n > size(). @@ -611,7 +611,7 @@ /*! \fn QUtf8StringView::last(qsizetype n) const - Returns a string view that contains the last \a n code points of this string. + Returns a string view that contains the last \a n code points of this string view. \note The behavior is undefined when \a n < 0 or \a n > size(). @@ -685,7 +685,7 @@ Convert \a s to a QUtf8StringView ignoring \c{s.isNull()}. - Returns a string-view that references \a{s}'s data, but is never null. + Returns a string view that references \a{s}'s data, but is never null. This is a faster way to convert a QByteArray to a QUtf8StringView, if null QByteArrays can legitimately be treated as empty ones. |