45 #ifndef QT_NO_TEXTCODEC 48 #include <private/qutfcodec_p.h> 63 #include <private/qcore_mac_p.h> 66 #include <private/qfunctions_p.h> 68 #if defined(Q_OS_WINCE) 91 #define LLONG_MAX qint64_C(9223372036854775807) 94 #define LLONG_MIN (-LLONG_MAX - qint64_C(1)) 97 #define ULLONG_MAX quint64_C(18446744073709551615) 102 #ifndef QT_NO_TEXTCODEC 125 const QChar *needle,
int needleLen,
185 while (a < ae && *b) {
203 while (l-- && *a == *b)
207 return a->
unicode() - b->unicode();
213 if (a == b && alen == blen)
215 int l =
qMin(alen, blen);
217 return cmp ?
cmp : (alen-blen);
275 if (a == b || !length)
287 if ((sa.value & 2) == (sb.value & 2)) {
303 register const quint32 *e = sa.d + (length >> 1);
304 for ( ; sa.d != e; ++sa.d, ++sb.d) {
310 return (length & 1) ? *sa.w == *sb.w :
true;
313 register const quint16 *e = sa.w + length;
314 for ( ; sa.w != e; ++sa.w, ++sb.w) {
339 from =
qMax(from + len, 0);
341 const ushort *n = s + from - 1;
342 const ushort *e = s + len;
358 if (sl_minus_1 < (int)sizeof(int) * CHAR_BIT) \ 359 hashHaystack -= (a) << sl_minus_1; \ 364 return ch >=
'A' && ch <=
'Z';
369 return ch >=
'0' && ch <=
'9';
374 if (ch >=
'A' && ch <=
'Z')
375 return ch -
'A' +
'a';
818 0, 0, shared_null.array, 0, 0, 0, 0, 0, 0, {0} };
820 0, 0, shared_empty.array, 0, 0, 0, 0, 0, 0, {0} };
1021 if (
sizeof(
wchar_t) ==
sizeof(
QChar)) {
1050 for (; i <
length; ++i) {
1088 if (
sizeof(
wchar_t) ==
sizeof(
QChar)) {
1092 return toUcs4_helper<wchar_t>(
utf16(),
length(), array);
1123 }
else if (size <= 0) {
1157 while (unicode[size] != 0)
1240 d =
reinterpret_cast<Data *
>(buf);
1317 asciiCache->remove(d);
1366 (!
d->
capacity && size < d->size && size < d->alloc >> 1))
1461 asciiCache->remove(
d);
1481 if (
d->
size - 1 > sz) {
1619 if (i < 0 || !s || !(*s))
1626 for (
int j = 0; j < len; ++j)
1627 d->
data[i + j] = s[j];
1640 if (i < 0 || size <= 0)
1648 memcpy(tmp, s, size *
sizeof(
QChar));
1649 insert(i, reinterpret_cast<const QChar *>(tmp), size);
1657 memcpy(
d->
data + i, s, size *
sizeof(
QChar));
1733 while ((*i++ = *s++))
1871 if (pos < 0 || pos >=
d->
size) {
1873 }
else if (len >=
d->
size - pos) {
1875 }
else if (len > 0) {
1899 while ((i =
indexOf(str, i, cs)) != -1)
1900 remove(i, str.
d->
size);
1926 if (
d->
data[i] == ch)
1985 if (pos < 0 || pos >
d->
size)
1987 if (pos + len >
d->
size)
1988 len =
d->
size - pos;
2007 return replace(pos, len, &after, 1);
2043 QChar *afterBuffer =
const_cast<QChar *
>(after);
2044 if (after >= reinterpret_cast<QChar *>(
d->
data) && after < reinterpret_cast<QChar *>(
d->
data) +
d->
size) {
2047 ::memcpy(afterBuffer, after, alen*
sizeof(
QChar));
2054 for (
int i = 0; i < nIndices; ++i)
2055 memcpy(
d->
data + indices[i], afterBuffer, alen *
sizeof(
QChar));
2056 }
else if (alen < blen) {
2059 uint to = indices[0];
2061 memcpy(
d->
data+to, after, alen*
sizeof(
QChar));
2063 uint movestart = indices[0] + blen;
2064 for (
int i = 1; i < nIndices; ++i) {
2065 int msize = indices[i] - movestart;
2071 memcpy(
d->
data + to, afterBuffer, alen*
sizeof(
QChar));
2074 movestart = indices[i] + blen;
2076 int msize =
d->
size - movestart;
2082 int adjust = nIndices*(alen-blen);
2083 int newLen =
d->
size + adjust;
2084 int moveend =
d->
size;
2089 int movestart = indices[nIndices] + blen;
2090 int insertstart = indices[nIndices] + nIndices*(alen-blen);
2091 int moveto = insertstart + alen;
2092 memmove(
d->
data + moveto,
d->
data + movestart,
2093 (moveend - movestart)*
sizeof(
QChar));
2094 memcpy(
d->
data + insertstart, afterBuffer, alen*
sizeof(
QChar));
2095 moveend = movestart-blen;
2098 }
QT_CATCH(
const std::bad_alloc &) {
2099 if (afterBuffer != after)
2103 if (afterBuffer != after)
2122 const QChar *after,
int alen,
2132 if (alen == 0 && blen == 0)
2141 while (pos < 1023) {
2142 index = matcher.
indexIn(*
this, index);
2145 indices[pos++] =
index;
2159 index += pos*(alen-blen);
2178 if (after.
d->
size == 0)
2179 return remove(ch, cs);
2181 if (after.
d->
size == 1)
2194 while (pos < 1023 && index < d->
size) {
2195 if (
d->
data[index] == cc)
2196 indices[pos++] =
index;
2200 while (pos < 1023 && index < d->
size) {
2202 indices[pos++] = index;
2214 index += pos*(after.
d->
size - 1);
2273 for (
int i = 0; i < alen; ++i)
2277 for (
int i = 0; i < blen; ++i)
2279 return replace((
const QChar *)b.data(), blen, (
const QChar *)a.data(), alen, cs);
2303 for (
int i = 0; i < blen; ++i)
2329 for (
int i = 0; i < alen; ++i)
2353 for (
int i = 0; i < alen; ++i)
2355 return replace(&c, 1, (
const QChar *)a.data(), alen, cs);
2389 if (uc == e || *uc != *c)
2454 if (uc == e || *uc != *c)
2459 return (uc == e ? *c : *uc < *c);
2564 if (!c || *c ==
'\0')
2568 if (uc == e || *uc != *c)
2573 return (uc == e ?
false : *uc > *c);
2754 const QChar *haystack0,
int haystackLen,
int from,
2757 const int l = haystackLen;
2758 const int sl = needleLen;
2769 return findChar(haystack0, haystackLen, needle0[0], from, cs);
2776 if (l > 500 && sl > 5)
2778 needle0, needleLen, cs);
2787 const ushort *haystack = (
const ushort *)haystack0 + from;
2789 const int sl_minus_1 = sl-1;
2790 int hashNeedle = 0, hashHaystack = 0, idx;
2793 for (idx = 0; idx < sl; ++idx) {
2794 hashNeedle = ((hashNeedle<<1) + needle[idx]);
2795 hashHaystack = ((hashHaystack<<1) + haystack[idx]);
2797 hashHaystack -= haystack[sl_minus_1];
2799 while (haystack <= end) {
2800 hashHaystack += haystack[sl_minus_1];
2801 if (hashHaystack == hashNeedle
2803 return haystack - (
const ushort *)haystack0;
2809 const ushort *haystack_start = (
const ushort *)haystack0;
2810 for (idx = 0; idx < sl; ++idx) {
2811 hashNeedle = (hashNeedle<<1) +
foldCase(needle + idx, needle);
2812 hashHaystack = (hashHaystack<<1) +
foldCase(haystack + idx, haystack_start);
2814 hashHaystack -=
foldCase(haystack + sl_minus_1, haystack_start);
2816 while (haystack <= end) {
2817 hashHaystack +=
foldCase(haystack + sl_minus_1, haystack_start);
2818 if (hashHaystack == hashNeedle &&
ucstrnicmp(needle, haystack, sl) == 0)
2819 return haystack - (
const ushort *)haystack0;
2871 const int sl_minus_1 = sl-1;
2872 const ushort *n = needle+sl_minus_1;
2873 const ushort *h = haystack+sl_minus_1;
2874 int hashNeedle = 0, hashHaystack = 0, idx;
2877 for (idx = 0; idx < sl; ++idx) {
2878 hashNeedle = ((hashNeedle<<1) + *(n-idx));
2879 hashHaystack = ((hashHaystack<<1) + *(h-idx));
2881 hashHaystack -= *haystack;
2883 while (haystack >= end) {
2884 hashHaystack += *haystack;
2885 if (hashHaystack == hashNeedle
2887 return haystack - end;
2892 for (idx = 0; idx < sl; ++idx) {
2893 hashNeedle = ((hashNeedle<<1) +
foldCase(n-idx, needle));
2894 hashHaystack = ((hashHaystack<<1) +
foldCase(h-idx, end));
2896 hashHaystack -=
foldCase(haystack, end);
2898 while (haystack >= end) {
2899 hashHaystack +=
foldCase(haystack, end);
2900 if (hashHaystack == hashNeedle &&
ucstrnicmp(needle, haystack, sl) == 0)
2901 return haystack -
end;
2927 const int sl = str.
d->
size;
2935 if (from == l && sl == 0)
2937 if (from < 0 || from >= l || delta < 0)
2977 if (from == l && sl == 0)
2979 if (from < 0 || from >= l || delta < 0)
2985 for (
int i = 0; i < sl; ++i)
3025 const int sl = str.
size();
3033 if (from == l && sl == 0)
3035 if (from < 0 || from >= l || delta < 0)
3044 #ifndef QT_NO_REGEXP 3086 if (numCaptures > 0) {
3088 int numBackRefs = 0;
3090 for (
int i = 0; i < al - 1; i++) {
3093 if (no > 0 && no <= numCaptures)
3101 if (numBackRefs > 0) {
3105 for (
int i = 0; i < al - 1; i++) {
3108 if (no > 0 && no <= numCaptures) {
3115 if (secondDigit != -1 && ((no * 10) + secondDigit) <= numCaptures) {
3116 no = (no * 10) + secondDigit;
3122 captures[j++] = capture;
3127 while (index <=
length()) {
3128 index = rx2.
indexIn(*
this, index, caretMode);
3133 for (j = numBackRefs - 1; j >= 0; j--) {
3139 index += after2.
length();
3155 while (index != -1) {
3159 } replacements[2048];
3163 while (pos < 2047) {
3164 index = rx2.
indexIn(*
this, index, caretMode);
3168 replacements[pos].pos =
index;
3169 replacements[pos++].length = ml;
3178 replacements[pos].pos =
d->
size;
3179 int newlen =
d->
size + adjust;
3186 newstring.
reserve(newlen + 1);
3192 int copyend = replacements[i].pos;
3193 int size = copyend - copystart;
3194 memcpy(uc,
d->
data + copystart, size *
sizeof(
QChar));
3196 memcpy(uc, after.
d->
data, al *
sizeof(
QChar));
3198 copystart = copyend + replacements[i].length;
3201 memcpy(uc,
d->
data + copystart, (
d->
size - copystart) *
sizeof(
QChar));
3202 newstring.
resize(newlen);
3327 #ifndef QT_NO_REGEXP 3345 return rx2.
indexIn(*
this, from);
3368 return rx.
indexIn(*
this, from);
3435 while (index < len - 1) {
3436 index = rx2.
indexIn(*
this, index + 1);
3443 #endif // QT_NO_REGEXP 3534 start += sections.
count();
3536 end += sections.
count();
3539 for (
int k=0; k<sections.
size(); ++k) {
3544 start += sections.
count() - skip;
3546 end += sections.
count() - skip;
3550 int first_i = start, last_i =
end;
3551 for (
int i = 0; x <= end && i < sections.
size(); ++i) {
3553 const bool empty = section.
isEmpty();
3563 if (!empty || !(flags & SectionSkipEmpty))
3573 #ifndef QT_NO_REGEXP 3608 int n =
length(), m = 0, last_m = 0, last_len = 0;
3609 while ((m = sep.
indexIn(*
this, m)) != -1) {
3618 start += sections.
count();
3620 end += sections.
count();
3624 int first_i = start, last_i =
end;
3625 for (
int i = 0; x <= end && i < sections.
size(); ++i) {
3666 if (n >=
d->
size || n < 0)
3684 if (n >=
d->
size || n < 0)
3716 if (n + position >
d->
size)
3718 if (position == 0 && n ==
d->
size)
3869 #if defined(QT_ALWAYS_HAVE_SSE2) 3870 static inline __m128i mergeQuestionMarks(__m128i chunk)
3872 const __m128i questionMark = _mm_set1_epi16(
'?');
3889 const int mode = _SIDD_UWORD_OPS | _SIDD_CMP_RANGES | _SIDD_UNIT_MASK;
3890 const __m128i rangeMatch = _mm_cvtsi32_si128(0xffff0100);
3891 const __m128i offLimitMask = _mm_cmpestrm(rangeMatch, 2, chunk, 8, mode);
3894 chunk = _mm_blendv_epi8(chunk, questionMark, offLimitMask);
3898 const __m128i signedBitOffset = _mm_set1_epi16(0x8000);
3899 const __m128i thresholdMask = _mm_set1_epi16(0xff + 0x8000);
3901 const __m128i signedChunk = _mm_add_epi16(chunk, signedBitOffset);
3902 const __m128i offLimitMask = _mm_cmpgt_epi16(signedChunk, thresholdMask);
3906 chunk = _mm_blendv_epi8(chunk, questionMark, offLimitMask);
3910 const __m128i offLimitQuestionMark = _mm_and_si128(offLimitMask, questionMark);
3914 const __m128i correctBytes = _mm_andnot_si128(offLimitMask, chunk);
3917 chunk = _mm_or_si128(correctBytes, offLimitQuestionMark);
3931 #if defined(QT_ALWAYS_HAVE_SSE2) 3933 const int chunkCount = length >> 4;
3935 for (
int i = 0; i < chunkCount; ++i) {
3936 __m128i chunk1 = _mm_loadu_si128((__m128i*)src);
3937 chunk1 = mergeQuestionMarks(chunk1);
3940 __m128i chunk2 = _mm_loadu_si128((__m128i*)src);
3941 chunk2 = mergeQuestionMarks(chunk2);
3945 const __m128i result = _mm_packus_epi16(chunk1, chunk2);
3947 _mm_storeu_si128((__m128i*)dst, result);
3950 length = length % 16;
3952 #elif defined(QT_ALWAYS_HAVE_NEON) 3958 const int chunkCount = length >> 3;
3959 const uint16x8_t questionMark = vdupq_n_u16(
'?');
3960 const uint16x8_t thresholdMask = vdupq_n_u16(0xff);
3961 for (
int i = 0; i < chunkCount; ++i) {
3962 uint16x8_t chunk = vld1q_u16((uint16_t *)src);
3965 const uint16x8_t offLimitMask = vcgtq_u16(chunk, thresholdMask);
3966 const uint16x8_t offLimitQuestionMark = vandq_u16(offLimitMask, questionMark);
3967 const uint16x8_t correctBytes = vbicq_u16(chunk, offLimitMask);
3968 chunk = vorrq_u16(correctBytes, offLimitQuestionMark);
3969 const uint8x8_t result = vmovn_u16(chunk);
3970 vst1_u8(dst, result);
3973 length = length % 8;
3977 *dst++ = (*src>0xff) ?
'?' : (
uchar) *src;
4016 #ifndef QT_NO_TEXTCODEC 4019 #endif // QT_NO_TEXTCODEC 4023 #if !defined(Q_WS_MAC) && defined(Q_OS_UNIX) 4026 #ifndef QT_NO_TEXTCODEC 4029 #endif // QT_NO_TEXTCODEC 4051 #ifndef QT_NO_TEXTCODEC 4054 #endif // QT_NO_TEXTCODEC 4110 }
else if (size == 0 || (!*str && size < 0)) {
4128 #if defined(QT_ALWAYS_HAVE_SSE2) 4130 int chunkCount = size >> 4;
4131 const __m128i nullMask = _mm_set1_epi32(0);
4132 for (
int i = 0; i < chunkCount; ++i) {
4133 const __m128i chunk = _mm_loadu_si128((__m128i*)str);
4137 const __m128i firstHalf = _mm_unpacklo_epi8(chunk, nullMask);
4138 _mm_storeu_si128((__m128i*)dst, firstHalf);
4142 const __m128i secondHalf = _mm_unpackhi_epi8 (chunk, nullMask);
4143 _mm_storeu_si128((__m128i*)dst, secondHalf);
4150 *dst++ = (
uchar)*str++;
4157 #ifndef QT_NO_TEXTCODEC 4163 }
else if (size == 0 || (!*str && size < 0)) {
4199 const char *QString::ascii_helper()
const 4210 asciiCache->insert(
d, ascii);
4217 const char *QString::latin1_helper()
const 4228 asciiCache->insert(
d, ascii);
4249 if (size == 0 || (!*str && size < 0))
4251 #if !defined(QT_NO_TEXTCODEC) 4257 #endif // !QT_NO_TEXTCODEC 4335 while (unicode[size] != 0)
4362 while (unicode[size] != 0)
4380 if (unicode && size)
4381 memcpy(
d->
data, unicode, size *
sizeof(
QChar));
4421 const QChar *from = start;
4427 if (++from == fromEnd) {
4436 while (fromEnd[-1].isSpace())
4440 const QChar *copyFrom = from;
4443 if (++from == fromEnd) {
4445 return mid(copyFrom - start, from - copyFrom);
4451 copyCount = from - copyFrom;
4456 copyCount = from - copyFrom - 1;
4466 ::memcpy(to, copyFrom, copyCount * 2);
4475 if (from == fromEnd)
4480 if (from == fromEnd)
4486 result.
truncate(to - reinterpret_cast<QChar *>(result.
d->
data));
4515 while (start<=end && s[start].isSpace())
4518 while (end && s[end].isSpace())
4521 int l = end - start + 1;
4643 resize(size < 0 ? d->size : size);
5063 return ucstrcmp(data1, length1, data2, length2);
5064 register const ushort *s1 =
reinterpret_cast<const ushort *
>(data1);
5065 register const ushort *s2 =
reinterpret_cast<const ushort *
>(data2);
5066 return ucstricmp(s1, s1 + length1, s2, s2 + length2);
5104 const ushort *uc =
reinterpret_cast<const ushort *
>(data1);
5105 const ushort *e = uc + length1;
5112 while (uc < e && *c && *uc == *c)
5178 #if !defined(CSTR_LESS_THAN) 5179 #define CSTR_LESS_THAN 1 5180 #define CSTR_EQUAL 2 5181 #define CSTR_GREATER_THAN 3 5202 #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) 5213 const QChar *data2,
int length2)
5216 if (length1 == 0 || length2 == 0)
5217 return ucstrcmp(data1, length1, data2, length2);
5219 #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) 5220 int res = CompareString(GetUserDefaultLCID(), 0, (
wchar_t*)data1, length1, (
wchar_t*)data2, length2);
5230 #elif defined (Q_OS_MAC) 5236 CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault,
5237 reinterpret_cast<const UniChar *>(data1), length1, kCFAllocatorNull);
5239 CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault,
5240 reinterpret_cast<const UniChar *>(data2), length2, kCFAllocatorNull);
5242 const int result = CFStringCompare(thisString, otherString, kCFCompareLocalized);
5243 CFRelease(thisString);
5244 CFRelease(otherString);
5246 #elif defined(Q_OS_SYMBIAN) 5247 TPtrC p1 = TPtrC16(reinterpret_cast<const TUint16 *>(data1), length1);
5248 TPtrC p2 = TPtrC16(reinterpret_cast<const TUint16 *>(data2), length2);
5249 return p1.CompareC(p2);
5250 #elif defined(Q_OS_UNIX) 5251 # if defined(QT_USE_ICU) 5255 res =
ucstrcmp(data1, length1, data2, length2);
5260 int delta = strcoll(toLocal8Bit_helper(data1, length1), toLocal8Bit_helper(data2, length2));
5262 delta =
ucstrcmp(data1, length1, data2, length2);
5265 return ucstrcmp(data1, length1, data2, length2);
5295 return that->
d->
data;
5322 int padlen = width - len;
5324 result.
resize(len+padlen);
5332 result =
left(width);
5361 int padlen = width - len;
5363 result.
resize(len+padlen);
5371 result =
left(width);
5418 int pos = pp - s.
d->
data;
5420 pp = s.
d->
data + pos;
5422 while (*specialCase)
5423 *pp++ = *specialCase++;
5460 last = pp > s.
d->
data ? *(pp - 1) : 0;
5512 int pos = pp - s.
d->
data;
5514 pp = s.
d->
data + pos;
5516 while (*specialCase)
5517 *pp++ = *specialCase++;
5570 va_start(ap, cformat);
5591 if (!cformat || !*cformat) {
5600 const char *
c = cformat;
5603 #ifndef QT_NO_TEXTCODEC 5605 while (*(c + i) !=
'\0' && *(c + i) !=
'%')
5613 while (*c !=
'\0' && *c !=
'%')
5621 const char *escape_start =
c;
5636 bool no_more_flags =
false;
5645 default: no_more_flags =
true;
break;
5650 }
while (!no_more_flags);
5666 width = width_str.
toInt();
5668 else if (*c ==
'*') {
5669 width = va_arg(ap,
int);
5691 precision = precision_str.
toInt();
5693 else if (*c ==
'*') {
5694 precision = va_arg(ap,
int);
5707 enum LengthMod { lm_none, lm_hh, lm_h, lm_l, lm_ll, lm_L, lm_j, lm_z, lm_t };
5708 LengthMod length_mod = lm_none;
5765 switch (length_mod) {
5766 case lm_none: i = va_arg(ap,
int);
break;
5767 case lm_hh: i = va_arg(ap,
int);
break;
5768 case lm_h: i = va_arg(ap,
int);
break;
5769 case lm_l: i = va_arg(ap,
long int);
break;
5770 case lm_ll: i = va_arg(ap,
qint64);
break;
5771 case lm_j: i = va_arg(ap,
long int);
break;
5772 case lm_z: i = va_arg(ap,
size_t);
break;
5773 case lm_t: i = va_arg(ap,
int);
break;
5774 default: i = 0;
break;
5785 switch (length_mod) {
5786 case lm_none: u = va_arg(ap,
uint);
break;
5787 case lm_hh: u = va_arg(ap,
uint);
break;
5788 case lm_h: u = va_arg(ap,
uint);
break;
5789 case lm_l: u = va_arg(ap,
ulong);
break;
5790 case lm_ll: u = va_arg(ap,
quint64);
break;
5791 case lm_z: u = va_arg(ap,
size_t);
break;
5792 default: u = 0;
break;
5821 if (length_mod == lm_L)
5822 d = va_arg(ap,
long double);
5824 d = va_arg(ap,
double);
5842 if (length_mod == lm_l)
5850 if (length_mod == lm_l) {
5858 if (precision != -1)
5864 void *
arg = va_arg(ap,
void*);
5868 quint64 i =
reinterpret_cast<unsigned long>(
arg);
5876 switch (length_mod) {
5878 signed char *n = va_arg(ap,
signed char*);
5883 short int *n = va_arg(ap,
short int*);
5888 long int *n = va_arg(ap,
long int*);
5899 int *n = va_arg(ap,
int*);
5908 for (
const char *cc = escape_start; cc !=
c; ++cc)
5945 #if defined(QT_CHECK_RANGE) 5946 if (base != 0 && (base < 2 || base > 36)) {
5947 qWarning(
"QString::toLongLong: Invalid base (%d)", base);
5986 #if defined(QT_CHECK_RANGE) 5987 if (base != 0 && (base < 2 || base > 36)) {
5988 qWarning(
"QString::toULongLong: Invalid base (%d)", base);
6030 if (v < LONG_MIN || v > LONG_MAX) {
6062 if (v > ULONG_MAX) {
6093 if (v < INT_MIN || v >
INT_MAX) {
6153 if (v < SHRT_MIN || v > SHRT_MAX) {
6183 if (v > USHRT_MAX) {
6255 #define QT_MAX_FLOAT 3.4028234663852886e+38 6309 #if defined(QT_CHECK_RANGE) 6310 if (base < 2 || base > 36) {
6311 qWarning(
"QString::setNum: Invalid base (%d)", base);
6325 #if defined(QT_CHECK_RANGE) 6326 if (base < 2 || base > 36) {
6327 qWarning(
"QString::setNum: Invalid base (%d)", base);
6384 #if defined(QT_CHECK_RANGE) 6385 qWarning(
"QString::setNum: Invalid format char '%c'", f);
6532 while ((end =
indexOf(sep, start + extra, cs)) != -1) {
6535 start = end + sep.
size();
6536 extra = (sep.
size() == 0 ? 1 : 0);
6551 while ((end =
indexOf(sep, start, cs)) != -1) {
6561 #ifndef QT_NO_REGEXP 6598 while ((end = rx2.
indexIn(*
this, start + extra)) != -1) {
6602 start = end + matchedLen;
6603 extra = (matchedLen == 0) ? 1 : 0;
6668 const int resultSize = times *
d->
size;
6672 if (result.
d->
alloc != resultSize)
6677 int sizeSoFar =
d->
size;
6680 const int halfResultSize = resultSize >> 1;
6681 while (sizeSoFar <= halfResultSize) {
6682 memcpy(end, result.
d->
data, sizeSoFar *
sizeof(
ushort));
6686 memcpy(end, result.
d->
data, (resultSize - sizeSoFar) *
sizeof(
ushort));
6687 result.
d->
data[resultSize] =
'\0';
6688 result.
d->
size = resultSize;
6714 int len = data->
length();
6715 for (
int i = from; i < len; ++i) {
6738 while (pos < s.
length() - 1) {
6742 d[pos] =
QChar(oldHigh);
6743 d[++pos] =
QChar(oldLow);
6748 while (pos < s.
length()) {
6792 const QChar *
c = uc_begin;
6793 while (c != uc_end) {
6794 while (c != uc_end && c->
unicode() !=
'%')
6799 const QChar *escape_start =
c;
6803 bool locale_arg =
false;
6845 int abs_field_width =
qAbs(field_width);
6846 int result_len = s.
length()
6856 QChar *rc = result_buff;
6857 const QChar *
c = uc_begin;
6859 while (c != uc_end) {
6864 const QChar *text_start =
c;
6869 const QChar *escape_start = c++;
6871 bool locale_arg =
false;
6879 if (c + 1 != uc_end && (c + 1)->digitValue() != -1) {
6880 escape = (10 *
escape) + (c + 1)->digitValue();
6886 memcpy(rc, text_start, (c - text_start)*
sizeof(
QChar));
6887 rc += c - text_start;
6892 memcpy(rc, text_start, (escape_start - text_start)*
sizeof(
QChar));
6893 rc += escape_start - text_start;
6901 if (field_width > 0) {
6902 for (
uint i = 0; i < pad_chars; ++i)
6903 (rc++)->unicode() = fillChar.unicode();
6915 if (field_width < 0) {
6916 for (
uint i = 0; i < pad_chars; ++i)
6917 (rc++)->unicode() = fillChar.unicode();
6921 memcpy(rc, c, (uc_end - c)*
sizeof(
QChar));
6923 Q_ASSERT(rc - result_buff == result_len);
6928 Q_ASSERT(rc == result_buff + result_len);
7191 qWarning() <<
"QString::arg: Argument missing:" << *
this <<
',' <<
a;
7238 qWarning() <<
"QString::arg: Argument missing:" << *
this <<
',' <<
a;
7311 return arg(c, fieldWidth, fillChar);
7326 return arg(c, fieldWidth, fillChar);
7386 #if defined(QT_CHECK_RANGE) 7387 qWarning(
"QString::arg: Invalid format char '%c'", fmt);
7402 locale_arg = locale.
d()->
doubleToString(a, prec, form, fieldWidth, flags);
7416 if (
uint(escape) >= 10U)
7420 int digit = uc[i].
unicode() -
'0';
7421 if (
uint(digit) >= 10U)
7423 escape = (escape * 10) + digit;
7426 if (escape <= maxNumber) {
7439 const int len = d->size;
7440 const int end = len - 1;
7441 int lastNumber = -1;
7449 numbersUsed.
insert(number, -1);
7460 while (j != jend && arg < numArgs) {
7462 lastNumber = j.
key();
7467 if (numArgs > arg) {
7476 int arg = numbersUsed[
number];
7477 if (number != -1 && arg != -1) {
7478 result += *args[
arg];
7489 bool righttoleft =
false;
7514 d->simpletext =
true;
7518 if (uc > 0x058f && (uc < 0x1100 || uc > 0xfb0f)) {
7519 d->simpletext =
false;
7709 if (d->ref != 1 || (d->data == d->array && d->alloc)) {
7713 if (d->asciiCache) {
7716 asciiCache->remove(d);
7720 d->data = (
ushort *)unicode;
7725 d->alloc = d->size =
size;
7727 d->clean = d->asciiCache = d->simpletext = d->righttoleft = d->capacity = 0;
8021 #if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)) 8045 for (
int i = 0; i < str.
length(); i++) {
8046 buffer[i] =
qbswap(*data);
8049 out.
writeBytes(reinterpret_cast<const char *>(buffer.data()),
sizeof(
ushort) * buffer.size());
8073 #ifdef QT_QSTRING_UCS_4 8074 #if defined(Q_CC_GNU) 8075 #warning "operator>> not working properly" 8086 if (bytes == 0xffffffff) {
8088 }
else if (bytes > 0) {
8095 const quint32 Step = 1024 * 1024;
8099 while (allocated < len) {
8101 str.
resize(allocated + blockSize);
8102 if (in.
readRawData(reinterpret_cast<char *>(str.
data()) + allocated * 2,
8103 blockSize * 2) != blockSize * 2) {
8112 != (QSysInfo::ByteOrder == QSysInfo::BigEndian)) {
8125 #endif // QT_NO_DATASTREAM 8656 if (m_size && m_position == 0 && m_size == m_string->size())
8658 return QString(m_string->unicode() + m_position, m_size);
8671 {
return (s1.
size() == s2.
size() &&
8684 {
return (s1.
size() == s2.
size() &&
8705 if (uc == e || *uc != *c)
8832 int pos =
string->size();
9019 if (str.
string() ==
this) {
9021 }
else if (str.
string()) {
9022 int oldSize =
size();
9047 if (n >= d->size || n < 0)
9070 if (n >= d->size || n < 0)
9109 if (n + position > d->size)
9219 const int sl = str.
size();
9223 const int l =
size();;
9227 if (from == l && sl == 0)
9229 if (from < 0 || from >= l || delta < 0)
9235 reinterpret_cast<const ushort*>(str.
unicode()), str.
size(), cs);
9279 const int l =
size();
9283 if (from == l && sl == 0)
9285 if (from < 0 || from >= l || delta < 0)
9291 for (
int i = 0; i < sl; ++i)
9317 const int sl = str.
size();
9321 const int l =
size();
9325 if (from == l && sl == 0)
9327 if (from < 0 || from >= l || delta < 0)
9333 reinterpret_cast<const ushort*>(str.
unicode()),
9503 ? data[size - 1] == ch
9600 from += haystackLen;
9601 if (from < 0 || from >= haystackLen)
9604 const ushort *b =
reinterpret_cast<const ushort*
>(haystack);
9605 const ushort *n = b + from;
9623 const QChar *needle,
int needleLen,
9628 if (haystackLen > 500 && needleLen > 5) {
9630 while ((i = matcher.
indexIn(haystack, haystackLen, i + 1)) != -1)
9633 while ((i =
qFindString(haystack, haystackLen, i + 1, needle, needleLen, cs)) != -1)
9663 const char *latin1 = needle.
latin1();
9666 for (
int i = 0; i < len; ++i)
9670 reinterpret_cast<const QChar*>(s.
constData()), len, cs);
9678 if (haystackLen == 0)
9679 return needleLen == 0;
9680 if (needleLen > haystackLen)
9683 const ushort *h =
reinterpret_cast<const ushort*
>(haystack);
9684 const ushort *n =
reinterpret_cast<const ushort*
>(needle);
9691 for (
int i = 0; i < needleLen; ++i)
9703 if (haystackLen == 0)
9706 if (slen > haystackLen)
9708 const ushort *data =
reinterpret_cast<const ushort*
>(haystack);
9711 for (
int i = 0; i < slen; ++i)
9712 if (data[i] != latin[i])
9715 for (
int i = 0; i < slen; ++i)
9727 if (haystackLen == 0)
9728 return needleLen == 0;
9729 const int pos = haystackLen - needleLen;
9733 const ushort *h =
reinterpret_cast<const ushort*
>(haystack);
9734 const ushort *n =
reinterpret_cast<const ushort*
>(needle);
9741 for (
int i = 0; i < needleLen; i++)
9754 if (haystackLen == 0)
9757 int pos = haystackLen - slen;
9761 const ushort *data =
reinterpret_cast<const ushort*
>(haystack);
9763 for (
int i = 0; i < slen; i++)
9764 if (data[pos+i] != latin[i])
9767 for (
int i = 0; i < slen; i++)
9812 #ifndef QT_NO_TEXTCODEC 9815 #endif // QT_NO_TEXTCODEC 9841 #ifndef QT_NO_TEXTCODEC 9844 #endif // QT_NO_TEXTCODEC 9894 int len = toUcs4_helper<uint>(
reinterpret_cast<const unsigned short *
>(
unicode()),
length(),
a);
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QString fromWCharArray(const wchar_t *, int size=-1)
Returns a copy of the string, where the encoding of string depends on the size of wchar...
static QTextCodec * codecForLocale()
Returns a pointer to the codec most suitable for this locale.
#define UNICODE_DATA_VERSION
int qFindString(const QChar *haystack, int haystackLen, int from, const QChar *needle, int needleLen, Qt::CaseSensitivity cs)
QString toString() const
Returns a copy of the string reference as a QString object.
QString section(QChar sep, int start, int end=-1, SectionFlags flags=SectionDefault) const
This function returns a section of the string.
const T * constData() const
iterator end()
Returns an STL-style iterator pointing to the imaginary character after the last character in the str...
const struct __CFString * CFStringRef
static QString convertToUnicode(const char *, int, QTextCodec::ConverterState *, DataEndianness=DetectEndianness)
qlonglong toLongLong(bool *ok=0, int base=10) const
Returns the string converted to a long long using base base, which is 10 by default and must be betwe...
float toFloat(bool *ok=0) const
QString & sprintf(const char *format,...)
Safely builds a formatted string from the format string cformat and an arbitrary list of arguments...
bool operator==(const QStringRef &s1, const QStringRef &s2)
Returns true if string reference s1 is lexically equal to string reference s2; otherwise returns fals...
static QString fromLocal8Bit(const char *, int size=-1)
Returns a QString initialized with the first size characters of the 8-bit string str.
static int qt_string_count(const QChar *haystack, int haystackLen, const QChar *needle, int needleLen, Qt::CaseSensitivity cs)
static int ucstrnicmp(const ushort *a, const ushort *b, int l)
QStringRef appendTo(QString *string) const
Appends the string reference to string, and returns a new reference to the combined string data...
QIntegerForSizeof< void * >::Unsigned quintptr
signed short upperCaseDiff
qint64 stringToLongLong(const QString &num, int base, bool *ok, GroupSeparatorMode group_sep_mode) const
static int localeAwareCompare_helper(const QChar *data1, int length1, const QChar *data2, int length2)
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string reference starts with str; otherwise returns false.
QString cap(int nth=0) const
Returns the text captured by the nth subexpression.
#define QT_END_NAMESPACE
This macro expands to.
const Key key(const T &value) const
Returns the first key with value value.
The QMutex class provides access serialization between threads.
int lastIndexIn(const QString &str, int offset=-1, CaretMode caretMode=CaretAtZero) const
Attempts to find a match backwards in str from position offset.
QString & operator=(QChar c)
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
NormalizationForm
This enum describes the various normalized forms of Unicode text.
char * data()
Returns a pointer to the data stored in the byte array.
qulonglong toULongLong(bool *ok=0, int base=10) const
Returns the string converted to an unsigned long long using base base, which is 10 by default and mus...
int length() const
Returns the number of characters referred to by the string reference.
int digitValue() const
Returns the numeric value of the digit, or -1 if the character is not a digit.
const QChar at(int i) const
Returns the character at the given index position in the string.
The QRegExp class provides pattern matching using regular expressions.
void qbswap(const T src, uchar *dest)
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
ushort toUShort(bool *ok=0, int base=10) const
Returns the string converted to an unsigned short using base base, which is 10 by default and must be...
QByteArray toAscii() const Q_REQUIRED_RESULT
Returns an 8-bit representation of the string as a QByteArray.
#define QT_MAX_FLOAT
Returns the string converted to a float value.
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
ByteOrder byteOrder() const
Returns the current byte order setting – either BigEndian or LittleEndian.
static bool qMemEquals(const quint16 *a, const quint16 *b, int length)
Q_CORE_EXPORT void qFree(void *ptr)
QString & replace(int i, int len, QChar after)
void updateProperties() const
The QByteArray class provides an array of bytes.
QString leftJustified(int width, QChar fill=QLatin1Char(' '), bool trunc=false) const Q_REQUIRED_RESULT
Returns a string of size width that contains this string padded by the fill character.
void chop(int n)
Removes n characters from the end of the string.
int length() const
Returns the number of characters in this string.
QString & prepend(QChar c)
QString toUpper() const Q_REQUIRED_RESULT
Returns an uppercase copy of the string.
int toWCharArray(wchar_t *array) const
Fills the array with the data contained in this QString object.
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
qt_section_chunk(int l, QString s)
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
bool isLowSurrogate() const
Returns true if the QChar is the low part of a utf16 surrogate (ie.
int matchedLength() const
Returns the length of the last matched string, or -1 if there was no match.
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
long ASN1_INTEGER_get ASN1_INTEGER * a
void setStatus(Status status)
Sets the status of the data stream to the status given.
int count(const T &t) const
Returns the number of occurrences of value in the list.
Q_CORE_EXPORT void * qMalloc(size_t size)
Q_CORE_EXPORT void * qRealloc(void *ptr, size_t size)
The QString class provides a Unicode character string.
QString normalized(NormalizationForm mode) const Q_REQUIRED_RESULT
Returns the string in the given Unicode normalization mode.
The QHash class is a template class that provides a hash-table-based dictionary.
QString & vsprintf(const char *format, va_list ap)
Equivalent method to sprintf(), but takes a va_list ap instead a list of variable arguments...
QString multiArg(int numArgs, const QString **args) const
static QByteArray toLatin1_helper(const QChar *data, int length)
bool isHighSurrogate() const
Returns true if the QChar is the high part of a utf16 surrogate (ie.
Q_DECL_CONSTEXPR T qAbs(const T &t)
#define Q_BASIC_ATOMIC_INITIALIZER(a)
QChar toCaseFolded() const
Returns the case folded equivalent of the character.
static bool isStringRightToLeft(const ushort *p, const ushort *end)
The QChar class provides a 16-bit Unicode character.
QChar * data()
Returns a pointer to the data stored in the QString.
static int qt_find_latin1_string(const QChar *hay, int size, const QLatin1String &needle, int from, Qt::CaseSensitivity cs)
static QString fromRawData(const QChar *, int size)
Constructs a QString that uses the first size Unicode characters in the array unicode.
static QByteArray convertFromUnicode(const QChar *, int, QTextCodec::ConverterState *)
The QStringMatcher class holds a sequence of characters that can be quickly matched in a Unicode stri...
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
NumberOptions numberOptions() const
Returns the options related to number conversions for this QLocale instance.
bool isSpace() const
Returns true if the character is a separator character (Separator_* categories); otherwise returns fa...
QString repeated(int times) const
Returns a copy of this string repeated the specified number of times.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string reference ends with str; otherwise returns false.
void resize(int size)
Sets the size of the vector to size.
static ushort highSurrogate(uint ucs4)
Returns the high surrogate value of a ucs4 code point.
QString & setRawData(const QChar *unicode, int size)
Resets the QString to use the first size Unicode characters in the array unicode. ...
static QString doubleToString(const QChar zero, const QChar plus, const QChar minus, const QChar exponent, const QChar group, const QChar decimal, double d, int precision, DoubleForm form, int width, unsigned flags)
QStringRef leftRef(int n) const Q_REQUIRED_RESULT
Returns a substring reference to the n leftmost characters of the string.
static ushort lowSurrogate(uint ucs4)
Returns the low surrogate value of a ucs4 code point.
const QChar * constData() const
Same as unicode().
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
static void decomposeHelper(QString *str, bool canonical, QChar::UnicodeVersion version, int from)
void reserve(int size)
Attempts to allocate memory for at least size characters.
static const NormalizationCorrection uc_normalization_corrections[]
static const ushort specialCaseMap[]
QString rightJustified(int width, QChar fill=QLatin1Char(' '), bool trunc=false) const Q_REQUIRED_RESULT
Returns a string of size() width that contains the fill character followed by the string...
static QString unsLongLongToString(const QChar zero, const QChar group, const QChar plus, quint64 l, int precision, int base, int width, unsigned flags)
void append(const T &t)
Inserts value at the end of the list.
bool operator==(const QString &s) const
Returns true if string other is equal to this string; otherwise returns false.
static int compare_helper(const QChar *data1, int length1, const QChar *data2, int length2, Qt::CaseSensitivity cs=Qt::CaseSensitive)
static QString longLongToString(const QChar zero, const QChar group, const QChar plus, const QChar minus, qint64 l, int precision, int base, int width, unsigned flags)
int size() const
Returns the number of characters referred to by the string reference.
#define QT_BEGIN_NAMESPACE
This macro expands to.
static bool requiresSurrogates(uint ucs4)
Returns true if the UCS-4-encoded character specified by ucs4 can be split into the high and low part...
const char * latin1() const
Returns the Latin-1 string stored in this object.
quint64 stringToUnsLongLong(const QString &num, int base, bool *ok, GroupSeparatorMode group_sep_mode) const
QByteArray fromUnicode(const QString &uc) const
Converts str from Unicode to the encoding of this codec, and returns the result in a QByteArray...
int qAllocMore(int alloc, int extra)
void truncate(int pos)
Truncates the string at the given position index.
int indexIn(const QString &str, int offset=0, CaretMode caretMode=CaretAtZero) const
Attempts to find a match in str from position offset (0 by default).
int readRawData(char *, int len)
Reads at most len bytes from the stream into s and returns the number of bytes read.
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
bool operator<(const QStringRef &s1, const QStringRef &s2)
Returns true if string reference s1 is lexically less than string reference s2; otherwise returns fal...
static int qt_last_index_of(const QChar *haystack, int haystackLen, const QChar &needle, int from, Qt::CaseSensitivity cs)
QStringRef rightRef(int n) const Q_REQUIRED_RESULT
Returns a substring reference to the n rightmost characters of the string.
double stringToDouble(const QString &num, bool *ok, GroupSeparatorMode group_sep_mode) const
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
int size() const
Returns the number of characters in this string.
const QChar * unicode() const
Returns a '\0'-terminated Unicode representation of the string.
QString & setNum(short, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QDataStream & writeBytes(const char *, uint len)
Writes the length specifier len and the buffer s to the stream and returns a reference to the stream...
bool isRightToLeft() const
Returns true if the string is read right to left.
static QString convertToUnicode(const char *, int, QTextCodec::ConverterState *)
static int ucstrncmp(const QChar *a, const QChar *b, int l)
void replace_helper(uint *indices, int nIndices, int blen, const QChar *after, int alen)
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
const T & at(int i) const
Returns the item at index position i in the list.
static int ucstricmp(const ushort *a, const ushort *ae, const ushort *b, const ushort *be)
The QStringList class provides a list of strings.
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
static const QUnicodeTables::Properties * qGetProp(uint ucs4)
bool qt_ucol_strcoll(const QChar *source, int sourceLength, const QChar *target, int targetLength, int *result)
Q_CORE_EXPORT void qWarning(const char *,...)
bool isEmpty() const
Returns true if the string reference has no characters; otherwise returns false.
QString toCaseFolded() const Q_REQUIRED_RESULT
Returns the case folded equivalent of the string.
int count() const
Returns the number of characters referred to by the string reference.
int indexOf(const QString &str, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns the index position of the first occurrence of the string str in this string reference...
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString replaceArgEscapes(const QString &s, const ArgEscapeData &d, int field_width, const QString &arg, const QString &larg, const QChar &fillChar=QLatin1Char(' '))
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
static QTextCodec * codec(MYSQL *mysql)
int toUcs4_helper(const unsigned short *uc, int length, T *out)
static int getEscape(const QChar *uc, int *pos, int len, int maxNumber=999)
const QChar * unicode() const
Returns a Unicode representation of the string reference.
QString right(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n rightmost characters of the string.
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
static int cmp(const ushort *s1, const ushort *s2, size_t len)
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
bool operator>(const QString &s) const
Returns true if this string is lexically greater than string other; otherwise returns false...
UnicodeVersion
Specifies which version of the [Unicode standard](http://www.
int localeAwareCompare(const QString &s) const
The QStringRef class provides a thin wrapper around QString substrings.
QDataStream & operator<<(QDataStream &stream, const QString &string)
Writes the given string to the specified stream.
static Data * fromAscii_helper(const char *str, int size=-1)
Q_GUI_EXPORT QString escape(const QString &plain)
Converts the plain text string plain to a HTML string with HTML metacharacters <, >...
int lastIndexOf(const QString &str, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns the index position of the last occurrence of the string str in this string reference...
iterator begin()
Returns an STL-style iterator pointing to the first item in the map.
int version() const
Returns the version number of the data serialization format.
void resize(int size)
Sets the size of the string to size characters.
const char * constData() const
Returns a pointer to the data stored in the byte array.
static uint foldCase(const ushort *ch, const ushort *start)
bool isNull() const
Returns true if this string is null; otherwise returns false.
QString toUnicode(const QByteArray &) const
Converts a from the encoding of this codec to Unicode, and returns the result in a QString...
static int findChar(const QChar *str, int len, QChar ch, int from, Qt::CaseSensitivity cs)
Returns the index position of the first occurrence of the character ch in the string given by str and...
QStringRef midRef(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a substring reference to n characters of this string, starting at the specified position...
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
int qFindStringBoyerMoore(const QChar *haystack, int haystackLen, int from, const QChar *needle, int needleLen, Qt::CaseSensitivity cs)
signed short lowerCaseDiff
uint qstrlen(const char *str)
const QLocalePrivate * d() const
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
static QLocale c()
Returns a QLocale object initialized to the "C" locale.
QString & append(QChar c)
int compare(const QString &s) const
const QString * string() const
Returns a pointer to the string referred to by the string reference, or 0 if it does not reference a ...
static ArgEscapeData findArgEscapes(const QString &s)
QString simplified() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end, and that has each sequence o...
QDataStream & operator>>(QDataStream &stream, QString &string)
Reads a string from the specified stream into the given string.
void clear()
Clears the contents of the string and makes it empty.
int captureCount() const
Returns the number of captures contained in the regular expression.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the map...
bool operator==(const QString &s1, const QStringRef &s2)
Returns true if string s1 is lexically equal to string reference s2; otherwise returns false...
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
iterator insert(const Key &key, const T &value)
Inserts a new item with the key key and a value of value.
#define SPECIAL_CASE_MAX_LEN
bool operator==(const QLatin1String &s1, const QStringRef &s2)
Returns true if string s1 is lexically equal to string reference s2; otherwise returns false...
QVector< uint > toUcs4() const Q_REQUIRED_RESULT
Returns a UCS-4/UTF-32 representation of the string as a QVector<uint>.
QString toLower() const Q_REQUIRED_RESULT
Returns a lowercase copy of the string.
void resize(int size)
Sets the size of the byte array to size bytes.
double toDouble(bool *ok=0) const
Returns the string converted to a double value.
int size() const
Returns the number of items in the list.
static QTextCodec * codecForCStrings
QByteArray toAscii() const Q_REQUIRED_RESULT
Returns an 8-bit representation of the string as a QByteArray.
QString & fill(QChar c, int size=-1)
Sets every character in the string to character ch.
uint toUInt(bool *ok=0, int base=10) const
Returns the string converted to an unsigned int using base base, which is 10 by default and must be b...
static QString convertToUnicode(const char *, int, QTextCodec::ConverterState *, DataEndianness=DetectEndianness)
if(void) toggleToolbarShown
static int lastIndexOfHelper(const ushort *haystack, int from, const ushort *needle, int sl, Qt::CaseSensitivity cs)
static uint surrogateToUcs4(ushort high, ushort low)
Converts a UTF16 surrogate pair with the given high and low values to its UCS-4 code point...
int indexIn(const QString &str, int from=0) const
Searches the string str from character position from (default 0, i.e.
static bool qt_starts_with(const QChar *haystack, int haystackLen, const QChar *needle, int needleLen, Qt::CaseSensitivity cs)
short toShort(bool *ok=0, int base=10) const
Returns the string converted to a short using base base, which is 10 by default and must be between 2...
static void composeHelper(QString *str, QChar::UnicodeVersion version, int from)
#define CSTR_GREATER_THAN
CaretMode
The CaretMode enum defines the different meanings of the caret (^) in a regular expression.
T * data()
Returns a pointer to the data stored in the vector.
void setCaseSensitivity(Qt::CaseSensitivity cs)
Sets case sensitive matching to cs.
QString & setUtf16(const ushort *utf16, int size)
Resizes the string to size characters and copies unicode into the string.
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
The QDataStream class provides serialization of binary data to a QIODevice.
static int ucstrcmp(const QChar *a, int alen, const QChar *b, int blen)
bool isNull() const
Returns true if string() returns a null pointer or a pointer to a null string; otherwise returns true...
Direction direction() const
Returns the character's direction.
static Data * fromLatin1_helper(const char *str, int size=-1)
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
The QTextCodec class provides conversions between text encodings.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, int from)
QVector< uint > toUcs4() const Q_REQUIRED_RESULT
Returns a UCS-4/UTF-32 representation of the string as a QVector<uint>.
QString & insert(int i, QChar c)
ulong toULong(bool *ok=0, int base=10) const
Returns the string converted to an unsigned long using base base, which is 10 by default and must be ...
SplitBehavior
This enum specifies how the split() function should behave with respect to empty strings.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QString & setUnicode(const QChar *unicode, int size)
Resizes the string to size characters and copies unicode into the string.
const QChar * constData() const
Returns a pointer to the data stored in the QString.
const QChar at(int i) const
Returns the character at the given index position in the string reference.
void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar::UnicodeVersion version, int from)
static QString fromUtf16(const ushort *, int size=-1)
Returns a QString initialized with the first size characters of the Unicode string unicode (ISO-10646...
bool operator<(const QString &s) const
Returns true if this string is lexically less than string other; otherwise returns false...
QString()
Constructs a null string.
long toLong(bool *ok=0, int base=10) const
Returns the string converted to a long using base base, which is 10 by default and must be between 2 ...
The QList class is a template class that provides lists.
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.
static bool qt_ends_with(const QChar *haystack, int haystackLen, const QChar *needle, int needleLen, Qt::CaseSensitivity cs)
static QString fromUcs4(const uint *, int size=-1)
Returns a QString initialized with the first size characters of the Unicode string unicode (ISO-10646...
#define forever
This macro is provided for convenience for writing infinite loops.