diff options
author | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2011-04-27 13:53:28 (GMT) |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2011-04-27 14:49:22 (GMT) |
commit | feabda665de62a0f6a82d831b45926697f30b45b (patch) | |
tree | bef0c40e7e6043130532b60060bd835e06784634 /examples/network | |
parent | 4671c273edb87e55436dd3bf0b371267c5e34ff7 (diff) | |
download | Qt-feabda665de62a0f6a82d831b45926697f30b45b.zip Qt-feabda665de62a0f6a82d831b45926697f30b45b.tar.gz Qt-feabda665de62a0f6a82d831b45926697f30b45b.tar.bz2 |
Added QStringRef::toLatin1 and QStringRef::toUtf8
These helper functions make it convenient to avoid making an unnecessary
copy of the string before converting it to a QByteArray. The current
most obvious way to do this would be:
// QStringRef text
QByteArray latin1 = text.toString().toLatin1();
Though the copy can also be avoided by doing:
const QString textData =
QString::fromRawData(text.unicode(), text.size());
QByteArray latin1 = textData.toLatin1();
Now the faster method can be achieved using the new obvious way:
QByteArray latin1 = text.toLatin1();
Reviewed-by: Thiago Macieira
Reviewed-by: Robin Burchell
Diffstat (limited to 'examples/network')
0 files changed, 0 insertions, 0 deletions