qt5base-lts/qmake
Thiago Macieira b0afad8f0b Implement support for ref-qualified QString::toLatin1 & friends
This is the first step in implementing an in-place conversion of QString
to QByteArray. This requires ref-qualifiers in member functions so we
know that we have an rvalue QString.

Converting from UTF-16 to Latin1 always requires half the memory.

For conversion from UTF-16 to UTF-8, the typical string will also need
the same memory or less: characters from U+0000 to U+007F consume one
fewer byte; characters from U+0080 to U+07FF and from U+10000 to
U+1FFFFF occupy the same space in UTF-8 and UTF-16; it's only the ones
from U+0800 to U+FFFF that consume more space in the UTF-8 string.

For the locale's 8-bit codec, we can't be sure and the code (currently)
needs to go through QTextCodec anyway.

This requires a #define set before #include'ing "qstring.h". However,
since qstring.h is included by the QtCore PCH, we need an extra qmake
compiler without the PCH flags to compile this .cpp.

After this change, the distribution of calls in QtCore, Network, Gui,
and Widgets is as follows:

                  const &               &&
 toUtf8           31 (74%)              11 (26%)
 toLatin1         79 (77%)              24 (23%)
 toLocal8Bit      26 (16%)              138 (84%)

Change-Id: Idd96f9ddb51b989bc59f6da50054dd10c953dd4f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2013-12-13 09:29:58 +01:00
..
doc Doc: fixed invalid reference 2013-12-03 11:16:24 +01:00
generators qmake vcxproj: Provide saner defaults for certain WinRT options 2013-12-11 10:47:15 +01:00
library support a cache that is really just a cache 2013-11-14 19:26:20 +01:00
cachekeys.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
main.cpp fix handling of \\ in replacement string in s/// cmd of built-in sed 2013-11-23 23:31:18 +01:00
Makefile.unix Implement support for ref-qualified QString::toLatin1 & friends 2013-12-13 09:29:58 +01:00
Makefile.win32 Implement support for ref-qualified QString::toLatin1 & friends 2013-12-13 09:29:58 +01:00
meta.cpp Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
meta.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
option.cpp fix warnings about unused variables & parameters 2013-11-04 19:50:05 +01:00
option.h qmake: Expose qmake arguments as QMAKE_ARGS 2013-10-24 20:20:59 +02:00
project.cpp implement simple VFS to support caching during project parsing 2013-08-07 13:58:41 +02:00
project.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
property.cpp fix signedness warnings 2013-11-04 19:49:55 +01:00
property.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qmake_pch.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qmake-docs.pro move qmake docs into qtbase 2013-06-17 15:41:55 +02:00
qmake.pri Implement support for ref-qualified QString::toLatin1 & friends 2013-12-13 09:29:58 +01:00
qmake.pro bring fake qmake project up to snuff 2013-11-04 19:50:07 +01:00