60 using DataPointer = QByteArrayData;
62 typedef QTypedArrayData<
char> Data;
65 static const char _empty;
67 friend class ::tst_QByteArray;
69 template <
typename InputIterator>
70 using if_input_iterator = QtPrivate::IfIsInputIterator<InputIterator>;
74 Base64UrlEncoding = 1,
76 KeepTrailingEquals = 0,
77 OmitTrailingEquals = 2,
79 IgnoreBase64DecodingErrors = 0,
80 AbortOnBase64DecodingErrors = 4,
82 Q_DECLARE_FLAGS(Base64Options, Base64Option)
84 enum class Base64DecodingStatus {
91 inline constexpr QByteArray()
noexcept;
92 QByteArray(
const char *, qsizetype size = -1);
93 QByteArray(qsizetype size,
char c);
94 QByteArray(qsizetype size, Qt::Initialization);
95 explicit QByteArray(QByteArrayView v) : QByteArray(v.data(), v.size()) {}
96 inline QByteArray(
const QByteArray &)
noexcept;
99 QByteArray &operator=(
const QByteArray &)
noexcept;
100 QByteArray &operator=(
const char *str);
101 inline QByteArray(QByteArray && other)
noexcept
103 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QByteArray)
104 inline void swap(QByteArray &other)
noexcept
107 constexpr bool isEmpty()
const noexcept {
return size() == 0; }
108 void resize(qsizetype size);
109 void resize(qsizetype size,
char c);
110 void resizeForOverwrite(qsizetype size);
112 QByteArray &fill(
char c, qsizetype size = -1);
114 inline qsizetype capacity()
const;
115 inline void reserve(qsizetype size);
116 inline void squeeze();
118#ifndef QT_NO_CAST_FROM_BYTEARRAY
119 inline operator
const char *()
const;
120 inline operator
const void *()
const;
127#if (!defined(Q_OS_QNX) || !defined(Q_CC_GNU_ONLY) || Q_CC_GNU_ONLY > 803
) &&
128 (!defined(Q_CC_GHS) || !defined(__GHS_VERSION_NUMBER) || __GHS_VERSION_NUMBER > 202214
)
129# define QT_BYTEARRAY_CONVERTS_TO_STD_STRING_VIEW
130 Q_IMPLICIT operator std::string_view()
const noexcept
131 {
return std::string_view(data(), std::size_t(size())); }
135 inline const char *data()
const noexcept;
136 const char *constData()
const noexcept {
return data(); }
137 inline void detach();
138 inline bool isDetached()
const;
139 inline bool isSharedWith(
const QByteArray &other)
const noexcept
140 {
return data() == other.data() && size() == other.size(); }
143 inline char at(qsizetype i)
const;
144 inline char operator[](qsizetype i)
const;
145 [[nodiscard]]
inline char &operator[](qsizetype i);
146 [[nodiscard]]
char front()
const {
return at(0); }
147 [[nodiscard]]
inline char &front();
148 [[nodiscard]]
char back()
const {
return at(size() - 1); }
149 [[nodiscard]]
inline char &back();
151 QT_CORE_INLINE_SINCE(6, 8)
152 qsizetype indexOf(
char c, qsizetype from = 0)
const;
153 qsizetype indexOf(QByteArrayView bv, qsizetype from = 0)
const
154 {
return QByteArrayView(begin(), size()).indexOf(bv, from); }
156 QT_CORE_INLINE_SINCE(6, 8)
157 qsizetype lastIndexOf(
char c, qsizetype from = -1)
const;
158 qsizetype lastIndexOf(QByteArrayView bv)
const
159 {
return lastIndexOf(bv, size()); }
160 qsizetype lastIndexOf(QByteArrayView bv, qsizetype from)
const
161 {
return QByteArrayView(begin(), size()).lastIndexOf(bv, from); }
163 inline bool contains(
char c)
const;
164 inline bool contains(QByteArrayView bv)
const;
165 qsizetype count(
char c)
const;
166 qsizetype count(QByteArrayView bv)
const
167 {
return QByteArrayView(begin(), size()).count(bv); }
169 inline int compare(QByteArrayView a)
const noexcept;
170 inline int compare(QByteArrayView a, Qt::CaseSensitivity cs)
const noexcept;
172#if QT_CORE_REMOVED_SINCE(6
, 7
)
173 QByteArray left(qsizetype len)
const;
174 QByteArray right(qsizetype len)
const;
175 QByteArray mid(qsizetype index, qsizetype len = -1)
const;
176 QByteArray first(qsizetype n)
const;
177 QByteArray last(qsizetype n)
const;
178 QByteArray sliced(qsizetype pos)
const;
179 QByteArray sliced(qsizetype pos, qsizetype n)
const;
180 QByteArray chopped(qsizetype len)
const;
182 [[nodiscard]] QByteArray left(qsizetype n)
const &
186 return first(qMax(n, 0));
188 [[nodiscard]] QByteArray left(qsizetype n) &&
191 return std::move(*
this);
192 return std::move(*
this).first(qMax(n, 0));
194 [[nodiscard]] QByteArray right(qsizetype n)
const &
198 return last(qMax(n, 0));
200 [[nodiscard]] QByteArray right(qsizetype n) &&
203 return std::move(*
this);
204 return std::move(*
this).last(qMax(n, 0));
206 [[nodiscard]] QByteArray mid(qsizetype index, qsizetype len = -1)
const &;
207 [[nodiscard]] QByteArray mid(qsizetype index, qsizetype len = -1) &&;
209 [[nodiscard]] QByteArray first(qsizetype n)
const &
210 { verify(0, n);
return sliced(0, n); }
211 [[nodiscard]] QByteArray last(qsizetype n)
const &
212 { verify(0, n);
return sliced(size() - n, n); }
213 [[nodiscard]] QByteArray sliced(qsizetype pos)
const &
214 { verify(pos, 0);
return sliced(pos, size() - pos); }
215 [[nodiscard]] QByteArray sliced(qsizetype pos, qsizetype n)
const &
216 { verify(pos, n);
return QByteArray(d.data() + pos, n); }
217 [[nodiscard]] QByteArray chopped(qsizetype len)
const &
218 { verify(0, len);
return sliced(0, size() - len); }
220 [[nodiscard]] QByteArray first(qsizetype n) &&
224 return std::move(*
this);
226 [[nodiscard]] QByteArray last(qsizetype n) &&
227 { verify(0, n);
return sliced_helper(*
this, size() - n, n); }
228 [[nodiscard]] QByteArray sliced(qsizetype pos) &&
229 { verify(pos, 0);
return sliced_helper(*
this, pos, size() - pos); }
230 [[nodiscard]] QByteArray sliced(qsizetype pos, qsizetype n) &&
231 { verify(pos, n);
return sliced_helper(*
this, pos, n); }
232 [[nodiscard]] QByteArray chopped(qsizetype len) &&
233 { verify(0, len); chop(len);
return std::move(*
this); }
236 bool startsWith(QByteArrayView bv)
const
237 {
return QByteArrayView(begin(), size()).startsWith(bv); }
238 bool startsWith(
char c)
const {
return size() > 0 && front() == c; }
240 bool endsWith(
char c)
const {
return size() > 0 && back() == c; }
241 bool endsWith(QByteArrayView bv)
const
242 {
return QByteArrayView(begin(), size()).endsWith(bv); }
244 bool isUpper()
const;
245 bool isLower()
const;
247 [[nodiscard]]
bool isValidUtf8()
const noexcept
249 return QtPrivate::isValidUtf8(qToByteArrayViewIgnoringNull(*
this));
252 void truncate(qsizetype pos);
253 void chop(qsizetype n);
255 QByteArray &slice(qsizetype pos)
256 { verify(pos, 0);
return remove(0, pos); }
257 QByteArray &slice(qsizetype pos, qsizetype n)
263 return remove(0, pos);
267 [[nodiscard]] QByteArray toLower()
const &
268 {
return toLower_helper(*
this); }
269 [[nodiscard]] QByteArray toLower() &&
270 {
return toLower_helper(*
this); }
271 [[nodiscard]] QByteArray toUpper()
const &
272 {
return toUpper_helper(*
this); }
273 [[nodiscard]] QByteArray toUpper() &&
274 {
return toUpper_helper(*
this); }
275 [[nodiscard]] QByteArray trimmed()
const &
276 {
return trimmed_helper(*
this); }
277 [[nodiscard]] QByteArray trimmed() &&
278 {
return trimmed_helper(*
this); }
279 [[nodiscard]] QByteArray simplified()
const &
280 {
return simplified_helper(*
this); }
281 [[nodiscard]] QByteArray simplified() &&
282 {
return simplified_helper(*
this); }
284 [[nodiscard]] QByteArray toLower()
const;
285 [[nodiscard]] QByteArray toUpper()
const;
286 [[nodiscard]] QByteArray trimmed()
const;
287 [[nodiscard]] QByteArray simplified()
const;
290 [[nodiscard]] QByteArray leftJustified(qsizetype width,
char fill =
' ',
bool truncate =
false)
const;
291 [[nodiscard]] QByteArray rightJustified(qsizetype width,
char fill =
' ',
bool truncate =
false)
const;
293 QByteArray &prepend(
char c)
294 {
return insert(0, QByteArrayView(&c, 1)); }
295 inline QByteArray &prepend(qsizetype count,
char c);
296 QByteArray &prepend(
const char *s)
297 {
return insert(0, QByteArrayView(s, qsizetype(qstrlen(s)))); }
298 QByteArray &prepend(
const char *s, qsizetype len)
299 {
return insert(0, QByteArrayView(s, len)); }
300 QByteArray &prepend(
const QByteArray &a);
301 QByteArray &prepend(QByteArrayView a)
302 {
return insert(0, a); }
304 QByteArray &append(
char c);
305 inline QByteArray &append(qsizetype count,
char c);
306 QByteArray &append(
const char *s)
307 {
return append(s, -1); }
308 QByteArray &append(
const char *s, qsizetype len)
309 {
return append(QByteArrayView(s, len < 0 ? qsizetype(qstrlen(s)) : len)); }
310 QByteArray &append(
const QByteArray &a);
311 QByteArray &append(QByteArrayView a)
312 {
return insert(size(), a); }
314 QByteArray &assign(QByteArrayView v);
315 QByteArray &assign(qsizetype n,
char c)
320 template <
typename InputIterator, if_input_iterator<InputIterator> =
true>
321 QByteArray &assign(InputIterator first, InputIterator last)
323 if constexpr (std::is_same_v<InputIterator, iterator> || std::is_same_v<InputIterator, const_iterator>)
324 return assign(QByteArrayView(first, last));
325 d->assign(first, last);
327 d.data()[d.size] =
'\0';
331 QByteArray &insert(qsizetype i, QByteArrayView data);
332 inline QByteArray &insert(qsizetype i,
const char *s)
333 {
return insert(i, QByteArrayView(s)); }
334 inline QByteArray &insert(qsizetype i,
const QByteArray &data)
335 {
return insert(i, QByteArrayView(data)); }
336 QByteArray &insert(qsizetype i, qsizetype count,
char c);
337 QByteArray &insert(qsizetype i,
char c)
338 {
return insert(i, QByteArrayView(&c, 1)); }
339 QByteArray &insert(qsizetype i,
const char *s, qsizetype len)
340 {
return insert(i, QByteArrayView(s, len)); }
342 QByteArray &remove(qsizetype index, qsizetype len);
343 QByteArray &removeAt(qsizetype pos)
344 {
return size_t(pos) < size_t(size()) ? remove(pos, 1) : *
this; }
345 QByteArray &removeFirst() {
return !isEmpty() ? remove(0, 1) : *
this; }
346 QByteArray &removeLast() {
return !isEmpty() ? remove(size() - 1, 1) : *
this; }
348 template <
typename Predicate>
349 QByteArray &removeIf(Predicate pred)
351 removeIf_helper(pred);
355 QByteArray &replace(qsizetype index, qsizetype len,
const char *s, qsizetype alen)
356 {
return replace(index, len, QByteArrayView(s, alen)); }
357 QByteArray &replace(qsizetype index, qsizetype len, QByteArrayView s);
358 QByteArray &replace(
char before, QByteArrayView after)
359 {
return replace(QByteArrayView(&before, 1), after); }
360 QByteArray &replace(
const char *before, qsizetype bsize,
const char *after, qsizetype asize)
361 {
return replace(QByteArrayView(before, bsize), QByteArrayView(after, asize)); }
362 QByteArray &replace(QByteArrayView before, QByteArrayView after);
363 QByteArray &replace(
char before,
char after);
365 QByteArray &operator+=(
char c)
366 {
return append(c); }
367 QByteArray &operator+=(
const char *s)
368 {
return append(s); }
369 QByteArray &operator+=(
const QByteArray &a)
370 {
return append(a); }
371 QByteArray &operator+=(QByteArrayView a)
372 {
return append(a); }
374 QList<QByteArray> split(
char sep)
const;
376 [[nodiscard]] QByteArray repeated(qsizetype times)
const;
378#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
379#if QT_CORE_REMOVED_SINCE(6
, 8
)
380 QT_ASCII_CAST_WARN
inline bool operator==(
const QString &s2)
const;
381 QT_ASCII_CAST_WARN
inline bool operator!=(
const QString &s2)
const;
382 QT_ASCII_CAST_WARN
inline bool operator<(
const QString &s2)
const;
383 QT_ASCII_CAST_WARN
inline bool operator>(
const QString &s2)
const;
384 QT_ASCII_CAST_WARN
inline bool operator<=(
const QString &s2)
const;
385 QT_ASCII_CAST_WARN
inline bool operator>=(
const QString &s2)
const;
389 short toShort(
bool *ok =
nullptr,
int base = 10)
const;
390 ushort toUShort(
bool *ok =
nullptr,
int base = 10)
const;
391 int toInt(
bool *ok =
nullptr,
int base = 10)
const;
392 uint toUInt(
bool *ok =
nullptr,
int base = 10)
const;
393 long toLong(
bool *ok =
nullptr,
int base = 10)
const;
394 ulong toULong(
bool *ok =
nullptr,
int base = 10)
const;
395 qlonglong toLongLong(
bool *ok =
nullptr,
int base = 10)
const;
396 qulonglong toULongLong(
bool *ok =
nullptr,
int base = 10)
const;
397 float toFloat(
bool *ok =
nullptr)
const;
398 double toDouble(
bool *ok =
nullptr)
const;
399 QByteArray toBase64(Base64Options options = Base64Encoding)
const;
400 QByteArray toHex(
char separator =
'\0')
const;
401 QByteArray toPercentEncoding(
const QByteArray &exclude = QByteArray(),
402 const QByteArray &include = QByteArray(),
403 char percent =
'%')
const;
404#if QT_CORE_REMOVED_SINCE(6
, 11
)
405 [[nodiscard]] QByteArray percentDecoded(
char percent =
'%')
const;
407 [[nodiscard]] QByteArray percentDecoded(
char percent =
'%')
const &
408 {
return fromPercentEncoding(*
this, percent); }
409 [[nodiscard]] QByteArray percentDecoded(
char percent =
'%') &&
410 {
return fromPercentEncoding(std::move(*
this), percent); }
413 inline QByteArray &setNum(
short,
int base = 10);
414 inline QByteArray &setNum(ushort,
int base = 10);
415 inline QByteArray &setNum(
int,
int base = 10);
416 inline QByteArray &setNum(uint,
int base = 10);
417 inline QByteArray &setNum(
long,
int base = 10);
418 inline QByteArray &setNum(ulong,
int base = 10);
419 QByteArray &setNum(qlonglong,
int base = 10);
420 QByteArray &setNum(qulonglong,
int base = 10);
421 inline QByteArray &setNum(
float,
char format =
'g',
int precision = 6);
422 QByteArray &setNum(
double,
char format =
'g',
int precision = 6);
423 QByteArray &setRawData(
const char *a, qsizetype n);
425 [[nodiscard]]
static QByteArray number(
int,
int base = 10);
426 [[nodiscard]]
static QByteArray number(uint,
int base = 10);
427 [[nodiscard]]
static QByteArray number(
long,
int base = 10);
428 [[nodiscard]]
static QByteArray number(ulong,
int base = 10);
429 [[nodiscard]]
static QByteArray number(qlonglong,
int base = 10);
430 [[nodiscard]]
static QByteArray number(qulonglong,
int base = 10);
431 [[nodiscard]]
static QByteArray number(
double,
char format =
'g',
int precision = 6);
432 [[nodiscard]]
static QByteArray fromRawData(
const char *data, qsizetype size)
434 return QByteArray(DataPointer::fromRawData(data, size));
437 class FromBase64Result;
438 [[nodiscard]]
static FromBase64Result fromBase64Encoding(QByteArray &&base64, Base64Options options = Base64Encoding);
439 [[nodiscard]]
static FromBase64Result fromBase64Encoding(
const QByteArray &base64, Base64Options options = Base64Encoding);
440 [[nodiscard]]
static QByteArray fromBase64(
const QByteArray &base64, Base64Options options = Base64Encoding);
441 [[nodiscard]]
static QByteArray fromHex(
const QByteArray &hexEncoded);
442 [[nodiscard]]
static QByteArray fromPercentEncoding(
const QByteArray &pctEncoded,
char percent =
'%');
443 [[nodiscard]]
static QByteArray fromPercentEncoding(QByteArray &&pctEncoded,
char percent =
'%');
445#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
446 static QByteArray fromCFData(CFDataRef data);
447 static QByteArray fromRawCFData(CFDataRef data);
448 CFDataRef toCFData()
const Q_DECL_CF_RETURNS_RETAINED;
449 CFDataRef toRawCFData()
const Q_DECL_CF_RETURNS_RETAINED;
450 static QByteArray fromNSData(
const NSData *data);
451 static QByteArray fromRawNSData(
const NSData *data);
452 NSData *toNSData()
const Q_DECL_NS_RETURNS_AUTORELEASED;
453 NSData *toRawNSData()
const Q_DECL_NS_RETURNS_AUTORELEASED;
456#if defined(Q_OS_WASM) || defined(Q_QDOC)
457 static QByteArray fromEcmaUint8Array(emscripten::val uint8array);
458 emscripten::val toEcmaUint8Array();
461 typedef char *iterator;
462 typedef const char *const_iterator;
463 typedef iterator Iterator;
464 typedef const_iterator ConstIterator;
465 typedef std::reverse_iterator<iterator> reverse_iterator;
466 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
467 iterator begin() {
return data(); }
468 const_iterator begin()
const noexcept {
return d.data(); }
469 const_iterator cbegin()
const noexcept {
return begin(); }
470 const_iterator constBegin()
const noexcept {
return begin(); }
471 iterator end() {
return begin() + size(); }
472 const_iterator end()
const noexcept {
return begin() + size(); }
473 const_iterator cend()
const noexcept {
return end(); }
474 const_iterator constEnd()
const noexcept {
return end(); }
475 reverse_iterator rbegin() {
return reverse_iterator(end()); }
476 reverse_iterator rend() {
return reverse_iterator(begin()); }
477 const_reverse_iterator rbegin()
const noexcept {
return const_reverse_iterator(end()); }
478 const_reverse_iterator rend()
const noexcept {
return const_reverse_iterator(begin()); }
479 const_reverse_iterator crbegin()
const noexcept {
return rbegin(); }
480 const_reverse_iterator crend()
const noexcept {
return rend(); }
483 typedef qsizetype size_type;
484 typedef qptrdiff difference_type;
485 typedef const char & const_reference;
486 typedef char & reference;
487 typedef char *pointer;
488 typedef const char *const_pointer;
489 typedef char value_type;
490 void push_back(
char c)
492 void push_back(
const char *s)
494 void push_back(
const QByteArray &a)
496 void push_back(QByteArrayView a)
498 void push_front(
char c)
500 void push_front(
const char *c)
502 void push_front(
const QByteArray &a)
504 void push_front(QByteArrayView a)
506 void shrink_to_fit() { squeeze(); }
507 iterator erase(const_iterator first, const_iterator last);
508 inline iterator erase(const_iterator it) {
return erase(it, it + 1); }
509 constexpr qsizetype max_size()
const noexcept
514 static QByteArray fromStdString(
const std::string &s);
515 std::string toStdString()
const;
517 static constexpr qsizetype maxSize()
noexcept
520 return Data::maxSize() - 1;
522 constexpr qsizetype size()
const noexcept
524 constexpr size_t MaxSize = maxSize();
525 Q_PRESUME(size_t(d.size) <= MaxSize);
528#if QT_DEPRECATED_SINCE(6
, 4
)
529 QT_DEPRECATED_VERSION_X_6_4(
"Use size() or length() instead.")
530 constexpr qsizetype count()
const noexcept {
return size(); }
532 constexpr qsizetype length()
const noexcept {
return size(); }
533 QT_CORE_CONSTEXPR_INLINE_SINCE(6, 4)
534 bool isNull()
const noexcept;
536 inline const DataPointer &data_ptr()
const {
return d; }
537 inline DataPointer &data_ptr() {
return d; }
538#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
539 explicit inline QByteArray(
const DataPointer &dd) : d(dd) {}
541 explicit inline QByteArray(DataPointer &&dd) : d(std::move(dd)) {}
543 [[nodiscard]] QByteArray nullTerminated()
const &;
544 [[nodiscard]] QByteArray nullTerminated() &&;
545 QByteArray &nullTerminate();
548 friend bool comparesEqual(
const QByteArray &lhs,
char rhs)
noexcept
549 {
return QByteArrayView(lhs) == rhs; }
550 friend bool comparesEqual(
const QByteArray &lhs,
const QByteArrayView &rhs)
noexcept
551 {
return QByteArrayView(lhs) == rhs; }
552 friend Qt::strong_ordering
553 compareThreeWay(
const QByteArray &lhs,
char rhs)
noexcept
555 return compareThreeWay(QByteArrayView(lhs), rhs);
557 friend Qt::strong_ordering
558 compareThreeWay(
const QByteArray &lhs,
const QByteArrayView &rhs)
noexcept
560 const int res = QtPrivate::compareMemory(QByteArrayView(lhs), rhs);
561 return Qt::compareThreeWay(res, 0);
563 Q_DECLARE_STRONGLY_ORDERED(QByteArray)
564 Q_DECLARE_STRONGLY_ORDERED(QByteArray,
char)
565 Q_DECLARE_STRONGLY_ORDERED(QByteArray,
const char *)
566#if defined(__GLIBCXX__
) && defined(__cpp_lib_three_way_comparison)
571 friend bool operator<(
const QByteArray &lhs,
const QByteArray &rhs)
noexcept
572 {
return is_lt(compareThreeWay(lhs, rhs)); }
573 friend bool operator<=(
const QByteArray &lhs,
const QByteArray &rhs)
noexcept
574 {
return is_lteq(compareThreeWay(lhs, rhs)); }
575 friend bool operator>(
const QByteArray &lhs,
const QByteArray &rhs)
noexcept
576 {
return is_gt(compareThreeWay(lhs, rhs)); }
577 friend bool operator>=(
const QByteArray &lhs,
const QByteArray &rhs)
noexcept
578 {
return is_gteq(compareThreeWay(lhs, rhs)); }
582 friend bool comparesEqual(
const QByteArray &lhs, std::nullptr_t)
noexcept
583 {
return lhs.isEmpty(); }
584 friend Qt::strong_ordering compareThreeWay(
const QByteArray &lhs, std::nullptr_t)
noexcept
585 {
return lhs.isEmpty() ? Qt::strong_ordering::equivalent : Qt::strong_ordering::greater; }
586 Q_DECLARE_STRONGLY_ORDERED(QByteArray, std::nullptr_t)
589 friend Q_CORE_EXPORT
bool comparesEqual(
const QByteArray &lhs,
const QChar &rhs)
noexcept;
590 friend Q_CORE_EXPORT Qt::strong_ordering
591 compareThreeWay(
const QByteArray &lhs,
const QChar &rhs)
noexcept;
592 friend Q_CORE_EXPORT
bool comparesEqual(
const QByteArray &lhs,
char16_t rhs)
noexcept;
593 friend Q_CORE_EXPORT Qt::strong_ordering
594 compareThreeWay(
const QByteArray &lhs,
char16_t rhs)
noexcept;
595#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
596 Q_DECLARE_STRONGLY_ORDERED(QByteArray, QChar, QT_ASCII_CAST_WARN)
597 Q_DECLARE_STRONGLY_ORDERED(QByteArray,
char16_t, QT_ASCII_CAST_WARN)
601 void reallocData(qsizetype alloc, QArrayData::AllocationOption option);
602 void reallocGrowData(qsizetype n);
603 void expand(qsizetype i);
605 Q_ALWAYS_INLINE
constexpr void verify([[maybe_unused]] qsizetype pos = 0,
606 [[maybe_unused]] qsizetype n = 1)
const
609 Q_ASSERT(pos <= d.size);
611 Q_ASSERT(n <= d.size - pos);
614 static QByteArray sliced_helper(QByteArray &a, qsizetype pos, qsizetype n);
615 static QByteArray toLower_helper(
const QByteArray &a);
616 static QByteArray toLower_helper(QByteArray &a);
617 static QByteArray toUpper_helper(
const QByteArray &a);
618 static QByteArray toUpper_helper(QByteArray &a);
619 static QByteArray trimmed_helper(
const QByteArray &a);
620 static QByteArray trimmed_helper(QByteArray &a);
621 static QByteArray simplified_helper(
const QByteArray &a);
622 static QByteArray simplified_helper(QByteArray &a);
623 template <
typename Predicate>
624 qsizetype removeIf_helper(Predicate pred)
626 const qsizetype result = d->eraseIf(pred);
628 d.data()[d.size] =
'\0';
632 friend class QString;
633 friend Q_CORE_EXPORT QByteArray qUncompress(
const uchar *data, qsizetype nbytes);
635 template <
typename T>
friend qsizetype erase(QByteArray &ba,
const T &t);
636 template <
typename Predicate>
friend qsizetype erase_if(QByteArray &ba, Predicate pred);