![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtCore More...
#include <qstringview.h>
Public Types | |
typedef char16_t | storage_type |
Alias for {char16_t}. | |
typedef const QChar | value_type |
Alias for {const QChar}. | |
typedef std::ptrdiff_t | difference_type |
Alias for {std::ptrdiff_t}. | |
typedef qsizetype | size_type |
Alias for qsizetype. | |
typedef value_type & | reference |
Alias for {value_type &}. | |
typedef value_type & | const_reference |
Alias for {value_type &}. | |
typedef value_type * | pointer |
Alias for {value_type *}. | |
typedef value_type * | const_pointer |
Alias for {value_type *}. | |
typedef pointer | iterator |
This typedef provides an STL-style const iterator for QStringView. | |
typedef const_pointer | const_iterator |
This typedef provides an STL-style const iterator for QStringView. | |
typedef std::reverse_iterator< iterator > | reverse_iterator |
This typedef provides an STL-style const reverse iterator for QStringView. | |
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
This typedef provides an STL-style const reverse iterator for QStringView. | |
Public Member Functions | |
constexpr | QStringView () noexcept |
Constructs a null string view. | |
constexpr | QStringView (std::nullptr_t) noexcept |
Constructs a null string view. | |
template<typename Char , if_compatible_char< Char > = true> | |
constexpr | QStringView (const Char *str, qsizetype len) |
Constructs a string view on str with length len. | |
template<typename Char , if_compatible_char< Char > = true> | |
constexpr | QStringView (const Char *f, const Char *l) |
Constructs a string view on first with length (last - first). | |
template<typename Pointer , if_compatible_pointer< Pointer > = true> | |
constexpr | QStringView (const Pointer &str) noexcept |
template<typename String , if_compatible_qstring_like< String > = true> | |
QStringView (const String &str) noexcept | |
template<typename Container , if_compatible_container< Container > = true> | |
constexpr Q_ALWAYS_INLINE | QStringView (const Container &c) noexcept |
QString | toString () const |
Returns a deep copy of this string view's data as a QString. | |
constexpr qsizetype | size () const noexcept |
Returns the size of this string view, in UTF-16 code units (that is, surrogate pairs count as two for the purposes of this function, the same as in QString). | |
const_pointer | data () const noexcept |
const_pointer | constData () const noexcept |
constexpr const storage_type * | utf16 () const noexcept |
constexpr QChar | operator[] (qsizetype n) const |
Returns the character at position n in this string view. | |
template<typename... Args> | |
QString | arg (Args &&...args) const |
QByteArray | toLatin1 () const |
Returns a Latin-1 representation of the string as a QByteArray. | |
QByteArray | toUtf8 () const |
Returns a UTF-8 representation of the string view as a QByteArray. | |
QByteArray | toLocal8Bit () const |
Returns a local 8-bit representation of the string as a QByteArray. | |
QList< uint > | toUcs4 () const |
Returns a UCS-4/UTF-32 representation of the string view as a QList<uint>. | |
constexpr QChar | at (qsizetype n) const noexcept |
Returns the character at position n in this string view. | |
constexpr QStringView | mid (qsizetype pos, qsizetype n=-1) const noexcept |
Returns the substring of length length starting at position start in this object. | |
constexpr QStringView | left (qsizetype n) const noexcept |
constexpr QStringView | right (qsizetype n) const noexcept |
constexpr QStringView | first (qsizetype n) const noexcept |
constexpr QStringView | last (qsizetype n) const noexcept |
constexpr QStringView | sliced (qsizetype pos) const noexcept |
constexpr QStringView | sliced (qsizetype pos, qsizetype n) const noexcept |
constexpr QStringView | chopped (qsizetype n) const noexcept |
Returns the substring of length size() - length starting at the beginning of this object. | |
constexpr void | truncate (qsizetype n) noexcept |
Truncates this string view to length length. | |
constexpr void | chop (qsizetype n) noexcept |
Truncates this string view by length characters. | |
QStringView | trimmed () const noexcept |
Strips leading and trailing whitespace and returns the result. | |
template<typename Needle , typename... Flags> | |
constexpr auto | tokenize (Needle &&needle, Flags...flags) const noexcept(noexcept(qTokenize(std::declval< const QStringView & >(), std::forward< Needle >(needle), flags...))) -> decltype(qTokenize(*this, std::forward< Needle >(needle), flags...)) |
int | compare (QStringView other, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
int | compare (QLatin1StringView other, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
int | compare (QUtf8StringView other, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
constexpr int | compare (QChar c) const noexcept |
int | compare (QChar c, Qt::CaseSensitivity cs) const noexcept |
int | localeAwareCompare (QStringView other) const |
bool | startsWith (QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
bool | startsWith (QLatin1StringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
bool | startsWith (QChar c) const noexcept |
bool | startsWith (QChar c, Qt::CaseSensitivity cs) const noexcept |
Returns true if this string view starts with. | |
bool | endsWith (QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
bool | endsWith (QLatin1StringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
bool | endsWith (QChar c) const noexcept |
bool | endsWith (QChar c, Qt::CaseSensitivity cs) const noexcept |
Returns true if this string view ends with. | |
qsizetype | indexOf (QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
qsizetype | indexOf (QStringView s, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
qsizetype | indexOf (QLatin1StringView s, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
bool | contains (QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
bool | contains (QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
bool | contains (QLatin1StringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
qsizetype | count (QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
qsizetype | count (QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
qsizetype | count (QLatin1StringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const |
qsizetype | lastIndexOf (QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
qsizetype | lastIndexOf (QChar c, qsizetype from, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
qsizetype | lastIndexOf (QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
qsizetype | lastIndexOf (QStringView s, qsizetype from, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
qsizetype | lastIndexOf (QLatin1StringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
qsizetype | lastIndexOf (QLatin1StringView s, qsizetype from, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
bool | isRightToLeft () const noexcept |
bool | isValidUtf16 () const noexcept |
short | toShort (bool *ok=nullptr, int base=10) const |
Returns the string view converted to a short using base base, which is 10 by default and must be between 2 and 36, or 0. | |
ushort | toUShort (bool *ok=nullptr, int base=10) const |
Returns the string view converted to an {unsigned short} using base base, which is 10 by default and must be between 2 and 36, or 0. | |
int | toInt (bool *ok=nullptr, int base=10) const |
Returns the string view converted to an int using base base, which is 10 by default and must be between 2 and 36, or 0. | |
uint | toUInt (bool *ok=nullptr, int base=10) const |
Returns the string view converted to an {unsigned int} using base base, which is 10 by default and must be between 2 and 36, or 0. | |
long | toLong (bool *ok=nullptr, int base=10) const |
Returns the string view converted to a long using base base, which is 10 by default and must be between 2 and 36, or 0. | |
ulong | toULong (bool *ok=nullptr, int base=10) const |
Returns the string view converted to an {unsigned long} using base base, which is 10 by default and must be between 2 and 36, or 0. | |
qlonglong | toLongLong (bool *ok=nullptr, int base=10) const |
Returns the string view converted to a {long long} using base base, which is 10 by default and must be between 2 and 36, or 0. | |
qulonglong | toULongLong (bool *ok=nullptr, int base=10) const |
Returns the string view converted to an {unsigned long long} using base base, which is 10 by default and must be between 2 and 36, or 0. | |
Q_CORE_EXPORT float | toFloat (bool *ok=nullptr) const |
Returns the string view converted to a float value. | |
Q_CORE_EXPORT double | toDouble (bool *ok=nullptr) const |
Returns the string view converted to a double value. | |
qsizetype | toWCharArray (wchar_t *array) const |
Q_CORE_EXPORT QList< QStringView > | split (QStringView sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const |
Splits the view into substring views wherever sep occurs, and returns the list of those string views. | |
Q_CORE_EXPORT QList< QStringView > | split (QChar sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const |
const_iterator | begin () const noexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first character in the string view. | |
const_iterator | end () const noexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary character after the last character in the list. | |
const_iterator | cbegin () const noexcept |
Same as begin(). | |
const_iterator | cend () const noexcept |
Same as end(). | |
const_reverse_iterator | rbegin () const noexcept |
Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first character in the string view, in reverse order. | |
const_reverse_iterator | rend () const noexcept |
Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past the last character in the string view, in reverse order. | |
const_reverse_iterator | crbegin () const noexcept |
Same as rbegin(). | |
const_reverse_iterator | crend () const noexcept |
Same as rend(). | |
constexpr bool | empty () const noexcept |
Returns whether this string view is empty - that is, whether {size() == 0}. | |
constexpr QChar | front () const |
constexpr QChar | back () const |
Returns the last character in the string view. | |
const_iterator | constBegin () const noexcept |
const_iterator | constEnd () const noexcept |
constexpr bool | isNull () const noexcept |
Returns whether this string view is null - that is, whether {data() == nullptr}. | |
constexpr bool | isEmpty () const noexcept |
Returns whether this string view is empty - that is, whether {size() == 0}. | |
constexpr qsizetype | length () const noexcept |
Same as size(). | |
constexpr QChar | first () const |
Returns the first character in the string view. | |
constexpr QChar | last () const |
Returns the last character in the string view. | |
template<typename... Args> | |
Q_ALWAYS_INLINE QString | arg (Args &&...args) const |
Static Public Member Functions | |
template<typename Char , size_t Size, if_compatible_char< Char > = true> | |
static constexpr QStringView | fromArray (const Char(&string)[Size]) noexcept |
Constructs a string view on the full character string literal string, including any trailing {Char(0)}. | |
Friends | |
bool | operator== (QStringView lhs, QStringView rhs) noexcept |
bool | operator!= (QStringView lhs, QStringView rhs) noexcept |
bool | operator< (QStringView lhs, QStringView rhs) noexcept |
bool | operator<= (QStringView lhs, QStringView rhs) noexcept |
bool | operator> (QStringView lhs, QStringView rhs) noexcept |
bool | operator>= (QStringView lhs, QStringView rhs) noexcept |
Operators for comparing lhs to rhs. | |
bool | operator== (QStringView lhs, QChar rhs) noexcept |
bool | operator!= (QStringView lhs, QChar rhs) noexcept |
bool | operator< (QStringView lhs, QChar rhs) noexcept |
bool | operator<= (QStringView lhs, QChar rhs) noexcept |
bool | operator> (QStringView lhs, QChar rhs) noexcept |
bool | operator>= (QStringView lhs, QChar rhs) noexcept |
bool | operator== (QChar lhs, QStringView rhs) noexcept |
bool | operator!= (QChar lhs, QStringView rhs) noexcept |
bool | operator< (QChar lhs, QStringView rhs) noexcept |
bool | operator<= (QChar lhs, QStringView rhs) noexcept |
bool | operator> (QChar lhs, QStringView rhs) noexcept |
bool | operator>= (QChar lhs, QStringView rhs) noexcept |
\inmodule QtCore
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QString API. \reentrant
A QStringView references a contiguous portion of a UTF-16 string it does not own. It acts as an interface type to all kinds of UTF-16 string, without the need to construct a QString first.
The UTF-16 string may be represented as an array (or an array-compatible data-structure such as QString, std::basic_string, etc.) of QChar, ushort
, char16_t
or (on platforms, such as Windows, where it is a 16-bit type) wchar_t
.
QStringView is designed as an interface type; its main use-case is as a function parameter type. When QStringViews are used as automatic variables or data members, care must be taken to ensure that the referenced string data (for example, owned by a QString) outlives the QStringView on all code paths, lest the string view ends up referencing deleted data.
When used as an interface type, QStringView allows a single function to accept a wide variety of UTF-16 string data sources. One function accepting QStringView thus replaces three function overloads (taking QString and {(const QChar*, qsizetype)}), while at the same time enabling even more string data sources to be passed to the function, such as
{u"Hello World"}, a
char16_t
string literal.
QStringViews should be passed by value, not by reference-to-const:
If you want to give your users maximum freedom in what strings they can pass to your function, accompany the QStringView overload with overloads for
\list
QStringView can also be used as the return value of a function. If you call a function returning QStringView, take extra care to not keep the QStringView around longer than the function promises to keep the referenced string data alive. If in doubt, obtain a strong reference to the data by calling toString() to convert the QStringView into a QString.
QStringView is a {Literal Type}, but since it stores data as {char16_t}, iteration is not
constexpr
(casts from {const char16_t*} to
{const QChar*}, which is not allowed in
constexpr
functions). You can use an indexed loop and/or utf16() in constexpr
contexts instead.
Definition at line 75 of file qstringview.h.
This typedef provides an STL-style const iterator for QStringView.
Definition at line 88 of file qstringview.h.
Alias for {value_type *}.
Provided for compatibility with the STL.
Definition at line 85 of file qstringview.h.
Alias for {value_type &}.
Provided for compatibility with the STL.
Definition at line 83 of file qstringview.h.
This typedef provides an STL-style const reverse iterator for QStringView.
Definition at line 90 of file qstringview.h.
Alias for {std::ptrdiff_t}.
Provided for compatibility with the STL.
Definition at line 80 of file qstringview.h.
This typedef provides an STL-style const iterator for QStringView.
QStringView does not support mutable iterators, so this is the same as const_iterator.
Definition at line 87 of file qstringview.h.
Alias for {value_type *}.
Provided for compatibility with the STL.
QStringView does not support mutable pointers, so this is the same as const_pointer.
Definition at line 84 of file qstringview.h.
Alias for {value_type &}.
Provided for compatibility with the STL.
QStringView does not support mutable references, so this is the same as const_reference.
Definition at line 82 of file qstringview.h.
This typedef provides an STL-style const reverse iterator for QStringView.
QStringView does not support mutable reverse iterators, so this is the same as const_reverse_iterator.
Definition at line 89 of file qstringview.h.
Alias for qsizetype.
Provided for compatibility with the STL.
Definition at line 81 of file qstringview.h.
Alias for {char16_t}.
Definition at line 78 of file qstringview.h.
Alias for {const QChar}.
Provided for compatibility with the STL.
Definition at line 79 of file qstringview.h.
|
inlineconstexprnoexcept |
Constructs a null string view.
Definition at line 126 of file qstringview.h.
Referenced by chopped(), compare(), contains(), endsWith(), first(), fromArray(), indexOf(), last(), lastIndexOf(), left(), mid(), right(), sliced(), sliced(), split(), split(), and startsWith().
|
inlineconstexprnoexcept |
|
inlineconstexpr |
Constructs a string view on str with length len.
The range {[str,len)} must remain valid for the lifetime of this string view object.
Passing \nullptr as str is safe if len is 0, too, and results in a null string view.
The behavior is undefined if len is negative or, when positive, if str is \nullptr.
This constructor only participates in overload resolution if Char
is a compatible character type. The compatible character types are: QChar
, ushort
, char16_t
and (on platforms, such as Windows, where it is a 16-bit type) wchar_t
.
Definition at line 131 of file qstringview.h.
|
inlineconstexpr |
Constructs a string view on first with length (last - first).
The range {[first,last)} must remain valid for the lifetime of this string view object.
Passing \nullptr
as first is safe if last is \nullptr, too, and results in a null string view.
The behavior is undefined if last precedes first, or first is \nullptr and last is not.
This constructor only participates in overload resolution if Char
is a compatible character type. The compatible character types are: QChar
, ushort
, char16_t
and (on platforms, such as Windows, where it is a 16-bit type) wchar_t
.
Definition at line 142 of file qstringview.h.
|
inlineconstexprnoexcept |
Definition at line 154 of file qstringview.h.
|
inlinenoexcept |
Definition at line 162 of file qstringview.h.
|
inlineconstexprnoexcept |
Definition at line 167 of file qstringview.h.
Q_ALWAYS_INLINE QString QStringView::arg | ( | Args &&... | args | ) | const |
Definition at line 1448 of file qstring.h.
References args, QtPrivate::argToQStringDispatch(), and QtPrivate::qStringLikeToArg().
|
inline |
Referenced by QString::arg(), and QLocale::createSeparatedList().
Returns the character at position n in this string view.
The behavior is undefined if n is negative or not less than size().
Definition at line 201 of file qstringview.h.
Referenced by QQmlJS::Dom::CommentInfo::CommentInfo(), QQmlJS::Dom::AstComments::collectComments(), createSvgGlyph(), QKeySequencePrivate::decodeString(), fontSizeSpec(), QQmlJS::Dom::FormatPartialStatus::handleTokens(), QQmlPropertyPrivate::initProperty(), QXmlUtils::isNCName(), macToQtFormat(), QTextHtmlParser::parseEntity(), QDateTimeParser::parseFormat(), processUrlForClassName(), qExtractFontFamiliesFromString(), QQmlJS::Dom::FormatPartialStatus::recalculateWithIndent(), and resolveColor().
|
inlineconstexpr |
Returns the last character in the string view.
\fn QChar QStringView::front() const Returns the first character in the string view. Same as first(). This function is provided for STL compatibility.
! [calling-on-empty-is-UB]
\sa back(), first(), last()
Same as last().
This function is provided for STL compatibility.
calling-on-empty-is-UB
Definition at line 401 of file qstringview.h.
References empty(), and Q_ASSERT.
Referenced by endsWith(), and last().
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first character in the string view.
This function is provided for STL compatibility.
Definition at line 390 of file qstringview.h.
Referenced by cbegin(), constBegin(), QQmlJS::Dom::inQString(), parseIp6(), rend(), and replace_helper().
|
inlinenoexcept |
Same as begin().
This function is provided for STL compatibility.
Definition at line 392 of file qstringview.h.
References begin().
|
inlinenoexcept |
Same as end().
This function is provided for STL compatibility.
Definition at line 393 of file qstringview.h.
Truncates this string view by length characters.
Same as {*this = left(size() - length)}.
Definition at line 235 of file qstringview.h.
References Q_ASSERT.
Referenced by QUrlPrivate::appendPath(), QQmlJSUtils::changeHandlerProperty(), QZipPrivate::fillFileInfo(), parseIp6(), parseLength(), and QDir::relativeFilePath().
|
inlineconstexprnoexcept |
Returns the substring of length size() - length starting at the beginning of this object.
Same as {left(size() - length)}.
Definition at line 230 of file qstringview.h.
References QStringView(), and Q_ASSERT.
|
inlineconstexprnoexcept |
Definition at line 250 of file qstringview.h.
References utf16().
|
inlinenoexcept |
Returns an integer that compares to zero as this string view compares to the Latin-1 string viewed by l1, or the character ch, respectively.
{search-comparison-case-sensitivity} {comparison}
Definition at line 252 of file qstringview.h.
References QStringView(), and QtPrivate::compareStrings().
|
inlinenoexcept |
Definition at line 70 of file qstring.h.
References QtPrivate::compareStrings().
|
inlinenoexcept |
Returns an integer that compares to zero as this string view compares to the string view str.
{search-comparison-case-sensitivity} {comparison}
Definition at line 246 of file qstringview.h.
References QtPrivate::compareStrings(), and other().
Referenced by QUrl::fromUserInput(), and QDir::relativeFilePath().
|
inlinenoexcept |
Returns an integer that compares to zero as this string view compares to the string view str.
{search-comparison-case-sensitivity} {comparison}
Definition at line 1007 of file qstring.h.
References QtPrivate::compareStrings(), and other().
|
inlinenoexcept |
Same as begin().
Definition at line 406 of file qstringview.h.
References begin().
Referenced by parseIp6().
|
inlinenoexcept |
\fn const QChar *QStringView::data() const
! [const-pointer-to-first-ch] Returns a const pointer to the first character in the string view.
\sa begin(), end(), utf16()
const-pointer-to-first-ch
Definition at line 183 of file qstringview.h.
Referenced by QQmlJS::Dom::inQString(), QHashedStringRef::operator==(), parsePathDataFast(), and resolveColor().
|
inlinenoexcept |
Same as end().
Definition at line 407 of file qstringview.h.
Referenced by parseIp6().
|
inlinenoexcept |
Returns true
if this string view contains an occurrence of
utf16-or-latin1-or-ch respectively; otherwise returns false
.
{search-comparison-case-sensitivity} {search}
Definition at line 279 of file qstringview.h.
References QStringView(), and indexOf().
Referenced by QAnyStringViewUtils::doesContain(), language::formatConnection(), QV4::StringPrototype::method_includes(), QHostAddress::parseSubnet(), qIsEffectiveTLD(), QTextBrowserPrivate::setSource(), and QQmlJS::Dom::QmlComponent::subComponentsNames().
|
inlinenoexcept |
|
inlinenoexcept |
Definition at line 281 of file qstringview.h.
References indexOf().
|
inlinenoexcept |
Definition at line 285 of file qstringview.h.
References QtPrivate::count().
|
inline |
Definition at line 84 of file qstring.h.
References QtPrivate::count().
|
inlinenoexcept |
Definition at line 287 of file qstringview.h.
References QtPrivate::count().
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Definition at line 182 of file qstringview.h.
Referenced by QDBusUtil::isValidMemberName(), QDBusUtil::isValidPartOfObjectPath(), QtPrivate::QStringList_replaceInStrings(), replaceArgEscapes(), QmlIR::IRBuilder::resolveQualifiedId(), QTextBoundaryFinder::string(), and QmlIR::IRBuilder::visit().
|
inlineconstexprnoexcept |
Returns whether this string view is empty - that is, whether {size() == 0}.
This function is provided for STL compatibility.
Definition at line 399 of file qstringview.h.
Referenced by back(), endsWith(), QQmlJS::Dom::QQmlDomAstCreator::endVisit(), front(), isEmpty(), and startsWith().
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary character after the last character in the list.
This function is provided for STL compatibility.
Definition at line 391 of file qstringview.h.
Referenced by parseIp6(), and replace_helper().
|
inlinenoexcept |
Definition at line 268 of file qstringview.h.
References back(), and empty().
|
inlinenoexcept |
Returns true
if this string view ends with.
utf16-or-latin1-or-ch respectively; otherwise returns false
.
{search-comparison-case-sensitivity} {search}
Definition at line 270 of file qstringview.h.
References QStringView(), and QtPrivate::endsWith().
|
inlinenoexcept |
Definition at line 74 of file qstring.h.
References QtPrivate::endsWith().
|
inlinenoexcept |
Definition at line 265 of file qstringview.h.
References QtPrivate::endsWith().
Referenced by QUrlPrivate::appendPath(), QQmlJSUtils::changeHandlerProperty(), QQmlJS::Dom::PathEls::Filter::checkName(), QZipPrivate::fillFileInfo(), QUrl::fromLocalFile(), QV4::StringPrototype::method_endsWith(), parseLength(), and readInputFile().
|
inlineconstexpr |
|
inlineconstexprnoexcept |
Returns a string view that points to the first n characters of this string view.
Definition at line 222 of file qstringview.h.
References QStringView(), and Q_ASSERT.
Referenced by QQmlPropertyPrivate::initProperty(), and QDateTimeParser::parseFormat().
|
inlinestaticconstexprnoexcept |
Constructs a string view on the full character string literal string, including any trailing {Char(0)}.
If you don't want the null-terminator included in the view then you can chop() it off when you are certain it is at the end. Alternatively you can use the constructor overload taking an array literal which will create a view up to, but not including, the first null-terminator in the data.
string must remain valid for the lifetime of this string view object.
This function will work with any array literal if Char
is a compatible character type. The compatible character types are: QChar
, ushort
, char16_t
and (on platforms, such as Windows, where it is a 16-bit type) wchar_t
.
Definition at line 171 of file qstringview.h.
References QStringView(), and Size.
|
inlineconstexpr |
Definition at line 400 of file qstringview.h.
References empty(), and Q_ASSERT.
Referenced by first(), QXmlUtils::isEncName(), and startsWith().
|
inlinenoexcept |
Returns the index position of the first occurrence of
utf16-or-latin1-or-ch respectively, in this string view, searching forward from index position from. Returns -1 if str, l1 or ch is not found, respectively.
{search-comparison-case-sensitivity} {search}
negative-index-start-search-from-end
Definition at line 273 of file qstringview.h.
References QStringView(), and QtPrivate::findString().
Referenced by contains(), contains(), QMimeType::genericIconName(), QFontMetrics::horizontalAdvance(), QFontMetricsF::horizontalAdvance(), QMYSQLDriver::open(), and parseIp6().
|
inlinenoexcept |
Definition at line 76 of file qstring.h.
References QtPrivate::findString().
|
inlinenoexcept |
Definition at line 275 of file qstringview.h.
References QtPrivate::findString().
|
inlineconstexprnoexcept |
Returns whether this string view is empty - that is, whether {size() == 0}.
This function is provided for compatibility with other Qt containers.
Definition at line 409 of file qstringview.h.
References empty().
Referenced by QQmlJS::Dom::OutWriter::OutWriter(), QSvgAttributes::QSvgAttributes(), QTextBoundaryFinder::QTextBoundaryFinder(), QV4::Compiler::ControlFlowCatch::~ControlFlowCatch(), QQmlJS::Dom::LineWriter::addNewlinesAutospacerCallback(), QWasmLocalStorageSettingsPrivate::clear(), QQmlJS::Dom::AstComments::collectComments(), QQmlJS::Dom::LineWriter::commitLine(), constructColor(), contradicts(), createRadialGradientNode(), createSolidColorNode(), createSvgGlyph(), createSvgNode(), QQmlJS::Dom::QQmlDomAstCreator::endVisitHelper(), QQmlJS::Dom::ErrorGroups::fatal(), language::formatConnection(), QQmlPropertyPrivate::initProperty(), QXmlUtils::isEncName(), QXmlUtils::isNCName(), QLocaleData::NumericData::isValid(), QDBusUtil::isValidMemberName(), QDBusUtil::isValidPartOfObjectPath(), QDBusUtil::isValidUniqueConnectionName(), QV4::Text::method_isElementContentWhitespace(), parseBaseGradient(), parseBrush(), parseCompOp(), parseDateString(), parseFont(), QDateTimeParser::parseFormat(), parseIp6(), parseOpacity(), parseOthers(), parsePen(), parseRenderingHints(), parseServerList(), parseStopNode(), parseTransform(), parseVisibility(), QQmlJS::Dom::Path::path(), processUrlForClassName(), qRelocateResourceFile(), qt_font_from_string(), resolveColor(), QWinRegistryKey::value(), QQmlJS::Dom::QQmlDomAstCreator::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::ScanFunctions::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::ScanFunctions::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::ScanFunctions::visit(), QmlIR::IRBuilder::visit(), and QQmlJS::Dom::LineWriter::write().
|
inlineconstexprnoexcept |
Returns whether this string view is null - that is, whether {data() == nullptr}.
This functions is provided for compatibility with other Qt containers.
Definition at line 408 of file qstringview.h.
Referenced by QQmlJS::AST::PatternElement::convertLiteralToAssignmentPattern(), createUseNode(), QQmlJS::AST::ImportDeclaration::lastSourceLocation(), QSvgHandler::startElement(), QQmlJS::Dom::Rewriter::visit(), QQmlJS::Dom::Rewriter::visit(), QQmlJS::Dom::Rewriter::visit(), QmlIR::IRBuilder::visit(), and QmlIR::IRBuilder::visit().
|
inlinenoexcept |
Returns true
if the string view is read right to left.
Definition at line 331 of file qstringview.h.
References QtPrivate::isRightToLeft().
|
inlinenoexcept |
Returns true
if the string view contains valid UTF-16 encoded data, or false
otherwise.
Note that this function does not perform any special validation of the data; it merely checks if it can be successfully decoded from UTF-16. The data is assumed to be in host byte order; the presence of a BOM is meaningless.
Definition at line 333 of file qstringview.h.
References QtPrivate::isValidUtf16().
Referenced by QString::isValidUtf16().
|
inlineconstexpr |
|
inlineconstexprnoexcept |
Returns a string view that points to the last n characters of this string view.
Definition at line 224 of file qstringview.h.
References QStringView(), and Q_ASSERT.
Referenced by QQmlPropertyPrivate::initProperty().
|
inlinenoexcept |
Returns the index position of the last occurrence of
utf16-or-latin1-or-ch respectively, in this string view, searching backward from index position from.
negative-index-start-search-from-end
Returns -1 if str, l1 or c is not found, respectively.
{search-comparison-case-sensitivity} {search}
{-1} is normally thought of as searching from the end of the string view: the match at the end is after the last character, so it is excluded. To include such a final empty match, either give a positive value for from or omit the from parameter entirely.Definition at line 293 of file qstringview.h.
References QStringView(), and QtPrivate::lastIndexOf().
|
inlinenoexcept |
Definition at line 291 of file qstringview.h.
References lastIndexOf().
Referenced by lastIndexOf(), lastIndexOf(), parseIp6(), parseIp6(), and qt_is_idn_enabled().
|
inlinenoexcept |
Definition at line 82 of file qstring.h.
References QtPrivate::lastIndexOf().
|
inlinenoexcept |
Definition at line 80 of file qstring.h.
References QtPrivate::lastIndexOf().
|
inlinenoexcept |
Definition at line 297 of file qstringview.h.
References QtPrivate::lastIndexOf().
|
inlinenoexcept |
Definition at line 295 of file qstringview.h.
References lastIndexOf().
|
inlineconstexprnoexcept |
Returns the substring of length length starting at position 0 in this object.
The entire string view is returned if length is greater than or equal to size(), or less than zero.
Definition at line 209 of file qstringview.h.
References QStringView().
Referenced by QUrlPrivate::appendPath(), language::formatMemberFnPtr(), QMimeType::genericIconName(), QFontMetrics::horizontalAdvance(), QFontMetricsF::horizontalAdvance(), QUrlPrivate::mergePaths(), QV4::StringPrototype::method_endsWith(), QMYSQLDriver::open(), parseServerList(), QQmlStringConverters::pointFFromString(), QXmlStreamAttribute::prefix(), qSetFontSizeFromToken(), QQmlStringConverters::rectFFromString(), QQmlImportNamespace::resolveType(), QQmlJS::Dom::sinkIndent(), QQmlStringConverters::sizeFFromString(), and QQmlJS::Dom::Rewriter::visit().
|
inlineconstexprnoexcept |
|
inline |
Compares this string view with the other string view and returns an integer less than, equal to, or greater than zero if this string view is less than, equal to, or greater than the other string view.
The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.
Definition at line 1369 of file qstring.h.
References QString::localeAwareCompare(), and other().
|
inlineconstexprnoexcept |
Returns the substring of length length starting at position start in this object.
Returns an empty string view if start exceeds the length of the string view. If there are less than length characters available in the string view starting at start, or if length is negative (default), the function returns all characters that are available from start.
Definition at line 203 of file qstringview.h.
References QStringView(), and pos.
Referenced by QQmlJS::Dom::CommentInfo::CommentInfo(), QMimeMagicRule::QMimeMagicRule(), QSvgAttributes::QSvgAttributes(), _q_resolveEntryAndCreateLegacyEngine_recursive(), adjustFtpPath(), appendReplacementString(), CompletionContextStrings::base(), QRegularExpressionMatch::capturedView(), QQmlJS::Dom::CommentInfo::comment(), QQmlJS::Dom::CommentInfo::commentContent(), QQmlJS::Dom::LineWriter::commitLine(), decode(), QKeySequencePrivate::decodeString(), QV4::Object::defineAccessorProperty(), QQmlJS::Dom::LineWriter::ensureSpace(), extractExtensions(), extractExtensionsAndGlobs(), QAndroidMetaData::extractMetadata(), QZipPrivate::fillFileInfo(), CompletionContextStrings::filterChars(), findGraphicsFactory(), findGroupFactory(), findStyleFactoryMethod(), findStyleUtilFactoryMethod(), findUtilFactory(), language::formatConnection(), language::formatMemberFnPtr(), getContextCapabilities(), QFileDialogPrivate::getEnvironmentVariable(), getFontWeight(), QXmlUtils::isEncName(), isParentDomain(), QDBusUtil::isValidObjectPath(), QDBusUtil::isValidUniqueConnectionName(), QQmlJS::Dom::FileLocations::iterateDirectSubpaths(), QSSGBufferManager::loadMeshData(), macToQtFormat(), QV4::StringPrototype::method_includes(), QV4::RegExpPrototype::method_replace(), QV4::StringPrototype::method_replace(), QV4::StringPrototype::method_startsWith(), Qt::mightBeRichText(), QMYSQLDriver::open(), QQmlDebugServerImpl::parseArguments(), QQuickStyledTextPrivate::parseAttribute(), parseBrush(), QQuickStyledTextPrivate::parseCloseTag(), QTextHtmlParser::parseEntity(), QQuickStyledTextPrivate::parseEntity(), QTextHtmlParser::parseEntity(), parseIp6(), parseIp6(), parsePen(), parseServerList(), QQuickStyledTextPrivate::parseTag(), QQuickStyledTextPrivate::parseValue(), QQmlStringConverters::pointFFromString(), QQmlJS::Dom::CommentInfo::postWhitespace(), CompletionContextStrings::preLine(), QQmlJS::Dom::CommentInfo::preWhitespace(), processUrlForClassName(), qExtractFontFamiliesFromString(), qParseOpts(), qt_font_from_string(), qt_is_idn_enabled(), quick_test_main_with_setup(), QQmlStringConverters::rectFFromString(), resolveColor(), QQmlImportNamespace::resolveType(), QtPrivate::QCalendarDateValidator::setFormat(), QQmlJSUtils::signalName(), QQmlStringConverters::sizeFFromString(), stringMidRetainingBidiCC(), QQmlJS::Dom::QmlComponent::subComponentsNames(), QXmlStreamReaderPrivate::symView(), QmlIR::IRBuilder::textRefAt(), QmlIR::IRBuilder::textRefAt(), QQmlJS::Dom::FormatPartialStatus::tokenText(), QV4::ExecutableCompilationUnit::translateFrom(), QQmlDelegateModelPrivate::variantValue(), QQmlJS::Dom::Comment::write(), and QQmlJS::Dom::LineWriter::write().
|
inlinenoexcept |
Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first character in the string view, in reverse order.
This function is provided for STL compatibility.
Definition at line 394 of file qstringview.h.
Referenced by crbegin().
|
inlinenoexcept |
Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past the last character in the string view, in reverse order.
This function is provided for STL compatibility.
Definition at line 395 of file qstringview.h.
References begin().
Referenced by crend().
|
inlineconstexprnoexcept |
Returns the substring of length length starting at position size() - length in this object.
The entire string view is returned if length is greater than or equal to size(), or less than zero.
Definition at line 215 of file qstringview.h.
References QStringView().
Referenced by qSetFontSizeFromToken(), and QQmlJS::Dom::Rewriter::visit().
|
inlineconstexprnoexcept |
Returns the size of this string view, in UTF-16 code units (that is, surrogate pairs count as two for the purposes of this function, the same as in QString).
Definition at line 181 of file qstringview.h.
Referenced by QQmlJS::Dom::CommentInfo::CommentInfo(), QTextBoundaryFinder::QTextBoundaryFinder(), QTextBoundaryFinder::QTextBoundaryFinder(), QTextBoundaryFinder::QTextBoundaryFinder(), QUrlPrivate::appendPath(), bm_find(), bm_init_skiptable(), QTextBoundaryFinder::boundaryReasons(), QQmlJS::Dom::FormatPartialStatus::column(), QtPrivate::count(), QtPrivate::count(), QKeySequencePrivate::decodeString(), QQmlJS::Dom::LineWriter::ensureSpace(), QUrl::fromLocalFile(), QQmlJS::Dom::inQString(), QTextBoundaryFinder::isAtBoundary(), QDBusUtil::isValidMemberName(), QDBusUtil::isValidPartOfObjectPath(), QDBusUtil::isValidUniqueConnectionName(), macToQtFormat(), QTextBoundaryFinder::operator=(), parseBrush(), QTextHtmlParser::parseEntity(), QDateTimeParser::parseFormat(), parseIp6(), parseIp6(), parsePathDataFast(), parsePen(), qExtractFontFamiliesFromString(), qSetFontSizeFromToken(), QtPrivate::QStringList_replaceInStrings(), qt_is_idn_enabled(), QQmlJS::Dom::FormatPartialStatus::recalculateWithIndent(), replace_helper(), replace_in_place(), replace_with_copy(), replaceArgEscapes(), resolveColor(), QTextBoundaryFinder::setPosition(), QQmlJSUtils::signalName(), QQmlJS::Dom::sinkIndent(), QConcatenable< const char16_t * >::size(), QTextBoundaryFinder::string(), toDouble(), QTextBoundaryFinder::toEnd(), QTextBoundaryFinder::toNextBoundary(), and QTextBoundaryFinder::toPreviousBoundary().
|
inlineconstexprnoexcept |
Returns a string view starting at position pos in this object, and extending to its end.
Definition at line 226 of file qstringview.h.
References QStringView(), pos, and Q_ASSERT.
Referenced by appendSeparator(), bm_find(), checkAsciiDomainName(), convertToAscii(), QSettingsPrivate::iniUnescapedKey(), QDateTimeParser::parseFormat(), QSettingsPrivate::stringToVariant(), and QDoubleSpinBoxPrivate::validateAndInterpret().
|
inlineconstexprnoexcept |
Returns a string view that points to n characters of this string view, starting at position pos.
Definition at line 228 of file qstringview.h.
References QStringView(), pos, and Q_ASSERT.
QList< QStringView > QStringView::split | ( | QChar | sep, |
Qt::SplitBehavior | behavior = Qt::KeepEmptyParts , |
||
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Definition at line 7992 of file qstring.cpp.
References QStringView(), sep, and split().
QList< QStringView > QStringView::split | ( | QStringView | sep, |
Qt::SplitBehavior | behavior = Qt::KeepEmptyParts , |
||
Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
) | const |
Splits the view into substring views wherever sep occurs, and returns the list of those string views.
See QString::split() for how sep, behavior and cs interact to form the result.
Definition at line 7987 of file qstring.cpp.
References QStringView(), and sep.
Referenced by QPpdPrintDevice::QPpdPrintDevice(), QCupsPrintEnginePrivate::closePrintDevice(), QEvdevMouseHandler::create(), fontKeys(), QFont::fromString(), QQmlPropertyPrivate::initProperty(), QDBusUtil::isValidObjectPath(), QDBusUtil::isValidUniqueConnectionName(), QDBusConnection::objectRegisteredAt(), QHostAddress::parseSubnet(), qQmlResolveImportPaths(), QDB2DriverPrivate::qSplitTableQualifier(), qt_font_from_string(), QWavefrontMesh::readData(), QCss::Declaration::rectValue(), QDBusConnection::registerObject(), QString::section(), split(), QODBCDriverPrivate::splitTableQualifier(), and QMimerSQLDriverPrivate::splitTableQualifier().
|
inlinenoexcept |
Definition at line 260 of file qstringview.h.
References empty(), and front().
|
inlinenoexcept |
Returns true
if this string view starts with.
utf16-or-latin1-or-ch respectively; otherwise returns false
.
{search-comparison-case-sensitivity} {search}
Definition at line 262 of file qstringview.h.
References QStringView(), and QtPrivate::startsWith().
|
inlinenoexcept |
Definition at line 72 of file qstring.h.
References QtPrivate::startsWith().
|
inlinenoexcept |
Definition at line 257 of file qstringview.h.
References QtPrivate::startsWith().
Referenced by bm_find(), checkAsciiDomainName(), QZipPrivate::fillFileInfo(), QDBusUtil::isValidUniqueConnectionName(), QV4::StringPrototype::method_startsWith(), QQmlDebugServerImpl::parseArguments(), QDateTimeParser::parseFormat(), QtPrivate::QCalendarDateValidator::setFormat(), QTextBrowserPrivate::setSource(), QQmlJSUtils::signalName(), and QDoubleSpinBoxPrivate::validateAndInterpret().
double QStringView::toDouble | ( | bool * | ok = nullptr | ) | const |
Returns the string view converted to a double
value.
Returns an infinity if the conversion overflows or 0.0 if the conversion fails for other reasons (e.g. underflow).
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toDouble()
For historic reasons, this function does not handle thousands group separators. If you need to convert such numbers, use QLocale::toDouble().
Definition at line 7647 of file qstring.cpp.
References QVarLengthArray< T, Prealloc >::data(), ok, qt_asciiToDouble(), qt_to_latin1(), and size().
Referenced by QQmlStringConverters::pointFFromString(), QQmlStringConverters::rectFFromString(), QQmlStringConverters::sizeFFromString(), toFloat(), and versionFromUiAttribute().
float QStringView::toFloat | ( | bool * | ok = nullptr | ) | const |
Returns the string view converted to a float
value.
Returns an infinity if the conversion overflows or 0.0 if the conversion fails for other reasons (e.g. underflow).
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toFloat()
Definition at line 7693 of file qstring.cpp.
References QLocaleData::convertDoubleToFloat(), ok, and toDouble().
Referenced by qParseFontSizeFromToken().
|
inline |
Returns the string view converted to an int
using base base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
If 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 dependent conversion use QLocale::toInt()
Definition at line 1025 of file qstring.h.
Referenced by QKeySequencePrivate::decodeString(), QMimeTypeParserBase::parse(), QQmlDebugServerImpl::parseArguments(), parseFont(), and QMessagePattern::setPattern().
|
inlineconstexprnoexcept |
Definition at line 241 of file qstringview.h.
References qTokenize().
|
inline |
Returns a Latin-1 representation of the string as a QByteArray.
The behavior is undefined if the string contains non-Latin1 characters.
Definition at line 196 of file qstringview.h.
References QtPrivate::convertToLatin1().
Referenced by QRasterPaintEngine::drawTextItem(), QDateTimeParser::parseFormat(), and QSettingsPrivate::stringToVariant().
|
inline |
Returns a local 8-bit representation of the string as a QByteArray.
On Unix systems this is equivalen to toUtf8(), on Windows the systems current code page is being used.
The behavior is undefined if the string contains characters not supported by the locale's 8-bit encoding.
Definition at line 198 of file qstringview.h.
References QtPrivate::convertToLocal8Bit().
Referenced by QMYSQLDriver::open().
|
inline |
Returns the string view converted to a long
using base base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
If 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 dependent conversion use QLocale::toLong()
Returns the string view converted to a {long long} using base base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
If 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 dependent conversion use QLocale::toLongLong()
|
inline |
Returns the string view converted to a short
using base base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
If 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 dependent conversion use QLocale::toShort()
|
inline |
Returns a deep copy of this string view's data as a QString.
The return value will be the null QString if and only if this string view is null.
Definition at line 1014 of file qstring.h.
Referenced by QSvgAttributes::QSvgAttributes(), QQmlJS::Dom::MutableDomItem::addPostComment(), QQmlJS::Dom::MutableDomItem::addPreComment(), QQmlJS::Dom::FileLocations::addRegion(), QmlIR::IRBuilder::appendAlias(), appendSeparator(), astNodeToStringList(), QQmlJS::AST::PatternElement::boundNames(), bulletChar(), QRegularExpressionMatch::captured(), QRegularExpressionMatch::captured(), QQmlJSUtils::changeHandlerProperty(), QQmlTranslation::contextFromQmlFilename(), createImageNode(), createPolygonNode(), createPolylineNode(), createSvgNode(), createUseNode(), QQmlJSImportVisitor::endVisit(), QQmlJSImportVisitor::endVisit(), QQmlJSImportVisitor::endVisit(), QQmlJSImportVisitor::endVisit(), QQmlJS::Dom::LineWriter::ensureSpace(), QV4::Compiler::ScanFunctions::enterFunction(), QZipPrivate::fillFileInfo(), QUrl::fromLocalFile(), QV4::RuntimeCodegen::generateFromFunctionExpression(), QQmlPropertyPrivate::initProperty(), QQmlJS::Dom::Paths::loadInfoPath(), QV4::Compiler::ControlFlow::loopLabel(), QResourceRoot::mappingRootSubdir(), QQmlJS::Dom::PathEls::Field::name(), QQmlJS::Dom::PathEls::Root::name(), QQmlJS::Dom::PathEls::Current::name(), QMimeTypeParserBase::parse(), parseAnimateColorNode(), parseAnimateTransformNode(), QQmlDebugServerImpl::parseArguments(), parseBaseGradient(), parseBrush(), parseCompOp(), parseFont(), QDateTimeParser::parseFormat(), parseIp6(), parseOthers(), parsePen(), parseRenderingHints(), parseServerList(), parseStopNode(), QHostAddress::parseSubnet(), QStringMatcher::pattern(), qExtractFontFamiliesFromString(), qRelocateResourceFile(), readInputFile(), QQmlJS::Dom::OutWriter::regionEnd(), QQmlJS::Dom::OutWriter::regionStart(), QV4::Compiler::JSUnitGenerator::registerRegExp(), resolveColor(), QmlIR::IRBuilder::resolveQualifiedId(), QQmlJSMetaPropertyBinding::setTranslation(), QQmlJSUtils::signalName(), someId(), QSvgHandler::startElement(), QTextBoundaryFinder::string(), QtPrivate::XmlStringRef::toString(), QQmlJS::Dom::QQmlDomAstCreator::visit(), QQmlJS::Dom::QQmlDomAstCreator::visit(), QQmlJS::Dom::QQmlDomAstCreator::visit(), QQmlJS::Dom::QQmlDomAstCreator::visit(), QQmlJS::Dom::QQmlDomAstCreator::visit(), QQmlJS::Dom::QQmlDomAstCreator::visit(), QQmlJS::Dom::QQmlDomAstCreator::visit(), QQmlJS::Dom::Rewriter::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::ScanFunctions::visit(), QQmlJSImportVisitor::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::ScanFunctions::visit(), QQmlJSImportVisitor::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::ScanFunctions::visit(), QQmlJSImportVisitor::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::ScanFunctions::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::ScanFunctions::visit(), QQmlJSImportVisitor::visit(), QV4::Compiler::ScanFunctions::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QmlIR::IRBuilder::visit(), QQmlJSImportVisitor::visit(), QmlIR::IRBuilder::visit(), QmlIR::IRBuilder::visit(), QQmlJSImportVisitor::visit(), QmlIR::IRBuilder::visit(), QmlIR::IRBuilder::visit(), QQmlJSImportVisitor::visit(), QQmlJSImportVisitor::visit(), QQmlJS::Dom::Rewriter::visit(), and QQmlJS::Dom::OutWriter::writeRegion().
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 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 {U+FFFD}).
The returned list is not 0-terminated.
Definition at line 1012 of file qlist.h.
References QtPrivate::convertToUcs4().
Returns the string view converted to an {unsigned int} using base base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
If 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 dependent conversion use QLocale::toUInt()
Definition at line 1027 of file qstring.h.
Referenced by QSSGBufferManager::loadMeshData(), QTextHtmlParser::parseEntity(), and parseServerList().
Returns the string view converted to an {unsigned long} using base base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
If 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 dependent conversion use QLocale::toULongLong()
Returns the string view converted to an {unsigned long long} using base base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
If 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 dependent conversion use QLocale::toULongLong()
Returns the string view converted to an {unsigned short} using base base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
If ok is not \nullptr, failure is reported by setting *{ok} to false
, and success by setting *{ok} to true
.
If 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 dependent conversion use QLocale::toUShort()
Definition at line 1031 of file qstring.h.
Referenced by QSettingsPrivate::iniUnescapedKey().
|
inline |
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.
Definition at line 197 of file qstringview.h.
References QtPrivate::convertToUtf8().
Referenced by QQmlPropertyCacheCreatorBase::createClassNameForInlineComponent(), QQmlPropertyCacheCreatorBase::createClassNameTypeByUrl(), QQmlPropertyPrivate::initProperty(), QQmlXMLHttpRequest::setOverrideCharset(), and QSSGQmlUtilities::setProperty().
|
inline |
Transcribes this string view into the given array.
The caller is responsible for ensuring array is large enough to hold the 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 wchar_t
is 2 bytes wide (e.g. Windows); otherwise (Unix systems), wchar_t
is assumed to be 4 bytes wide and the data is written in UCS-4.
Returns the number of wchar_t
entries written to array.
Definition at line 1151 of file qstring.h.
References utf16().
Referenced by QString::toWCharArray().
|
inlinenoexcept |
Strips leading and trailing whitespace and returns the result.
Whitespace means any character for which QChar::isSpace() returns true
. This includes the ASCII characters '\t', '\n', '\v', '\f', '\r', and ' '.
Definition at line 238 of file qstringview.h.
References QtPrivate::trimmed().
Referenced by QQmlJS::Dom::OutWriter::OutWriter(), QQmlJS::Dom::LineWriter::addNewlinesAutospacerCallback(), QQmlJS::Dom::LineWriter::commitLine(), fontKeys(), QFont::fromString(), QV4::Text::method_isElementContentWhitespace(), QMYSQLDriver::open(), parseOpacity(), parseTransform(), qParseFontSizeFromToken(), qParseOpts(), qSetFontSizeFromToken(), qt_font_from_string(), resolveColor(), setWidthAttribute(), QV4::RuntimeHelpers::stringToNumber(), and QQmlJS::Dom::LineWriter::write().
Truncates this string view to length length.
Same as {*this = left(length)}.
Definition at line 233 of file qstringview.h.
References Q_ASSERT.
Referenced by QUrl::fromLocalFile(), parseIp6(), QHostAddress::parseSubnet(), qt_font_from_string(), and setWidthAttribute().
|
inlineconstexprnoexcept |
const-pointer-to-first-ch
{storage_type} is
{char16_t}.
Definition at line 184 of file qstringview.h.
Referenced by QWinRegistryKey::QWinRegistryKey(), bm_find(), bm_init_skiptable(), compare(), QtPrivate::count(), replace_in_place(), replace_with_copy(), toWCharArray(), and QWinRegistryKey::value().
|
related |
Definition at line 1596 of file qstring.cpp.
References QUtf8::compareUtf8().
|
related |
Definition at line 1585 of file qstring.cpp.
|
related |
Definition at line 1572 of file qstring.cpp.
References Qt::CaseSensitive, QUtf8::compareUtf8(), and ucstricmp8().
|
related |
Definition at line 1561 of file qstring.cpp.
References QUtf8::compareUtf8().
|
related |
Returns an integer that compares to 0 as lhs compares to rhs.
{search-comparison-case-sensitivity} {comparison}
Case-sensitive comparison is based exclusively on the numeric Latin-1 values of the characters and is very fast, but is not what a human would expect. Consider sorting user-visible strings with QString::localeAwareCompare().
Definition at line 1544 of file qstring.cpp.
References Qt::CaseInsensitive, latin1nicmp(), and QtMiscUtils::qt_lencmp().
|
related |
Definition at line 1523 of file qstring.cpp.
|
related |
Definition at line 1512 of file qstring.cpp.
|
related |
Returns an integer that compares to 0 as lhs compares to rhs.
{search-comparison-case-sensitivity} {comparison}
Case-sensitive comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-visible strings with QString::localeAwareCompare().
Definition at line 1499 of file qstring.cpp.
References Qt::CaseSensitive, ucstrcmp(), and ucstricmp().
|
related |
Returns an integer that compares to 0 as lhs compares to rhs.
{search-comparison-case-sensitivity} {comparison}
Case-sensitive comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-visible strings with QString::localeAwareCompare().
Definition at line 1476 of file qstring.cpp.
References Qt::CaseSensitive, ucstrcmp(), and ucstricmp().
|
related |
Returns a Latin-1 representation of string as a QByteArray.
The behavior is undefined if string contains non-Latin1 characters.
Definition at line 5476 of file qstring.cpp.
References qt_convert_to_latin1().
|
related |
Returns a local 8-bit representation of string as a QByteArray.
On Unix systems this is equivalent to toUtf8(), on Windows the systems current code page is being used.
The behavior is undefined if string contains characters not supported by the locale's 8-bit encoding.
Definition at line 5597 of file qstring.cpp.
References qt_convert_to_local_8bit().
|
related |
Returns a UCS-4/UTF-32 representation of string 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's replacement character (QChar::ReplacementCharacter, which corresponds to {U+FFFD}).
The returned list is not \0'-terminated.
Definition at line 5695 of file qstring.cpp.
References qt_convert_to_ucs4().
|
related |
Returns a UTF-8 representation of string as a QByteArray.
UTF-8 is a Unicode codec and can represent all characters in a Unicode string like QStringView.
Definition at line 5640 of file qstring.cpp.
References qt_convert_to_utf8().
|
related |
Returns true
if haystack ends with needle, otherwise returns false
.
{search-comparison-case-sensitivity} {search}
|
related |
Returns true
if the string is read right to left.
Definition at line 9421 of file qstring.cpp.
References QChar::DirAL, QChar::DirAN, QChar::DirB, QChar::DirBN, QChar::DirCS, QChar::direction(), QChar::DirEN, QChar::DirES, QChar::DirET, QChar::DirFSI, QChar::DirL, QChar::DirLRE, QChar::DirLRI, QChar::DirLRO, QChar::DirNSM, QChar::DirON, QChar::DirPDF, QChar::DirPDI, QChar::DirR, QChar::DirRLE, QChar::DirRLI, QChar::DirRLO, QChar::DirS, QChar::DirWS, and i.
|
friend |
Definition at line 381 of file qstringview.h.
|
friend |
Definition at line 374 of file qstringview.h.
|
friend |
Definition at line 366 of file qstringview.h.
|
friend |
Definition at line 382 of file qstringview.h.
|
friend |
Definition at line 375 of file qstringview.h.
|
friend |
Definition at line 367 of file qstringview.h.
|
friend |
Definition at line 383 of file qstringview.h.
|
friend |
Definition at line 376 of file qstringview.h.
|
friend |
Definition at line 368 of file qstringview.h.
|
friend |
Definition at line 380 of file qstringview.h.
|
friend |
Definition at line 373 of file qstringview.h.
|
friend |
Definition at line 365 of file qstringview.h.
|
friend |
Definition at line 384 of file qstringview.h.
|
friend |
Definition at line 377 of file qstringview.h.
|
friend |
Definition at line 369 of file qstringview.h.
|
friend |
Definition at line 385 of file qstringview.h.
|
friend |
Definition at line 378 of file qstringview.h.
|
friend |
|
related |
Returns the hash value for the key, using seed to seed the calculation.
Definition at line 961 of file qhash.cpp.
References qHashBits(), and seed.
|
related |
Returns true
if haystack starts with needle, otherwise returns false
.
{search-comparison-case-sensitivity} {search}
|
related |
Returns s with whitespace removed from the start and the end.
Whitespace means any character for which QChar::isSpace() returns true
. This includes the ASCII characters '\t', '\n', '\v', '\f', '\r', and ' '.