Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtCore More...
#include <qstringbuilder.h>
Public Types | |
typedef Concatenable::ConvertTo | ConvertTo |
Public Member Functions | |
QStringBuilder (A &&a_, B &&b_) | |
QStringBuilder (QStringBuilder &&)=default | |
QStringBuilder (const QStringBuilder &)=default | |
~QStringBuilder ()=default | |
operator ConvertTo () const | |
qsizetype | size () const |
bool | isNull () const |
Public Member Functions inherited from QStringBuilderCommon< QStringBuilder< A, B >, QtStringBuilder::ConvertToTypeHelper< QConcatenableEx< A >::ConvertTo, QConcatenableEx< B >::ConvertTo >::ConvertTo > | |
QtStringBuilder::ConvertToTypeHelper< QConcatenableEx< A >::ConvertTo, QConcatenableEx< B >::ConvertTo >::ConvertTo | toUpper () const |
QtStringBuilder::ConvertToTypeHelper< QConcatenableEx< A >::ConvertTo, QConcatenableEx< B >::ConvertTo >::ConvertTo | toLower () const |
Public Attributes | |
A | a |
B | b |
Friends | |
class | QByteArray |
class | QString |
Additional Inherited Members | |
Protected Member Functions inherited from QStringBuilderCommon< QStringBuilder< A, B >, QtStringBuilder::ConvertToTypeHelper< QConcatenableEx< A >::ConvertTo, QConcatenableEx< B >::ConvertTo >::ConvertTo > | |
QtStringBuilder::ConvertToTypeHelper< QConcatenableEx< A >::ConvertTo, QConcatenableEx< B >::ConvertTo >::ConvertTo | resolved () const |
\inmodule QtCore
\reentrant
The QStringBuilder class is a template class that provides a facility to build up QStrings and QByteArrays from smaller chunks.
To build a QString by multiple concatenations, QString::operator+() is typically used. This causes {n - 1} allocations when building a string from {n} chunks. The same is true for QByteArray.
QStringBuilder uses expression templates to collect the individual chunks, compute the total size, allocate the required amount of memory for the final string object, and copy the chunks into the allocated memory.
The QStringBuilder class is not to be used explicitly in user code. Instances of the class are created as return values of the operator%() function, acting on objects of the following types:
For building QStrings:
\list
char16_t
,
{const char16_t[]} (
{u"foo"}), char
,
{const char[]}. \endlistThe types in the last list point are only available when QT_NO_CAST_FROM_ASCII
is not defined.
For building QByteArrays:
\list
char
,
{const char[]}. \endlistConcatenating strings with operator%() generally yields better performance than using QString::operator+()
on the same chunks if there are three or more of them, and performs equally well in other cases.
QT_USE_QSTRINGBUILDER
at build time (this is the default when building Qt libraries and tools), will make using {'+'}
when concatenating strings work the same way as operator%()
.Definition at line 79 of file qstringbuilder.h.
Concatenable::ConvertTo QStringBuilder< A, B >::ConvertTo |
Definition at line 129 of file qstringbuilder.h.
|
inline |
Definition at line 87 of file qstringbuilder.h.
References QStringBuilder< A, B >::a, and QStringBuilder< A, B >::b.
|
default |
|
default |
|
default |
|
inline |
Definition at line 134 of file qstringbuilder.h.
References QStringBuilder< A, B >::a, and QStringBuilder< A, B >::b.
Definition at line 130 of file qstringbuilder.h.
Definition at line 132 of file qstringbuilder.h.
|
friend |
Definition at line 94 of file qstringbuilder.h.
Definition at line 95 of file qstringbuilder.h.
Definition at line 139 of file qstringbuilder.h.
Referenced by QStringBuilder< A, B >::QStringBuilder(), and QStringBuilder< A, B >::isNull().
Definition at line 140 of file qstringbuilder.h.
Referenced by QStringBuilder< A, B >::QStringBuilder(), and QStringBuilder< A, B >::isNull().