summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qbytearray.cpp
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2021-03-04 17:19:33 +0100
committerAndrei Golubev <andrei.golubev@qt.io>2021-03-30 10:37:07 +0100
commitb1377ed02dce9a173e345aab22af504de2b77d54 (patch)
tree7909d18d4d97211ecf78600b9fca706dc399c483 /src/corelib/text/qbytearray.cpp
parentccf1a1a9536be7b904494f5b3243202d71a33b06 (diff)
Add literal operators for QString and QByteArray
[ChangeLog][QtCore][QString] Added literal operator u"..."_qs that converts a char16_t string literal to QString [ChangeLog][QtCore][QByteArray] Added literal operator "..."_qba that converts char string literal to QByteArray Change-Id: I4aa59b28cc17bff346b378eb70008fb8185d21ac Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/text/qbytearray.cpp')
-rw-r--r--src/corelib/text/qbytearray.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp
index bead997ab8..677fc6d6ac 100644
--- a/src/corelib/text/qbytearray.cpp
+++ b/src/corelib/text/qbytearray.cpp
@@ -4767,6 +4767,27 @@ QByteArray QByteArray::toPercentEncoding(const QByteArray &exclude, const QByteA
*/
/*!
+ \function QtLiterals::operator""_qba(const char *str, size_t size)
+
+ \relates QByteArray
+ \since 6.2
+
+ Literal operator that creates a QByteArray out of a char string literal \a
+ str. Creating a QByteArray from it is free in this case, and the generated
+ string data is stored in the read-only segment of the compiled object file.
+ Duplicate literals may share the same read-only memory. This functionality is
+ interchangeable with QByteArrayLiteral, but saves typing when many string
+ literals are present in the code.
+
+ The following code creates a QByteArray:
+ \code
+ auto str = "hello"_qba;
+ \endcode
+
+ \sa QByteArrayLiteral, QtLiterals::operator""_qs(const char16_t *str, size_t size)
+*/
+
+/*!
\class QByteArray::FromBase64Result
\inmodule QtCore
\ingroup tools