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;
79 char *
dst =
new char[strlen(
src) + 1];
102 const size_t len = strlen(
src);
141 return src ?
dst :
nullptr;
183int qstrcmp(
const char *str1,
const char *str2)
185 return (str1 && str2) ? strcmp(str1, str2)
186 : (str1 ? 1 : (str2 ? -1 : 0));
230 const uchar *
s1 =
reinterpret_cast<const uchar *
>(str1);
231 const uchar *
s2 =
reinterpret_cast<const uchar *
>(str2);
237 enum { Incomplete = 256 };
248 }
while (unlimited ||
offset < max);
249 return int(Incomplete);
252#if defined(__SSE4_1__) && !(defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer))
253 enum { PageSize = 4096, PageMask = PageSize - 1 };
254 const __m128i
zero = _mm_setzero_si128();
261 size_t n = PageSize - ((
u1 |
u2) & PageMask);
264 for ( ;
offset + 16 <= maxoffset;
offset +=
sizeof(__m128i)) {
266 __m128i
a = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(
s1 +
offset));
267 __m128i
b = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(
s2 +
offset));
270 __m128i cmp = _mm_cmpeq_epi8(
a,
b);
273 cmp = _mm_min_epu8(cmp,
a);
274 cmp = _mm_cmpeq_epi8(cmp,
zero);
290 int res = innerCompare(
n,
false);
291 if (
res != Incomplete)
296 return innerCompare(-1,
true);
320 const uchar *
s1 =
reinterpret_cast<const uchar *
>(str1);
321 const uchar *
s2 =
reinterpret_cast<const uchar *
>(str2);
323 return s1 ? 1 : (
s2 ? -1 : 0);
346 const uchar *
s1 =
reinterpret_cast<const uchar *
>(str1);
347 const uchar *
s2 =
reinterpret_cast<const uchar *
>(str2);
352 return (!
s2 || !*
s2) ? 0 : -1;
357 return len1 == 0 ? 0 : 1;
362 for (
i = 0;
i < len1; ++
i) {
370 return s2[
i] ? -1 : 0;
380 return len1 < len2 ? -1 : 1;
410static void createCRC16Table()
416 for (
i = 0;
i < 16;
i++) {
423#define SET_BIT(x, b, v) (x) |= (v) << (b)
438 printf(
"static const quint16 crc_tbl[16] = {\n");
439 for (
int i = 0;
i < 16;
i +=4)
446 0x0000, 0x1081, 0x2102, 0x3183,
447 0x4204, 0x5285, 0x6306, 0x7387,
448 0x8408, 0x9489, 0xa50a, 0xb58b,
449 0xc60c, 0xd68d, 0xe70e, 0xf78f
481 crc = ((crc >> 4) & 0x0fff) ^
crc_tbl[((crc ^
c) & 15)];
483 crc = ((crc >> 4) & 0x0fff) ^
crc_tbl[((crc ^
c) & 15)];
525#ifndef QT_NO_COMPRESS
537 Q_UNREACHABLE_RETURN(
nullptr);
556 return zlibError(op,
"Input length is negative");
562 return zlibError(op,
"Not enough memory");
574 qWarning(
"%s unexpected zlib error: %s (%d)",
586 if (
out.data() ==
nullptr)
590 const auto initalSize =
out.size;
593 zs.next_in =
reinterpret_cast<uchar *
>(
const_cast<char *
>(
input.data()));
594 if (
const int err =
init(&zs); err != Z_OK)
598 using ZlibChunkSize_t =
decltype(zs.avail_in);
599 static_assert(!std::is_signed_v<ZlibChunkSize_t>);
600 static_assert(std::is_same_v<ZlibChunkSize_t,
decltype(zs.avail_out)>);
601 constexpr auto MaxChunkSize = std::numeric_limits<ZlibChunkSize_t>::max();
603 constexpr auto MaxStatisticsSize = std::numeric_limits<
decltype(zs.total_out)>::max();
605 size_t inputLeft = size_t(
input.size());
612 if (zs.avail_out == 0) {
613 Q_ASSERT(
size_t(
out.size) - initalSize > MaxStatisticsSize ||
614 size_t(
out.size) - initalSize == zs.total_out);
618 if (avail_out == 0) {
620 if (
out.data() ==
nullptr)
625 zs.next_out =
reinterpret_cast<uchar *
>(
out.data()) +
out.size;
626 zs.avail_out = size_t(avail_out) > size_t(MaxChunkSize) ? MaxChunkSize
627 : ZlibChunkSize_t(avail_out);
628 out.size += zs.avail_out;
633 if (zs.avail_in == 0) {
635 zs.avail_in = inputLeft > MaxChunkSize ? MaxChunkSize : ZlibChunkSize_t(inputLeft);
636 inputLeft -= zs.avail_in;
639 res = processChunk(&zs, inputLeft);
640 }
while (
res == Z_OK);
644 out.size -= zs.avail_out;
645 Q_ASSERT(
size_t(
out.size) - initalSize > MaxStatisticsSize ||
646 size_t(
out.size) - initalSize == zs.total_out);
648 out.data()[
out.size] =
'\0';
679 if (compressionLevel < -1 || compressionLevel > 9)
680 compressionLevel = -1;
683 constexpr qsizetype SingleAllocLimit = 256 * 1024;
688 if (nbytes < SingleAllocLimit) {
690 capacity += compressBound(uLong(nbytes));
691 return QArrayDataPointer<char>(
capacity);
696 constexpr qsizetype MaxCompressionFactor = 1024;
700 nbytes / MaxCompressionFactor);
704 if (
out.data() ==
nullptr)
711 [=] (z_stream *zs) {
return deflateInit(zs, compressionLevel); },
712 [] (z_stream *zs,
size_t inputLeft) {
713 return deflate(zs, inputLeft ? Z_NO_FLUSH : Z_FINISH);
715 [] (z_stream *zs) { deflateEnd(zs); });
751#ifndef QT_NO_COMPRESS
771 const auto expectedSize = qFromBigEndian<CompressSizeHint_t>(
data);
773 if (expectedSize != 0)
779 if constexpr (MaxDecompressedSize < std::numeric_limits<CompressSizeHint_t>::max()) {
780 if (expectedSize > MaxDecompressedSize)
791 [] (z_stream *zs) {
return inflateInit(zs); },
792 [] (z_stream *zs, size_t) {
return inflate(zs, Z_NO_FLUSH); },
793 [] (z_stream *zs) { inflateEnd(zs); });
1882 if (d->needsDetach() ||
size > capacityAtEnd)
1885 if (d->allocatedCapacity())
1908 const auto old = d.
size;
1911 memset(d.
data() + old,
c, d.
size - old);
1958 if (d->needsDetach() || cannotUseReallocate) {
1962 ::memcpy(dd.data(), d.
data(), dd.size);
1963 dd.data()[dd.size] = 0;
1966 d->reallocate(alloc,
option);
1975 if (d->needsDetach()) {
1979 dd.data()[dd.size] = 0;
2018 return (*
this =
ba);
2142 d->copyAppend(1,
ch);
2209 *
this =
v.toByteArray();
2238 if (
i < 0 ||
size <= 0)
2250 d->copyAppend(
i - d->size,
' ');
2328 d->copyAppend(
i - d->size,
' ');
2365 if (!d->isShared()) {
2370 const auto toRemove_start = d.
begin() +
pos;
2371 copy.d->copyRanges({{d.
begin(), toRemove_start},
2372 {toRemove_start +
len, d.
end()}});
2440 memcpy(d.
data() +
pos, after.data(),
len*
sizeof(
char));
2483 const char *
b = before.
data();
2485 const char *
a = after.data();
2488 if (
isNull() || (
b ==
a && bsize == asize))
2506 if (bsize == asize) {
2513 }
else if (asize < bsize) {
2515 size_t movestart = 0;
2521 memmove(
d + to,
d + movestart, msize);
2528 memcpy(
d + to,
a, asize);
2538 memmove(
d + to,
d + movestart, msize);
2544 while (
index != -1) {
2578 memmove(
d + moveto,
d + movestart, (moveend - movestart));
2580 memcpy(
d + insertstart,
a, asize);
2581 moveend = movestart - bsize;
2604 if (before != after) {
2606 const auto detachedData =
data();
2607 std::replace(detachedData +
pos, detachedData +
size(), before, after);
2622 QList<QByteArray>
list;
2659 if (
result.capacity() != resultSize)
2665 char *
end =
result.d.data() + sizeSoFar;
2667 const qsizetype halfResultSize = resultSize >> 1;
2668 while (sizeSoFar <= halfResultSize) {
2669 memcpy(
end,
result.d.data(), sizeSoFar);
2673 memcpy(
end,
result.d.data(), resultSize - sizeSoFar);
2674 result.d.data()[resultSize] =
'\0';
2675 result.d.size = resultSize;
2709 auto delta = l - ol;
2712 if (from < 0 || from > l)
2717 const char *
end = haystack;
2719 const qregisteruint ol_minus_1 = ol - 1;
2720 const char *
n = needle + ol_minus_1;
2721 const char *
h = haystack + ol_minus_1;
2722 qregisteruint hashNeedle = 0, hashHaystack = 0;
2724 for (idx = 0; idx < ol; ++idx) {
2725 hashNeedle = ((hashNeedle<<1) + *(
n-idx));
2726 hashHaystack = ((hashHaystack<<1) + *(
h-idx));
2728 hashHaystack -= *haystack;
2729 while (haystack >=
end) {
2730 hashHaystack += *haystack;
2731 if (hashHaystack == hashNeedle && memcmp(needle, haystack, ol) == 0)
2732 return haystack -
end;
2734 if (ol_minus_1 <
sizeof(ol_minus_1) * CHAR_BIT)
2735 hashHaystack -= qregisteruint(*(haystack + ol)) << ol_minus_1;
2743 if (haystack.size() == 0)
2746 from += haystack.size();
2747 else if (from > haystack.size())
2748 from = haystack.size() - 1;
2750 const char *
b = haystack.data();
2751 const char *
n =
b + from + 1;
2767 if (haystack.isEmpty()) {
2768 if (needle.isEmpty() && from == 0)
2772 const auto ol = needle.size();
2776 return lastIndexOfHelper(haystack.data(), haystack.size(), needle.data(), ol, from);
2835 for (
char ch : haystack) {
2844 if (needle.size() == 0)
2845 return haystack.size() + 1;
2847 if (needle.size() == 1)
2852 if (haystack.size() > 500 && needle.size() > 5) {
2854 while ((
i =
matcher.indexIn(haystack,
i + 1)) != -1)
2857 while ((
i = haystack.indexOf(needle,
i + 1)) != -1)
2885#if QT_DEPRECATED_SINCE(6, 4)
2908 if (haystack.size() < needle.size())
2910 if (haystack.data() == needle.data() || needle.size() == 0)
2912 return memcmp(haystack.data(), needle.data(), needle.size()) == 0;
2937 if (haystack.size() < needle.size())
2939 if (haystack.end() == needle.end() || needle.size() == 0)
2941 return memcmp(haystack.end() - needle.size(), needle.data(), needle.size()) == 0;
2970 return c >=
'A' &&
c <=
'Z';
2978 return c >=
'a' &&
c <=
'z';
3079 switch (QContainerImplHelper::mid(
size(), &
p, &l)) {
3080 case QContainerImplHelper::Null:
3082 case QContainerImplHelper::Empty:
3084 return QByteArray(DataPointer::fromRawData(&_empty, 0));
3086 case QContainerImplHelper::Full:
3088 case QContainerImplHelper::Subset:
3089 return sliced(
p, l);
3099 switch (QContainerImplHelper::mid(
size(), &
p, &l)) {
3100 case QContainerImplHelper::Null:
3102 case QContainerImplHelper::Empty:
3105 case QContainerImplHelper::Full:
3106 return std::move(*
this);
3107 case QContainerImplHelper::Subset:
3108 return std::move(*this).sliced(
p, l);
3236template <
typename T>
3240 const char *orig_begin =
input.constBegin();
3241 const char *firstBad = orig_begin;
3242 const char *e =
input.constEnd();
3243 for ( ; firstBad != e ; ++firstBad) {
3246 if (
ch != converted)
3251 return std::move(
input);
3255 char *
b =
s.begin();
3256 char *
p =
b + (firstBad - orig_begin);
3258 for ( ;
p != e; ++
p)
3307#if !defined(QT_NO_DATASTREAM)
3320 QDataStream::writeQSizeType(
out, -1);
3342 in.setStatus(QDataStream::SizeLimitExceeded);
3358 in.setStatus(QDataStream::ReadPastEnd);
3362 }
while (allocated <
len);
3713#if defined(QT_CHECK_RANGE)
3714 if (
base != 0 && (base < 2 || base > 36)) {
3715 qWarning(
"QByteArray::toIntegral: Invalid base %d",
base);
3730#if defined(QT_CHECK_RANGE)
3731 if (
base != 0 && (base < 2 || base > 36)) {
3732 qWarning(
"QByteArray::toIntegral: Invalid base %d",
base);
4084 constexpr char alphabet_base64[] =
"ABCDEFGH" "IJKLMNOP" "QRSTUVWX" "YZabcdef"
4085 "ghijklmn" "opqrstuv" "wxyz0123" "456789+/";
4086 constexpr char alphabet_base64url[] =
"ABCDEFGH" "IJKLMNOP" "QRSTUVWX" "YZabcdef"
4087 "ghijklmn" "opqrstuv" "wxyz0123" "456789-_";
4088 const char *
const alphabet = options &
Base64UrlEncoding ? alphabet_base64url : alphabet_base64;
4089 constexpr char padchar =
'=';
4112 int j = (chunk & 0x00fc0000) >> 18;
4113 int k = (chunk & 0x0003f000) >> 12;
4114 int l = (chunk & 0x00000fc0) >> 6;
4115 int m = (chunk & 0x0000003f);
4116 *
out++ = alphabet[
j];
4117 *
out++ = alphabet[k];
4123 *
out++ = alphabet[l];
4129 *
out++ = alphabet[
m];
4195#if defined(QT_CHECK_RANGE)
4196 if (base < 2 || base > 36) {
4201 constexpr char b =
'a' - 10;
4205 *--
p =
c + (
c < 10 ?
'0' :
b);
4218 constexpr int buffsize = 66;
4219 char buff[buffsize];
4243 constexpr int buffsize = 66;
4244 char buff[buffsize];
4392#if defined(QT_CHECK_RANGE)
4393 qWarning(
"QByteArray::setNum: Invalid format char '%c'",
format);
4461struct fromBase64_helper_result {
4466fromBase64_helper_result fromBase64_helper(
const char *
input,
qsizetype inputSize,
4468 QByteArray::Base64Options options)
4472 unsigned int buf = 0;
4480 if (
ch >=
'A' &&
ch <=
'Z') {
4482 }
else if (
ch >=
'a' &&
ch <=
'z') {
4484 }
else if (
ch >=
'0' &&
ch <=
'9') {
4499 if ((inputSize % 4) != 0) {
4502 }
else if ((
i == inputSize - 1) ||
4503 (
i == inputSize - 2 &&
input[++
i] ==
'=')) {
4525 buf &= (1 << nbits) - 1;
4566 if (base64.isDetached()) {
4567 const auto base64result = fromBase64_helper(base64.data(),
4571 base64.truncate(base64result.decodedLength);
4572 return { std::move(base64), base64result.status };
4581 const auto base64Size = base64.size();
4583 const auto base64result = fromBase64_helper(base64.data(),
4585 const_cast<char *
>(
result.constData()),
4587 result.truncate(base64result.decodedLength);
4588 return { std::move(
result), base64result.status };
4618 return std::move(
result.decoded);
4638 bool odd_digit =
true;
4639 for (
qsizetype i = hexEncoded.size() - 1;
i >= 0; --
i) {
4679 char *hexData =
hex.data();
4685 if ((separator) && (
o <
length))
4686 hexData[
o++] = separator;
4697 const char *inputPtr =
data;
4706 if (
c == percent &&
i + 2 <
len) {
4710 if (
a >=
'0' &&
a <=
'9')
a -=
'0';
4711 else if (
a >=
'a' &&
a <=
'f')
a =
a -
'a' + 10;
4712 else if (
a >=
'A' &&
a <=
'F')
a =
a -
'A' + 10;
4714 if (
b >=
'0' &&
b <=
'9')
b -=
'0';
4715 else if (
b >=
'a' &&
b <=
'f')
b =
b -
'a' + 10;
4716 else if (
b >=
'A' &&
b <=
'F')
b =
b -
'A' + 10;
4718 *
data++ = (char)((
a << 4) |
b);
4775 return input.percentDecoded(percent);
4804 return std::string(
data(),
size_t(
size()));
4841 return view.size() > 0 && memchr(
view.data(),
c,
view.size()) !=
nullptr;
4848 for (
unsigned char c : *
this) {
4849 if (
char(
c) != percent
4850 && ((
c >= 0x61 &&
c <= 0x7A)
4851 || (
c >= 0x41 &&
c <= 0x5A)
4852 || (
c >= 0x30 &&
c <= 0x39)
4879#if defined(Q_OS_WASM) || defined(Q_QDOC)
4904QByteArray QByteArray::fromEcmaUint8Array(emscripten::val uint8array)
4926emscripten::val QByteArray::toEcmaUint8Array()
5029#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)
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)
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)