QByteArrayList Class

The QByteArrayList class provides a list of byte arrays. More...

Header: #include <QByteArrayList>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
Inherits: QList

Note: All functions in this class are reentrant.

Public Functions

QByteArray join(QByteArrayView separator = {}) const
QByteArray join(const QByteArray &separator) const
QByteArray join(char separator) const

Detailed Description

QByteArrayList is actually just a QList<QByteArray>. It is documented as a full class just for simplicity of documenting the member methods that exist only in QList<QByteArray>.

All of QList's functionality also applies to QByteArrayList. For example, you can use isEmpty() to test whether the list is empty, and you can call functions like append(), prepend(), insert(), replace(), removeAll(), removeAt(), removeFirst(), removeLast(), and removeOne() to modify a QByteArrayList. In addition, QByteArrayList provides several join() methods for concatenating the list into a single QByteArray.

The purpose of QByteArrayList is quite different from that of QStringList. Whereas QStringList has many methods for manipulation of elements within the list, QByteArrayList does not. Normally, QStringList should be used whenever working with a list of printable strings. QByteArrayList should be used to handle and efficiently join large blobs of binary data, as when sequentially receiving serialized data through a QIODevice.

See also QByteArray and QStringList.

Member Function Documentation

[since 6.3] QByteArray QByteArrayList::join(QByteArrayView separator = {}) const

Joins all the byte arrays into a single byte array with each element separated by the given separator, if any.

This function was introduced in Qt 6.3.

QByteArray QByteArrayList::join(const QByteArray &separator) const

Joins all the byte arrays into a single byte array with each element separated by the given separator.

QByteArray QByteArrayList::join(char separator) const

Joins all the byte arrays into a single byte array with each element separated by the given separator.

Related Non-Members

QByteArrayListIterator

The QByteArrayListIterator type definition provides a Java-style const iterator for QByteArrayList.

QByteArrayList provides both Java-style iterators and STL-style iterators. The Java-style const iterator is simply a type definition for QListIterator<QByteArray>.

See also QMutableByteArrayListIterator and QByteArrayList::const_iterator.

QMutableByteArrayListIterator

The QByteArrayListIterator type definition provides a Java-style non-const iterator for QByteArrayList.

QByteArrayList provides both Java-style iterators and STL-style iterators. The Java-style non-const iterator is simply a type definition for QMutableListIterator<QByteArray>.

See also QByteArrayListIterator and QByteArrayList::iterator.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.