#include <qutfcodec_p.h>
Definition at line 80 of file qutfcodec_p.h.
◆ convertFromUnicode()
Definition at line 388 of file qutfcodec.cpp.
Referenced by QUtf32Codec::convertFromUnicode().
400 char *
data =
d.data();
405 data[2] = (char)0xfe;
406 data[3] = (char)0xff;
408 data[0] = (char)0xff;
409 data[1] = (char)0xfe;
416 for (
int i = 0; i < len; ++i) {
418 if (uc[i].isHighSurrogate() && i < len - 1)
420 *(data++) = cp >> 24;
421 *(data++) = (cp >> 16) & 0xff;
422 *(data++) = (cp >> 8) & 0xff;
423 *(data++) = cp & 0xff;
426 for (
int i = 0; i < len; ++i) {
428 if (uc[i].isHighSurrogate() && i < len - 1)
430 *(data++) = cp & 0xff;
431 *(data++) = (cp >> 8) & 0xff;
432 *(data++) = (cp >> 16) & 0xff;
433 *(data++) = cp >> 24;
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QByteArray class provides an array of bytes.
static const char * data(const QByteArray &arr)
static uint surrogateToUcs4(ushort high, ushort low)
Converts a UTF16 surrogate pair with the given high and low values to its UCS-4 code point...
◆ convertToUnicode()
Definition at line 444 of file qutfcodec.cpp.
Referenced by QUtf32Codec::convertToUnicode(), and QString::fromUcs4().
449 bool headerdone =
false;
462 result.
resize((num + len) >> 2 << 1);
465 const char *
end = chars + len;
466 while (chars < end) {
467 tuple[num++] = *chars++;
472 if (tuple[0] == 0xff && tuple[1] == 0xfe && tuple[2] == 0 && tuple[3] == 0 && endian !=
BigEndianness) {
476 }
else if (tuple[0] == 0 && tuple[1] == 0 && tuple[2] == 0xfe && tuple[3] == 0xff && endian !=
LittleEndianness) {
480 }
else if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
492 if (code >= 0x10000) {
quint32 qFromBigEndian< quint32 >(const uchar *src)
The QString class provides a Unicode character string.
The QChar class provides a 16-bit Unicode character.
static ushort highSurrogate(uint ucs4)
Returns the high surrogate value of a ucs4 code point.
static ushort lowSurrogate(uint ucs4)
Returns the low surrogate value of a ucs4 code point.
void truncate(int pos)
Truncates the string at the given position index.
const QChar * unicode() const
Returns a '\0'-terminated Unicode representation of the string.
quint32 qFromLittleEndian< quint32 >(const uchar *src)
void resize(int size)
Sets the size of the string to size characters.
static const KeyPair *const end
The documentation for this struct was generated from the following files: