59 using DataPointer = QByteArrayData;
61 typedef QTypedArrayData<
char> Data;
64 static const char _empty;
66 friend class ::tst_QByteArray;
68 template <
typename InputIterator>
69 using if_input_iterator = QtPrivate::IfIsInputIterator<InputIterator>;
73 Base64UrlEncoding = 1,
75 KeepTrailingEquals = 0,
76 OmitTrailingEquals = 2,
78 IgnoreBase64DecodingErrors = 0,
79 AbortOnBase64DecodingErrors = 4,
81 Q_DECLARE_FLAGS(Base64Options, Base64Option)
83 enum class Base64DecodingStatus {
90 inline constexpr QByteArray()
noexcept;
91 QByteArray(
const char *, qsizetype size = -1);
92 QByteArray(qsizetype size,
char c);
93 QByteArray(qsizetype size, Qt::Initialization);
94 explicit QByteArray(QByteArrayView v) : QByteArray(v.data(), v.size()) {}
95 inline QByteArray(
const QByteArray &)
noexcept;
98 QByteArray &operator=(
const QByteArray &)
noexcept;
99 QByteArray &operator=(
const char *str);
100 inline QByteArray(QByteArray && other)
noexcept
102 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QByteArray)
103 inline void swap(QByteArray &other)
noexcept
106 constexpr bool isEmpty()
const noexcept {
return size() == 0; }
107 void resize(qsizetype size);
108 void resize(qsizetype size,
char c);
109 void resizeForOverwrite(qsizetype size);
111 QByteArray &fill(
char c, qsizetype size = -1);
113 inline qsizetype capacity()
const;
114 inline void reserve(qsizetype size);
115 inline void squeeze();
117#ifndef QT_NO_CAST_FROM_BYTEARRAY
118 inline operator
const char *()
const;
119 inline operator
const void *()
const;
126#if (!defined(Q_OS_QNX) || !defined(Q_CC_GNU_ONLY) || Q_CC_GNU_ONLY > 803
) &&
127 (!defined(Q_CC_GHS) || !defined(__GHS_VERSION_NUMBER) || __GHS_VERSION_NUMBER > 202214
)
128# define QT_BYTEARRAY_CONVERTS_TO_STD_STRING_VIEW
129 Q_IMPLICIT operator std::string_view()
const noexcept
130 {
return std::string_view(data(), std::size_t(size())); }
134 inline const char *data()
const noexcept;
135 const char *constData()
const noexcept {
return data(); }
136 inline void detach();
137 inline bool isDetached()
const;
138 inline bool isSharedWith(
const QByteArray &other)
const noexcept
139 {
return data() == other.data() && size() == other.size(); }
142 inline char at(qsizetype i)
const;
143 inline char operator[](qsizetype i)
const;
144 [[nodiscard]]
inline char &operator[](qsizetype i);
145 [[nodiscard]]
char front()
const {
return at(0); }
146 [[nodiscard]]
inline char &front();
147 [[nodiscard]]
char back()
const {
return at(size() - 1); }
148 [[nodiscard]]
inline char &back();
150 QT_CORE_INLINE_SINCE(6, 8)
151 qsizetype indexOf(
char c, qsizetype from = 0)
const;
152 qsizetype indexOf(QByteArrayView bv, qsizetype from = 0)
const
153 {
return QtPrivate::findByteArray(qToByteArrayViewIgnoringNull(*
this), from, bv); }
155 QT_CORE_INLINE_SINCE(6, 8)
156 qsizetype lastIndexOf(
char c, qsizetype from = -1)
const;
157 qsizetype lastIndexOf(QByteArrayView bv)
const
158 {
return lastIndexOf(bv, size()); }
159 qsizetype lastIndexOf(QByteArrayView bv, qsizetype from)
const
160 {
return QtPrivate::lastIndexOf(qToByteArrayViewIgnoringNull(*
this), from, bv); }
162 inline bool contains(
char c)
const;
163 inline bool contains(QByteArrayView bv)
const;
164 qsizetype count(
char c)
const;
165 qsizetype count(QByteArrayView bv)
const
166 {
return QtPrivate::count(qToByteArrayViewIgnoringNull(*
this), bv); }
168 inline int compare(QByteArrayView a, Qt::CaseSensitivity cs = Qt::CaseSensitive)
const noexcept;
170#if QT_CORE_REMOVED_SINCE(6
, 7
)
171 QByteArray left(qsizetype len)
const;
172 QByteArray right(qsizetype len)
const;
173 QByteArray mid(qsizetype index, qsizetype len = -1)
const;
174 QByteArray first(qsizetype n)
const;
175 QByteArray last(qsizetype n)
const;
176 QByteArray sliced(qsizetype pos)
const;
177 QByteArray sliced(qsizetype pos, qsizetype n)
const;
178 QByteArray chopped(qsizetype len)
const;
180 [[nodiscard]] QByteArray left(qsizetype n)
const &
184 return first(qMax(n, 0));
186 [[nodiscard]] QByteArray left(qsizetype n) &&
189 return std::move(*
this);
190 return std::move(*
this).first(qMax(n, 0));
192 [[nodiscard]] QByteArray right(qsizetype n)
const &
196 return last(qMax(n, 0));
198 [[nodiscard]] QByteArray right(qsizetype n) &&
201 return std::move(*
this);
202 return std::move(*
this).last(qMax(n, 0));
204 [[nodiscard]] QByteArray mid(qsizetype index, qsizetype len = -1)
const &;
205 [[nodiscard]] QByteArray mid(qsizetype index, qsizetype len = -1) &&;
207 [[nodiscard]] QByteArray first(qsizetype n)
const &
208 { verify(0, n);
return sliced(0, n); }
209 [[nodiscard]] QByteArray last(qsizetype n)
const &
210 { verify(0, n);
return sliced(size() - n, n); }
211 [[nodiscard]] QByteArray sliced(qsizetype pos)
const &
212 { verify(pos, 0);
return sliced(pos, size() - pos); }
213 [[nodiscard]] QByteArray sliced(qsizetype pos, qsizetype n)
const &
214 { verify(pos, n);
return QByteArray(d.data() + pos, n); }
215 [[nodiscard]] QByteArray chopped(qsizetype len)
const &
216 { verify(0, len);
return sliced(0, size() - len); }
218 [[nodiscard]] QByteArray first(qsizetype n) &&
222 return std::move(*
this);
224 [[nodiscard]] QByteArray last(qsizetype n) &&
225 { verify(0, n);
return sliced_helper(*
this, size() - n, n); }
226 [[nodiscard]] QByteArray sliced(qsizetype pos) &&
227 { verify(pos, 0);
return sliced_helper(*
this, pos, size() - pos); }
228 [[nodiscard]] QByteArray sliced(qsizetype pos, qsizetype n) &&
229 { verify(pos, n);
return sliced_helper(*
this, pos, n); }
230 [[nodiscard]] QByteArray chopped(qsizetype len) &&
231 { verify(0, len);
return std::move(*
this).first(size() - len); }
234 bool startsWith(QByteArrayView bv)
const
235 {
return QtPrivate::startsWith(qToByteArrayViewIgnoringNull(*
this), bv); }
236 bool startsWith(
char c)
const {
return size() > 0 && front() == c; }
238 bool endsWith(
char c)
const {
return size() > 0 && back() == c; }
239 bool endsWith(QByteArrayView bv)
const
240 {
return QtPrivate::endsWith(qToByteArrayViewIgnoringNull(*
this), bv); }
242 bool isUpper()
const;
243 bool isLower()
const;
245 [[nodiscard]]
bool isValidUtf8()
const noexcept
247 return QtPrivate::isValidUtf8(qToByteArrayViewIgnoringNull(*
this));
250 void truncate(qsizetype pos);
251 void chop(qsizetype n);
253 QByteArray &slice(qsizetype pos)
254 { verify(pos, 0);
return remove(0, pos); }
255 QByteArray &slice(qsizetype pos, qsizetype n)
261 return remove(0, pos);
265 [[nodiscard]] QByteArray toLower()
const &
266 {
return toLower_helper(*
this); }
267 [[nodiscard]] QByteArray toLower() &&
268 {
return toLower_helper(*
this); }
269 [[nodiscard]] QByteArray toUpper()
const &
270 {
return toUpper_helper(*
this); }
271 [[nodiscard]] QByteArray toUpper() &&
272 {
return toUpper_helper(*
this); }
273 [[nodiscard]] QByteArray trimmed()
const &
274 {
return trimmed_helper(*
this); }
275 [[nodiscard]] QByteArray trimmed() &&
276 {
return trimmed_helper(*
this); }
277 [[nodiscard]] QByteArray simplified()
const &
278 {
return simplified_helper(*
this); }
279 [[nodiscard]] QByteArray simplified() &&
280 {
return simplified_helper(*
this); }
282 [[nodiscard]] QByteArray toLower()
const;
283 [[nodiscard]] QByteArray toUpper()
const;
284 [[nodiscard]] QByteArray trimmed()
const;
285 [[nodiscard]] QByteArray simplified()
const;
288 [[nodiscard]] QByteArray leftJustified(qsizetype width,
char fill =
' ',
bool truncate =
false)
const;
289 [[nodiscard]] QByteArray rightJustified(qsizetype width,
char fill =
' ',
bool truncate =
false)
const;
291 QByteArray &prepend(
char c)
292 {
return insert(0, QByteArrayView(&c, 1)); }
293 inline QByteArray &prepend(qsizetype count,
char c);
294 QByteArray &prepend(
const char *s)
295 {
return insert(0, QByteArrayView(s, qsizetype(qstrlen(s)))); }
296 QByteArray &prepend(
const char *s, qsizetype len)
297 {
return insert(0, QByteArrayView(s, len)); }
298 QByteArray &prepend(
const QByteArray &a);
299 QByteArray &prepend(QByteArrayView a)
300 {
return insert(0, a); }
302 QByteArray &append(
char c);
303 inline QByteArray &append(qsizetype count,
char c);
304 QByteArray &append(
const char *s)
305 {
return append(s, -1); }
306 QByteArray &append(
const char *s, qsizetype len)
307 {
return append(QByteArrayView(s, len < 0 ? qsizetype(qstrlen(s)) : len)); }
308 QByteArray &append(
const QByteArray &a);
309 QByteArray &append(QByteArrayView a)
310 {
return insert(size(), a); }
312 QByteArray &assign(QByteArrayView v);
313 QByteArray &assign(qsizetype n,
char c)
318 template <
typename InputIterator, if_input_iterator<InputIterator> =
true>
319 QByteArray &assign(InputIterator first, InputIterator last)
321 d.assign(first, last);
323 d.data()[d.size] =
'\0';
327 QByteArray &insert(qsizetype i, QByteArrayView data);
328 inline QByteArray &insert(qsizetype i,
const char *s)
329 {
return insert(i, QByteArrayView(s)); }
330 inline QByteArray &insert(qsizetype i,
const QByteArray &data)
331 {
return insert(i, QByteArrayView(data)); }
332 QByteArray &insert(qsizetype i, qsizetype count,
char c);
333 QByteArray &insert(qsizetype i,
char c)
334 {
return insert(i, QByteArrayView(&c, 1)); }
335 QByteArray &insert(qsizetype i,
const char *s, qsizetype len)
336 {
return insert(i, QByteArrayView(s, len)); }
338 QByteArray &remove(qsizetype index, qsizetype len);
339 QByteArray &removeAt(qsizetype pos)
340 {
return size_t(pos) < size_t(size()) ? remove(pos, 1) : *
this; }
341 QByteArray &removeFirst() {
return !isEmpty() ? remove(0, 1) : *
this; }
342 QByteArray &removeLast() {
return !isEmpty() ? remove(size() - 1, 1) : *
this; }
344 template <
typename Predicate>
345 QByteArray &removeIf(Predicate pred)
347 removeIf_helper(pred);
351 QByteArray &replace(qsizetype index, qsizetype len,
const char *s, qsizetype alen)
352 {
return replace(index, len, QByteArrayView(s, alen)); }
353 QByteArray &replace(qsizetype index, qsizetype len, QByteArrayView s);
354 QByteArray &replace(
char before, QByteArrayView after)
355 {
return replace(QByteArrayView(&before, 1), after); }
356 QByteArray &replace(
const char *before, qsizetype bsize,
const char *after, qsizetype asize)
357 {
return replace(QByteArrayView(before, bsize), QByteArrayView(after, asize)); }
358 QByteArray &replace(QByteArrayView before, QByteArrayView after);
359 QByteArray &replace(
char before,
char after);
361 QByteArray &operator+=(
char c)
362 {
return append(c); }
363 QByteArray &operator+=(
const char *s)
364 {
return append(s); }
365 QByteArray &operator+=(
const QByteArray &a)
366 {
return append(a); }
367 QByteArray &operator+=(QByteArrayView a)
368 {
return append(a); }
370 QList<QByteArray> split(
char sep)
const;
372 [[nodiscard]] QByteArray repeated(qsizetype times)
const;
374#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
375#if QT_CORE_REMOVED_SINCE(6
, 8
)
376 QT_ASCII_CAST_WARN
inline bool operator==(
const QString &s2)
const;
377 QT_ASCII_CAST_WARN
inline bool operator!=(
const QString &s2)
const;
378 QT_ASCII_CAST_WARN
inline bool operator<(
const QString &s2)
const;
379 QT_ASCII_CAST_WARN
inline bool operator>(
const QString &s2)
const;
380 QT_ASCII_CAST_WARN
inline bool operator<=(
const QString &s2)
const;
381 QT_ASCII_CAST_WARN
inline bool operator>=(
const QString &s2)
const;
385 short toShort(
bool *ok =
nullptr,
int base = 10)
const;
386 ushort toUShort(
bool *ok =
nullptr,
int base = 10)
const;
387 int toInt(
bool *ok =
nullptr,
int base = 10)
const;
388 uint toUInt(
bool *ok =
nullptr,
int base = 10)
const;
389 long toLong(
bool *ok =
nullptr,
int base = 10)
const;
390 ulong toULong(
bool *ok =
nullptr,
int base = 10)
const;
391 qlonglong toLongLong(
bool *ok =
nullptr,
int base = 10)
const;
392 qulonglong toULongLong(
bool *ok =
nullptr,
int base = 10)
const;
393 float toFloat(
bool *ok =
nullptr)
const;
394 double toDouble(
bool *ok =
nullptr)
const;
395 QByteArray toBase64(Base64Options options = Base64Encoding)
const;
396 QByteArray toHex(
char separator =
'\0')
const;
397 QByteArray toPercentEncoding(
const QByteArray &exclude = QByteArray(),
398 const QByteArray &include = QByteArray(),
399 char percent =
'%')
const;
400 [[nodiscard]] QByteArray percentDecoded(
char percent =
'%')
const;
402 inline QByteArray &setNum(
short,
int base = 10);
403 inline QByteArray &setNum(ushort,
int base = 10);
404 inline QByteArray &setNum(
int,
int base = 10);
405 inline QByteArray &setNum(uint,
int base = 10);
406 inline QByteArray &setNum(
long,
int base = 10);
407 inline QByteArray &setNum(ulong,
int base = 10);
408 QByteArray &setNum(qlonglong,
int base = 10);
409 QByteArray &setNum(qulonglong,
int base = 10);
410 inline QByteArray &setNum(
float,
char format =
'g',
int precision = 6);
411 QByteArray &setNum(
double,
char format =
'g',
int precision = 6);
412 QByteArray &setRawData(
const char *a, qsizetype n);
414 [[nodiscard]]
static QByteArray number(
int,
int base = 10);
415 [[nodiscard]]
static QByteArray number(uint,
int base = 10);
416 [[nodiscard]]
static QByteArray number(
long,
int base = 10);
417 [[nodiscard]]
static QByteArray number(ulong,
int base = 10);
418 [[nodiscard]]
static QByteArray number(qlonglong,
int base = 10);
419 [[nodiscard]]
static QByteArray number(qulonglong,
int base = 10);
420 [[nodiscard]]
static QByteArray number(
double,
char format =
'g',
int precision = 6);
421 [[nodiscard]]
static QByteArray fromRawData(
const char *data, qsizetype size)
423 return QByteArray(DataPointer::fromRawData(data, size));
426 class FromBase64Result;
427 [[nodiscard]]
static FromBase64Result fromBase64Encoding(QByteArray &&base64, Base64Options options = Base64Encoding);
428 [[nodiscard]]
static FromBase64Result fromBase64Encoding(
const QByteArray &base64, Base64Options options = Base64Encoding);
429 [[nodiscard]]
static QByteArray fromBase64(
const QByteArray &base64, Base64Options options = Base64Encoding);
430 [[nodiscard]]
static QByteArray fromHex(
const QByteArray &hexEncoded);
431 [[nodiscard]]
static QByteArray fromPercentEncoding(
const QByteArray &pctEncoded,
char percent =
'%');
433#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
434 static QByteArray fromCFData(CFDataRef data);
435 static QByteArray fromRawCFData(CFDataRef data);
436 CFDataRef toCFData()
const Q_DECL_CF_RETURNS_RETAINED;
437 CFDataRef toRawCFData()
const Q_DECL_CF_RETURNS_RETAINED;
438 static QByteArray fromNSData(
const NSData *data);
439 static QByteArray fromRawNSData(
const NSData *data);
440 NSData *toNSData()
const Q_DECL_NS_RETURNS_AUTORELEASED;
441 NSData *toRawNSData()
const Q_DECL_NS_RETURNS_AUTORELEASED;
444#if defined(Q_OS_WASM) || defined(Q_QDOC)
445 static QByteArray fromEcmaUint8Array(emscripten::val uint8array);
446 emscripten::val toEcmaUint8Array();
449 typedef char *iterator;
450 typedef const char *const_iterator;
451 typedef iterator Iterator;
452 typedef const_iterator ConstIterator;
453 typedef std::reverse_iterator<iterator> reverse_iterator;
454 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
455 iterator begin() {
return data(); }
456 const_iterator begin()
const noexcept {
return d.data(); }
457 const_iterator cbegin()
const noexcept {
return begin(); }
458 const_iterator constBegin()
const noexcept {
return begin(); }
459 iterator end() {
return begin() + size(); }
460 const_iterator end()
const noexcept {
return begin() + size(); }
461 const_iterator cend()
const noexcept {
return end(); }
462 const_iterator constEnd()
const noexcept {
return end(); }
463 reverse_iterator rbegin() {
return reverse_iterator(end()); }
464 reverse_iterator rend() {
return reverse_iterator(begin()); }
465 const_reverse_iterator rbegin()
const noexcept {
return const_reverse_iterator(end()); }
466 const_reverse_iterator rend()
const noexcept {
return const_reverse_iterator(begin()); }
467 const_reverse_iterator crbegin()
const noexcept {
return rbegin(); }
468 const_reverse_iterator crend()
const noexcept {
return rend(); }
471 typedef qsizetype size_type;
472 typedef qptrdiff difference_type;
473 typedef const char & const_reference;
474 typedef char & reference;
475 typedef char *pointer;
476 typedef const char *const_pointer;
477 typedef char value_type;
478 void push_back(
char c)
480 void push_back(
const char *s)
482 void push_back(
const QByteArray &a)
484 void push_back(QByteArrayView a)
486 void push_front(
char c)
488 void push_front(
const char *c)
490 void push_front(
const QByteArray &a)
492 void push_front(QByteArrayView a)
494 void shrink_to_fit() { squeeze(); }
495 iterator erase(const_iterator first, const_iterator last);
496 inline iterator erase(const_iterator it) {
return erase(it, it + 1); }
497 constexpr qsizetype max_size()
const noexcept
502 static QByteArray fromStdString(
const std::string &s);
503 std::string toStdString()
const;
505 static constexpr qsizetype maxSize()
noexcept
508 return Data::maxSize() - 1;
510 constexpr qsizetype size()
const noexcept
513 constexpr size_t MaxSize = maxSize();
514 [[assume(size_t(d.size) <= MaxSize)]];
518#if QT_DEPRECATED_SINCE(6
, 4
)
519 QT_DEPRECATED_VERSION_X_6_4(
"Use size() or length() instead.")
520 constexpr qsizetype count()
const noexcept {
return size(); }
522 constexpr qsizetype length()
const noexcept {
return size(); }
523 QT_CORE_CONSTEXPR_INLINE_SINCE(6, 4)
524 bool isNull()
const noexcept;
526 inline const DataPointer &data_ptr()
const {
return d; }
527 inline DataPointer &data_ptr() {
return d; }
528#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
529 explicit inline QByteArray(
const DataPointer &dd) : d(dd) {}
531 explicit inline QByteArray(DataPointer &&dd) : d(std::move(dd)) {}
533 [[nodiscard]] QByteArray nullTerminated()
const &
537 return QByteArray{constData(), size()};
541 [[nodiscard]] QByteArray nullTerminated() &&
545 return QByteArray{constData(), size()};
546 return std::move(*
this);
549 QByteArray &nullTerminate()
553 *
this = QByteArray{constData(), size()};
558 friend bool comparesEqual(
const QByteArray &lhs,
const QByteArrayView &rhs)
noexcept
559 {
return QByteArrayView(lhs) == rhs; }
560 friend Qt::strong_ordering
561 compareThreeWay(
const QByteArray &lhs,
const QByteArrayView &rhs)
noexcept
563 const int res = QtPrivate::compareMemory(QByteArrayView(lhs), rhs);
564 return Qt::compareThreeWay(res, 0);
566 Q_DECLARE_STRONGLY_ORDERED(QByteArray)
567 Q_DECLARE_STRONGLY_ORDERED(QByteArray,
const char *)
568#if defined(__GLIBCXX__
) && defined(__cpp_lib_three_way_comparison)
573 friend bool operator<(
const QByteArray &lhs,
const QByteArray &rhs)
noexcept
574 {
return is_lt(compareThreeWay(lhs, rhs)); }
575 friend bool operator<=(
const QByteArray &lhs,
const QByteArray &rhs)
noexcept
576 {
return is_lteq(compareThreeWay(lhs, rhs)); }
577 friend bool operator>(
const QByteArray &lhs,
const QByteArray &rhs)
noexcept
578 {
return is_gt(compareThreeWay(lhs, rhs)); }
579 friend bool operator>=(
const QByteArray &lhs,
const QByteArray &rhs)
noexcept
580 {
return is_gteq(compareThreeWay(lhs, rhs)); }
584 friend bool comparesEqual(
const QByteArray &lhs, std::nullptr_t)
noexcept
585 {
return lhs.isEmpty(); }
586 friend Qt::strong_ordering compareThreeWay(
const QByteArray &lhs, std::nullptr_t)
noexcept
587 {
return lhs.isEmpty() ? Qt::strong_ordering::equivalent : Qt::strong_ordering::greater; }
588 Q_DECLARE_STRONGLY_ORDERED(QByteArray, std::nullptr_t)
591 friend Q_CORE_EXPORT
bool comparesEqual(
const QByteArray &lhs,
const QChar &rhs)
noexcept;
592 friend Q_CORE_EXPORT Qt::strong_ordering
593 compareThreeWay(
const QByteArray &lhs,
const QChar &rhs)
noexcept;
594 friend Q_CORE_EXPORT
bool comparesEqual(
const QByteArray &lhs,
char16_t rhs)
noexcept;
595 friend Q_CORE_EXPORT Qt::strong_ordering
596 compareThreeWay(
const QByteArray &lhs,
char16_t rhs)
noexcept;
597#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
598 Q_DECLARE_STRONGLY_ORDERED(QByteArray, QChar, QT_ASCII_CAST_WARN)
599 Q_DECLARE_STRONGLY_ORDERED(QByteArray,
char16_t, QT_ASCII_CAST_WARN)
603 void reallocData(qsizetype alloc, QArrayData::AllocationOption option);
604 void reallocGrowData(qsizetype n);
605 void expand(qsizetype i);
607 Q_ALWAYS_INLINE
constexpr void verify([[maybe_unused]] qsizetype pos = 0,
608 [[maybe_unused]] qsizetype n = 1)
const
611 Q_ASSERT(pos <= d.size);
613 Q_ASSERT(n <= d.size - pos);
616 static QByteArray sliced_helper(QByteArray &a, qsizetype pos, qsizetype n);
617 static QByteArray toLower_helper(
const QByteArray &a);
618 static QByteArray toLower_helper(QByteArray &a);
619 static QByteArray toUpper_helper(
const QByteArray &a);
620 static QByteArray toUpper_helper(QByteArray &a);
621 static QByteArray trimmed_helper(
const QByteArray &a);
622 static QByteArray trimmed_helper(QByteArray &a);
623 static QByteArray simplified_helper(
const QByteArray &a);
624 static QByteArray simplified_helper(QByteArray &a);
625 template <
typename Predicate>
626 qsizetype removeIf_helper(Predicate pred)
628 const qsizetype result = d->eraseIf(pred);
630 d.data()[d.size] =
'\0';
634 friend class QString;
635 friend Q_CORE_EXPORT QByteArray qUncompress(
const uchar *data, qsizetype nbytes);
637 template <
typename T>
friend qsizetype erase(QByteArray &ba,
const T &t);
638 template <
typename Predicate>
friend qsizetype erase_if(QByteArray &ba, Predicate pred);