43 #if QT_CONFIG(regularexpression)
47 #include <private/qstringconverter_p.h>
49 #include "private/qsimd_p.h"
63 #include <private/qcore_mac_p.h>
66 #include <private/qfunctions_p.h>
95 #define LLONG_MAX qint64_C(9223372036854775807)
98 #define LLONG_MIN (-LLONG_MAX - qint64_C(1))
101 #define ULLONG_MAX quint64_C(18446744073709551615)
104 #define IS_RAW_DATA(d) ((d.d)->flags & QArrayData::RawDataType)
106 if (sl_minus_1 < sizeof(std::size_t) * CHAR_BIT) \
107 hashHaystack -= std::size_t(a) << sl_minus_1; \
112 const char16_t QString::_empty = 0;
118 inline bool qIsUpper(
char ch)
120 return ch >=
'A' &&
ch <=
'Z';
123 inline bool qIsDigit(
char ch)
125 return ch >=
'0' &&
ch <=
'9';
128 inline char qToLower(
char ch)
130 if (
ch >=
'A' &&
ch <=
'Z')
131 return ch -
'A' +
'a';
135 template <
typename Po
inter>
141 return foldCase(
reinterpret_cast<const char16_t*
>(
ch),
142 reinterpret_cast<const char16_t*
>(
start));
146 char32_t foldCaseHelper<const char*>(
const char*
ch,
const char*)
148 return foldCase(char16_t(
uchar(*
ch)));
151 template <
typename T>
152 char16_t valueTypeToUtf16(
T t) =
delete;
155 char16_t valueTypeToUtf16<QChar>(
QChar t)
161 char16_t valueTypeToUtf16<char>(
char t)
163 return char16_t{
uchar(
t)};
182 char16_t
c =
ch.unicode();
183 const char16_t *
n =
s + from;
193 if (foldCase(*
n) ==
c)
200 template <
typename Haystack>
201 static inline qsizetype qLastIndexOf(Haystack haystack,
QChar needle,
204 if (haystack.size() == 0)
207 from += haystack.size();
208 else if (std::size_t(from) > std::size_t(haystack.size()))
209 from = haystack.size() - 1;
211 char16_t
c = needle.unicode();
212 const auto b = haystack.data();
216 if (valueTypeToUtf16(*
n) ==
c)
221 if (foldCase(valueTypeToUtf16(*
n)) ==
c)
230 template<
typename Haystack,
typename Needle>
236 return qLastIndexOf(haystack0, needle0.front(), from, cs);
241 if (from ==
l && sl == 0)
244 if (std::size_t(from) > std::size_t(
l) || delta < 0)
251 auto haystack = haystack0.data();
252 const auto needle = needle0.data();
253 const auto *
end = haystack;
255 const std::size_t sl_minus_1 = sl ? sl - 1 : 0;
256 const auto *
n = needle + sl_minus_1;
257 const auto *
h = haystack + sl_minus_1;
258 std::size_t hashNeedle = 0, hashHaystack = 0;
262 hashNeedle = (hashNeedle << 1) + valueTypeToUtf16(*(
n -
idx));
263 hashHaystack = (hashHaystack << 1) + valueTypeToUtf16(*(
h -
idx));
265 hashHaystack -= valueTypeToUtf16(*haystack);
267 while (haystack >=
end) {
268 hashHaystack += valueTypeToUtf16(*haystack);
269 if (hashHaystack == hashNeedle
271 return haystack -
end;
273 REHASH(valueTypeToUtf16(haystack[sl]));
277 hashNeedle = (hashNeedle << 1) + foldCaseHelper(
n -
idx, needle);
278 hashHaystack = (hashHaystack << 1) + foldCaseHelper(
h -
idx,
end);
280 hashHaystack -= foldCaseHelper(haystack,
end);
282 while (haystack >=
end) {
283 hashHaystack += foldCaseHelper(haystack,
end);
284 if (hashHaystack == hashNeedle
286 return haystack -
end;
288 REHASH(foldCaseHelper(haystack + sl,
end));
325 #if defined(__mips_dsp)
327 extern "C" void qt_fromlatin1_mips_asm_unroll4 (char16_t*,
const char*,
uint);
328 extern "C" void qt_fromlatin1_mips_asm_unroll8 (char16_t*,
const char*,
uint);
329 extern "C" void qt_toLatin1_mips_dsp_asm(
uchar *
dst,
const char16_t *
src,
int length);
339 #if defined(__SSE2__) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL)
340 # if defined(__SANITIZE_ADDRESS__) && Q_CC_GNU < 800 && !defined(Q_CC_CLANG)
341 # warning "The __attribute__ on below will likely cause a build failure with your GCC version. Your choices are:"
342 # warning "1) disable ASan;"
343 # warning "2) disable the optimized code in qustrlen (change __SSE2__ to anything else);"
344 # warning "3) upgrade your compiler (preferred)."
355 #if defined(__SSE2__) && !(defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer))
359 const char16_t *ptr =
str - (misalignment / 2);
363 const __m128i zeroes = _mm_setzero_si128();
364 __m128i
data = _mm_load_si128(
reinterpret_cast<const __m128i *
>(ptr));
365 __m128i comparison = _mm_cmpeq_epi16(
data, zeroes);
369 mask >>= misalignment;
378 data = _mm_load_si128(
reinterpret_cast<const __m128i *
>(ptr));
380 comparison = _mm_cmpeq_epi16(
data, zeroes);
381 mask = _mm_movemask_epi8(comparison);
386 return ptr -
str +
idx / 2;
389 if (
sizeof(
wchar_t) ==
sizeof(char16_t))
390 return wcslen(
reinterpret_cast<const wchar_t *
>(
str));
397 #if !defined(__OPTIMIZE_SIZE__)
399 template <u
int MaxCount>
struct UnrollTailLoop
401 template <
typename RetType,
typename Functor1,
typename Functor2,
typename Number>
402 static inline RetType
exec(
Number count, RetType returnIfExited, Functor1 loopCheck, Functor2 returnIfFailed,
Number i = 0)
413 return returnIfExited;
415 bool check = loopCheck(
i);
417 return returnIfFailed(
i);
422 template <
typename Functor,
typename Number>
432 template <>
template <
typename RetType,
typename Functor1,
typename Functor2,
typename Number>
435 return returnIfExited;
457 # if defined(__AVX2__) && !defined(__OPTIMIZE_SIZE__)
459 __m256i mch256 = _mm256_set1_epi32(
c | (
c << 16));
461 __m256i
data = _mm256_loadu_si256(
reinterpret_cast<const __m256i *
>(
n));
462 __m256i
result = _mm256_cmpeq_epi16(
data, mch256);
470 __m128i mch = _mm256_castsi256_si128(mch256);
472 __m128i mch = _mm_set1_epi32(
c | (
c << 16));
475 auto hasMatch = [mch, &
n](__m128i
data,
ushort validityMask) {
478 if ((
mask & validityMask) == 0)
487 __m128i
data = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(
n));
488 if (hasMatch(
data, 0xffff))
497 # if !defined(__OPTIMIZE_SIZE__)
500 __m128i
data = _mm_loadl_epi64(
reinterpret_cast<const __m128i *
>(
n));
501 if (hasMatch(
data, 0xff))
508 [=](
int i) {
return n[
i] ==
c; },
509 [=](
int i) {
return n +
i; });
511 #elif defined(__ARM_NEON__)
512 const uint16x8_t vmask = { 1, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, 1 << 6, 1 << 7 };
513 const uint16x8_t ch_vec = vdupq_n_u16(
c);
515 uint16x8_t
data = vld1q_u16(
reinterpret_cast<const uint16_t *
>(
n));
516 uint mask = vaddvq_u16(vandq_u16(vceqq_u16(
data, ch_vec), vmask));
537 static bool simdTestMask(
const char *&ptr,
const char *
end,
quint32 maskval)
546 # if defined(__SSE4_1__)
548 auto updatePtrSimd = [&](__m128i
data) {
549 __m128i masked = _mm_and_si128(
mask,
data);
550 __m128i comparison = _mm_cmpeq_epi16(masked, _mm_setzero_si128());
555 # if defined(__AVX2__)
557 const __m256i mask256 = _mm256_broadcastd_epi32(_mm_cvtsi32_si128(maskval));
558 while (ptr + 32 <=
end) {
559 __m256i
data = _mm256_loadu_si256(
reinterpret_cast<const __m256i *
>(ptr));
560 if (!_mm256_testz_si256(mask256,
data)) {
562 __m256i masked256 = _mm256_and_si256(mask256,
data);
563 __m256i comparison256 = _mm256_cmpeq_epi16(masked256, _mm256_setzero_si256());
564 return updatePtr(_mm256_movemask_epi8(comparison256));
569 mask = _mm256_castsi256_si128(mask256);
573 mask = _mm_set1_epi32(maskval);
574 while (ptr + 32 <=
end) {
575 __m128i data1 = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(ptr));
576 __m128i data2 = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(ptr + 16));
577 if (!_mm_testz_si128(
mask, data1))
578 return updatePtrSimd(data1);
581 if (!_mm_testz_si128(
mask, data2))
582 return updatePtrSimd(data2);
588 if (ptr + 16 <=
end) {
589 __m128i data1 = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(ptr));
590 if (!_mm_testz_si128(
mask, data1))
591 return updatePtrSimd(data1);
596 if (ptr + 8 <=
end) {
597 __m128i data1 = _mm_loadl_epi64(
reinterpret_cast<const __m128i *
>(ptr));
598 if (!_mm_testz_si128(
mask, data1))
599 return updatePtrSimd(data1);
605 const __m128i
mask = _mm_set1_epi32(maskval);
606 while (ptr + 16 <=
end) {
607 __m128i
data = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(ptr));
608 __m128i masked = _mm_and_si128(
mask,
data);
609 __m128i comparison = _mm_cmpeq_epi16(masked, _mm_setzero_si128());
617 if (ptr + 8 <=
end) {
618 __m128i
data = _mm_loadl_epi64(
reinterpret_cast<const __m128i *
>(ptr));
619 __m128i masked = _mm_and_si128(
mask,
data);
620 __m128i comparison = _mm_cmpeq_epi16(masked, _mm_setzero_si128());
631 static Q_ALWAYS_INLINE __m128i mm_load8_zero_extend(
const void *ptr)
633 const __m128i *
dataptr =
static_cast<const __m128i *
>(ptr);
634 #if defined(__SSE4_1__)
638 return _mm_cvtepu8_epi16(
data);
642 return _mm_unpacklo_epi8(
data, _mm_setzero_si128());
651 #if defined(__SSE2__)
654 # if defined(__AVX2__)
655 while (ptr + 32 <=
end) {
656 __m256i
data = _mm256_loadu_si256(
reinterpret_cast<const __m256i *
>(ptr));
668 while (ptr + 16 <=
end) {
669 __m128i
data = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(ptr));
681 if (ptr + 8 <=
end) {
682 __m128i
data = _mm_loadl_epi64(
reinterpret_cast<const __m128i *
>(ptr));
693 while (ptr + 4 <=
end) {
695 if (
data &= 0x80808080U) {
715 const char *ptr =
s.begin();
716 const char *
end =
s.end();
721 static bool isAscii_helper(
const char16_t *&ptr,
const char16_t *
end)
724 const char *ptr8 =
reinterpret_cast<const char *
>(ptr);
725 const char *end8 =
reinterpret_cast<const char *
>(
end);
726 bool ok = simdTestMask(ptr8, end8, 0xff80ff80);
727 ptr =
reinterpret_cast<const char16_t *
>(ptr8);
742 const char16_t *ptr =
s.utf16();
743 const char16_t *
end = ptr +
s.size();
745 return isAscii_helper(ptr,
end);
750 const char16_t *ptr =
s.utf16();
751 const char16_t *
end = ptr +
s.size();
754 const char *ptr8 =
reinterpret_cast<const char *
>(ptr);
755 const char *end8 =
reinterpret_cast<const char *
>(
end);
756 if (!simdTestMask(ptr8, end8, 0xff00ff00))
758 ptr =
reinterpret_cast<const char16_t *
>(ptr8);
770 constexpr char32_t InvalidCodePoint = UINT_MAX;
773 while (
i.hasNext()) {
774 const char32_t
c =
i.next(InvalidCodePoint);
775 if (
c == InvalidCodePoint)
790 #if defined(__SSE2__)
796 const __m128i
chunk = _mm_loadu_si128((
const __m128i*)(
str +
offset));
799 const __m256i extended = _mm256_cvtepu8_epi16(
chunk);
802 _mm256_storeu_si256((__m256i*)(
dst +
offset), extended);
804 const __m128i nullMask = _mm_set1_epi32(0);
807 const __m128i firstHalf = _mm_unpacklo_epi8(
chunk, nullMask);
808 _mm_storeu_si128((__m128i*)(
dst +
offset), firstHalf);
811 const __m128i secondHalf = _mm_unpackhi_epi8 (
chunk, nullMask);
812 _mm_storeu_si128((__m128i*)(
dst +
offset + 8), secondHalf);
818 const __m128i unpacked = mm_load8_zero_extend(
str +
offset);
819 _mm_storeu_si128(
reinterpret_cast<__m128i *
>(
dst +
offset), unpacked);
826 # if !defined(__OPTIMIZE_SIZE__)
830 #if defined(__mips_dsp)
832 qt_fromlatin1_mips_asm_unroll8(
dst,
str,
size);
834 qt_fromlatin1_mips_asm_unroll4(
dst,
str,
size);
841 template <
bool Checked>
844 #if defined(__SSE2__)
849 const __m256i questionMark256 = _mm256_broadcastw_epi16(_mm_cvtsi32_si128(
'?'));
850 const __m256i outOfRange256 = _mm256_broadcastw_epi16(_mm_cvtsi32_si128(0x100));
851 const __m128i questionMark = _mm256_castsi256_si128(questionMark256);
852 const __m128i outOfRange = _mm256_castsi256_si128(outOfRange256);
854 const __m128i questionMark = _mm_set1_epi16(
'?');
855 const __m128i outOfRange = _mm_set1_epi16(0x100);
858 auto mergeQuestionMarks = [=](__m128i
chunk) {
863 const __m128i offLimitMask = _mm_cmpeq_epi16(
chunk, outOfRange);
864 chunk = _mm_blendv_epi8(
chunk, questionMark, offLimitMask);
867 const __m128i signedBitOffset = _mm_set1_epi16(
short(0x8000));
868 const __m128i thresholdMask = _mm_set1_epi16(
short(0xff + 0x8000));
870 const __m128i signedChunk = _mm_add_epi16(
chunk, signedBitOffset);
871 const __m128i offLimitMask = _mm_cmpgt_epi16(signedChunk, thresholdMask);
875 const __m128i offLimitQuestionMark = _mm_and_si128(offLimitMask, questionMark);
879 const __m128i correctBytes = _mm_andnot_si128(offLimitMask,
chunk);
882 chunk = _mm_or_si128(correctBytes, offLimitQuestionMark);
891 # if defined(__AVX2__)
892 __m256i
chunk = _mm256_loadu_si256(
reinterpret_cast<const __m256i *
>(
src +
offset));
895 chunk = _mm256_min_epu16(
chunk, outOfRange256);
896 const __m256i offLimitMask = _mm256_cmpeq_epi16(
chunk, outOfRange256);
897 chunk = _mm256_blendv_epi8(
chunk, questionMark256, offLimitMask);
900 const __m128i chunk2 = _mm256_extracti128_si256(
chunk, 1);
901 const __m128i chunk1 = _mm256_castsi256_si128(
chunk);
903 __m128i chunk1 = _mm_loadu_si128((
const __m128i*)(
src +
offset));
905 chunk1 = mergeQuestionMarks(chunk1);
907 __m128i chunk2 = _mm_loadu_si128((
const __m128i*)(
src +
offset + 8));
909 chunk2 = mergeQuestionMarks(chunk2);
913 const __m128i
result = _mm_packus_epi16(chunk1, chunk2);
917 # if !defined(__OPTIMIZE_SIZE__)
920 __m128i
chunk = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(
src +
offset));
932 __m128i
chunk = _mm_loadl_epi64(
reinterpret_cast<const __m128i *
>(
src +
offset));
951 # if !defined(__OPTIMIZE_SIZE__)
959 #elif defined(__ARM_NEON__)
965 const int chunkCount =
length >> 3;
966 const uint16x8_t questionMark = vdupq_n_u16(
'?');
967 const uint16x8_t thresholdMask = vdupq_n_u16(0xff);
968 for (
int i = 0;
i < chunkCount; ++
i) {
969 uint16x8_t
chunk = vld1q_u16((uint16_t *)
src);
973 const uint16x8_t offLimitMask = vcgtq_u16(
chunk, thresholdMask);
974 const uint16x8_t offLimitQuestionMark = vandq_u16(offLimitMask, questionMark);
975 const uint16x8_t correctBytes = vbicq_u16(
chunk, offLimitMask);
976 chunk = vorrq_u16(correctBytes, offLimitQuestionMark);
985 #if defined(__mips_dsp)
1015 if (be -
b < ae -
a)
1024 int diff = foldCase(
a->unicode(), alast) - foldCase(
b->unicode(), blast);
1039 static int ucstricmp(
const QChar *
a,
const QChar *ae,
const char *
b,
const char *be)
1042 if (be -
b < ae -
a)
1046 int diff = foldCase(
a->unicode()) - foldCase(char16_t{
uchar(*
b)});
1061 static int ucstricmp8(
const char *utf8,
const char *utf8end,
const QChar *utf16,
const QChar *utf16end)
1063 auto src1 =
reinterpret_cast<const uchar *
>(utf8);
1064 auto end1 =
reinterpret_cast<const uchar *
>(utf8end);
1067 while (src1 < end1 && src2.hasNext()) {
1069 char32_t *output = &uc1;
1071 int res = QUtf8Functions::fromUtf8<QUtf8BaseTraits>(
b, output, src1, end1);
1080 int diff = uc1 - uc2;
1086 return (end1 > src1) - int(src2.hasNext());
1089 #if defined(__mips_dsp)
1091 extern "C" int qt_ucstrncmp_mips_dsp_asm(
const char16_t *
a,
1097 static int ucstrncmp(
const QChar *
a,
const QChar *
b,
size_t l)
1099 #ifdef __OPTIMIZE_SIZE__
1102 if (
int diff = (
int)
a->unicode() - (
int)
b->unicode())
1109 #if defined(__mips_dsp)
1110 static_assert(
sizeof(
uint) ==
sizeof(
size_t));
1112 return qt_ucstrncmp_mips_dsp_asm(
reinterpret_cast<const char16_t*
>(
a),
1113 reinterpret_cast<const char16_t*
>(
b),
1124 auto isDifferent = [
a,
b, &
offset, &retval](__m128i a_data, __m128i b_data) {
1125 __m128i
result = _mm_cmpeq_epi16(a_data, b_data);
1137 __m256i a_data = _mm256_loadu_si256(
reinterpret_cast<const __m256i *
>(
a +
offset));
1138 __m256i b_data = _mm256_loadu_si256(
reinterpret_cast<const __m256i *
>(
b +
offset));
1139 __m256i
result = _mm256_cmpeq_epi16(a_data, b_data);
1142 __m128i a_data1 = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(
a +
offset));
1143 __m128i a_data2 = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(
a +
offset + 8));
1144 __m128i b_data1 = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(
b +
offset));
1145 __m128i b_data2 = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(
b +
offset + 8));
1146 __m128i result1 = _mm_cmpeq_epi16(a_data1, b_data1);
1147 __m128i result2 = _mm_cmpeq_epi16(a_data2, b_data2);
1148 uint mask = _mm_movemask_epi8(result1) | (_mm_movemask_epi8(result2) << 16);
1160 __m128i a_data = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(
a +
offset));
1161 __m128i b_data = _mm_loadu_si128(
reinterpret_cast<const __m128i *
>(
b +
offset));
1162 if (isDifferent(a_data, b_data))
1170 __m128i a_data = _mm_loadl_epi64(
reinterpret_cast<const __m128i *
>(
a +
offset));
1171 __m128i b_data = _mm_loadl_epi64(
reinterpret_cast<const __m128i *
>(
b +
offset));
1172 if (isDifferent(a_data, b_data))
1181 const auto lambda = [=](
size_t i) ->
int {
1189 const uint16x8_t
mask = { 1, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, 1 << 6, 1 << 7 };
1190 while (
end -
a > 7) {
1191 uint16x8_t da = vld1q_u16(
reinterpret_cast<const uint16_t *
>(
a));
1192 uint16x8_t
db = vld1q_u16(
reinterpret_cast<const uint16_t *
>(
b));
1194 uint8_t
r = ~(uint8_t)vaddvq_u16(vandq_u16(vceqq_u16(da,
db),
mask));
1198 return (
int)
a[
idx].unicode() - (int)
b[
idx].unicode();
1205 const auto lambda = [=](
size_t i) ->
int {
1206 return a[
i].unicode() -
b[
i].unicode();
1216 if (
reinterpret_cast<quintptr>(
a) & 2) {
1220 return a->unicode() -
b->unicode();
1233 for ( ; da !=
e; ++da, ++
db) {
1235 a =
reinterpret_cast<const QChar *
>(da);
1236 b =
reinterpret_cast<const QChar *
>(
db);
1239 return a[1].unicode() -
b[1].unicode();
1244 a =
reinterpret_cast<const QChar *
>(da);
1245 b =
reinterpret_cast<const QChar *
>(
db);
1246 return (
l & 1) ?
a->
unicode() -
b->unicode() : 0;
1250 for ( ;
a !=
e; ++
a, ++
b) {
1252 return a->unicode() -
b->unicode();
1259 static int ucstrncmp(
const QChar *
a,
const uchar *
c,
size_t l)
1261 const char16_t *uc =
reinterpret_cast<const char16_t *
>(
a);
1262 const char16_t *
e = uc +
l;
1265 __m128i nullmask = _mm_setzero_si128();
1268 # if !defined(__OPTIMIZE_SIZE__)
1272 auto isDifferent = [uc,
c, &
offset, &retval](__m128i a_data, __m128i b_data) {
1273 __m128i
result = _mm_cmpeq_epi16(a_data, b_data);
1288 __m128i
chunk = _mm_loadu_si128((
const __m128i*)(
c +
offset));
1292 __m256i ldata = _mm256_cvtepu8_epi16(
chunk);
1295 __m256i ucdata = _mm256_loadu_si256((
const __m256i*)(uc +
offset));
1296 __m256i
result = _mm256_cmpeq_epi16(ldata, ucdata);
1301 __m128i firstHalf = _mm_unpacklo_epi8(
chunk, nullmask);
1302 __m128i secondHalf = _mm_unpackhi_epi8(
chunk, nullmask);
1305 __m128i ucdata1 = _mm_loadu_si128((
const __m128i*)(uc +
offset));
1306 __m128i ucdata2 = _mm_loadu_si128((
const __m128i*)(uc +
offset + 8));
1307 __m128i result1 = _mm_cmpeq_epi16(firstHalf, ucdata1);
1308 __m128i result2 = _mm_cmpeq_epi16(secondHalf, ucdata2);
1310 uint mask = ~(_mm_movemask_epi8(result1) | _mm_movemask_epi8(result2) << 16);
1319 # if !defined(__OPTIMIZE_SIZE__)
1323 __m128i secondHalf = mm_load8_zero_extend(
c +
offset);
1325 __m128i ucdata = _mm_loadu_si128((
const __m128i*)(uc +
offset));
1326 if (isDifferent(ucdata, secondHalf))
1333 enum { MaxTailLength = 3 };
1336 __m128i
chunk = _mm_cvtsi32_si128(qFromUnaligned<int>(
c +
offset));
1337 __m128i secondHalf = _mm_unpacklo_epi8(
chunk, nullmask);
1339 __m128i ucdata = _mm_loadl_epi64(
reinterpret_cast<const __m128i *
>(uc +
offset));
1340 if (isDifferent(ucdata, secondHalf))
1352 # if !defined(__OPTIMIZE_SIZE__)
1353 const auto lambda = [=](
size_t i) {
return uc[
i] - char16_t(
c[
i]); };
1359 int diff = *uc - *
c;
1370 return lhs ==
rhs ? 0 :
1376 static int ucstrcmp(
const QChar *
a,
size_t alen,
const QChar *
b,
size_t blen)
1378 if (
a ==
b && alen == blen)
1380 const size_t l = qMin(alen, blen);
1381 int cmp = ucstrncmp(
a,
b,
l);
1382 return cmp ? cmp :
lencmp(alen, blen);
1385 static int ucstrcmp(
const QChar *
a,
size_t alen,
const char *
b,
size_t blen)
1387 const size_t l = qMin(alen, blen);
1388 const int cmp = ucstrncmp(
a,
reinterpret_cast<const uchar*
>(
b),
l);
1389 return cmp ? cmp :
lencmp(alen, blen);
1392 static constexpr
uchar latin1Lower[256] = {
1393 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
1394 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,
1395 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,
1396 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
1397 0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,
1398 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x5b,0x5c,0x5d,0x5e,0x5f,
1399 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,
1400 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f,
1401 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,
1402 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f,
1403 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,
1404 0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf,
1406 0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,
1407 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xd7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xdf,
1408 0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,
1409 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
1411 static int latin1nicmp(
const char *lhsChar,
qsizetype lSize,
const char *rhsChar,
qsizetype rSize)
1414 Q_ASSERT(lSize >= 0 && rSize >= 0);
1416 return rSize ? -1 : 0;
1421 const uchar *lhs =
reinterpret_cast<const uchar *
>(lhsChar);
1422 const uchar *
rhs =
reinterpret_cast<const uchar *
>(rhsChar);
1425 if (
int res = latin1Lower[lhs[
i]] - latin1Lower[
rhs[
i]])
1428 return lencmp(lSize, rSize);
1432 return ucstrcmp(lhs.begin(), lhs.size(),
rhs.begin(),
rhs.size()) == 0;
1437 return ucstrcmp(lhs.begin(), lhs.size(),
rhs.begin(),
rhs.size()) == 0;
1447 return lhs.size() ==
rhs.size() && (!lhs.size() || memcmp(lhs.data(),
rhs.data(), lhs.size()) == 0);
1473 return lhs.size() ==
rhs.size() && (!lhs.size() || memcmp(lhs.data(),
rhs.data(), lhs.size()) == 0);
1478 if (lhs.size() !=
rhs.size() && lhs.isUtf8() ==
rhs.isUtf8())
1480 return lhs.visit([
rhs](
auto lhs) {
1481 return rhs.visit([lhs](
auto rhs) {
1506 return ucstrcmp(lhs.begin(), lhs.size(),
rhs.begin(),
rhs.size());
1507 return ucstricmp(lhs.begin(), lhs.end(),
rhs.begin(),
rhs.end());
1530 return ucstrcmp(lhs.begin(), lhs.size(),
rhs.begin(),
rhs.size());
1531 return ucstricmp(lhs.begin(), lhs.end(),
rhs.begin(),
rhs.end());
1578 return latin1nicmp(lhs.data(), lhs.size(),
rhs.data(),
rhs.size());
1579 const auto l = std::min(lhs.size(),
rhs.size());
1580 int r = memcmp(lhs.data(),
rhs.data(),
l);
1605 return ucstricmp8(lhs.begin(), lhs.end(),
rhs.begin(),
rhs.end());
1631 const auto l = std::min(lhs.size(),
rhs.size());
1632 int r = memcmp(lhs.data(),
rhs.data(),
l);
1638 return lhs.visit([
rhs, cs](
auto lhs) {
1639 return rhs.visit([lhs, cs](
auto rhs) {
1647 #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
1648 static bool supportUnicodeDigitValuesInArg()
1650 static const bool result = []() {
1651 static const char supportUnicodeDigitValuesEnvVar[]
1652 =
"QT_USE_UNICODE_DIGIT_VALUES_IN_STRING_ARG";
1654 if (qEnvironmentVariableIsSet(supportUnicodeDigitValuesEnvVar))
1655 return qEnvironmentVariableIntValue(supportUnicodeDigitValuesEnvVar) != 0;
1657 #if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
1668 static int qArgDigitValue(
QChar ch) noexcept
1670 #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
1671 if (supportUnicodeDigitValuesInArg())
1672 return ch.digitValue();
1674 if (
ch >=
u'0' &&
ch <=
u'9')
1675 return int(
ch.unicode() -
u'0');
2539 char16_t *
b = d.
data();
2540 const char16_t
value =
ch.unicode();
2577 d.
data()[0] =
ch.unicode();
2699 std::fill_n(d.
data() + oldSize, difference, fillChar.
unicode());
2785 ::memcpy(dd.data(), d.
data(), dd.size *
sizeof(
QChar));
2786 dd.data()[dd.size] = 0;
2789 d->reallocate(alloc,
option);
2802 dd.data()[dd.size] = 0;
2891 d.
data()[0] =
ch.unicode();
2971 const char *
s =
str.latin1();
2972 if (
i < 0 || !
s || !(*
s))
2978 difference =
i -
size();
3004 if (
i < 0 ||
size <= 0)
3007 const char16_t *
s =
reinterpret_cast<const char16_t *
>(
unicode);
3089 static_assert(
sizeof(
QChar) ==
sizeof(char16_t),
"Unexpected difference in sizes");
3091 const char16_t *char16String =
reinterpret_cast<const char16_t *
>(
str);
3105 const char *
s =
str.latin1();
3256 if (
size_t(
pos) >=
size_t(
size())) {
3260 }
else if (
len > 0) {
3268 template<
typename T>
3271 const auto needleSize = needle.size();
3280 const auto beg =
s.begin();
3282 auto src = beg +
i + needleSize;
3283 const auto end =
s.end();
3287 const auto i =
s.indexOf(needle,
src - beg, cs);
3288 const auto hit =
i == -1 ?
end : beg +
i;
3289 const auto skipped = hit -
src;
3292 src = hit + needleSize;
3294 s.truncate(
dst - beg);
3313 if (QtPrivate::q_points_into_range(
s, d.
data(), d.
data() + d.
size))
3338 removeStringImpl(*
this,
str, cs);
3369 auto caseInsensEqual = [
c](
QChar x) {
3370 return c ==
x.toCaseFolded();
3433 if (
size_t(
pos) >
size_t(this->
size()))
3435 if (len > this->
size() - pos)
3491 const std::less<const QChar *> less;
3503 QChar *afterBuffer =
nullptr;
3504 if (pointsIntoRange(after, d.
data(), d.
size))
3505 after = afterBuffer = textCopy(after, alen);
3513 }
else if (alen < blen) {
3518 memcpy(d.
data()+to, after, alen*
sizeof(
QChar));
3520 size_t movestart =
indices[0] + blen;
3528 memcpy(d.
data() + to, after, alen *
sizeof(
QChar));
3539 qsizetype adjust = nIndices*(alen-blen);
3550 (moveend - movestart)*
sizeof(
QChar));
3551 memcpy(d.
data() + insertstart, after, alen *
sizeof(
QChar));
3552 moveend = movestart-blen;
3555 } QT_CATCH(
const std::bad_alloc &) {
3556 ::free(afterBuffer);
3559 ::free(afterBuffer);
3584 if (alen == 0 && blen == 0)
3588 QChar *beforeBuffer =
nullptr, *afterBuffer =
nullptr;
3594 while (
pos < 1024) {
3612 if (!afterBuffer && pointsIntoRange(after, d.
data(), d.
size))
3613 after = afterBuffer = textCopy(after, alen);
3615 if (!beforeBuffer && pointsIntoRange(before, d.
data(), d.
size)) {
3616 beforeBuffer = textCopy(before, blen);
3621 replace_helper(
indices,
pos, blen, after, alen);
3628 ::free(afterBuffer);
3629 ::free(beforeBuffer);
3644 if (after.
size() == 0)
3647 if (after.
size() == 1)
3699 const char16_t
a = after.
unicode();
3700 char16_t *
i = d.
data();
3701 char16_t *
const e =
i + d.
size;
3705 const char16_t
b = before.
unicode();
3711 const char16_t
b = foldCase(before.
unicode());
3713 if (foldCase(*
i) ==
b)
4124 #if QT_STRINGVIEW_LEVEL < 2
4202 #if QT_STRINGVIEW_LEVEL < 2
4355 #if QT_CONFIG(regularexpression)
4356 struct QStringCapture
4385 qWarning(
"QString::replace: invalid QRegularExpression object");
4407 if (no > 0 && no <= numCaptures) {
4408 QStringCapture backReference;
4409 backReference.pos =
i;
4410 backReference.len = 2;
4414 if (secondDigit != -1 && ((no * 10) + secondDigit) <= numCaptures) {
4415 no = (no * 10) + secondDigit;
4416 ++backReference.len;
4420 backReference.no = no;
4421 backReferences.
append(backReference);
4433 const QStringView copyView{ copy }, afterView{ after };
4440 chunks << copyView.
mid(lastEnd,
len);
4446 for (
const QStringCapture &backReference : qAsConst(backReferences)) {
4448 len = backReference.pos - lastEnd;
4450 chunks << afterView.
mid(lastEnd,
len);
4461 lastEnd = backReference.pos + backReference.len;
4465 len = afterView.length() - lastEnd;
4467 chunks << afterView.
mid(lastEnd,
len);
4475 if (copyView.length() > lastEnd) {
4476 chunks << copyView.
mid(lastEnd);
4477 newLength += copyView.
length() - lastEnd;
4541 #if QT_STRINGVIEW_LEVEL < 2
4587 #if QT_CONFIG(regularexpression)
4784 start += sectionsSize;
4786 end += sectionsSize;
4789 for (
qsizetype k = 0; k < sectionsSize; ++k) {
4790 if (sections.
at(k).isEmpty())
4794 start += sectionsSize - skip;
4796 end += sectionsSize - skip;
4825 #if QT_CONFIG(regularexpression)
4826 class qt_section_chunk {
4828 qt_section_chunk() {}
4836 QString::SectionFlags
flags)
4842 start += sectionsSize;
4844 end += sectionsSize;
4847 for (
qsizetype k = 0; k < sectionsSize; ++k) {
4848 const qt_section_chunk §ion = sections.
at(k);
4849 if (section.length == section.string.length())
4853 start += sectionsSize - skip;
4855 end += sectionsSize - skip;
4864 const qt_section_chunk §ion = sections.
at(
i);
4865 const bool empty = (section.length == section.string.length());
4872 ret += section.string;
4874 ret += section.string.mid(section.length);
4881 const qt_section_chunk §ion = sections.
at(first_i);
4882 ret.prepend(section.string.left(section.length));
4886 && last_i < sectionsSize - 1) {
4887 const qt_section_chunk §ion = sections.
at(last_i+1);
4888 ret += section.string.left(section.length);
4911 qWarning(
"QString::section: invalid QRegularExpression object");
4953 if (
size_t(
n) >=
size_t(
size()))
4972 if (
size_t(
n) >=
size_t(
size()))
4999 switch (QContainerImplHelper::mid(
size(), &
p, &
l)) {
5002 case QContainerImplHelper::Empty:
5004 case QContainerImplHelper::Full:
5006 case QContainerImplHelper::Subset:
5080 #if QT_STRINGVIEW_LEVEL < 2
5094 return qt_starts_with(*
this,
s, cs);
5103 return qt_starts_with(*
this,
s, cs);
5114 return qt_starts_with(*
this,
c, cs);
5131 #if QT_STRINGVIEW_LEVEL < 2
5145 return qt_ends_with(*
this,
s, cs);
5167 return qt_ends_with(*
this,
s, cs);
5178 return qt_ends_with(*
this,
c, cs);
5198 while (
it.hasNext()) {
5199 const char32_t uc =
it.next();
5224 while (
it.hasNext()) {
5225 const char32_t uc =
it.next();
5237 return qt_convert_to_latin1(
string);
5252 return string.visit([] (
auto string) {
return string.toString(); });
5269 return qt_convert_to_latin1(
string);
5281 qt_to_latin1(
reinterpret_cast<uchar *
>(
const_cast<char *
>(
ba.
constData())),
5282 string.utf16(),
string.size());
5288 if (!
s.isDetached())
5289 return qt_convert_to_latin1(
s);
5293 const char16_t *
data =
s.d.data();
5305 char *ddata = ba_d.data();
5308 ba_d.d_ptr()->alloc *=
sizeof(char16_t);
5377 return qt_convert_to_local_8bit(
string);
5395 return qt_convert_to_utf8(
str);
5420 return qt_convert_to_utf8(
string);
5442 return qt_convert_to_ucs4(*
this);
5450 while (
it.hasNext())
5452 v.resize(
a -
v.constData());
5475 return qt_convert_to_ucs4(
string);
5493 }
else if (
ba.
size() == 0) {
5499 char16_t *
dst =
d.data();
5764 template <
typename StringView>
5765 StringView qt_trimmed(StringView
s) noexcept
5791 return qt_trimmed(
s);
5796 return qt_trimmed(
s);
6251 #if QT_STRINGVIEW_LEVEL < 2
6382 #if !defined(CSTR_LESS_THAN)
6383 #define CSTR_LESS_THAN 1
6384 #define CSTR_EQUAL 2
6385 #define CSTR_GREATER_THAN 3
6412 int QString::localeAwareCompare_helper(
const QChar *data1,
qsizetype length1,
6421 if (length1 == 0 || length2 == 0)
6430 # if defined(Q_OS_WIN)
6441 # elif defined (Q_OS_DARWIN)
6446 const CFStringRef thisString =
6447 CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault,
6448 reinterpret_cast<const UniChar *
>(lhs.
constData()), lhs.
length(), kCFAllocatorNull);
6449 const CFStringRef otherString =
6450 CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault,
6451 reinterpret_cast<const UniChar *
>(
rhs.constData()),
rhs.length(), kCFAllocatorNull);
6453 const int result = CFStringCompare(thisString, otherString, kCFCompareLocalized);
6454 CFRelease(thisString);
6455 CFRelease(otherString);
6457 # elif defined(Q_OS_UNIX)
6461 # error "This case shouldn't happen"
6497 return reinterpret_cast<const ushort *
>(d.
data());
6568 memcpy(
static_cast<void *
>(uc),
static_cast<const void *
>(d.
data()),
sizeof(
QChar)*
len);
6617 template <
typename T>
6623 QChar *pp =
s.begin() +
it.index();
6626 const auto folded = fullConvertCase(
it.next(), which);
6628 if (folded.chars[0] == *pp && folded.size() == 2) {
6632 *pp++ = folded.chars[1];
6638 s.replace(outpos, 1,
reinterpret_cast<const QChar *
>(folded.data()), folded.size());
6639 pp =
const_cast<QChar *
>(
s.constBegin()) + outpos + folded.size();
6646 *pp++ = folded.chars[0];
6648 }
while (
it.hasNext());
6653 template <
typename T>
6660 while (
e !=
p &&
e[-1].isHighSurrogate())
6664 while (
it.hasNext()) {
6665 const char32_t uc =
it.next();
6666 if (qGetProp(uc)->cases[which].diff) {
6668 return detachAndConvertCase(
str,
it, which);
6671 return std::move(
str);
6768 static void append_utf8(
QString &qs,
const char *cs,
int len)
6770 const int oldSize = qs.
size();
6776 static uint parse_flag_characters(
const char * &
c) noexcept
6790 default:
return flags;
6799 const char *
const stop =
c +
size;
6808 while (
c < stop && qIsDigit(*
c))
6815 static inline bool can_consume(
const char * &
c,
char ch) noexcept
6824 static LengthMod parse_length_modifier(
const char * &
c) noexcept
6827 case 'h':
return can_consume(
c,
'h') ?
lm_hh :
lm_h;
6828 case 'l':
return can_consume(
c,
'l') ?
lm_ll :
lm_l;
6829 case 'L':
return lm_L;
6830 case 'j':
return lm_j;
6832 case 'Z':
return lm_z;
6833 case 't':
return lm_t;
6855 if (!cformat || !*cformat) {
6863 const char *
c = cformat;
6864 const char *formatEnd = cformat +
qstrlen(cformat);
6868 while (*
c !=
'\0' && *
c !=
'%')
6876 const char *escape_start =
c;
6899 width = parse_field_width(
c, formatEnd -
c);
6900 }
else if (*
c ==
'*') {
6901 width = va_arg(ap,
int);
6918 }
else if (*
c ==
'*') {
6931 const LengthMod length_mod = parse_length_modifier(
c);
6944 switch (length_mod) {
6945 case lm_none:
i = va_arg(ap,
int);
break;
6946 case lm_hh:
i = va_arg(ap,
int);
break;
6947 case lm_h:
i = va_arg(ap,
int);
break;
6948 case lm_l:
i = va_arg(ap,
long int);
break;
6950 case lm_j:
i = va_arg(ap,
long int);
break;
6955 default:
i = 0;
break;
6966 switch (length_mod) {
6972 case lm_t:
u = va_arg(ap,
size_t);
break;
6973 case lm_z:
u = va_arg(ap,
size_t);
break;
6974 default:
u = 0;
break;
6981 switch (qToLower(*
c)) {
7003 if (length_mod ==
lm_L)
7004 d = va_arg(ap,
long double);
7006 d = va_arg(ap,
double);
7012 switch (qToLower(*
c)) {
7024 if (length_mod ==
lm_l)
7032 if (length_mod ==
lm_l) {
7043 const char *buff = va_arg(ap,
const char*);
7050 void *
arg = va_arg(ap,
void*);
7058 switch (length_mod) {
7060 signed char *
n = va_arg(ap,
signed char*);
7065 short int *
n = va_arg(ap,
short int*);
7070 long int *
n = va_arg(ap,
long int*);
7080 int *
n = va_arg(ap,
int*);
7089 for (
const char *cc = escape_start; cc !=
c; ++cc)
7129 return toIntegral_helper<qlonglong>(*
this,
ok,
base);
7134 #if defined(QT_CHECK_RANGE)
7136 qWarning(
"QString::toULongLong: Invalid base (%d)",
base);
7171 return toIntegral_helper<qulonglong>(*
this,
ok,
base);
7176 #if defined(QT_CHECK_RANGE)
7178 qWarning(
"QString::toULongLong: Invalid base (%d)",
base);
7556 #if defined(QT_CHECK_RANGE)
7562 bool negative =
n < 0;
7575 #if defined(QT_CHECK_RANGE)
7600 switch (qToLower(
format)) {
7611 #if defined(QT_CHECK_RANGE)
7621 template<
class ResultList,
class StringSource>
7626 typename StringSource::size_type
start = 0;
7627 typename StringSource::size_type
end;
7628 typename StringSource::size_type extra = 0;
7633 extra = (sep.
size() == 0 ? 1 : 0);
7674 return splitString<QStringList>(*
this, sep, behavior, cs);
7683 return splitString<QStringList>(*
this,
QStringView(&sep, 1), behavior, cs);
7704 return splitString<QList<QStringView>>(
QStringView(*
this), sep, behavior, cs);
7712 #if QT_CONFIG(regularexpression)
7714 template<
class ResultList,
typename String>
7716 Qt::SplitBehavior behavior)
7720 qWarning(
"QString::split: invalid QRegularExpression object");
7771 return splitString<QStringList>(*
this, re, behavior);
7788 return splitString<QList<QStringView>>(*
this, re, behavior);
7832 result.reserve(resultSize);
7833 if (
result.capacity() != resultSize)
7839 char16_t *
end =
result.d.data() + sizeSoFar;
7841 const qsizetype halfResultSize = resultSize >> 1;
7842 while (sizeSoFar <= halfResultSize) {
7847 memcpy(
end,
result.d.data(), (resultSize - sizeSoFar) *
sizeof(
QChar));
7848 result.d.data()[resultSize] =
'\0';
7849 result.d.size = resultSize;
7857 auto start =
reinterpret_cast<const char16_t *
>(
data->constData());
7858 const char16_t *
p =
start + from;
7859 if (isAscii_helper(
p,
p +
data->length() - from))
7879 while (
pos <
s.length() - 1) {
7880 if (
s.at(
pos).unicode() == ucs4High &&
s.at(
pos + 1).unicode() == ucs4Low) {
7889 while (
pos <
s.length()) {
7890 if (
s.at(
pos).unicode() ==
n.ucs4) {
7902 if (normalizationQuickCheckHelper(
data,
mode, from, &from))
7926 #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
7932 if (!supportUnicodeDigitValuesInArg())
7935 const auto isNonAsciiDigit = [](
QChar c) {
7940 const auto accumulateDigit = [](
int partial,
QChar digit) {
7941 return partial * 10 + digit.digitValue();
7943 const int parsedNumber =
std::accumulate(
s.begin(),
s.end(), 0, accumulateDigit);
7945 qWarning(
"QString::arg(): the replacement \"%%%ls\" contains non-ASCII digits;\n"
7946 " it is currently being interpreted as the %d-th substitution.\n"
7947 " This is deprecated; support for non-ASCII digits will be dropped\n"
7948 " in a future version of Qt.",
7949 qUtf16Printable(
s.toString()),
7966 const QChar *uc_begin =
s.begin();
7967 const QChar *uc_end =
s.end();
7971 d.min_escape = INT_MAX;
7974 d.locale_occurrences = 0;
7976 const QChar *
c = uc_begin;
7977 while (
c != uc_end) {
7978 while (
c != uc_end &&
c->
unicode() !=
'%')
7983 const QChar *escape_start =
c;
7987 bool locale_arg =
false;
7988 if (
c->unicode() ==
'L') {
7994 int escape = qArgDigitValue(*
c);
8000 #if QT_VERSION <= QT_VERSION_CHECK(7, 0, 0)
8001 const QChar *escapeBegin =
c;
8002 const QChar *escapeEnd = escapeBegin + 1;
8008 const int next_escape = qArgDigitValue(*
c);
8009 if (next_escape != -1) {
8012 #if QT_VERSION <= QT_VERSION_CHECK(7, 0, 0)
8018 #if QT_VERSION <= QT_VERSION_CHECK(7, 0, 0)
8019 checkArgEscape(
QStringView(escapeBegin, escapeEnd));
8029 d.locale_occurrences = 0;
8034 ++
d.locale_occurrences;
8035 d.escape_len +=
c - escape_start;
8046 s.length() -
d.escape_len
8047 + (
d.occurrences -
d.locale_occurrences) * qMax(abs_field_width,
arg.
length())
8048 +
d.locale_occurrences * qMax(abs_field_width, larg.
length());
8052 QChar *
const result_end = rc + result_len;
8056 const QChar *
const uc_end =
s.end();
8057 while (
c != uc_end) {
8063 const QChar *text_start =
c;
8064 while (
c->unicode() !=
'%')
8067 const QChar *escape_start =
c++;
8068 const bool localize =
c->
unicode() ==
'L';
8072 int escape = qArgDigitValue(*
c);
8073 if (
escape != -1 &&
c + 1 != uc_end) {
8074 const int digit = qArgDigitValue(
c[1]);
8082 memcpy(rc, text_start, (
c - text_start) *
sizeof(
QChar));
8083 rc +=
c - text_start;
8087 memcpy(rc, text_start, (escape_start - text_start) *
sizeof(
QChar));
8088 rc += escape_start - text_start;
8094 if (field_width > 0) {
8102 if (field_width < 0) {
8107 if (++repl_cnt ==
d.occurrences) {
8108 memcpy(rc,
c, (uc_end -
c) *
sizeof(
QChar));
8120 #if QT_STRINGVIEW_LEVEL < 2
8193 qWarning(
"QString::arg: Argument missing: %ls, %ls", qUtf16Printable(*
this),
8194 qUtf16Printable(
a.toString()));
8197 return replaceArgEscapes(*
this,
d, fieldWidth,
a,
a, fillChar);
8322 if (
d.occurrences == 0) {
8323 qWarning() <<
"QString::arg: Argument missing:" << *
this <<
',' <<
a;
8333 if (
d.occurrences >
d.locale_occurrences) {
8340 if (
d.locale_occurrences > 0) {
8344 localeArg = locale.d->m_data->longLongToString(
a, -1,
base, fieldWidth,
flags);
8346 || fieldWidth <= localeArg.
length());
8349 return replaceArgEscapes(*
this,
d, fieldWidth,
arg, localeArg, fillChar);
8370 if (
d.occurrences == 0) {
8371 qWarning() <<
"QString::arg: Argument missing:" << *
this <<
',' <<
a;
8381 if (
d.occurrences >
d.locale_occurrences) {
8388 if (
d.locale_occurrences > 0) {
8392 localeArg = locale.d->m_data->unsLongLongToString(
a, -1,
base, fieldWidth,
flags);
8394 || fieldWidth <= localeArg.
length());
8397 return replaceArgEscapes(*
this,
d, fieldWidth,
arg, localeArg, fillChar);
8470 if (
d.occurrences == 0) {
8484 switch (qToLower(
format)) {
8495 #if defined(QT_CHECK_RANGE)
8502 if (
d.occurrences >
d.locale_occurrences) {
8510 if (
d.locale_occurrences > 0) {
8513 const QLocale::NumberOptions numberOptions = locale.numberOptions();
8522 || fieldWidth <= localeArg.
length());
8525 return replaceArgEscapes(*
this,
d, fieldWidth,
arg, localeArg, fillChar);
8528 static inline char16_t to_unicode(
const QChar c) {
return c.unicode(); }
8531 template <
typename Char>
8539 int escape = to_unicode(uc[
i]) -
'0';
8544 int digit = to_unicode(uc[
i]) -
'0';
8545 if (
uint(digit) >= 10U)
8550 if (
escape <= maxNumber) {
8615 enum { ExpectedParts = 32 };
8618 typedef QVarLengthArray<int, ExpectedParts/2> ArgIndexToPlaceholderMap;
8620 template <
typename StringView>
8621 static ParseResult parseMultiArgFormatString(StringView
s)
8625 const auto uc =
s.data();
8626 const auto len =
s.size();
8627 const auto end =
len - 1;
8636 if (
last != percent)
8652 static ArgIndexToPlaceholderMap makeArgIndexToPlaceholderMap(
const ParseResult &parts)
8654 ArgIndexToPlaceholderMap
result;
8656 for (Part
part : parts) {
8657 if (
part.number >= 0)
8668 static qsizetype resolveStringRefsAndReturnTotalSize(ParseResult &parts,
const ArgIndexToPlaceholderMap &argIndexToPlaceholderMap,
const QtPrivate::ArgBase *
args[])
8672 for (Part &
part : parts) {
8673 if (
part.number != -1) {
8674 const auto it =
std::find(argIndexToPlaceholderMap.begin(), argIndexToPlaceholderMap.end(),
part.number);
8675 if (
it != argIndexToPlaceholderMap.end()) {
8676 const auto &
arg = *
args[
it - argIndexToPlaceholderMap.begin()];
8690 totalSize +=
part.size;
8700 template <
typename StringView>
8704 ParseResult parts = parseMultiArgFormatString(
pattern);
8707 ArgIndexToPlaceholderMap argIndexToPlaceholderMap = makeArgIndexToPlaceholderMap(parts);
8709 if (
static_cast<size_t>(argIndexToPlaceholderMap.size()) > numArgs)
8710 argIndexToPlaceholderMap.resize(
qsizetype(numArgs));
8711 else if (
Q_UNLIKELY(
static_cast<size_t>(argIndexToPlaceholderMap.size()) < numArgs))
8712 qWarning(
"QString::arg: %d argument(s) missing in %ls",
8713 int(numArgs - argIndexToPlaceholderMap.size()), qUtf16Printable(
to_string(
pattern)));
8716 const qsizetype totalSize = resolveStringRefsAndReturnTotalSize(parts, argIndexToPlaceholderMap,
args);
8722 for (Part
part : parts) {
8727 reinterpret_cast<const char*
>(
part.data),
part.size);
8760 const char16_t *
p =
d.data();
8761 const char16_t *
const end =
p +
d.size;
8765 if (uc > 0x058f && (uc < 0x1100 || uc > 0xfb0f)) {
10074 #if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED)
10086 if (
out.version() == 1) {
10091 out.writeBytes(
reinterpret_cast<const char *
>(
str.
unicode()),
10096 out.writeBytes(
reinterpret_cast<const char *
>(
buffer.data()),
10097 static_cast<uint>(
sizeof(char16_t) *
buffer.size()));
10118 if (
in.version() == 1) {
10125 if (bytes == 0xffffffff) {
10127 }
else if (bytes > 0) {
10134 const quint32 Step = 1024 * 1024;
10138 while (allocated <
len) {
10141 if (
in.readRawData(
reinterpret_cast<char *
>(
str.
data()) + allocated * 2,
10152 char16_t *
data =
reinterpret_cast<char16_t *
>(
str.
data());
10189 int isolateLevel = 0;
10192 const char32_t
c =
i.next();
10239 if (haystack.size() > 500 && needle.size() > 5) {
10241 while ((
i = matcher.
indexIn(haystack,
i + 1)) != -1)
10254 for (
QChar c : haystack) {
10260 for (
QChar c : haystack) {
10261 if (foldCase(
c) ==
ch)
10268 template <
typename Haystack,
typename Needle>
10271 if (haystack.isNull())
10272 return needle.isNull();
10273 const auto haystackLen = haystack.size();
10274 const auto needleLen = needle.size();
10275 if (haystackLen == 0)
10276 return needleLen == 0;
10277 if (needleLen > haystackLen)
10295 return haystack.
size()
10297 : foldCase(haystack.
front()) == foldCase(needle));
10341 template <
typename Haystack,
typename Needle>
10346 const auto haystackLen = haystack.
size();
10347 const auto needleLen = needle.size();
10348 if (haystackLen == 0)
10349 return needleLen == 0;
10350 if (haystackLen < needleLen)
10368 return haystack.
size()
10370 : foldCase(haystack.
back()) == foldCase(needle));
10420 if (std::size_t(sl + from) > std::size_t(
l))
10428 return qFindChar(haystack0, needle0[0], from, cs);
10435 if (
l > 500 && sl > 5)
10438 auto sv = [sl](
const char16_t *
v) {
return QStringView(
v, sl); };
10445 const char16_t *needle = needle0.utf16();
10446 const char16_t *haystack = haystack0.
utf16() + from;
10447 const char16_t *
end = haystack0.utf16() + (
l - sl);
10448 const std::size_t sl_minus_1 = sl - 1;
10449 std::size_t hashNeedle = 0, hashHaystack = 0;
10454 hashNeedle = ((hashNeedle<<1) + needle[
idx]);
10455 hashHaystack = ((hashHaystack<<1) + haystack[
idx]);
10457 hashHaystack -= haystack[sl_minus_1];
10459 while (haystack <=
end) {
10460 hashHaystack += haystack[sl_minus_1];
10461 if (hashHaystack == hashNeedle
10463 return haystack - haystack0.utf16();
10469 const char16_t *haystack_start = haystack0.utf16();
10471 hashNeedle = (hashNeedle<<1) + foldCase(needle +
idx, needle);
10472 hashHaystack = (hashHaystack<<1) + foldCase(haystack +
idx, haystack_start);
10474 hashHaystack -= foldCase(haystack + sl_minus_1, haystack_start);
10476 while (haystack <=
end) {
10477 hashHaystack += foldCase(haystack + sl_minus_1, haystack_start);
10478 if (hashHaystack == hashNeedle
10480 return haystack - haystack0.utf16();
10482 REHASH(foldCase(haystack, haystack_start));
10491 if (haystack.
size() < needle.size())
10501 if (haystack.
size() < needle.size())
10507 if (needle.size() == 1) {
10508 const char n = needle.front().
toLatin1();
10520 from += haystack.
size();
10524 if (adjustedSize < needle.size())
10526 if (needle.size() == 0)
10531 if (needle.size() == 1) {
10533 if (
auto it = memchr(haystack.
data() + from, needle.front().
toLatin1(), adjustedSize))
10534 return static_cast<const char *
>(
it) - haystack.
data();
10539 return matcher.
indexIn(haystack, from);
10556 if (needle.size() <= threshold) {
10558 const auto end = haystack.
end() - needle.size() + 1;
10560 auto ciMatch = [needle1](
const char ch) {
10561 return latin1Lower[
uchar(
ch)] == needle1;
10563 const qsizetype nlen1 = needle.size() - 1;
10565 it = std::find_if(
it + 1,
end, ciMatch)) {
10573 #ifdef __cpp_lib_boyer_moore_searcher
10574 const auto ciHasher = [](
char a) {
return latin1Lower[
uchar(
a)]; };
10575 const auto ciEqual = [](
char a,
char b) {
10576 return latin1Lower[
uchar(
a)] == latin1Lower[
uchar(
b)];
10579 std::search(haystack.
begin() + from, haystack.
end(),
10580 std::boyer_moore_searcher(needle.begin(), needle.end(), ciHasher, ciEqual));
10584 const auto begin = haystack.
end() - adjustedSize;
10598 return qLastIndexOf(haystack, from, needle, cs);
10603 return qLastIndexOf(haystack, from, needle, cs);
10608 return qLastIndexOf(haystack, from, needle, cs);
10613 return qLastIndexOf(haystack, from, needle, cs);
10616 #if QT_CONFIG(regularexpression)
10620 qWarning(
"QString(View)::indexOf: invalid QRegularExpression object");
10628 *rmatch = std::move(match);
10638 qWarning(
"QString(View)::lastIndexOf: invalid QRegularExpression object");
10642 qsizetype endpos = (from < 0) ? (haystack.
size() + from + 1) : (from + 1);
10648 if (
start < endpos) {
10651 *rmatch = std::move(match);
10663 qWarning(
"QString(View)::contains: invalid QRegularExpression object");
10668 if (hasMatch && rmatch)
10669 *rmatch = std::move(
m);
10676 qWarning(
"QString(View)::count: invalid QRegularExpression object");
10710 for (
int i = 0;
i <
len; ++
i) {
small capitals from c petite p scientific f u
small capitals from c petite p scientific i
[1]
static Q_CORE_EXPORT int compare(QAnyStringView lhs, QAnyStringView rhs, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
static Q_CORE_EXPORT bool equal(QAnyStringView lhs, QAnyStringView rhs) noexcept
The QByteArray class provides an array of bytes.
qsizetype size() const noexcept
const char * constData() const noexcept
bool isEmpty() const noexcept
bool isNull() const noexcept
The QByteArrayMatcher class holds a sequence of bytes that can be quickly matched in a byte array.
Q_WEAK_OVERLOAD qsizetype indexIn(const QByteArray &ba, qsizetype from=0) const
The QChar class provides a 16-bit Unicode character.
static constexpr QChar fromUcs2(char16_t c) noexcept
static constexpr bool requiresSurrogates(char32_t ucs4) noexcept
int digitValue() const noexcept
Direction direction() const noexcept
constexpr char toLatin1() const noexcept
static constexpr char16_t highSurrogate(char32_t ucs4) noexcept
constexpr char16_t unicode() const noexcept
QChar toCaseFolded() const noexcept
static constexpr char16_t lowSurrogate(char32_t ucs4) noexcept
constexpr bool isNull() const noexcept
static UnicodeVersion QT_FASTCALL currentUnicodeVersion() noexcept Q_DECL_CONST_FUNCTION
static int defaultCompare(QStringView s1, QStringView s2)
The QDataStream class provides serialization of binary data to a QIODevice.
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
constexpr const char * latin1() const noexcept
constexpr qsizetype size() const noexcept
int compare(QStringView other, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
qsizetype size() const noexcept
qsizetype length() const noexcept
const_reference at(qsizetype i) const noexcept
QList< T > mid(qsizetype pos, qsizetype len=-1) const
void append(parameter_type t)
@ IncludeTrailingZeroesAfterDot
@ OmitLeadingZeroInExponent
The QRegularExpression class provides pattern matching using regular expressions.
QRegularExpressionMatch match(const QString &subject, qsizetype offset=0, MatchType matchType=NormalMatch, MatchOptions matchOptions=NoMatchOption) const
QRegularExpressionMatchIterator globalMatch(const QString &subject, qsizetype offset=0, MatchType matchType=NormalMatch, MatchOptions matchOptions=NoMatchOption) const
The QRegularExpressionMatch class provides the results of a matching a QRegularExpression against a s...
qsizetype capturedEnd(int nth=0) const
qsizetype capturedStart(int nth=0) const
qsizetype capturedLength(int nth=0) const
The QRegularExpressionMatchIterator class provides an iterator on the results of a global match of a ...
The QStringDecoder class provides a state-based decoder for text. \reentrant.
The QStringEncoder class provides a state-based encoder for text. \reentrant.
The QString class provides a Unicode character string.
QString right(qsizetype n) const
bool isSimpleText() const
QByteArray toLatin1() const &
QString repeated(qsizetype times) const
double toDouble(bool *ok=nullptr) const
QString leftJustified(qsizetype width, QChar fill=QLatin1Char(' '), bool trunc=false) const
QString last(qsizetype n) const
qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString & fill(QChar c, qsizetype size=-1)
QString & replace(qsizetype i, qsizetype len, QChar after)
void reserve(qsizetype size)
qlonglong toLongLong(bool *ok=nullptr, int base=10) const
qulonglong toULongLong(bool *ok=nullptr, int base=10) const
static QString fromLatin1(QByteArrayView ba)
const ushort * utf16() const
QStringList split(const QString &sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QDataStream & operator<<(QDataStream &stream, const QString &string)
void truncate(qsizetype pos)
static QString fromLocal8Bit(QByteArrayView ba)
static QString fromUtf16(const char16_t *, qsizetype size=-1)
static QString fromUcs4(const char32_t *, qsizetype size=-1)
const QChar * constData() const
const_iterator cbegin() const
QString & operator=(QChar c)
QString & setUnicode(const QChar *unicode, qsizetype size)
QList< uint > toUcs4() const
QString rightJustified(qsizetype width, QChar fill=QLatin1Char(' '), bool trunc=false) const
QStringPrivate DataPointer
static QString fromUtf8(QByteArrayView utf8)
QString mid(qsizetype position, qsizetype n=-1) const
@ SectionCaseInsensitiveSeps
@ SectionIncludeLeadingSep
@ SectionIncludeTrailingSep
QString section(QChar sep, qsizetype start, qsizetype end=-1, SectionFlags flags=SectionDefault) const
static QString fromRawData(const QChar *, qsizetype size)
constexpr QString() noexcept
qsizetype capacity() const
const QChar at(qsizetype i) const
float toFloat(bool *ok=nullptr) const
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QString & insert(qsizetype i, QChar c)
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=QLatin1Char(' ')) const
QByteArray toLocal8Bit() const &
static QString vasprintf(const char *format, va_list ap) Q_ATTRIBUTE_FORMAT_PRINTF(1
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString number(int, int base=10)
QString & append(QChar c)
QString left(qsizetype n) const
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString & setUtf16(const ushort *utf16, qsizetype size)
bool isRightToLeft() const
QString & setNum(short, int base=10)
QString & setRawData(const QChar *unicode, qsizetype size)
QString & remove(qsizetype i, qsizetype len)
const_iterator constBegin() const
static QString static QString asprintf(const char *format,...) Q_ATTRIBUTE_FORMAT_PRINTF(1
QString toHtmlEscaped() const
const QChar * unicode() const
QString normalized(NormalizationForm mode, QChar::UnicodeVersion version=QChar::Unicode_Unassigned) const
iterator erase(const_iterator first, const_iterator last)
void resize(qsizetype size)
QDataStream & operator>>(QDataStream &stream, QString &string)
The QStringList class provides a list of strings.
The QStringMatcher class holds a sequence of characters that can be quickly matched in a Unicode stri...
qsizetype indexIn(const QString &str, qsizetype from=0) const
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QStrin...
int compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs) noexcept
Q_CORE_EXPORT double toDouble(bool *ok=nullptr) const
Q_CORE_EXPORT float toFloat(bool *ok=nullptr) const
constexpr const storage_type * utf16() const noexcept
constexpr QChar front() const
constexpr qsizetype length() const noexcept
constexpr qsizetype size() const noexcept
const_iterator begin() const noexcept
Q_CORE_EXPORT QList< QStringView > split(QStringView sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
const_pointer data() const noexcept
constexpr QChar back() const
constexpr bool isNull() const noexcept
constexpr QStringView right(qsizetype n) const noexcept
constexpr QStringView sliced(qsizetype pos) const noexcept
const_iterator end() const noexcept
static void const void const char bool unsigned int int const char va_start(ap, message)
int const JOCTET * dataptr
GeneratorWrapper< std::vector< T > > chunk(size_t size, GeneratorWrapper< T > &&generator)
typename C::value_type value_type
QHighDpiScaling::Point position(T, QHighDpiScaling::Point::Kind)
@ NormalizationCorrectionsVersionMax
@ NumNormalizationCorrections
constexpr Initialization Uninitialized
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QByteArrayView haystack, QByteArrayView needle) noexcept
constexpr bool isLatin1(QLatin1String s) noexcept
Q_CORE_EXPORT QList< uint > convertToUcs4(QStringView str)
Q_CORE_EXPORT QByteArray convertToLocal8Bit(QStringView str)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype qustrlen(const char16_t *str) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isValidUtf16(QStringView s) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION QByteArrayView trimmed(QByteArrayView s) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QByteArrayView haystack, QByteArrayView needle) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype lastIndexOf(QByteArrayView haystack, qsizetype from, QByteArrayView needle) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype count(QByteArrayView haystack, QByteArrayView needle) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool equalStrings(QStringView lhs, QStringView rhs) noexcept
Q_CORE_EXPORT QByteArray convertToUtf8(QStringView str)
Q_CORE_EXPORT QString convertToQString(QAnyStringView s)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype findString(QStringView haystack, qsizetype from, QStringView needle, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
Q_CORE_EXPORT QString argToQString(QStringView pattern, size_t n, const ArgBase **args)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isAscii(QLatin1String s) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
qsizetype indexOf(const QList< V > &list, const U &u, qsizetype from) noexcept
Q_CORE_EXPORT QByteArray convertToLatin1(QStringView str)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION const char16_t * qustrchr(QStringView str, char16_t ch) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isRightToLeft(QStringView string) noexcept
constexpr struct q20::ranges::@309 any_of
int distance(TestIterator &a, TestIterator &b)
void *PRIV() memmove(void *d, const void *s, size_t n)
PCRE2_SIZE PRIV() strlen(PCRE2_SPTR str)
QT_POPCOUNT_RELAXED_CONSTEXPR uint qCountLeadingZeroBits(quint32 v) noexcept
constexpr uint qCountTrailingZeroBits(quint32 v) noexcept
size_t qstrlen(const char *str)
size_t qstrnlen(const char *str, size_t maxlen)
EGLOutputLayerEXT EGLint EGLAttrib value
QT_BEGIN_NAMESPACE Q_ALWAYS_INLINE void qToUnaligned(const T src, void *dest)
bool qIsFinite(qfloat16 f) noexcept
QT_BEGIN_INCLUDE_NAMESPACE typedef unsigned char uchar
unsigned long long quint64
GLenum GLuint GLenum GLsizei length
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLint GLsizei GLsizei GLenum format
GLsizei GLenum const void * indices
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLsizei GLchar * source
GLenum GLint GLint * precision
GLsizei const GLchar *const * string
[0]
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
bool qt_is_ascii(const char *&ptr, const char *end) noexcept
Q_DECLARE_TYPEINFO(Part, Q_PRIMITIVE_TYPE)
Q_ALWAYS_INLINE QString to_string(QLatin1String s) noexcept
qsizetype qFindStringBoyerMoore(QStringView haystack, qsizetype from, QStringView needle, Qt::CaseSensitivity cs)
bool qt_starts_with_impl(Haystack haystack, Needle needle, Qt::CaseSensitivity cs) noexcept
void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar::UnicodeVersion version, qsizetype from)
constexpr int lencmp(qsizetype lhs, qsizetype rhs) noexcept
#define CSTR_GREATER_THAN
void qt_to_latin1_unchecked(uchar *dst, const char16_t *src, qsizetype length)
Q_CORE_EXPORT void qt_from_latin1(char16_t *dst, const char *str, size_t size) noexcept
bool qt_ends_with_impl(Haystack haystack, Needle needle, Qt::CaseSensitivity cs) noexcept
QStringView qToStringViewIgnoringNull(const QStringLike &s) noexcept
QT_BEGIN_NAMESPACE typedef char Char
QBasicUtf8StringView< false > QUtf8StringView
QVarLengthArray(InputIterator, InputIterator) -> QVarLengthArray< ValueType >
Q_CHECK_PTR(a=new int[80])
settings remove("monkey")
QTextStream out(stdout)
[7]
static void appendLatin1To(QLatin1String in, QChar *out) noexcept
void detachAndGrow(QArrayData::GrowthPosition where, qsizetype n, const T **data, QArrayDataPointer *old)
bool isNull() const noexcept
qsizetype freeSpaceAtBegin() const noexcept
bool needsDetach() const noexcept
qsizetype allocatedCapacity() noexcept
qsizetype constAllocatedCapacity() const noexcept
void clear() noexcept(std::is_nothrow_destructible< T >::value)
static QArrayDataPointer fromRawData(const char16_t *rawData, qsizetype length) noexcept
static QArrayDataPointer allocateGrow(const QArrayDataPointer &from, qsizetype n, QArrayData::GrowthPosition position)
bool isMutable() const noexcept
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
constexpr char16_t unicode() const noexcept
static float convertDoubleToFloat(double d, bool *ok)
QString doubleToString(double d, int precision=-1, DoubleForm form=DFSignificantDigits, int width=-1, unsigned flags=NoFlags) const
static const QLocaleData * c()
quint64 stringToUnsLongLong(QStringView str, int base, bool *ok, QLocale::NumberOptions options) const
qint64 stringToLongLong(QStringView str, int base, bool *ok, QLocale::NumberOptions options) const
double stringToDouble(QStringView str, bool *ok, QLocale::NumberOptions options) const
QString longLongToString(qint64 l, int precision=-1, int base=10, int width=-1, unsigned flags=NoFlags) const
QString unsLongLongToString(quint64 l, int precision=-1, int base=10, int width=-1, unsigned flags=NoFlags) const
static StringType trimmed_helper(StringType &str)
static void trimmed_helper_positions(const Char *&begin, const Char *&end)
static StringType simplified_helper(StringType &str)
static QPair< QTypedArrayData *, T * > allocate(qsizetype capacity, AllocationOption option=QArrayData::KeepSize)
static Q_CORE_EXPORT QByteArray convertFromUnicode(QStringView in)
static Q_CORE_EXPORT QChar * convertToUnicode(QChar *buffer, QByteArrayView in) noexcept
static int compareUtf8(QByteArrayView utf8, QStringView utf16) noexcept
void growAppend(const T *b, const T *e)
void copyAppend(const T *b, const T *e)
void erase(T *b, qsizetype n)
void insert(qsizetype i, const T *data, qsizetype n)
QString escape(const QString &s)
ByteArray detached(ByteArray b)
QDomElement find(const QString &tagName, const QDomElement &e)
XmlOutput::xml_output tag(const QString &name)