On Tuesday, 15 April 2025 01:32:56 Pacific Daylight Time Ivan Solovev via Interest wrote: > > My primary question is: is there a way to avoid doing a copy for the utf8 > > data (the char *buffer in operator>> and the QByteArray utf8 in > > operator<<)? > > QString stores the data as UTF-16, so you won't be able to avoid a copy > if you want to convert the data to/from UTF-8. > > I didn't have a look at the implementation, but one thing to note is that > IIUC defining your own serialization operators for QString would be > an ODR violation. So, maybe you'd need to wrap QString into a custom > struct first.
Or just not use QDataStream in the first place. Using CBOR, strings are serialised as UTF-8 with a compressed size. Null-vs- empty distinction is lost, though. -- Thiago Macieira - thiago.macieira (AT) intel.com Principal Engineer - Intel DCAI Platform & System Engineering
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest