[][src]Struct qt_core::QLatin1String

#[repr(C)]
pub struct QLatin1String { /* fields omitted */ }

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.

Methods

impl QLatin1String[src]

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

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[]().

pub unsafe fn copy_from(
    &mut self,
    other: impl CastInto<Ref<QLatin1String>>
) -> MutRef<QLatin1String>
[src]

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.

pub unsafe fn data(&self) -> Ptr<c_char>[src]

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.

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

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().

pub unsafe fn latin1(&self) -> Ptr<c_char>[src]

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.

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

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().

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

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().

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

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().

pub unsafe fn new() -> CppBox<QLatin1String>[src]

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.

pub unsafe fn from_char(s: impl CastInto<Ptr<c_char>>) -> CppBox<QLatin1String>[src]

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().

pub unsafe fn from_char_int(
    s: impl CastInto<Ptr<c_char>>,
    sz: c_int
) -> CppBox<QLatin1String>
[src]

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().

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

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().

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

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.

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

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().

pub unsafe fn size(&self) -> c_int[src]

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.

Trait Implementations

impl PartialEq<Ref<QString>> for QLatin1String[src]

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

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().

impl PartialEq<Ptr<i8>> for QLatin1String[src]

fn eq(&self, s: &Ptr<c_char>) -> bool[src]

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.

impl PartialEq<Ref<QByteArray>> for QLatin1String[src]

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

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.

impl PartialEq<Ref<QLatin1String>> for QLatin1String[src]

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

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.

impl PartialEq<Ref<QStringRef>> for QLatin1String[src]

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

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.

impl PartialEq<Ref<QChar>> for QLatin1String[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==(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.

impl<'_> Add<Ref<QStringRef>> for &'_ QLatin1String[src]

type Output = CppBox<QString>

The resulting type after applying the + operator.

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

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

impl Lt<Ref<QString>> for QLatin1String[src]

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

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.

impl Lt<Ptr<i8>> for QLatin1String[src]

unsafe fn lt(&self, s: &Ptr<c_char>) -> bool[src]

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.

impl Lt<Ref<QByteArray>> for QLatin1String[src]

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

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.

impl Lt<Ref<QLatin1String>> for QLatin1String[src]

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

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

impl Lt<Ref<QStringRef>> for QLatin1String[src]

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

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

impl Lt<Ref<QChar>> for QLatin1String[src]

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

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

impl Le<Ref<QString>> for QLatin1String[src]

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

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().

impl Le<Ptr<i8>> for QLatin1String[src]

unsafe fn le(&self, s: &Ptr<c_char>) -> bool[src]

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.

impl Le<Ref<QByteArray>> for QLatin1String[src]

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

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.

impl Le<Ref<QLatin1String>> for QLatin1String[src]

unsafe fn le(&self, s2: &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<=(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.

impl Le<Ref<QStringRef>> for QLatin1String[src]

unsafe fn le(&self, rhs: &Ref<QStringRef>) -> 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<=(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.

impl Le<Ref<QChar>> for QLatin1String[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<=(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.

impl Gt<Ref<QString>> for QLatin1String[src]

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

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().

impl Gt<Ptr<i8>> for QLatin1String[src]

unsafe fn gt(&self, s: &Ptr<c_char>) -> bool[src]

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.

impl Gt<Ref<QByteArray>> for QLatin1String[src]

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

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.

impl Gt<Ref<QLatin1String>> for QLatin1String[src]

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

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

impl Gt<Ref<QStringRef>> for QLatin1String[src]

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

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

impl Gt<Ref<QChar>> for QLatin1String[src]

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

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

impl Ge<Ref<QString>> for QLatin1String[src]

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

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().

impl Ge<Ptr<i8>> for QLatin1String[src]

unsafe fn ge(&self, s: &Ptr<c_char>) -> bool[src]

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.

impl Ge<Ref<QByteArray>> for QLatin1String[src]

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

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.

impl Ge<Ref<QLatin1String>> for QLatin1String[src]

unsafe fn ge(&self, s2: &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>=(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.

impl Ge<Ref<QStringRef>> for QLatin1String[src]

unsafe fn ge(&self, rhs: &Ref<QStringRef>) -> 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>=(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.

impl Ge<Ref<QChar>> for QLatin1String[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>=(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.

impl CppDeletable for QLatin1String[src]

unsafe fn delete(&mut self)[src]

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.

impl Data for QLatin1String[src]

type Output = Ptr<c_char>

unsafe fn data(&self) -> Ptr<c_char>[src]

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.

impl Size for QLatin1String[src]

unsafe fn size(&self) -> usize[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<V, T> VectorAsSlice for V where
    V: Data<Output = Ptr<T>> + Size
[src]

type Item = T