[−][src]Struct qt_core::QStringView
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QString API.
C++ class: QStringView
.
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QString API.
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
(on compilers that support C++11 Unicode strings) 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, QStringRef, and (const QChar*, int)
), 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:
void myfun1(QStringView sv); // preferred void myfun2(const QStringView &sv); // compiles and works, but slower
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
- QChar: this overload can delegate to the QStringView version:
void fun(QChar ch) { fun(QStringView(&ch, 1)); }
even though, for technical reasons, QStringView cannot provide a QChar constructor by itself.
- QString: if you store an unmodified copy of the string and thus would like to take advantage of QString's implicit sharing.
- QLatin1String: if you can implement the function without converting the QLatin1String to UTF-16 first; users expect a function overloaded on QLatin1String to perform strictly less memory allocations than the semantically equivalent call of the QStringView version, involving construction of a QString from the QLatin1String.
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.
Note: We strongly discourage the use of QList<QStringView>, because QList is a very inefficient container for QStringViews (it would heap-allocate every element). Use QVector (or std::vector) to hold QStringViews instead.
Methods
impl QStringView
[src]
pub unsafe fn at(&self, n: c_longlong) -> CppBox<QChar>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns the character at position n in this string view.
Calls C++ function: QChar QStringView::at(long long n) const
.
Returns the character at position n in this string view.
The behavior is undefined if n is negative or not less than size().
See also operator[](), front(), and back().
pub unsafe fn back(&self) -> CppBox<QChar>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns the last character in the string. Same as last().
Calls C++ function: QChar QStringView::back() const
.
pub unsafe fn begin(&self) -> Ptr<QChar>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns a const STL-style iterator pointing to the first character in the string.
Calls C++ function: const QChar* QStringView::begin() const
.
Returns a const STL-style iterator pointing to the first character in the string.
This function is provided for STL compatibility.
pub unsafe fn cbegin(&self) -> Ptr<QChar>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Same as begin().
Calls C++ function: const QChar* QStringView::cbegin() const
.
pub unsafe fn cend(&self) -> Ptr<QChar>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Same as end().
Calls C++ function: const QChar* QStringView::cend() const
.
pub unsafe fn chop(&self, n: c_longlong)
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Truncates this string view by length characters.
Calls C++ function: void QStringView::chop(long long n)
.
pub unsafe fn chopped(&self, n: c_longlong) -> CppBox<QStringView>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns the substring of length size() - length starting at the beginning of this object.
Calls C++ function: QStringView QStringView::chopped(long long n) const
.
pub unsafe fn compare_2a(
&self,
other: impl CastInto<Ref<QStringView>>,
cs: CaseSensitivity
) -> c_int
[src]
&self,
other: impl CastInto<Ref<QStringView>>,
cs: CaseSensitivity
) -> c_int
cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.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.
Calls C++ function: int QStringView::compare(QStringView other, Qt::CaseSensitivity cs = …) const
.
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.
If cs is Qt::CaseSensitive, the comparison is case sensitive; otherwise the comparison is case insensitive.
This function was introduced in Qt 5.12.
See also operator==(), operator<(), and operator>().
pub unsafe fn compare_1a(&self, other: impl CastInto<Ref<QStringView>>) -> c_int
[src]
cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.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.
Calls C++ function: int QStringView::compare(QStringView other) const
.
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.
If cs is Qt::CaseSensitive, the comparison is case sensitive; otherwise the comparison is case insensitive.
This function was introduced in Qt 5.12.
See also operator==(), operator<(), and operator>().
pub unsafe fn contains_q_char_case_sensitivity(
&self,
c: impl CastInto<Ref<QChar>>,
cs: CaseSensitivity
) -> bool
[src]
&self,
c: impl CastInto<Ref<QChar>>,
cs: CaseSensitivity
) -> bool
cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::contains(QChar c, Qt::CaseSensitivity cs = …) const
.
pub unsafe fn contains_q_string_view_case_sensitivity(
&self,
s: impl CastInto<Ref<QStringView>>,
cs: CaseSensitivity
) -> bool
[src]
&self,
s: impl CastInto<Ref<QStringView>>,
cs: CaseSensitivity
) -> bool
cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::contains(QStringView s, Qt::CaseSensitivity cs = …) const
.
pub unsafe fn contains_q_latin1_string_case_sensitivity(
&self,
s: impl CastInto<Ref<QLatin1String>>,
cs: CaseSensitivity
) -> bool
[src]
&self,
s: impl CastInto<Ref<QLatin1String>>,
cs: CaseSensitivity
) -> bool
cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::contains(QLatin1String s, Qt::CaseSensitivity cs = …) const
.
pub unsafe fn contains_q_char(&self, c: impl CastInto<Ref<QChar>>) -> bool
[src]
cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::contains(QChar c) const
.
pub unsafe fn contains_q_string_view(
&self,
s: impl CastInto<Ref<QStringView>>
) -> bool
[src]
&self,
s: impl CastInto<Ref<QStringView>>
) -> bool
cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::contains(QStringView s) const
.
pub unsafe fn contains_q_latin1_string(
&self,
s: impl CastInto<Ref<QLatin1String>>
) -> bool
[src]
&self,
s: impl CastInto<Ref<QLatin1String>>
) -> bool
cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::contains(QLatin1String s) const
.
pub unsafe fn copy_from(
&self,
other: impl CastInto<Ref<QStringView>>
) -> Ref<QStringView>
[src]
&self,
other: impl CastInto<Ref<QStringView>>
) -> Ref<QStringView>
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QString API.
Calls C++ function: QStringView& QStringView::operator=(const QStringView& other)
.
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QString API.
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
(on compilers that support C++11 Unicode strings) 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, QStringRef, and (const QChar*, int)
), 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:
void myfun1(QStringView sv); // preferred void myfun2(const QStringView &sv); // compiles and works, but slower
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
- QChar: this overload can delegate to the QStringView version:
void fun(QChar ch) { fun(QStringView(&ch, 1)); }
even though, for technical reasons, QStringView cannot provide a QChar constructor by itself.
- QString: if you store an unmodified copy of the string and thus would like to take advantage of QString's implicit sharing.
- QLatin1String: if you can implement the function without converting the QLatin1String to UTF-16 first; users expect a function overloaded on QLatin1String to perform strictly less memory allocations than the semantically equivalent call of the QStringView version, involving construction of a QString from the QLatin1String.
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.
Note: We strongly discourage the use of QList<QStringView>, because QList is a very inefficient container for QStringViews (it would heap-allocate every element). Use QVector (or std::vector) to hold QStringViews instead.
pub unsafe fn data(&self) -> Ptr<QChar>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns a const pointer to the first character in the string.
Calls C++ function: const QChar* QStringView::data() const
.
pub unsafe fn empty(&self) -> bool
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns whether this string view is empty - that is, whether size() == 0
.
Calls C++ function: bool QStringView::empty() const
.
pub unsafe fn end(&self) -> Ptr<QChar>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns a const STL-style iterator pointing to the imaginary character after the last character in the list.
Calls C++ function: const QChar* QStringView::end() const
.
Returns a const STL-style iterator pointing to the imaginary character after the last character in the list.
This function is provided for STL compatibility.
pub unsafe fn ends_with_q_string_view_case_sensitivity(
&self,
s: impl CastInto<Ref<QStringView>>,
cs: CaseSensitivity
) -> bool
[src]
&self,
s: impl CastInto<Ref<QStringView>>,
cs: CaseSensitivity
) -> bool
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::endsWith(QStringView s, Qt::CaseSensitivity cs = …) const
.
pub unsafe fn ends_with_q_latin1_string_case_sensitivity(
&self,
s: impl CastInto<Ref<QLatin1String>>,
cs: CaseSensitivity
) -> bool
[src]
&self,
s: impl CastInto<Ref<QLatin1String>>,
cs: CaseSensitivity
) -> bool
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::endsWith(QLatin1String s, Qt::CaseSensitivity cs = …) const
.
pub unsafe fn ends_with_q_char(&self, c: impl CastInto<Ref<QChar>>) -> bool
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::endsWith(QChar c) const
.
pub unsafe fn ends_with_q_char_case_sensitivity(
&self,
c: impl CastInto<Ref<QChar>>,
cs: CaseSensitivity
) -> bool
[src]
&self,
c: impl CastInto<Ref<QChar>>,
cs: CaseSensitivity
) -> bool
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::endsWith(QChar c, Qt::CaseSensitivity cs) const
.
pub unsafe fn ends_with_q_string_view(
&self,
s: impl CastInto<Ref<QStringView>>
) -> bool
[src]
&self,
s: impl CastInto<Ref<QStringView>>
) -> bool
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::endsWith(QStringView s) const
.
pub unsafe fn ends_with_q_latin1_string(
&self,
s: impl CastInto<Ref<QLatin1String>>
) -> bool
[src]
&self,
s: impl CastInto<Ref<QLatin1String>>
) -> bool
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::endsWith(QLatin1String s) const
.
pub unsafe fn first(&self) -> CppBox<QChar>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns the first character in the string. Same as front().
Calls C++ function: QChar QStringView::first() const
.
pub unsafe fn front(&self) -> CppBox<QChar>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns the first character in the string. Same as first().
Calls C++ function: QChar QStringView::front() const
.
pub unsafe fn index(&self, n: c_longlong) -> CppBox<QChar>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns the character at position n in this string view.
Calls C++ function: QChar QStringView::operator[](long long n) const
.
pub unsafe fn index_of_q_char_longlong_case_sensitivity(
&self,
c: impl CastInto<Ref<QChar>>,
from: c_longlong,
cs: CaseSensitivity
) -> c_longlong
[src]
&self,
c: impl CastInto<Ref<QChar>>,
from: c_longlong,
cs: CaseSensitivity
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::indexOf(QChar c, long long from = …, Qt::CaseSensitivity cs = …) const
.
pub unsafe fn index_of_q_string_view_longlong_case_sensitivity(
&self,
s: impl CastInto<Ref<QStringView>>,
from: c_longlong,
cs: CaseSensitivity
) -> c_longlong
[src]
&self,
s: impl CastInto<Ref<QStringView>>,
from: c_longlong,
cs: CaseSensitivity
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::indexOf(QStringView s, long long from = …, Qt::CaseSensitivity cs = …) const
.
pub unsafe fn index_of_q_latin1_string_longlong_case_sensitivity(
&self,
s: impl CastInto<Ref<QLatin1String>>,
from: c_longlong,
cs: CaseSensitivity
) -> c_longlong
[src]
&self,
s: impl CastInto<Ref<QLatin1String>>,
from: c_longlong,
cs: CaseSensitivity
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::indexOf(QLatin1String s, long long from = …, Qt::CaseSensitivity cs = …) const
.
pub unsafe fn index_of_q_char_longlong(
&self,
c: impl CastInto<Ref<QChar>>,
from: c_longlong
) -> c_longlong
[src]
&self,
c: impl CastInto<Ref<QChar>>,
from: c_longlong
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::indexOf(QChar c, long long from = …) const
.
pub unsafe fn index_of_q_char(&self, c: impl CastInto<Ref<QChar>>) -> c_longlong
[src]
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::indexOf(QChar c) const
.
pub unsafe fn index_of_q_string_view_longlong(
&self,
s: impl CastInto<Ref<QStringView>>,
from: c_longlong
) -> c_longlong
[src]
&self,
s: impl CastInto<Ref<QStringView>>,
from: c_longlong
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::indexOf(QStringView s, long long from = …) const
.
pub unsafe fn index_of_q_string_view(
&self,
s: impl CastInto<Ref<QStringView>>
) -> c_longlong
[src]
&self,
s: impl CastInto<Ref<QStringView>>
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::indexOf(QStringView s) const
.
pub unsafe fn index_of_q_latin1_string_longlong(
&self,
s: impl CastInto<Ref<QLatin1String>>,
from: c_longlong
) -> c_longlong
[src]
&self,
s: impl CastInto<Ref<QLatin1String>>,
from: c_longlong
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::indexOf(QLatin1String s, long long from = …) const
.
pub unsafe fn index_of_q_latin1_string(
&self,
s: impl CastInto<Ref<QLatin1String>>
) -> c_longlong
[src]
&self,
s: impl CastInto<Ref<QLatin1String>>
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::indexOf(QLatin1String s) const
.
pub unsafe fn is_empty(&self) -> bool
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns whether this string view is empty - that is, whether size() == 0
.
Calls C++ function: bool QStringView::isEmpty() const
.
pub unsafe fn is_null(&self) -> bool
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns whether this string view is null - that is, whether data() == nullptr
.
Calls C++ function: bool QStringView::isNull() const
.
pub unsafe fn is_right_to_left(&self) -> bool
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns true
if the string is read right to left.
Calls C++ function: bool QStringView::isRightToLeft() const
.
Returns true
if the string is read right to left.
This function was introduced in Qt 5.11.
See also QString::isRightToLeft().
pub unsafe fn last(&self) -> CppBox<QChar>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns the last character in the string. Same as back().
Calls C++ function: QChar QStringView::last() const
.
pub unsafe fn last_index_of_q_char_longlong_case_sensitivity(
&self,
c: impl CastInto<Ref<QChar>>,
from: c_longlong,
cs: CaseSensitivity
) -> c_longlong
[src]
&self,
c: impl CastInto<Ref<QChar>>,
from: c_longlong,
cs: CaseSensitivity
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::lastIndexOf(QChar c, long long from = …, Qt::CaseSensitivity cs = …) const
.
pub unsafe fn last_index_of_q_string_view_longlong_case_sensitivity(
&self,
s: impl CastInto<Ref<QStringView>>,
from: c_longlong,
cs: CaseSensitivity
) -> c_longlong
[src]
&self,
s: impl CastInto<Ref<QStringView>>,
from: c_longlong,
cs: CaseSensitivity
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::lastIndexOf(QStringView s, long long from = …, Qt::CaseSensitivity cs = …) const
.
pub unsafe fn last_index_of_q_latin1_string_longlong_case_sensitivity(
&self,
s: impl CastInto<Ref<QLatin1String>>,
from: c_longlong,
cs: CaseSensitivity
) -> c_longlong
[src]
&self,
s: impl CastInto<Ref<QLatin1String>>,
from: c_longlong,
cs: CaseSensitivity
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::lastIndexOf(QLatin1String s, long long from = …, Qt::CaseSensitivity cs = …) const
.
pub unsafe fn last_index_of_q_char_longlong(
&self,
c: impl CastInto<Ref<QChar>>,
from: c_longlong
) -> c_longlong
[src]
&self,
c: impl CastInto<Ref<QChar>>,
from: c_longlong
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::lastIndexOf(QChar c, long long from = …) const
.
pub unsafe fn last_index_of_q_char(
&self,
c: impl CastInto<Ref<QChar>>
) -> c_longlong
[src]
&self,
c: impl CastInto<Ref<QChar>>
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::lastIndexOf(QChar c) const
.
pub unsafe fn last_index_of_q_string_view_longlong(
&self,
s: impl CastInto<Ref<QStringView>>,
from: c_longlong
) -> c_longlong
[src]
&self,
s: impl CastInto<Ref<QStringView>>,
from: c_longlong
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::lastIndexOf(QStringView s, long long from = …) const
.
pub unsafe fn last_index_of_q_string_view(
&self,
s: impl CastInto<Ref<QStringView>>
) -> c_longlong
[src]
&self,
s: impl CastInto<Ref<QStringView>>
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::lastIndexOf(QStringView s) const
.
pub unsafe fn last_index_of_q_latin1_string_longlong(
&self,
s: impl CastInto<Ref<QLatin1String>>,
from: c_longlong
) -> c_longlong
[src]
&self,
s: impl CastInto<Ref<QLatin1String>>,
from: c_longlong
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::lastIndexOf(QLatin1String s, long long from = …) const
.
pub unsafe fn last_index_of_q_latin1_string(
&self,
s: impl CastInto<Ref<QLatin1String>>
) -> c_longlong
[src]
&self,
s: impl CastInto<Ref<QLatin1String>>
) -> c_longlong
cpp_lib_version="5.14.0"
only.Calls C++ function: long long QStringView::lastIndexOf(QLatin1String s) const
.
pub unsafe fn left(&self, n: c_longlong) -> CppBox<QStringView>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns the substring of length length starting at position 0 in this object.
Calls C++ function: QStringView QStringView::left(long long n) const
.
pub unsafe fn length(&self) -> c_int
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Same as size(), except returns the result as an int
.
Calls C++ function: int QStringView::length() const
.
Same as size(), except returns the result as an int
.
This function is provided for compatibility with other Qt containers.
Warning: QStringView can represent strings with more than 231 characters. Calling this function on a string view for which size() returns a value greater than INT_MAX
constitutes undefined behavior.
pub unsafe fn mid_1a(&self, pos: c_longlong) -> CppBox<QStringView>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns the substring starting at position start in this object, and extending to the end of the string.
Calls C++ function: QStringView QStringView::mid(long long pos) const
.
pub unsafe fn mid_2a(
&self,
pos: c_longlong,
n: c_longlong
) -> CppBox<QStringView>
[src]
&self,
pos: c_longlong,
n: c_longlong
) -> CppBox<QStringView>
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.This is an overloaded function.
Calls C++ function: QStringView QStringView::mid(long long pos, long long n) const
.
pub unsafe fn new() -> CppBox<QStringView>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Constructs a null string view.
Calls C++ function: [constructor] void QStringView::QStringView()
.
Constructs a null string view.
See also isNull().
pub unsafe fn new_copy(
other: impl CastInto<Ref<QStringView>>
) -> CppBox<QStringView>
[src]
other: impl CastInto<Ref<QStringView>>
) -> CppBox<QStringView>
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QString API.
Calls C++ function: [constructor] void QStringView::QStringView(const QStringView& other)
.
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QString API.
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
(on compilers that support C++11 Unicode strings) 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, QStringRef, and (const QChar*, int)
), 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:
void myfun1(QStringView sv); // preferred void myfun2(const QStringView &sv); // compiles and works, but slower
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
- QChar: this overload can delegate to the QStringView version:
void fun(QChar ch) { fun(QStringView(&ch, 1)); }
even though, for technical reasons, QStringView cannot provide a QChar constructor by itself.
- QString: if you store an unmodified copy of the string and thus would like to take advantage of QString's implicit sharing.
- QLatin1String: if you can implement the function without converting the QLatin1String to UTF-16 first; users expect a function overloaded on QLatin1String to perform strictly less memory allocations than the semantically equivalent call of the QStringView version, involving construction of a QString from the QLatin1String.
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.
Note: We strongly discourage the use of QList<QStringView>, because QList is a very inefficient container for QStringViews (it would heap-allocate every element). Use QVector (or std::vector) to hold QStringViews instead.
pub unsafe fn right(&self, n: c_longlong) -> CppBox<QStringView>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns the substring of length length starting at position size() - length in this object.
Calls C++ function: QStringView QStringView::right(long long n) const
.
pub unsafe fn size(&self) -> c_longlong
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns the size of this string view, in UTF-16 code points (that is, surrogate pairs count as two for the purposes of this function, the same as in QString and QStringRef).
Calls C++ function: long long QStringView::size() const
.
pub unsafe fn starts_with_q_string_view_case_sensitivity(
&self,
s: impl CastInto<Ref<QStringView>>,
cs: CaseSensitivity
) -> bool
[src]
&self,
s: impl CastInto<Ref<QStringView>>,
cs: CaseSensitivity
) -> bool
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::startsWith(QStringView s, Qt::CaseSensitivity cs = …) const
.
pub unsafe fn starts_with_q_latin1_string_case_sensitivity(
&self,
s: impl CastInto<Ref<QLatin1String>>,
cs: CaseSensitivity
) -> bool
[src]
&self,
s: impl CastInto<Ref<QLatin1String>>,
cs: CaseSensitivity
) -> bool
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::startsWith(QLatin1String s, Qt::CaseSensitivity cs = …) const
.
pub unsafe fn starts_with_q_char(&self, c: impl CastInto<Ref<QChar>>) -> bool
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::startsWith(QChar c) const
.
pub unsafe fn starts_with_q_char_case_sensitivity(
&self,
c: impl CastInto<Ref<QChar>>,
cs: CaseSensitivity
) -> bool
[src]
&self,
c: impl CastInto<Ref<QChar>>,
cs: CaseSensitivity
) -> bool
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::startsWith(QChar c, Qt::CaseSensitivity cs) const
.
pub unsafe fn starts_with_q_string_view(
&self,
s: impl CastInto<Ref<QStringView>>
) -> bool
[src]
&self,
s: impl CastInto<Ref<QStringView>>
) -> bool
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::startsWith(QStringView s) const
.
pub unsafe fn starts_with_q_latin1_string(
&self,
s: impl CastInto<Ref<QLatin1String>>
) -> bool
[src]
&self,
s: impl CastInto<Ref<QLatin1String>>
) -> bool
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Calls C++ function: bool QStringView::startsWith(QLatin1String s) const
.
pub unsafe fn to_latin1(&self) -> CppBox<QByteArray>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns a Latin-1 representation of the string as a QByteArray.
Calls C++ function: QByteArray QStringView::toLatin1() const
.
Returns a Latin-1 representation of the string as a QByteArray.
The behavior is undefined if the string contains non-Latin1 characters.
See also toUtf8(), toLocal8Bit(), and QTextCodec.
pub unsafe fn to_local8_bit(&self) -> CppBox<QByteArray>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns a local 8-bit representation of the string as a QByteArray.
Calls C++ function: QByteArray QStringView::toLocal8Bit() const
.
Returns a local 8-bit representation of the string as a QByteArray.
QTextCodec::codecForLocale() is used to perform the conversion from Unicode. If the locale's encoding could not be determined, this function does the same as toLatin1().
The behavior is undefined if the string contains characters not supported by the locale's 8-bit encoding.
See also toLatin1(), toUtf8(), and QTextCodec.
pub unsafe fn to_string(&self) -> CppBox<QString>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns a deep copy of this string view's data as a QString.
Calls C++ function: QString QStringView::toString() const
.
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.
Warning: QStringView can store strings with more than 230 characters while QString cannot. Calling this function on a string view for which size() returns a value greater than INT_MAX / 2
constitutes undefined behavior.
pub unsafe fn to_ucs4(&self) -> CppBox<QVectorOfUint>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns a UCS-4/UTF-32 representation of the string as a QVector<uint>.
Calls C++ function: QVector<unsigned int> QStringView::toUcs4() const
.
Returns a UCS-4/UTF-32 representation of the string as a QVector<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 (QChar::ReplacementCharacter, which corresponds to U+FFFD
).
The returned vector is not 0-terminated.
See also toUtf8(), toLatin1(), toLocal8Bit(), and QTextCodec.
pub unsafe fn to_utf8(&self) -> CppBox<QByteArray>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns a UTF-8 representation of the string as a QByteArray.
Calls C++ function: QByteArray QStringView::toUtf8() const
.
Returns a UTF-8 representation of the string as a QByteArray.
UTF-8 is a Unicode codec and can represent all characters in a Unicode string like QString.
See also toLatin1(), toLocal8Bit(), and QTextCodec.
pub unsafe fn to_w_char_array(&self, array: *mut wchar_t) -> c_int
[src]
cpp_lib_version="5.14.0"
only.Transcribes this string into the given array.
Calls C++ function: int QStringView::toWCharArray(wchar_t* array) const
.
Transcribes this string into the given array.
The caller is responsible for ensuring array is large enough to hold the 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 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.
Note: This function writes no null terminator to the end of array.
Returns the number of wchar_t
entries written to array.
This function was introduced in Qt 5.14.
See also QString::toWCharArray().
pub unsafe fn trimmed(&self) -> CppBox<QStringView>
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Strips leading and trailing whitespace and returns the result.
Calls C++ function: QStringView QStringView::trimmed() const
.
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 ' '.
pub unsafe fn truncate(&self, n: c_longlong)
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Truncates this string view to length length.
Calls C++ function: void QStringView::truncate(long long n)
.
pub unsafe fn utf16(&self) -> *const char16_t
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Returns a const pointer to the first character in the string.
Calls C++ function: const char16_t* QStringView::utf16() const
.
Trait Implementations
impl Begin for QStringView
[src]
type Output = Ptr<QChar>
Output type.
unsafe fn begin(&self) -> Ptr<QChar>
[src]
Returns a const STL-style iterator pointing to the first character in the string.
Calls C++ function: const QChar* QStringView::begin() const
.
Returns a const STL-style iterator pointing to the first character in the string.
This function is provided for STL compatibility.
impl CppDeletable for QStringView
[src]
unsafe fn delete(&self)
[src]
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QString API.
Calls C++ function: [destructor] void QStringView::~QStringView()
.
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QString API.
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
(on compilers that support C++11 Unicode strings) 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, QStringRef, and (const QChar*, int)
), 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:
void myfun1(QStringView sv); // preferred void myfun2(const QStringView &sv); // compiles and works, but slower
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
- QChar: this overload can delegate to the QStringView version:
void fun(QChar ch) { fun(QStringView(&ch, 1)); }
even though, for technical reasons, QStringView cannot provide a QChar constructor by itself.
- QString: if you store an unmodified copy of the string and thus would like to take advantage of QString's implicit sharing.
- QLatin1String: if you can implement the function without converting the QLatin1String to UTF-16 first; users expect a function overloaded on QLatin1String to perform strictly less memory allocations than the semantically equivalent call of the QStringView version, involving construction of a QString from the QLatin1String.
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.
Note: We strongly discourage the use of QList<QStringView>, because QList is a very inefficient container for QStringViews (it would heap-allocate every element). Use QVector (or std::vector) to hold QStringViews instead.
impl Data for QStringView
[src]
type Output = Ptr<QChar>
Return type of data()
function.
unsafe fn data(&self) -> Ptr<QChar>
[src]
Returns a const pointer to the first character in the string.
Calls C++ function: const QChar* QStringView::data() const
.
impl End for QStringView
[src]
type Output = Ptr<QChar>
Output type.
unsafe fn end(&self) -> Ptr<QChar>
[src]
Returns a const STL-style iterator pointing to the imaginary character after the last character in the list.
Calls C++ function: const QChar* QStringView::end() const
.
Returns a const STL-style iterator pointing to the imaginary character after the last character in the list.
This function is provided for STL compatibility.
impl Ge<Ref<QChar>> for QStringView
[src]
unsafe fn ge(&self, rhs: &Ref<QChar>) -> bool
[src]
Returns true
if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false
.
Calls C++ function: bool operator>=(QStringView lhs, QChar rhs)
.
Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator>=(QChar c1, QChar c2)
:
Returns true
if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false
.
impl Ge<Ref<QLatin1String>> for QStringView
[src]
unsafe fn ge(&self, rhs: &Ref<QLatin1String>) -> bool
[src]
Returns true
if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false
.
Calls C++ function: bool operator>=(QStringView lhs, QLatin1String rhs)
.
Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator>=(QChar c1, QChar c2)
:
Returns true
if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false
.
impl Ge<Ref<QStringView>> for QStringView
[src]
unsafe fn ge(&self, rhs: &Ref<QStringView>) -> bool
[src]
Returns true
if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false
.
Calls C++ function: bool operator>=(QStringView lhs, QStringView rhs)
.
Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator>=(QChar c1, QChar c2)
:
Returns true
if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false
.
impl Gt<Ref<QChar>> for QStringView
[src]
unsafe fn gt(&self, rhs: &Ref<QChar>) -> bool
[src]
Calls C++ function: bool operator>(QStringView lhs, QChar rhs)
.
impl Gt<Ref<QLatin1String>> for QStringView
[src]
unsafe fn gt(&self, rhs: &Ref<QLatin1String>) -> bool
[src]
Calls C++ function: bool operator>(QStringView lhs, QLatin1String rhs)
.
impl Gt<Ref<QStringView>> for QStringView
[src]
unsafe fn gt(&self, rhs: &Ref<QStringView>) -> bool
[src]
Calls C++ function: bool operator>(QStringView lhs, QStringView rhs)
.
impl Le<Ref<QChar>> for QStringView
[src]
unsafe fn le(&self, rhs: &Ref<QChar>) -> bool
[src]
Returns true
if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false
.
Calls C++ function: bool operator<=(QStringView lhs, QChar rhs)
.
Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator<=(QChar c1, QChar c2)
:
Returns true
if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false
.
impl Le<Ref<QLatin1String>> for QStringView
[src]
unsafe fn le(&self, rhs: &Ref<QLatin1String>) -> bool
[src]
Returns true
if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false
.
Calls C++ function: bool operator<=(QStringView lhs, QLatin1String rhs)
.
Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator<=(QChar c1, QChar c2)
:
Returns true
if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false
.
impl Le<Ref<QStringView>> for QStringView
[src]
unsafe fn le(&self, rhs: &Ref<QStringView>) -> bool
[src]
Returns true
if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false
.
Calls C++ function: bool operator<=(QStringView lhs, QStringView rhs)
.
Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator<=(QChar c1, QChar c2)
:
Returns true
if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false
.
impl Lt<Ref<QChar>> for QStringView
[src]
unsafe fn lt(&self, rhs: &Ref<QChar>) -> bool
[src]
Calls C++ function: bool operator<(QStringView lhs, QChar rhs)
.
impl Lt<Ref<QLatin1String>> for QStringView
[src]
unsafe fn lt(&self, rhs: &Ref<QLatin1String>) -> bool
[src]
Calls C++ function: bool operator<(QStringView lhs, QLatin1String rhs)
.
impl Lt<Ref<QStringView>> for QStringView
[src]
unsafe fn lt(&self, rhs: &Ref<QStringView>) -> bool
[src]
Calls C++ function: bool operator<(QStringView lhs, QStringView rhs)
.
impl PartialEq<Ref<QChar>> for QStringView
[src]
fn eq(&self, rhs: &Ref<QChar>) -> bool
[src]
Returns true
if c1 and c2 are the same Unicode character; otherwise returns false
.
Calls C++ function: bool operator==(QStringView lhs, QChar rhs)
.
Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator==(QChar c1, QChar c2)
:
Returns true
if c1 and c2 are the same Unicode character; otherwise returns false
.
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<Ref<QLatin1String>> for QStringView
[src]
fn eq(&self, rhs: &Ref<QLatin1String>) -> bool
[src]
Returns true
if c1 and c2 are the same Unicode character; otherwise returns false
.
Calls C++ function: bool operator==(QStringView lhs, QLatin1String rhs)
.
Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator==(QChar c1, QChar c2)
:
Returns true
if c1 and c2 are the same Unicode character; otherwise returns false
.
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<Ref<QStringView>> for QStringView
[src]
fn eq(&self, rhs: &Ref<QStringView>) -> bool
[src]
Returns true
if c1 and c2 are the same Unicode character; otherwise returns false
.
Calls C++ function: bool operator==(QStringView lhs, QStringView rhs)
.
Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator==(QChar c1, QChar c2)
:
Returns true
if c1 and c2 are the same Unicode character; otherwise returns false
.
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl Size for QStringView
[src]
unsafe fn size(&self) -> usize
[src]
Returns the size of this string view, in UTF-16 code points (that is, surrogate pairs count as two for the purposes of this function, the same as in QString and QStringRef).
Calls C++ function: long long QStringView::size() const
.
Auto Trait Implementations
impl RefUnwindSafe for QStringView
impl Send for QStringView
impl Sync for QStringView
impl Unpin for QStringView
impl UnwindSafe for QStringView
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> CastInto<U> for T where
U: CastFrom<T>,
[src]
U: CastFrom<T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> StaticUpcast<T> for T
[src]
unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,