Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qbytearraylist.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2014 by Southwest Research Institute (R)
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#include <qbytearraylist.h>
6
8
92{
93 qsizetype totalLength = 0;
94 const qsizetype size = that->size();
95
96 for (qsizetype i = 0; i < size; ++i)
97 totalLength += that->at(i).size();
98
99 if (size > 0)
100 totalLength += seplen * (size - 1);
101
102 return totalLength;
103}
104
106{
108 if (const qsizetype joinedSize = QByteArrayList_joinedSize(that, seplen))
109 res.reserve(joinedSize); // don't call reserve(0) - it allocates one byte for the NUL
110 const qsizetype size = that->size();
111 for (qsizetype i = 0; i < size; ++i) {
112 if (i)
113 res.append(sep, seplen);
114 res += that->at(i);
115 }
116 return res;
117}
118
\inmodule QtCore
\inmodule QtCore
Definition qbytearray.h:57
void reserve(qsizetype size)
Attempts to allocate memory for at least size bytes.
Definition qbytearray.h:634
Combined button and popup list for selecting options.
QByteArray Q_CORE_EXPORT QByteArrayList_join(const QByteArrayList *that, const char *sep, qsizetype len)
static qsizetype QByteArrayList_joinedSize(const QByteArrayList *that, qsizetype seplen)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint res
static constexpr QChar sep
ptrdiff_t qsizetype
Definition qtypes.h:165