Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QUtf8 Struct Reference

#include <qstringconverter_p.h>

+ Collaboration diagram for QUtf8:

Classes

struct  ValidUtf8Result
 

Static Public Member Functions

static QCharconvertToUnicode (QChar *buffer, QByteArrayView in) noexcept
 
static Q_CORE_EXPORT char16_t * convertToUnicode (char16_t *dst, QByteArrayView in) noexcept
 
static QString convertToUnicode (QByteArrayView in)
 
static Q_CORE_EXPORT QString convertToUnicode (QByteArrayView in, QStringConverter::State *state)
 
static QCharconvertToUnicode (QChar *out, QByteArrayView in, QStringConverter::State *state)
 
static char16_t * convertToUnicode (char16_t *dst, QByteArrayView in, QStringConverter::State *state)
 
static Q_CORE_EXPORT QByteArray convertFromUnicode (QStringView in)
 
static Q_CORE_EXPORT QByteArray convertFromUnicode (QStringView in, QStringConverterBase::State *state)
 
static char * convertFromUnicode (char *out, QStringView in, QStringConverter::State *state)
 
static Q_CORE_EXPORT char * convertFromLatin1 (char *out, QLatin1StringView in)
 
static ValidUtf8Result isValidUtf8 (QByteArrayView in)
 
