![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtCore More...
#include <qstringbuilder.h>
Inheritance diagram for QStringBuilder< A, B >:
Collaboration diagram for QStringBuilder< A, B >: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< Builder, T > | |
| T | toUpper () const |
| T | toLower () const |
Public Attributes | |
| A | a |
| B | b |
Friends | |
| class | QByteArray |
| class | QString |
Additional Inherited Members | |
Protected Member Functions inherited from QStringBuilderCommon< Builder, T > | |
| T | 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 78 of file qstringbuilder.h.
| typedef Concatenable::ConvertTo QStringBuilder< A, B >::ConvertTo |
Definition at line 122 of file qstringbuilder.h.
|
inline |
Definition at line 86 of file qstringbuilder.h.
|
default |
|
default |
|
default |
|
inline |
Definition at line 127 of file qstringbuilder.h.
References QtStringBuilder::isNull().
Here is the call graph for this function:Definition at line 123 of file qstringbuilder.h.
Definition at line 125 of file qstringbuilder.h.
References QConcatenable< QStringBuilder< A, B > >::size().
Here is the call graph for this function:
|
friend |
Definition at line 93 of file qstringbuilder.h.
Definition at line 94 of file qstringbuilder.h.
Definition at line 132 of file qstringbuilder.h.
Definition at line 133 of file qstringbuilder.h.