1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2016 Intel Corporation.
3// Copyright (C) 2014 by Southwest Research Institute (R)
4// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
5
6#include <QtCore/qlist.h>
7
8#ifndef QBYTEARRAYLIST_H
9#define QBYTEARRAYLIST_H
10
11#include <QtCore/qbytearray.h>
12
13#include <limits>
14
15QT_BEGIN_NAMESPACE
16
17#if !defined(QT_NO_JAVA_STYLE_ITERATORS)
18typedef QListIterator<QByteArray> QByteArrayListIterator;
19typedef QMutableListIterator<QByteArray> QMutableByteArrayListIterator;
20#endif
21
22#ifndef Q_QDOC
23
24namespace QtPrivate {
25#if QT_CORE_REMOVED_SINCE(6, 3) && QT_POINTER_SIZE != 4
26 QByteArray Q_CORE_EXPORT QByteArrayList_join(const QByteArrayList *that, const char *separator, int separatorLength);
27#endif
28 QByteArray Q_CORE_EXPORT QByteArrayList_join(const QByteArrayList *that, const char *sep, qsizetype len);
29}
30#endif
31
32#ifdef Q_QDOC
33class QByteArrayList : public QList<QByteArray>
34#else
35template <> struct QListSpecialMethods<QByteArray> : QListSpecialMethodsBase<QByteArray>
36#endif
37{
38#ifndef Q_QDOC
39protected:
40 ~QListSpecialMethods() = default;
41#endif
42public:
43 using QListSpecialMethodsBase<QByteArray>::indexOf;
44 using QListSpecialMethodsBase<QByteArray>::lastIndexOf;
45 using QListSpecialMethodsBase<QByteArray>::contains;
46
47 QByteArray join(QByteArrayView sep = {}) const
48 {
49 return QtPrivate::QByteArrayList_join(that: self(), sep: sep.data(), len: sep.size());
50 }
51 Q_WEAK_OVERLOAD
52 inline QByteArray join(const QByteArray &sep) const
53 { return join(sep: qToByteArrayViewIgnoringNull(b: sep)); }
54 inline QByteArray join(char sep) const
55 { return join(sep: {&sep, 1}); }
56};
57
58QT_END_NAMESPACE
59
60#endif // QBYTEARRAYLIST_H
61

source code of qtbase/src/corelib/text/qbytearraylist.h