static int compareUtf8 (QByteArrayView utf8, QStringView utf16, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
 
static int compareUtf8 (QByteArrayView utf8, QLatin1StringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive)
 
static int compareUtf8 (QByteArrayView lhs, QByteArrayView rhs, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
 

Detailed Description

Definition at line 290 of file qstringconverter_p.h.

Member Function Documentation

◆ compareUtf8() [1/3]

int QUtf8::compareUtf8 ( QByteArrayView  lhs,
QByteArrayView  rhs,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
)
staticnoexcept

Definition at line 894 of file qstringconverter.cpp.

References Qt::CaseSensitive, QChar::Null, output, QtMiscUtils::qt_lencmp(), QChar::ReplacementCharacter, and QChar::toCaseFolded().

+ Here is the call graph for this function:

◆ compareUtf8() [2/3]

int QUtf8::compareUtf8 ( QByteArrayView  utf8,
QLatin1StringView  s,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
)
static

Definition at line 864 of file qstringconverter.cpp.

References Qt::CaseInsensitive, QByteArrayView::data(), QChar::Null, output, QChar::ReplacementCharacter, QByteArrayView::size(), and QChar::toCaseFolded().

+ Here is the call graph for this function:

◆ compareUtf8() [3/3]

int QUtf8::compareUtf8 ( QByteArrayView  utf8,
QStringView  utf16,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
)
staticnoexcept

Definition at line 824 of file qstringconverter.cpp.

References Qt::CaseInsensitive, QChar::isHighSurrogate(), QChar::isLowSurrogate(), output, QChar::ReplacementCharacter, simdCompareAscii(), QChar::surrogateToUcs4(), and QChar::toCaseFolded().

Referenced by QStringView::compareStrings(), QStringView::compareStrings(), QStringView::compareStrings(), QCborContainerPrivate::compareUtf8(), QCborContainerPrivate::compareUtf8(), QtPrivate::equalStrings(), and QtPrivate::equalStrings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ convertFromLatin1()

char * QUtf8::convertFromLatin1 ( char *  out,
QLatin1StringView  in 
)
static

Definition at line 575 of file qstringconverter.cpp.

References ch, and out.

◆ convertFromUnicode() [1/3]

char * QUtf8::convertFromUnicode ( char *  out,
QStringView  in,
QStringConverter::State state 
)
static

Definition at line 505 of file qstringconverter.cpp.

References QStringConverterBase::ConvertInvalidToNull, cursor, QUtf8BaseTraits::EndOfString, QUtf8BaseTraits::Error, HeaderDone, out, Q_ASSERT, Q_LIKELY, simdEncodeAscii(), state, QStringConverterBase::Stateless, utf8bom, and QStringConverterBase::WriteBom.

+ Here is the call graph for this function:

◆ convertFromUnicode() [2/3]

QByteArray QUtf8::convertFromUnicode ( QStringView  in)
static

Definition at line 468 of file qstringconverter.cpp.

References simdEncodeAscii(), QByteArray::size(), and Qt::Uninitialized.

Referenced by QLocal8Bit::convertFromUnicode(), convertFromUnicode(), and qt_convert_to_utf8().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ convertFromUnicode() [3/3]

QByteArray QUtf8::convertFromUnicode ( QStringView  in,
QStringConverterBase::State state 
)
static

Definition at line 497 of file qstringconverter.cpp.

References ba, convertFromUnicode(), QByteArray::data(), state, QByteArray::truncate(), and Qt::Uninitialized.

+ Here is the call graph for this function:

◆ convertToUnicode() [1/6]

char16_t * QUtf8::convertToUnicode ( char16_t *  dst,
QByteArrayView  in 
)
staticnoexcept
Since
6.6 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Converts the UTF-8 sequence of bytes viewed by in to a sequence of QChar starting at dst in the destination buffer. The buffer is expected to be large enough to hold the result. An upper bound for the size of the buffer is in.size() QChars.

If, during decoding, an error occurs, a QChar::ReplacementCharacter is written.

Returns a pointer to one past the last QChar written.

This function never throws.

For QChar buffers, instead of casting manually, you can use the static QUtf8::convertToUnicode(QChar *, QByteArrayView) directly.

Definition at line 630 of file qstringconverter.cpp.

References Q_UNLIKELY, QChar::ReplacementCharacter, simdDecodeAscii(), and utf8bom.

+ Here is the call graph for this function:

◆ convertToUnicode() [2/6]

char16_t * QUtf8::convertToUnicode ( char16_t *  dst,
QByteArrayView  in,
QStringConverter::State state 
)
static

Definition at line 684 of file qstringconverter.cpp.

References begin(), ch, QStringConverterBase::ConvertInitialBom, QStringConverterBase::ConvertInvalidToNull, QUtf8BaseTraits::EndOfString, QUtf8BaseTraits::Error, HeaderDone, QChar::Null, Q_ASSERT, QChar::ReplacementCharacter, simdDecodeAscii(), state, QStringConverterBase::Stateless, and utf8bom.

+ Here is the call graph for this function:

◆ convertToUnicode() [3/6]

QString QUtf8::convertToUnicode ( QByteArrayView  in)
static

Definition at line 590 of file qstringconverter.cpp.

References convertToUnicode(), and Qt::Uninitialized.

+ Here is the call graph for this function:

◆ convertToUnicode() [4/6]

QString QUtf8::convertToUnicode ( QByteArrayView  in,
QStringConverter::State state 
)
static

Definition at line 666 of file qstringconverter.cpp.

References convertToUnicode(), state, and Qt::Uninitialized.

+ Here is the call graph for this function:

◆ convertToUnicode() [5/6]

static QChar * QUtf8::convertToUnicode ( QChar buffer,
QByteArrayView  in 
)
inlinestaticnoexcept

Definition at line 292 of file qstringconverter_p.h.

References convertToUnicode().

Referenced by append_utf8(), QAbstractConcatenable::convertFromUtf8(), convertToUnicode(), convertToUnicode(), QLocal8Bit::convertToUnicode(), convertToUnicode(), convertToUnicode(), QString::fromUtf8(), QString::insert(), and QCborStreamReaderPrivate::readStringChunk_unicode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ convertToUnicode() [6/6]

static QChar * QUtf8::convertToUnicode ( QChar out,
QByteArrayView  in,
QStringConverter::State state 
)
inlinestatic

Definition at line 303 of file qstringconverter_p.h.

References convertToUnicode(), out, and state.

+ Here is the call graph for this function:

◆ isValidUtf8()

QUtf8::ValidUtf8Result QUtf8::isValidUtf8 ( QByteArrayView  in)
static

Definition at line 793 of file qstringconverter.cpp.

References output, and simdFindNonAscii().

Referenced by checkNameDecodable(), and QtPrivate::isValidUtf8().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this struct was generated from the following files: