Struct qt_core::QLatin1String

source ·
#[repr(C)]
pub struct QLatin1String { /* private fields */ }
Expand description

The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.

C++ class: QLatin1String.

C++ documentation:

The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.

Many of QString's member functions are overloaded to accept const char * instead of QString. This includes the copy constructor, the assignment operator, the comparison operators, and various other functions such as insert(), replace(), and indexOf(). These functions are usually optimized to avoid constructing a QString object for the const char * data. For example, assuming str is a QString,

if (str == “auto” || str == “extern” || str == “static” || str == “register”) { ... }

is much faster than

if (str == QString(“auto”) || str == QString(“extern”) || str == QString(“static”) || str == QString(“register”)) { ... }

because it doesn't construct four temporary QString objects and make a deep copy of the character data.

Applications that define QT_NO_CAST_FROM_ASCII (as explained in the QString documentation) don't have access to QString's const char * API. To provide an efficient way of specifying constant Latin-1 strings, Qt provides the QLatin1String, which is just a very thin wrapper around a const char *. Using QLatin1String, the example code above becomes

if (str == QLatin1String(“auto”) || str == QLatin1String(“extern”) || str == QLatin1String(“static”) || str == QLatin1String(“register”) { ... }

This is a bit longer to type, but it provides exactly the same benefits as the first version of the code, and is faster than converting the Latin-1 strings using QString::fromLatin1().

Thanks to the QString(QLatin1String) constructor, QLatin1String can be used everywhere a QString is expected. For example:

QLabel *label = new QLabel(QLatin1String(“MOD”), this);

Note: If the function you're calling with a QLatin1String argument isn't actually overloaded to take QLatin1String, the implicit conversion to QString will trigger a memory allocation, which is usually what you want to avoid by using QLatin1String in the first place. In those cases, using QStringLiteral may be the better option.

Implementations§

source§

impl QLatin1String

source

pub unsafe fn at(&self, i: c_int) -> CppBox<QLatin1Char>

Returns the character at position pos in this object.

Calls C++ function: QLatin1Char QLatin1String::at(int i) const.

C++ documentation:

Returns the character at position pos in this object.

Note: This function performs no error checking. The behavior is undefined when pos < 0 or pos >= size().

This function was introduced in Qt 5.8.

See also operator[]().

source

pub unsafe fn back(&self) -> CppBox<QLatin1Char>

Available on 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 at(size() - 1).

Calls C++ function: QLatin1Char QLatin1String::back() const.

C++ documentation:

Returns the last character in the string. Same as at(size() - 1).

This function is provided for STL compatibility.

Warning: Calling this function on an empty string constitutes undefined behavior.

This function was introduced in Qt 5.10.

See also front(), at(), and operator[]().

source

pub unsafe fn begin(&self) -> *const c_char

Available on 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 char* QLatin1String::begin() const.

C++ documentation:

Returns a const STL-style iterator pointing to the first character in the string.

This function is provided for STL compatibility.

This function was introduced in Qt 5.10.

See also end(), cbegin(), rbegin(), and data().

source

pub unsafe fn cbegin(&self) -> *const c_char

Available on 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 char* QLatin1String::cbegin() const.

C++ documentation:

Same as begin().

This function is provided for STL compatibility.

This function was introduced in Qt 5.10.

See also cend(), begin(), crbegin(), and data().

source

pub unsafe fn cend(&self) -> *const c_char

Available on 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 char* QLatin1String::cend() const.

C++ documentation:

Same as end().

This function is provided for STL compatibility.

This function was introduced in Qt 5.10.

See also cbegin(), end(), and crend().

source

pub unsafe fn chop(&self, n: c_int)

Available on 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 by length characters.

Calls C++ function: void QLatin1String::chop(int n).

C++ documentation:

Truncates this string by length characters.

Same as *this = left(size() - length).

Note: The behavior is undefined when length < 0 or length > size().

This function was introduced in Qt 5.10.

See also mid(), left(), right(), chopped(), and truncate().

source

pub unsafe fn chopped(&self, n: c_int) -> CppBox<QLatin1String>

Available on 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: QLatin1String QLatin1String::chopped(int n) const.

C++ documentation:

Returns the substring of length size() - length starting at the beginning of this object.

Same as left(size() - length).

Note: The behavior is undefined when length < 0 or length > size().

This function was introduced in Qt 5.10.

See also mid(), left(), right(), chop(), and truncate().

source

pub unsafe fn contains_q_string_view_case_sensitivity( &self, s: impl CastInto<Ref<QStringView>>, cs: CaseSensitivity ) -> bool

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: bool QLatin1String::contains(QStringView s, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn contains_q_latin1_string_case_sensitivity( &self, s: impl CastInto<Ref<QLatin1String>>, cs: CaseSensitivity ) -> bool

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: bool QLatin1String::contains(QLatin1String s, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn contains_q_char_case_sensitivity( &self, c: impl CastInto<Ref<QChar>>, cs: CaseSensitivity ) -> bool

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: bool QLatin1String::contains(QChar c, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn contains_q_string_view( &self, s: impl CastInto<Ref<QStringView>> ) -> bool

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: bool QLatin1String::contains(QStringView s) const.

source

pub unsafe fn contains_q_latin1_string( &self, s: impl CastInto<Ref<QLatin1String>> ) -> bool

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: bool QLatin1String::contains(QLatin1String s) const.

source

pub unsafe fn contains_q_char(&self, c: impl CastInto<Ref<QChar>>) -> bool

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: bool QLatin1String::contains(QChar c) const.

source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QLatin1String>> ) -> Ref<QLatin1String>

The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.

Calls C++ function: QLatin1String& QLatin1String::operator=(const QLatin1String& other).

C++ documentation:

The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.

Many of QString's member functions are overloaded to accept const char * instead of QString. This includes the copy constructor, the assignment operator, the comparison operators, and various other functions such as insert(), replace(), and indexOf(). These functions are usually optimized to avoid constructing a QString object for the const char * data. For example, assuming str is a QString,

if (str == “auto” || str == “extern” || str == “static” || str == “register”) { ... }

is much faster than

if (str == QString(“auto”) || str == QString(“extern”) || str == QString(“static”) || str == QString(“register”)) { ... }

because it doesn't construct four temporary QString objects and make a deep copy of the character data.

Applications that define QT_NO_CAST_FROM_ASCII (as explained in the QString documentation) don't have access to QString's const char * API. To provide an efficient way of specifying constant Latin-1 strings, Qt provides the QLatin1String, which is just a very thin wrapper around a const char *. Using QLatin1String, the example code above becomes

if (str == QLatin1String(“auto”) || str == QLatin1String(“extern”) || str == QLatin1String(“static”) || str == QLatin1String(“register”) { ... }

This is a bit longer to type, but it provides exactly the same benefits as the first version of the code, and is faster than converting the Latin-1 strings using QString::fromLatin1().

Thanks to the QString(QLatin1String) constructor, QLatin1String can be used everywhere a QString is expected. For example:

QLabel *label = new QLabel(QLatin1String(“MOD”), this);

Note: If the function you're calling with a QLatin1String argument isn't actually overloaded to take QLatin1String, the implicit conversion to QString will trigger a memory allocation, which is usually what you want to avoid by using QLatin1String in the first place. In those cases, using QStringLiteral may be the better option.

source

pub unsafe fn data(&self) -> *const c_char

Returns the Latin-1 string stored in this object.

Calls C++ function: const char* QLatin1String::data() const.

C++ documentation:

Returns the Latin-1 string stored in this object.

source

pub unsafe fn end(&self) -> *const c_char

Available on 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 char* QLatin1String::end() const.

C++ documentation:

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.

This function was introduced in Qt 5.10.

See also begin(), cend(), and rend().

source

pub unsafe fn ends_with_q_string_view_case_sensitivity( &self, s: impl CastInto<Ref<QStringView>>, cs: CaseSensitivity ) -> bool

Available on 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 QLatin1String::endsWith(QStringView s, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn ends_with_q_latin1_string_case_sensitivity( &self, s: impl CastInto<Ref<QLatin1String>>, cs: CaseSensitivity ) -> bool

Available on 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 QLatin1String::endsWith(QLatin1String s, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn ends_with_q_char(&self, c: impl CastInto<Ref<QChar>>) -> bool

Available on 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 QLatin1String::endsWith(QChar c) const.

source

pub unsafe fn ends_with_q_char_case_sensitivity( &self, c: impl CastInto<Ref<QChar>>, cs: CaseSensitivity ) -> bool

Available on 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 QLatin1String::endsWith(QChar c, Qt::CaseSensitivity cs) const.

source

pub unsafe fn ends_with_q_string_view( &self, s: impl CastInto<Ref<QStringView>> ) -> bool

Available on 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 QLatin1String::endsWith(QStringView s) const.

source

pub unsafe fn ends_with_q_latin1_string( &self, s: impl CastInto<Ref<QLatin1String>> ) -> bool

Available on 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 QLatin1String::endsWith(QLatin1String s) const.

source

pub unsafe fn front(&self) -> CppBox<QLatin1Char>

Available on 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 at(0).

Calls C++ function: QLatin1Char QLatin1String::front() const.

C++ documentation:

Returns the first character in the string. Same as at(0).

This function is provided for STL compatibility.

Warning: Calling this function on an empty string constitutes undefined behavior.

This function was introduced in Qt 5.10.

See also back(), at(), and operator[]().

source

pub unsafe fn index(&self, i: c_int) -> CppBox<QLatin1Char>

Returns the character at position pos in this object.

Calls C++ function: QLatin1Char QLatin1String::operator[](int i) const.

C++ documentation:

Returns the character at position pos in this object.

Note: This function performs no error checking. The behavior is undefined when pos < 0 or pos >= size().

This function was introduced in Qt 5.8.

See also at().

source

pub unsafe fn index_of_q_string_view_int_case_sensitivity( &self, s: impl CastInto<Ref<QStringView>>, from: c_int, cs: CaseSensitivity ) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::indexOf(QStringView s, int from = …, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn index_of_q_latin1_string_int_case_sensitivity( &self, s: impl CastInto<Ref<QLatin1String>>, from: c_int, cs: CaseSensitivity ) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::indexOf(QLatin1String s, int from = …, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn index_of_q_char_int_case_sensitivity( &self, c: impl CastInto<Ref<QChar>>, from: c_int, cs: CaseSensitivity ) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::indexOf(QChar c, int from = …, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn index_of_q_string_view_int( &self, s: impl CastInto<Ref<QStringView>>, from: c_int ) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::indexOf(QStringView s, int from = …) const.

source

pub unsafe fn index_of_q_string_view( &self, s: impl CastInto<Ref<QStringView>> ) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::indexOf(QStringView s) const.

source

pub unsafe fn index_of_q_latin1_string_int( &self, s: impl CastInto<Ref<QLatin1String>>, from: c_int ) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::indexOf(QLatin1String s, int from = …) const.

source

pub unsafe fn index_of_q_latin1_string( &self, s: impl CastInto<Ref<QLatin1String>> ) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::indexOf(QLatin1String s) const.

source

pub unsafe fn index_of_q_char_int( &self, c: impl CastInto<Ref<QChar>>, from: c_int ) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::indexOf(QChar c, int from = …) const.

source

pub unsafe fn index_of_q_char(&self, c: impl CastInto<Ref<QChar>>) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::indexOf(QChar c) const.

source

pub unsafe fn is_empty(&self) -> bool

Available on 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 the Latin-1 string stored in this object is empty (size() == 0) or not.

Calls C++ function: bool QLatin1String::isEmpty() const.

C++ documentation:

Returns whether the Latin-1 string stored in this object is empty (size() == 0) or not.

This function was introduced in Qt 5.10.

See also isNull() and size().

source

pub unsafe fn is_null(&self) -> bool

Available on 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 the Latin-1 string stored in this object is null (data() == nullptr) or not.

Calls C++ function: bool QLatin1String::isNull() const.

C++ documentation:

Returns whether the Latin-1 string stored in this object is null (data() == nullptr) or not.

This function was introduced in Qt 5.10.

See also isEmpty() and data().

source

pub unsafe fn last_index_of_q_string_view_int_case_sensitivity( &self, s: impl CastInto<Ref<QStringView>>, from: c_int, cs: CaseSensitivity ) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::lastIndexOf(QStringView s, int from = …, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn last_index_of_q_latin1_string_int_case_sensitivity( &self, s: impl CastInto<Ref<QLatin1String>>, from: c_int, cs: CaseSensitivity ) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::lastIndexOf(QLatin1String s, int from = …, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn last_index_of_q_char_int_case_sensitivity( &self, c: impl CastInto<Ref<QChar>>, from: c_int, cs: CaseSensitivity ) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::lastIndexOf(QChar c, int from = …, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn last_index_of_q_string_view_int( &self, s: impl CastInto<Ref<QStringView>>, from: c_int ) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::lastIndexOf(QStringView s, int from = …) const.

source

pub unsafe fn last_index_of_q_string_view( &self, s: impl CastInto<Ref<QStringView>> ) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::lastIndexOf(QStringView s) const.

source

pub unsafe fn last_index_of_q_latin1_string_int( &self, s: impl CastInto<Ref<QLatin1String>>, from: c_int ) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::lastIndexOf(QLatin1String s, int from = …) const.

source

pub unsafe fn last_index_of_q_latin1_string( &self, s: impl CastInto<Ref<QLatin1String>> ) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::lastIndexOf(QLatin1String s) const.

source

pub unsafe fn last_index_of_q_char_int( &self, c: impl CastInto<Ref<QChar>>, from: c_int ) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::lastIndexOf(QChar c, int from = …) const.

source

pub unsafe fn last_index_of_q_char(&self, c: impl CastInto<Ref<QChar>>) -> c_int

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: int QLatin1String::lastIndexOf(QChar c) const.

source

pub unsafe fn latin1(&self) -> *const c_char

Returns the Latin-1 string stored in this object.

Calls C++ function: const char* QLatin1String::latin1() const.

C++ documentation:

Returns the Latin-1 string stored in this object.

source

pub unsafe fn left(&self, n: c_int) -> CppBox<QLatin1String>

Returns the substring of length length starting at position 0 in this object.

Calls C++ function: QLatin1String QLatin1String::left(int n) const.

C++ documentation:

Returns the substring of length length starting at position 0 in this object.

Note: This function performs no error checking. The behavior is undefined when length < 0 or length > size().

This function was introduced in Qt 5.8.

See also mid() and right().

source

pub unsafe fn mid_1a(&self, pos: c_int) -> CppBox<QLatin1String>

Returns the substring starting at position start in this object, and extending to the end of the string.

Calls C++ function: QLatin1String QLatin1String::mid(int pos) const.

C++ documentation:

Returns the substring starting at position start in this object, and extending to the end of the string.

Note: This function performs no error checking. The behavior is undefined when start < 0 or start > size().

This function was introduced in Qt 5.8.

See also left() and right().

source

pub unsafe fn mid_2a(&self, pos: c_int, n: c_int) -> CppBox<QLatin1String>

This is an overloaded function.

Calls C++ function: QLatin1String QLatin1String::mid(int pos, int n) const.

C++ documentation:

This is an overloaded function.

Returns the substring of length length starting at position start in this object.

Note: This function performs no error checking. The behavior is undefined when start < 0, length < 0, or start + length > size().

This function was introduced in Qt 5.8.

See also left() and right().

source

pub unsafe fn new() -> CppBox<QLatin1String>

Constructs a QLatin1String object that stores a nullptr.

Calls C++ function: [constructor] void QLatin1String::QLatin1String().

C++ documentation:

Constructs a QLatin1String object that stores a nullptr.

This function was introduced in Qt 5.6.

source

pub unsafe fn from_char(s: *const c_char) -> CppBox<QLatin1String>

Constructs a QLatin1String object that stores str.

Calls C++ function: [constructor] void QLatin1String::QLatin1String(const char* s).

C++ documentation:

Constructs a QLatin1String object that stores str.

The string data is not copied. The caller must be able to guarantee that str will not be deleted or modified as long as the QLatin1String object exists.

See also latin1().

source

pub unsafe fn from_char_int( s: *const c_char, sz: c_int ) -> CppBox<QLatin1String>

Constructs a QLatin1String object that stores str with size.

Calls C++ function: [constructor] void QLatin1String::QLatin1String(const char* s, int sz).

C++ documentation:

Constructs a QLatin1String object that stores str with size.

The string data is not copied. The caller must be able to guarantee that str will not be deleted or modified as long as the QLatin1String object exists.

See also latin1().

source

pub unsafe fn from_q_byte_array( s: impl CastInto<Ref<QByteArray>> ) -> CppBox<QLatin1String>

Constructs a QLatin1String object that stores str.

Calls C++ function: [constructor] void QLatin1String::QLatin1String(const QByteArray& s).

C++ documentation:

Constructs a QLatin1String object that stores str.

The string data is not copied. The caller must be able to guarantee that str will not be deleted or modified as long as the QLatin1String object exists.

See also latin1().

source

pub unsafe fn from_2_char( f: *const c_char, l: *const c_char ) -> CppBox<QLatin1String>

Available on 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 QLatin1String object that stores first with length (last - first).

Calls C++ function: [constructor] void QLatin1String::QLatin1String(const char* f, const char* l).

C++ documentation:

Constructs a QLatin1String object that stores first with length (last - first).

The range [first,last) must remain valid for the lifetime of this Latin-1 string object.

Passing nullptr as first is safe if last is nullptr, too, and results in a null Latin-1 string.

The behavior is undefined if last precedes first, first is nullptr and last is not, or if last - first > INT_MAX.

This function was introduced in Qt 5.10.

source

pub unsafe fn new_copy( other: impl CastInto<Ref<QLatin1String>> ) -> CppBox<QLatin1String>

The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.

Calls C++ function: [constructor] void QLatin1String::QLatin1String(const QLatin1String& other).

C++ documentation:

The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.

Many of QString's member functions are overloaded to accept const char * instead of QString. This includes the copy constructor, the assignment operator, the comparison operators, and various other functions such as insert(), replace(), and indexOf(). These functions are usually optimized to avoid constructing a QString object for the const char * data. For example, assuming str is a QString,

if (str == “auto” || str == “extern” || str == “static” || str == “register”) { ... }

is much faster than

if (str == QString(“auto”) || str == QString(“extern”) || str == QString(“static”) || str == QString(“register”)) { ... }

because it doesn't construct four temporary QString objects and make a deep copy of the character data.

Applications that define QT_NO_CAST_FROM_ASCII (as explained in the QString documentation) don't have access to QString's const char * API. To provide an efficient way of specifying constant Latin-1 strings, Qt provides the QLatin1String, which is just a very thin wrapper around a const char *. Using QLatin1String, the example code above becomes

if (str == QLatin1String(“auto”) || str == QLatin1String(“extern”) || str == QLatin1String(“static”) || str == QLatin1String(“register”) { ... }

This is a bit longer to type, but it provides exactly the same benefits as the first version of the code, and is faster than converting the Latin-1 strings using QString::fromLatin1().

Thanks to the QString(QLatin1String) constructor, QLatin1String can be used everywhere a QString is expected. For example:

QLabel *label = new QLabel(QLatin1String(“MOD”), this);

Note: If the function you're calling with a QLatin1String argument isn't actually overloaded to take QLatin1String, the implicit conversion to QString will trigger a memory allocation, which is usually what you want to avoid by using QLatin1String in the first place. In those cases, using QStringLiteral may be the better option.

source

pub unsafe fn right(&self, n: c_int) -> CppBox<QLatin1String>

Returns the substring of length length starting at position size() - length in this object.

Calls C++ function: QLatin1String QLatin1String::right(int n) const.

C++ documentation:

Returns the substring of length length starting at position size() - length in this object.

Note: This function performs no error checking. The behavior is undefined when length < 0 or length > size().

This function was introduced in Qt 5.8.

See also mid() and left().

source

pub unsafe fn size(&self) -> c_int

Returns the size of the Latin-1 string stored in this object.

Calls C++ function: int QLatin1String::size() const.

C++ documentation:

Returns the size of the Latin-1 string stored in this object.

source

pub unsafe fn starts_with_q_string_view_case_sensitivity( &self, s: impl CastInto<Ref<QStringView>>, cs: CaseSensitivity ) -> bool

Available on 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 QLatin1String::startsWith(QStringView s, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn starts_with_q_latin1_string_case_sensitivity( &self, s: impl CastInto<Ref<QLatin1String>>, cs: CaseSensitivity ) -> bool

Available on 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 QLatin1String::startsWith(QLatin1String s, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn starts_with_q_char(&self, c: impl CastInto<Ref<QChar>>) -> bool

Available on 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 QLatin1String::startsWith(QChar c) const.

source

pub unsafe fn starts_with_q_char_case_sensitivity( &self, c: impl CastInto<Ref<QChar>>, cs: CaseSensitivity ) -> bool

Available on 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 QLatin1String::startsWith(QChar c, Qt::CaseSensitivity cs) const.

source

pub unsafe fn starts_with_q_string_view( &self, s: impl CastInto<Ref<QStringView>> ) -> bool

Available on 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 QLatin1String::startsWith(QStringView s) const.

source

pub unsafe fn starts_with_q_latin1_string( &self, s: impl CastInto<Ref<QLatin1String>> ) -> bool

Available on 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 QLatin1String::startsWith(QLatin1String s) const.

source

pub unsafe fn trimmed(&self) -> CppBox<QLatin1String>

Available on 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: QLatin1String QLatin1String::trimmed() const.

C++ documentation:

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 ' '.

This function was introduced in Qt 5.10.

source

pub unsafe fn truncate(&self, n: c_int)

Available on 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 to length length.

Calls C++ function: void QLatin1String::truncate(int n).

C++ documentation:

Truncates this string to length length.

Same as *this = left(length).

Note: The behavior is undefined when length < 0 or length > size().

This function was introduced in Qt 5.10.

See also mid(), left(), right(), chopped(), and chop().

Trait Implementations§

source§

impl Add<Ref<QStringRef>> for &QLatin1String

source§

fn add(self, s2: Ref<QStringRef>) -> CppBox<QString>

Calls C++ function: QString operator+(QLatin1String s1, const QStringRef& s2).

§

type Output = CppBox<QString>

The resulting type after applying the + operator.
source§

impl Begin for QLatin1String

Available on 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.
source§

unsafe fn begin(&self) -> *const c_char

Returns a const STL-style iterator pointing to the first character in the string.

Calls C++ function: const char* QLatin1String::begin() const.

C++ documentation:

Returns a const STL-style iterator pointing to the first character in the string.

This function is provided for STL compatibility.

This function was introduced in Qt 5.10.

See also end(), cbegin(), rbegin(), and data().

§

type Output = *const i8

Output type.
source§

impl CppDeletable for QLatin1String

source§

unsafe fn delete(&self)

The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.

Calls C++ function: [destructor] void QLatin1String::~QLatin1String().

C++ documentation:

The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.

Many of QString's member functions are overloaded to accept const char * instead of QString. This includes the copy constructor, the assignment operator, the comparison operators, and various other functions such as insert(), replace(), and indexOf(). These functions are usually optimized to avoid constructing a QString object for the const char * data. For example, assuming str is a QString,

if (str == “auto” || str == “extern” || str == “static” || str == “register”) { ... }

is much faster than

if (str == QString(“auto”) || str == QString(“extern”) || str == QString(“static”) || str == QString(“register”)) { ... }

because it doesn't construct four temporary QString objects and make a deep copy of the character data.

Applications that define QT_NO_CAST_FROM_ASCII (as explained in the QString documentation) don't have access to QString's const char * API. To provide an efficient way of specifying constant Latin-1 strings, Qt provides the QLatin1String, which is just a very thin wrapper around a const char *. Using QLatin1String, the example code above becomes

if (str == QLatin1String(“auto”) || str == QLatin1String(“extern”) || str == QLatin1String(“static”) || str == QLatin1String(“register”) { ... }

This is a bit longer to type, but it provides exactly the same benefits as the first version of the code, and is faster than converting the Latin-1 strings using QString::fromLatin1().

Thanks to the QString(QLatin1String) constructor, QLatin1String can be used everywhere a QString is expected. For example:

QLabel *label = new QLabel(QLatin1String(“MOD”), this);

Note: If the function you're calling with a QLatin1String argument isn't actually overloaded to take QLatin1String, the implicit conversion to QString will trigger a memory allocation, which is usually what you want to avoid by using QLatin1String in the first place. In those cases, using QStringLiteral may be the better option.

source§

impl Data for QLatin1String

source§

unsafe fn data(&self) -> *const c_char

Returns the Latin-1 string stored in this object.

Calls C++ function: const char* QLatin1String::data() const.

C++ documentation:

Returns the Latin-1 string stored in this object.

§

type Output = *const i8

Return type of data() function.
source§

impl End for QLatin1String

Available on 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.
source§

unsafe fn end(&self) -> *const c_char

Returns a const STL-style iterator pointing to the imaginary character after the last character in the list.

Calls C++ function: const char* QLatin1String::end() const.

C++ documentation:

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.

This function was introduced in Qt 5.10.

See also begin(), cend(), and rend().

§

type Output = *const i8

Output type.
source§

impl Ge<*const i8> for QLatin1String

source§

unsafe fn ge(&self, s: &*const c_char) -> bool

This is an overloaded function.

Calls C++ function: bool QLatin1String::operator>=(const char* s) const.

C++ documentation:

This is an overloaded function.

The other const char pointer is converted to a QString using the QString::fromUtf8() function.

You can disable this operator by defining QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr(), for example.

This function was introduced in Qt 4.3.

source§

impl Ge<Ref<QByteArray>> for QLatin1String

source§

unsafe fn ge(&self, s: &Ref<QByteArray>) -> bool

This is an overloaded function.

Calls C++ function: bool QLatin1String::operator>=(const QByteArray& s) const.

C++ documentation:

This is an overloaded function.

The other array is converted to a QString using the QString::fromUtf8() function.

You can disable this operator by defining QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr(), for example.

This function was introduced in Qt 5.0.

source§

impl Ge<Ref<QChar>> for QLatin1String

source§

unsafe fn ge(&self, rhs: &Ref<QChar>) -> bool

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>=(QLatin1String 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.

source§

impl Ge<Ref<QLatin1String>> for QLatin1String

source§

unsafe fn ge(&self, s2: &Ref<QLatin1String>) -> bool

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>=(QLatin1String s1, QLatin1String s2).

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.

source§

impl Ge<Ref<QString>> for QLatin1String

source§

unsafe fn ge(&self, s: &Ref<QString>) -> bool

Returns true if this string is lexically greater than or equal to string other; otherwise returns false.

Calls C++ function: bool QLatin1String::operator>=(const QString& s) const.

C++ documentation:

Returns true if this string is lexically greater than or equal to string other; otherwise returns false.

The 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-interface strings with QString::localeAwareCompare().

source§

impl Ge<Ref<QStringRef>> for QLatin1String

source§

unsafe fn ge(&self, rhs: &Ref<QStringRef>) -> bool

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>=(QLatin1String lhs, const QStringRef& 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.

source§

impl Ge<Ref<QStringView>> for QLatin1String

Available on 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.
source§

unsafe fn ge(&self, rhs: &Ref<QStringView>) -> bool

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>=(QLatin1String 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.

source§

impl Gt<*const i8> for QLatin1String

source§

unsafe fn gt(&self, s: &*const c_char) -> bool

This is an overloaded function.

Calls C++ function: bool QLatin1String::operator>(const char* s) const.

C++ documentation:

This is an overloaded function.

The other const char pointer is converted to a QString using the QString::fromUtf8() function.

You can disable this operator by defining QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr(), for example.

This function was introduced in Qt 4.3.

source§

impl Gt<Ref<QByteArray>> for QLatin1String

source§

unsafe fn gt(&self, s: &Ref<QByteArray>) -> bool

This is an overloaded function.

Calls C++ function: bool QLatin1String::operator>(const QByteArray& s) const.

C++ documentation:

This is an overloaded function.

The other const char pointer is converted to a QString using the QString::fromUtf8() function.

You can disable this operator by defining QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr(), for example.

This function was introduced in Qt 5.0.

source§

impl Gt<Ref<QChar>> for QLatin1String

source§

unsafe fn gt(&self, rhs: &Ref<QChar>) -> bool

Calls C++ function: bool operator>(QLatin1String lhs, QChar rhs).

source§

impl Gt<Ref<QLatin1String>> for QLatin1String

source§

unsafe fn gt(&self, s2: &Ref<QLatin1String>) -> bool

Calls C++ function: bool operator>(QLatin1String s1, QLatin1String s2).

source§

impl Gt<Ref<QString>> for QLatin1String

source§

unsafe fn gt(&self, s: &Ref<QString>) -> bool

Returns true if this string is lexically greater than string other; otherwise returns false.

Calls C++ function: bool QLatin1String::operator>(const QString& s) const.

C++ documentation:

Returns true if this string is lexically greater than string other; otherwise returns false.

The 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-interface strings with QString::localeAwareCompare().

source§

impl Gt<Ref<QStringRef>> for QLatin1String

source§

unsafe fn gt(&self, rhs: &Ref<QStringRef>) -> bool

Calls C++ function: bool operator>(QLatin1String lhs, const QStringRef& rhs).

source§

impl Gt<Ref<QStringView>> for QLatin1String

Available on 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.
source§

unsafe fn gt(&self, rhs: &Ref<QStringView>) -> bool

Calls C++ function: bool operator>(QLatin1String lhs, QStringView rhs).

source§

impl Le<*const i8> for QLatin1String

source§

unsafe fn le(&self, s: &*const c_char) -> bool

This is an overloaded function.

Calls C++ function: bool QLatin1String::operator<=(const char* s) const.

C++ documentation:

This is an overloaded function.

The other const char pointer is converted to a QString using the QString::fromUtf8() function.

You can disable this operator by defining QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr(), for example.

This function was introduced in Qt 4.3.

source§

impl Le<Ref<QByteArray>> for QLatin1String

source§

unsafe fn le(&self, s: &Ref<QByteArray>) -> bool

This is an overloaded function.

Calls C++ function: bool QLatin1String::operator<=(const QByteArray& s) const.

C++ documentation:

This is an overloaded function.

The other array is converted to a QString using the QString::fromUtf8() function.

You can disable this operator by defining QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr(), for example.

This function was introduced in Qt 5.0.

source§

impl Le<Ref<QChar>> for QLatin1String

source§

unsafe fn le(&self, rhs: &Ref<QChar>) -> bool

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<=(QLatin1String 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.

source§

impl Le<Ref<QLatin1String>> for QLatin1String

source§

unsafe fn le(&self, s2: &Ref<QLatin1String>) -> bool

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<=(QLatin1String s1, QLatin1String s2).

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.

source§

impl Le<Ref<QString>> for QLatin1String

source§

unsafe fn le(&self, s: &Ref<QString>) -> bool

Returns true if this string is lexically less than or equal to string other; otherwise returns false.

Calls C++ function: bool QLatin1String::operator<=(const QString& s) const.

C++ documentation:

Returns true if this string is lexically less than or equal to string other; otherwise returns false.

The 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-interface strings with QString::localeAwareCompare().

source§

impl Le<Ref<QStringRef>> for QLatin1String

source§

unsafe fn le(&self, rhs: &Ref<QStringRef>) -> bool

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<=(QLatin1String lhs, const QStringRef& 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.

source§

impl Le<Ref<QStringView>> for QLatin1String

Available on 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.
source§

unsafe fn le(&self, rhs: &Ref<QStringView>) -> bool

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<=(QLatin1String 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.

source§

impl Lt<*const i8> for QLatin1String

source§

unsafe fn lt(&self, s: &*const c_char) -> bool

This is an overloaded function.

Calls C++ function: bool QLatin1String::operator<(const char* s) const.

C++ documentation:

This is an overloaded function.

The other const char pointer is converted to a QString using the QString::fromUtf8() function.

You can disable this operator by defining QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr(), for example.

This function was introduced in Qt 4.3.

source§

impl Lt<Ref<QByteArray>> for QLatin1String

source§

unsafe fn lt(&self, s: &Ref<QByteArray>) -> bool

This is an overloaded function.

Calls C++ function: bool QLatin1String::operator<(const QByteArray& s) const.

C++ documentation:

This is an overloaded function.

The other const char pointer is converted to a QString using the QString::fromUtf8() function.

You can disable this operator by defining QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr(), for example.

This function was introduced in Qt 5.0.

source§

impl Lt<Ref<QChar>> for QLatin1String

source§

unsafe fn lt(&self, rhs: &Ref<QChar>) -> bool

Calls C++ function: bool operator<(QLatin1String lhs, QChar rhs).

source§

impl Lt<Ref<QLatin1String>> for QLatin1String

source§

unsafe fn lt(&self, s2: &Ref<QLatin1String>) -> bool

Calls C++ function: bool operator<(QLatin1String s1, QLatin1String s2).

source§

impl Lt<Ref<QString>> for QLatin1String

source§

unsafe fn lt(&self, s: &Ref<QString>) -> bool

Returns true if this string is lexically less than the other string; otherwise returns false.

Calls C++ function: bool QLatin1String::operator<(const QString& s) const.

C++ documentation:

Returns true if this string is lexically less than the other string; otherwise returns false.

The 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-interface strings using the QString::localeAwareCompare() function.

source§

impl Lt<Ref<QStringRef>> for QLatin1String

source§

unsafe fn lt(&self, rhs: &Ref<QStringRef>) -> bool

Calls C++ function: bool operator<(QLatin1String lhs, const QStringRef& rhs).

source§

impl Lt<Ref<QStringView>> for QLatin1String

Available on 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.
source§

unsafe fn lt(&self, rhs: &Ref<QStringView>) -> bool

Calls C++ function: bool operator<(QLatin1String lhs, QStringView rhs).

source§

impl PartialEq<*const i8> for QLatin1String

source§

fn eq(&self, s: &*const c_char) -> bool

This is an overloaded function.

Calls C++ function: bool QLatin1String::operator==(const char* s) const.

C++ documentation:

This is an overloaded function.

The other const char pointer is converted to a QString using the QString::fromUtf8() function.

You can disable this operator by defining QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr(), for example.

This function was introduced in Qt 4.3.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Ref<QByteArray>> for QLatin1String

source§

fn eq(&self, s: &Ref<QByteArray>) -> bool

This is an overloaded function.

Calls C++ function: bool QLatin1String::operator==(const QByteArray& s) const.

C++ documentation:

This is an overloaded function.

The other byte array is converted to a QString using the QString::fromUtf8() function.

You can disable this operator by defining QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr(), for example.

This function was introduced in Qt 5.0.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Ref<QChar>> for QLatin1String

source§

fn eq(&self, rhs: &Ref<QChar>) -> bool

Returns true if c1 and c2 are the same Unicode character; otherwise returns false.

Calls C++ function: bool operator==(QLatin1String 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.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Ref<QLatin1String>> for QLatin1String

source§

fn eq(&self, s2: &Ref<QLatin1String>) -> bool

Returns true if c1 and c2 are the same Unicode character; otherwise returns false.

Calls C++ function: bool operator==(QLatin1String s1, QLatin1String s2).

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.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Ref<QString>> for QLatin1String

source§

fn eq(&self, s: &Ref<QString>) -> bool

Returns true if this string is equal to string other; otherwise returns false.

Calls C++ function: bool QLatin1String::operator==(const QString& s) const.

C++ documentation:

Returns true if this string is equal to string other; otherwise returns false.

The 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-interface strings with QString::localeAwareCompare().

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Ref<QStringRef>> for QLatin1String

source§

fn eq(&self, rhs: &Ref<QStringRef>) -> bool

Returns true if c1 and c2 are the same Unicode character; otherwise returns false.

Calls C++ function: bool operator==(QLatin1String lhs, const QStringRef& 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.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Ref<QStringView>> for QLatin1String

Available on 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.
source§

fn eq(&self, rhs: &Ref<QStringView>) -> bool

Returns true if c1 and c2 are the same Unicode character; otherwise returns false.

Calls C++ function: bool operator==(QLatin1String 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.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Size for QLatin1String

source§

unsafe fn size(&self) -> usize

Returns the size of the Latin-1 string stored in this object.

Calls C++ function: int QLatin1String::size() const.

C++ documentation:

Returns the size of the Latin-1 string stored in this object.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.