[Development] QUtf8String{, View}

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Sat May 23 14:39:37 CEST 2020


Il 23/05/20 03:06, Thiago Macieira ha scritto:
> As we're reviewing the changes Lars is making to get rid of QStringRef, Lars,
> Marc and I came to the conclusion that QUtf8StringView is required for Qt 6.0.
> That's because some methods that previously returned QStringRef now return
> QStringView and to retain compatibility with:
> 
>      if (xml.attribute("foo") == "bar")
> 
> where QXmlStreamReader::attribute() returns QStringView, we really need to
> capture that "bar" as a UTF-8 string and we ought to have optimised UTF-16 to
> UTF-8 comparisons. So we're working on it.

To elaborate on this: does operator==(QStringView, char*) already exist 
(maybe under QT_NO_CAST...)? If yes, isn't that char* already assumed to 
be UTF-8? Do you want a QUtf8StringView to cleanly compile also under 
QT_NO_CAST_FROM_ASCII (and obviously use UTF-8, not Latin1), to reap 
compile-time strlen, etc?

Thanks,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4329 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20200523/e34c7a48/attachment.bin>


More information about the Development mailing list