8#include "private/qtools_p.h"
13#include "private/qnumeric_p.h"
14#include "private/qsimd_p.h"
21#include "private/qstdweb_p.h"
37# if !defined(QT_BOOTSTRAPPED) && (defined(QT_NO_CAST_FROM_ASCII) || defined(QT_NO_CAST_FROM_BYTEARRAY))
39# error "This file cannot be compiled with QT_NO_CAST_{TO,FROM}_ASCII, " \
40 "otherwise some QByteArray functions will not get exported."
46Q_CONSTINIT
const char QByteArray::_empty =
'\0';
51 return c >=
'a' &&
c <=
'z' ?
c & ~0x20 :
c;
56 return c >=
'A' &&
c <=
'Z' ?
c | 0x20 :
c;
61 const char *needle0,
qsizetype needleLen);
83 char *
dst =
new char[strlen(
src) + 1];
106 const size_t len = strlen(
src);
145 return src ?
dst :
nullptr;
187int qstrcmp(
const char *str1,
const char *str2)
189 return (str1 && str2) ? strcmp(str1, str2)
190 : (str1 ? 1 : (str2 ? -1 : 0));
234 const uchar *
s1 =
reinterpret_cast<const uchar *
>(str1);
235 const uchar *
s2 =
reinterpret_cast<const uchar *
>(str2);
241 enum { Incomplete = 256 };
252 }
while (unlimited ||
offset < max);
253 return int(Incomplete);
256#if defined(__SSE4_1__) && !(defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer))
257 enum { PageSize = 4096, PageMask = PageSize - 1 };
258 const __m128i
zero = _mm_setzero_si128();
265 size_t n = PageSize - ((
u1 |
u2) & PageMask);
268 for ( ;
offset + 16 <= maxoffset;
offset +=
sizeof(__m128i)) {
270 __m128i
a = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(
s1 +
offset));
271 __m128i
b = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(
s2 +
offset));
274 __m128i cmp = _mm_cmpeq_epi8(
a,
b);
277 cmp = _mm_min_epu8(cmp,
a);
278 cmp = _mm_cmpeq_epi8(cmp,
zero);
294 int res = innerCompare(
n,
false);
295 if (
res != Incomplete)
300 return innerCompare(-1,
true);
324 const uchar *
s1 =
reinterpret_cast<const uchar *
>(str1);
325 const uchar *
s2 =
reinterpret_cast<const uchar *
>(str2);
327 return s1 ? 1 : (
s2 ? -1 : 0);
350 const uchar *
s1 =
reinterpret_cast<const uchar *
>(str1);
351 const uchar *
s2 =
reinterpret_cast<const uchar *
>(str2);
356 return (!
s2 || !*
s2) ? 0 : -1;
361 return len1 == 0 ? 0 : 1;
366 for (
i = 0;
i < len1; ++
i) {
374 return s2[
i] ? -1 : 0;
384 return len1 < len2 ? -1 : 1;
414static void createCRC16Table()
420 for (
i = 0;
i < 16;
i++) {
427#define SET_BIT(x, b, v) (x) |= (v) << (b)
442 printf(
"static const quint16 crc_tbl[16] = {\n");
443 for (
int i = 0;
i < 16;
i +=4)
450 0x0000, 0x1081, 0x2102, 0x3183,
451 0x4204, 0x5285, 0x6306, 0x7387,
452 0x8408, 0x9489, 0xa50a, 0xb58b,
453 0xc60c, 0xd68d, 0xe70e, 0xf78f
485 crc = ((crc >> 4) & 0x0fff) ^
crc_tbl[((crc ^
c) & 15)];
487 crc = ((crc >> 4) & 0x0fff) ^
crc_tbl[((crc ^
c) & 15)];
529#ifndef QT_NO_COMPRESS
541 Q_UNREACHABLE_RETURN(
nullptr);
560 return zlibError(op,
"Input length is negative");
566 return zlibError(op,
"Not enough memory");
578 qWarning(
"%s unexpected zlib error: %s (%d)",
590 if (
out.data() ==
nullptr)
594 const auto initalSize =
out.size;
597 zs.next_in =
reinterpret_cast<uchar *
>(
const_cast<char *
>(
input.data()));
598 if (
const int err =
init(&zs); err != Z_OK)
602 using ZlibChunkSize_t =
decltype(zs.avail_in);
603 static_assert(!std::is_signed_v<ZlibChunkSize_t>);
604 static_assert(std::is_same_v<ZlibChunkSize_t,
decltype(zs.avail_out)>);
605 constexpr auto MaxChunkSize = std::numeric_limits<ZlibChunkSize_t>::max();
607 constexpr auto MaxStatisticsSize = std::numeric_limits<
decltype(zs.total_out)>::max();
609 size_t inputLeft = size_t(
input.size());
616 if (zs.avail_out == 0) {
617 Q_ASSERT(
size_t(
out.size) - initalSize > MaxStatisticsSize ||
618 size_t(
out.size) - initalSize == zs.total_out);
622 if (avail_out == 0) {
624 if (
out.data() ==
nullptr)
629 zs.next_out =
reinterpret_cast<uchar *
>(
out.data()) +
out.size;
630 zs.avail_out = size_t(avail_out) > size_t(MaxChunkSize) ? MaxChunkSize
631 : ZlibChunkSize_t(avail_out);
632 out.size += zs.avail_out;
637 if (zs.avail_in == 0) {
639 zs.avail_in = inputLeft > MaxChunkSize ? MaxChunkSize : ZlibChunkSize_t(inputLeft);
640 inputLeft -= zs.avail_in;
643 res = processChunk(&zs, inputLeft);
644 }
while (
res == Z_OK);
648 out.size -= zs.avail_out;
649 Q_ASSERT(
size_t(
out.size) - initalSize > MaxStatisticsSize ||
650 size_t(
out.size) - initalSize == zs.total_out);
652 out.data()[
out.size] =
'\0';
683 if (compressionLevel < -1 || compressionLevel > 9)
684 compressionLevel = -1;
687 constexpr qsizetype SingleAllocLimit = 256 * 1024;
692 if (nbytes < SingleAllocLimit) {
694 capacity += compressBound(uLong(nbytes));
695 return QArrayDataPointer<char>(
capacity);
700 constexpr qsizetype MaxCompressionFactor = 1024;
704 nbytes / MaxCompressionFactor);
708 if (
out.data() ==
nullptr)
715 [=] (z_stream *zs) {
return deflateInit(zs, compressionLevel); },
716 [] (z_stream *zs,
size_t inputLeft) {
717 return deflate(zs, inputLeft ? Z_NO_FLUSH : Z_FINISH);
719 [] (z_stream *zs) { deflateEnd(zs); });
755#ifndef QT_NO_COMPRESS
775 const auto expectedSize = qFromBigEndian<CompressSizeHint_t>(
data);
777 if (expectedSize != 0)
783 if constexpr (MaxDecompressedSize < std::numeric_limits<CompressSizeHint_t>::max()) {
784 if (expectedSize > MaxDecompressedSize)
795 [] (z_stream *zs) {
return inflateInit(zs); },
796 [] (z_stream *zs, size_t) {
return inflate(zs, Z_NO_FLUSH); },
797 [] (z_stream *zs) { inflateEnd(zs); });
1886 if (d->needsDetach() ||
size > capacityAtEnd)
1889 if (d->allocatedCapacity())
1912 const auto old = d.
size;
1915 memset(d.
data() + old,
c, d.
size - old);
1962 if (d->needsDetach() || cannotUseReallocate) {
1966 ::memcpy(dd.data(), d.
data(), dd.size);
1967 dd.data()[dd.size] = 0;
1970 d->reallocate(alloc,
option);
1979 if (d->needsDetach()) {
1983 dd.data()[dd.size] = 0;
2022 return (*
this =
ba);
2146 d->copyAppend(1,
ch);
2213 *
this =
v.toByteArray();
2242 if (
i < 0 ||
size <= 0)
2254 d->copyAppend(
i - d->size,
' ');
2332 d->copyAppend(
i - d->size,
' ');
2369 if (!d->isShared()) {
2374 const auto toRemove_start = d.
begin() +
pos;
2375 copy.d->copyRanges({{d.
begin(), toRemove_start},
2376 {toRemove_start +
len, d.
end()}});
2444 memcpy(d.
data() +
pos, after.data(),
len*
sizeof(
char));
2487 const char *
b = before.
data();
2489 const char *
a = after.data();
2492 if (
isNull() || (
b ==
a && bsize == asize))
2510 if (bsize == asize) {
2517 }
else if (asize < bsize) {
2519 size_t movestart = 0;
2525 memmove(
d + to,
d + movestart, msize);
2532 memcpy(
d + to,
a, asize);
2542 memmove(
d + to,
d + movestart, msize);
2548 while (
index != -1) {
2582 memmove(
d + moveto,
d + movestart, (moveend - movestart));
2584 memcpy(
d + insertstart,
a, asize);
2585 moveend = movestart - bsize;
2608 if (before != after) {
2610 const auto detachedData =
data();
2611 std::replace(detachedData +
pos, detachedData +
size(), before, after);
2626 QList<QByteArray>
list;
2663 if (
result.capacity() != resultSize)
2669 char *
end =
result.d.data() + sizeSoFar;
2671 const qsizetype halfResultSize = resultSize >> 1;
2672 while (sizeSoFar <= halfResultSize) {
2673 memcpy(
end,
result.d.data(), sizeSoFar);
2677 memcpy(
end,
result.d.data(), resultSize - sizeSoFar);
2678 result.d.data()[resultSize] =
'\0';
2679 result.d.size = resultSize;
2684 if (ol_minus_1 < sizeof(std::size_t) * CHAR_BIT) \
2685 hashHaystack -= std::size_t(a) << ol_minus_1; \
2690 const auto ol = needle.size();
2691 const auto l = haystack.size();
2694 return qMax(from + l, 0);
2696 return from > l ? -1 : from;
2702 if (from > l || ol + from > l)
2705 return qFindByteArray(haystack.data(), haystack.size(), from, needle.data(), ol);
2738 auto delta = l - ol;
2741 if (from < 0 || from > l)
2746 const char *
end = haystack;
2748 const auto ol_minus_1 = std::size_t(ol - 1);
2749 const char *
n = needle + ol_minus_1;
2750 const char *
h = haystack + ol_minus_1;
2751 std::size_t hashNeedle = 0, hashHaystack = 0;
2753 for (idx = 0; idx < ol; ++idx) {
2754 hashNeedle = ((hashNeedle<<1) + *(
n-idx));
2755 hashHaystack = ((hashHaystack<<1) + *(
h-idx));
2757 hashHaystack -= *haystack;
2758 while (haystack >=
end) {
2759 hashHaystack += *haystack;
2760 if (hashHaystack == hashNeedle && memcmp(needle, haystack, ol) == 0)
2761 return haystack -
end;
2763 REHASH(*(haystack + ol));
2771 if (haystack.size() == 0)
2774 from += haystack.size();
2775 else if (from > haystack.size())
2776 from = haystack.size() - 1;
2778 const char *
b = haystack.data();
2779 const char *
n =
b + from + 1;
2795 if (haystack.isEmpty()) {
2796 if (needle.isEmpty() && from == 0)
2800 const auto ol = needle.size();
2804 return lastIndexOfHelper(haystack.data(), haystack.size(), needle.data(), ol, from);
2863 for (
char ch : haystack) {
2872 if (needle.size() == 0)
2873 return haystack.size() + 1;
2875 if (needle.size() == 1)
2880 if (haystack.size() > 500 && needle.size() > 5) {
2882 while ((
i =
matcher.indexIn(haystack,
i + 1)) != -1)
2885 while ((
i = haystack.indexOf(needle,
i + 1)) != -1)
2913#if QT_DEPRECATED_SINCE(6, 4)
2936 if (haystack.size() < needle.size())
2938 if (haystack.data() == needle.data() || needle.size() == 0)
2940 return memcmp(haystack.data(), needle.data(), needle.size()) == 0;
2965 if (haystack.size() < needle.size())
2967 if (haystack.end() == needle.end() || needle.size() == 0)
2969 return memcmp(haystack.end() - needle.size(), needle.data(), needle.size()) == 0;
2998 return c >=
'A' &&
c <=
'Z';
3006 return c >=
'a' &&
c <=
'z';
3107 switch (QContainerImplHelper::mid(
size(), &
p, &l)) {
3108 case QContainerImplHelper::Null:
3110 case QContainerImplHelper::Empty:
3112 return QByteArray(DataPointer::fromRawData(&_empty, 0));
3114 case QContainerImplHelper::Full:
3116 case QContainerImplHelper::Subset:
3117 return sliced(
p, l);
3127 switch (QContainerImplHelper::mid(
size(), &
p, &l)) {
3128 case QContainerImplHelper::Null:
3130 case QContainerImplHelper::Empty:
3133 case QContainerImplHelper::Full:
3134 return std::move(*
this);
3135 case QContainerImplHelper::Subset:
3136 return std::move(*this).sliced(
p, l);
3264template <
typename T>
3268 const char *orig_begin =
input.constBegin();
3269 const char *firstBad = orig_begin;
3270 const char *e =
input.constEnd();
3271 for ( ; firstBad != e ; ++firstBad) {
3274 if (
ch != converted)
3279 return std::move(
input);
3283 char *
b =
s.begin();
3284 char *
p =
b + (firstBad - orig_begin);
3286 for ( ;
p != e; ++
p)
3335#if !defined(QT_NO_DATASTREAM)
3348 QDataStream::writeQSizeType(
out, -1);
3370 in.setStatus(QDataStream::SizeLimitExceeded);
3386 in.setStatus(QDataStream::ReadPastEnd);
3390 }
while (allocated <
len);
3741#if defined(QT_CHECK_RANGE)
3742 if (
base != 0 && (base < 2 || base > 36)) {
3743 qWarning(
"QByteArray::toIntegral: Invalid base %d",
base);
3758#if defined(QT_CHECK_RANGE)
3759 if (
base != 0 && (base < 2 || base > 36)) {
3760 qWarning(
"QByteArray::toIntegral: Invalid base %d",
base);
4112 constexpr char alphabet_base64[] =
"ABCDEFGH" "IJKLMNOP" "QRSTUVWX" "YZabcdef"
4113 "ghijklmn" "opqrstuv" "wxyz0123" "456789+/";
4114 constexpr char alphabet_base64url[] =
"ABCDEFGH" "IJKLMNOP" "QRSTUVWX" "YZabcdef"
4115 "ghijklmn" "opqrstuv" "wxyz0123" "456789-_";
4116 const char *
const alphabet = options &
Base64UrlEncoding ? alphabet_base64url : alphabet_base64;
4117 constexpr char padchar =
'=';
4140 int j = (chunk & 0x00fc0000) >> 18;
4141 int k = (chunk & 0x0003f000) >> 12;
4142 int l = (chunk & 0x00000fc0) >> 6;
4143 int m = (chunk & 0x0000003f);
4144 *
out++ = alphabet[
j];
4145 *
out++ = alphabet[k];
4151 *
out++ = alphabet[l];
4157 *
out++ = alphabet[
m];
4223#if defined(QT_CHECK_RANGE)
4224 if (base < 2 || base > 36) {
4229 constexpr char b =
'a' - 10;
4233 *--
p =
c + (
c < 10 ?
'0' :
b);
4246 constexpr int buffsize = 66;
4247 char buff[buffsize];
4271 constexpr int buffsize = 66;
4272 char buff[buffsize];
4420#if defined(QT_CHECK_RANGE)
4421 qWarning(
"QByteArray::setNum: Invalid format char '%c'",
format);
4489struct fromBase64_helper_result {
4494fromBase64_helper_result fromBase64_helper(
const char *
input,
qsizetype inputSize,
4496 QByteArray::Base64Options options)
4500 unsigned int buf = 0;
4508 if (
ch >=
'A' &&
ch <=
'Z') {
4510 }
else if (
ch >=
'a' &&
ch <=
'z') {
4512 }
else if (
ch >=
'0' &&
ch <=
'9') {
4527 if ((inputSize % 4) != 0) {
4530 }
else if ((
i == inputSize - 1) ||
4531 (
i == inputSize - 2 &&
input[++
i] ==
'=')) {
4553 buf &= (1 << nbits) - 1;
4594 if (base64.isDetached()) {
4595 const auto base64result = fromBase64_helper(base64.data(),
4599 base64.truncate(base64result.decodedLength);
4600 return { std::move(base64), base64result.status };
4609 const auto base64Size = base64.size();
4611 const auto base64result = fromBase64_helper(base64.data(),
4613 const_cast<char *
>(
result.constData()),
4615 result.truncate(base64result.decodedLength);
4616 return { std::move(
result), base64result.status };
4646 return std::move(
result.decoded);
4666 bool odd_digit =
true;
4667 for (
qsizetype i = hexEncoded.size() - 1;
i >= 0; --
i) {
4707 char *hexData =
hex.data();
4713 if ((separator) && (
o <
length))
4714 hexData[
o++] = separator;
4725 const char *inputPtr =
data;
4734 if (
c == percent &&
i + 2 <
len) {
4738 if (
a >=
'0' &&
a <=
'9')
a -=
'0';
4739 else if (
a >=
'a' &&
a <=
'f')
a =
a -
'a' + 10;
4740 else if (
a >=
'A' &&
a <=
'F')
a =
a -
'A' + 10;
4742 if (
b >=
'0' &&
b <=
'9')
b -=
'0';
4743 else if (
b >=
'a' &&
b <=
'f')
b =
b -
'a' + 10;
4744 else if (
b >=
'A' &&
b <=
'F')
b =
b -
'A' + 10;
4746 *
data++ = (char)((
a << 4) |
b);
4803 return input.percentDecoded(percent);
4832 return std::string(
data(),
size_t(
size()));
4869 return view.size() > 0 && memchr(
view.data(),
c,
view.size()) !=
nullptr;
4876 for (
unsigned char c : *
this) {
4877 if (
char(
c) != percent
4878 && ((
c >= 0x61 &&
c <= 0x7A)
4879 || (
c >= 0x41 &&
c <= 0x5A)
4880 || (
c >= 0x30 &&
c <= 0x39)
4907#if defined(Q_OS_WASM) || defined(Q_QDOC)
4932QByteArray QByteArray::fromEcmaUint8Array(emscripten::val uint8array)
4954emscripten::val QByteArray::toEcmaUint8Array()
5057#if QT_DEPRECATED_SINCE(6, 8)
constexpr bool isNull() const noexcept
constexpr qsizetype size() const noexcept
constexpr const_pointer data() const noexcept
double toDouble(bool *ok=nullptr) const
size_t qHash(const QByteArray::FromBase64Result &key, size_t seed) noexcept
Returns the hash value for key, using seed to seed the calculation.
char * data()
\macro QT_NO_CAST_FROM_BYTEARRAY
qulonglong toULongLong(bool *ok=nullptr, int base=10) const
Returns the byte array converted to an {unsigned long long} using base base, which is ten by default.
qlonglong toLongLong(bool *ok=nullptr, int base=10) const
Returns the byte array converted to a {long long} using base base, which is ten by default.
char * iterator
This typedef provides an STL-style non-const iterator for QByteArray.
char * qstrncpy(char *dst, const char *src, size_t len)
A safe strncpy() function.
QByteArray & prepend(char c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
size_t qstrlen(const char *str)
A safe strlen() function.
QByteArray repeated(qsizetype times) const
QDataStream & operator<<(QDataStream &out, const QByteArray &ba)
Writes byte array ba to the stream out and returns a reference to the stream.
QDataStream & operator>>(QDataStream &in, QByteArray &ba)
Reads a byte array into ba from the stream in and returns a reference to the stream.
QByteArray & operator=(const QByteArray &) noexcept
Assigns other to this byte array and returns a reference to this byte array.
uint toUInt(bool *ok=nullptr, int base=10) const
Returns the byte array converted to an {unsigned int} using base base, which is ten by default.
QByteArray & fill(char c, qsizetype size=-1)
Sets every byte in the byte array to ch.
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
quint16 qChecksum(QByteArrayView data, Qt::ChecksumType standard)
static QByteArray fromHex(const QByteArray &hexEncoded)
Returns a decoded copy of the hex encoded array hexEncoded.
std::string toStdString() const
void reserve(qsizetype size)
Attempts to allocate memory for at least size bytes.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
QByteArray & setNum(short, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int toInt(bool *ok=nullptr, int base=10) const
Returns the byte array converted to an int using base base, which is ten by default.
bool isLower() const
Returns true if this byte array is lowercase, that is, if it's identical to its toLower() folding.
friend qsizetype erase(QByteArray &ba, const T &t)
QList< QByteArray > split(char sep) const
Splits the byte array into subarrays wherever sep occurs, and returns the list of those arrays.
int qstricmp(const char *str1, const char *str2)
A safe stricmp() function.
static QByteArray fromPercentEncoding(const QByteArray &pctEncoded, char percent='%')
qsizetype indexOf(char c, qsizetype from=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void chop(qsizetype n)
Removes n bytes from the end of the byte array.
qsizetype length() const noexcept
Same as size().
bool isUpper() const
Returns true if this byte array is uppercase, that is, if it's identical to its toUpper() folding.
static constexpr qsizetype max_size() noexcept
static QByteArray fromStdString(const std::string &s)
ushort toUShort(bool *ok=nullptr, int base=10) const
Returns the byte array converted to an {unsigned short} using base base, which is ten by default.
iterator end()
Returns an \l{STL-style iterators}{STL-style iterator} pointing just after the last byte in the byte-...
const char * const_iterator
This typedef provides an STL-style const iterator for QByteArray.
long toLong(bool *ok=nullptr, int base=10) const
void truncate(qsizetype pos)
Truncates the byte array at index position pos.
double toDouble(bool *ok=nullptr) const
Returns the byte array converted to a double value.
QByteArray percentDecoded(char percent='%') const
static QByteArray fromBase64(const QByteArray &base64, Base64Options options=Base64Encoding)
@ AbortOnBase64DecodingErrors
QByteArray toPercentEncoding(const QByteArray &exclude=QByteArray(), const QByteArray &include=QByteArray(), char percent='%') const
int qstrnicmp(const char *str1, const char *str2, size_t len)
A safe strnicmp() function.
void swap(QByteArray &other) noexcept
QByteArray & insert(qsizetype i, QByteArrayView data)
bool contains(char c) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
constexpr QByteArray() noexcept
Constructs an empty byte array.
short toShort(bool *ok=nullptr, int base=10) const
Returns the byte array converted to a short using base base, which is ten by default.
const_iterator cbegin() const noexcept
ulong toULong(bool *ok=nullptr, int base=10) const
static QByteArray number(int, int base=10)
Returns a byte-array representing the whole number n as text.
float toFloat(bool *ok=nullptr) const
Returns the byte array converted to a float value.
char * qstrcpy(char *dst, const char *src)
Copies all the characters up to and including the '\0' from src into dst and returns a pointer to dst...
QByteArray leftJustified(qsizetype width, char fill=' ', bool truncate=false) const
Returns a byte array of size width that contains this byte array padded with the fill byte.
QByteArrayData DataPointer
void clear()
Clears the contents of the byte array and makes it null.
int qstrcmp(const char *str1, const char *str2)
A safe strcmp() function.
QByteArray rightJustified(qsizetype width, char fill=' ', bool truncate=false) const
Returns a byte array of size width that contains the fill byte followed by this byte array.
QByteArray last(qsizetype n) const &
iterator begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first byte in the byte-array.
qsizetype capacity() const
Returns the maximum number of bytes that can be stored in the byte array without forcing a reallocati...
void resize(qsizetype size)
Sets the size of the byte array to size bytes.
QByteArray & remove(qsizetype index, qsizetype len)
Removes len bytes from the array, starting at index position pos, and returns a reference to the arra...
QByteArray & append(char c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QByteArray toBase64(Base64Options options=Base64Encoding) const
char * qstrdup(const char *src)
Returns a duplicate string.
qsizetype count(char c) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void resizeForOverwrite(qsizetype size)
QByteArray mid(qsizetype index, qsizetype len=-1) const &
QByteArray & setRawData(const char *a, qsizetype n)
QByteArray toHex(char separator='\0') const
Returns a hex encoded copy of the byte array.
bool isNull() const noexcept
Returns true if this byte array is null; otherwise returns false.
static FromBase64Result fromBase64Encoding(QByteArray &&base64, Base64Options options=Base64Encoding)
QByteArray & assign(QByteArrayView v)
static QByteArray fromRawData(const char *data, qsizetype size)
Constructs a QByteArray that uses the first size bytes of the data array.
QByteArray & replace(qsizetype index, qsizetype len, const char *s, qsizetype alen)
This is an overloaded member function, provided for convenience. It differs from the above function o...
\inmodule QtCore\reentrant
void append(parameter_type t)
QChar * data()
Returns a pointer to the data stored in the QString.
QByteArray copyToQByteArray() const
static Uint8Array copyFrom(const char *buffer, uint32_t size)
Combined button and popup list for selecting options.
constexpr int caseCompareAscii(char lhs, char rhs) noexcept
constexpr char toHexUpper(char32_t value) noexcept
constexpr char toHexLower(char32_t value) noexcept
constexpr int fromHex(char32_t c) noexcept
constexpr char toAsciiLower(char ch) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype lastIndexOf(QByteArrayView haystack, qsizetype from, char needle) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QByteArrayView haystack, QByteArrayView needle) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION ParsedNumber< qulonglong > toUnsignedInteger(QByteArrayView data, int base)
qsizetype findByteArray(QByteArrayView haystack, qsizetype from, char needle) noexcept
static constexpr bool q_points_into_range(const T *p, const T *b, const T *e, Cmp less={}) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION QByteArrayView trimmed(QByteArrayView s) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION ParsedNumber< qlonglong > toSignedInteger(QByteArrayView data, int base)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QByteArrayView haystack, QByteArrayView needle) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype count(QByteArrayView haystack, QByteArrayView needle) noexcept
Q_CORE_EXPORT int compareMemory(QByteArrayView lhs, QByteArrayView rhs)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION ParsedNumber< float > toFloat(QByteArrayView a) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION ParsedNumber< double > toDouble(QByteArrayView a) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isValidUtf8(QByteArrayView s) noexcept
constexpr Initialization Uninitialized
QT_POPCOUNT_RELAXED_CONSTEXPR uint qCountLeadingZeroBits(quint32 v) noexcept
constexpr uint qCountTrailingZeroBits(quint32 v) noexcept
static jboolean copy(JNIEnv *, jobject)
static constexpr bool isLowerCaseAscii(char c)
static char * qulltoa2(char *p, qulonglong n, int base)
QByteArray qCompress(const uchar *data, qsizetype nbytes, int compressionLevel)
static Q_DECL_COLD_FUNCTION QByteArray tooMuchData(ZLibOp op)
static Q_DECL_COLD_FUNCTION QByteArray lengthIsNegative(ZLibOp op)
static Q_DECL_COLD_FUNCTION QByteArray invalidCompressedData()
static qsizetype lastIndexOfCharHelper(QByteArrayView haystack, qsizetype from, char needle) noexcept
static Q_DECL_COLD_FUNCTION const char * zlibOpAsString(ZLibOp op)
static QByteArray toCase_template(T &input, uchar(*lookup)(uchar))
static Q_DECL_COLD_FUNCTION QByteArray zlibError(ZLibOp op, const char *what)
static void q_fromPercentEncoding(QByteArray *ba, char percent)
int qstrnicmp(const char *str1, qsizetype len1, const char *str2, qsizetype len2)
static qsizetype lastIndexOfHelper(const char *haystack, qsizetype l, const char *needle, qsizetype ol, qsizetype from)
static Q_DECL_COLD_FUNCTION QByteArray dataIsNull(ZLibOp op)
static constexpr bool isUpperCaseAscii(char c)
static const quint16 crc_tbl[16]
static QByteArray xxflate(ZLibOp op, QArrayDataPointer< char > out, QByteArrayView input, qxp::function_ref< int(z_stream *) const > init, qxp::function_ref< int(z_stream *, size_t) const > processChunk, qxp::function_ref< void(z_stream *) const > deinit)
qsizetype qFindByteArray(const char *haystack0, qsizetype haystackLen, qsizetype from, const char *needle0, qsizetype needleLen)
quint32 CompressSizeHint_t
static constexpr uchar asciiLower(uchar c)
static qsizetype countCharHelper(QByteArrayView haystack, char needle) noexcept
static Q_DECL_COLD_FUNCTION QByteArray unexpectedZlibError(ZLibOp op, int err, const char *msg)
static constexpr uchar asciiUpper(uchar c)
Q_CORE_EXPORT QByteArray qUncompress(const uchar *data, qsizetype nbytes)
Q_CORE_EXPORT char * qstrcpy(char *dst, const char *src)
QByteArrayView qToByteArrayViewIgnoringNull(const QByteArrayLike &b) noexcept
#define Q_DECL_COLD_FUNCTION
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
constexpr T qToBigEndian(T source)
constexpr QtPrivate::QHashMultiReturnType< T... > qHashMulti(size_t seed, const T &... args) noexcept(std::conjunction_v< QtPrivate::QNothrowHashable< T >... >)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLint GLfloat GLfloat GLfloat v2
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum GLuint GLintptr offset
GLint GLfloat GLfloat GLfloat GLfloat v3
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLint GLsizei GLsizei GLenum format
GLsizei GLenum const void * indices
GLfloat GLfloat GLfloat GLfloat h
GLenum GLenum GLenum input
GLenum GLint GLint * precision
static constexpr qint64 HeaderSize
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
QScopeGuard< typename std::decay< F >::type > qScopeGuard(F &&f)
[qScopeGuard]
static constexpr QChar sep
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
static double toDouble(Value v)
QT_BEGIN_NAMESPACE typedef uchar * output
static int inflate(Bytef *dest, ulong *destLen, const Bytef *source, ulong sourceLen)
static int deflate(Bytef *dest, ulong *destLen, const Bytef *source, ulong sourceLen)
Q_CHECK_PTR(a=new int[80])
QTextStream out(stdout)
[7]
static const auto matcher
[0]
void detachAndGrow(QArrayData::GrowthPosition where, qsizetype n, const T **data, QArrayDataPointer *old)
qsizetype freeSpaceAtBegin() const noexcept
void setBegin(T *begin) noexcept
qsizetype constAllocatedCapacity() const noexcept
void clear() noexcept(std::is_nothrow_destructible< T >::value)
static QArrayDataPointer allocateGrow(const QArrayDataPointer &from, qsizetype n, QArrayData::GrowthPosition position)
QArrayDataPointer sliced(qsizetype pos, qsizetype n) const &
bool isMutable() const noexcept
static Q_NODISCARD_CTOR QArrayDataPointer fromRawData(const T *rawData, qsizetype length) noexcept
static float convertDoubleToFloat(double d, bool *ok)
static QSimpleParsedNumber< quint64 > bytearrayToUnsLongLong(QByteArrayView num, int base)
static Q_CORE_EXPORT QSimpleParsedNumber< qint64 > bytearrayToLongLong(QByteArrayView num, int base)
static TrimPositions trimmed_helper_positions(const StringType &str)
static StringType trimmed_helper(StringType &str)
static StringType simplified_helper(StringType &str)
static ValidUtf8Result isValidUtf8(QByteArrayView in)