Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qlatin1stringview.h
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// Copyright (C) 2019 Intel Corporation.
3// Copyright (C) 2019 Mail.ru Group.
4// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
5// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
6// Qt-Security score:critical reason:data-parser
7
8#ifndef QLATIN1STRINGVIEW_H
9#define QLATIN1STRINGVIEW_H
10
11#include <QtCore/qbytearrayview.h>
12#include <QtCore/qchar.h>
13#include <QtCore/qcompare.h>
14#include <QtCore/qcontainerfwd.h>
15#include <QtCore/qnamespace.h>
16#include <QtCore/qtversionchecks.h>
17#include <QtCore/qstringfwd.h>
18#include <QtCore/qstringview.h>
19
20#if 0
21// Workaround for generating forward headers
22#pragma qt_class(QLatin1String)
23#pragma qt_class(QLatin1StringView)
24#endif
25
26QT_BEGIN_NAMESPACE
27
28class QString;
29
30#ifdef Q_L1S_VIEW_IS_PRIMARY
31class QLatin1StringView
32#else
34#endif
35{
36public:
37#ifdef Q_L1S_VIEW_IS_PRIMARY
38 constexpr QLatin1StringView() noexcept {}
39 constexpr QLatin1StringView(std::nullptr_t) noexcept : QLatin1StringView() {}
40 constexpr explicit QLatin1StringView(const char *s) noexcept
42 constexpr QLatin1StringView(const char *f, const char *l)
44 constexpr QLatin1StringView(const char *s, qsizetype sz) noexcept : m_data(s), m_size(sz) {}
45 explicit QLatin1StringView(const QByteArray &s) noexcept
46 : QLatin1StringView{s.begin(), s.size()} {}
47 constexpr explicit QLatin1StringView(QByteArrayView s) noexcept
49#else
50 constexpr QLatin1String() noexcept : m_size(0), m_data(nullptr) {}
52 constexpr QLatin1String(std::nullptr_t) noexcept : QLatin1String() {}
53 constexpr explicit QLatin1String(const char *s) noexcept
54 : m_size(s ? qsizetype(QtPrivate::lengthHelperPointer(s)) : 0), m_data(s) {}
55 constexpr QLatin1String(const char *f, const char *l)
56 : QLatin1String(f, qsizetype(l - f)) {}
57 constexpr QLatin1String(const char *s, qsizetype sz) noexcept : m_size(sz), m_data(s) {}
58 explicit QLatin1String(const QByteArray &s) noexcept : QLatin1String(s.begin(), s.size()) {}
59 constexpr explicit QLatin1String(QByteArrayView s) noexcept : m_size(s.size()), m_data(s.data()) {}
60#endif // !Q_L1S_VIEW_IS_PRIMARY
61
62 inline QString toString() const;
63 QByteArray toUtf8() const { return QtPrivate::convertToUtf8(*this); }
64
65 constexpr const char *latin1() const noexcept { return m_data; }
66 constexpr qsizetype size() const noexcept { return m_size; }
67 constexpr const char *data() const noexcept { return m_data; }
68 [[nodiscard]] constexpr const char *constData() const noexcept { return data(); }
69 [[nodiscard]] constexpr const char *constBegin() const noexcept { return begin(); }
70 [[nodiscard]] constexpr const char *constEnd() const noexcept { return end(); }
71
72 [[nodiscard]] constexpr QLatin1Char first() const { return front(); }
73 [[nodiscard]] constexpr QLatin1Char last() const { return back(); }
74
75 [[nodiscard]] constexpr qsizetype length() const noexcept { return size(); }
76
77 constexpr bool isNull() const noexcept { return !data(); }
78 constexpr bool isEmpty() const noexcept { return !size(); }
79
80 [[nodiscard]] constexpr bool empty() const noexcept { return size() == 0; }
81
82 template <typename...Args>
83 [[nodiscard]] inline QString arg(Args &&...args) const;
84
85 [[nodiscard]] constexpr QLatin1Char at(qsizetype i) const
86 {
87 Q_ASSERT(i >= 0);
88 Q_ASSERT(i < size());
89 return QLatin1Char(m_data[i]);
90 }
91 [[nodiscard]] constexpr QLatin1Char operator[](qsizetype i) const { return at(i); }
92
93 [[nodiscard]] constexpr QLatin1Char front() const { return at(0); }
94 [[nodiscard]] constexpr QLatin1Char back() const { return at(size() - 1); }
95
96 [[nodiscard]] int compare(QStringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
97 { return QtPrivate::compareStrings(*this, other, cs); }
98 [[nodiscard]] int compare(QLatin1StringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
99 { return QtPrivate::compareStrings(*this, other, cs); }
100 [[nodiscard]] inline int compare(QUtf8StringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept;
101 [[nodiscard]] constexpr int compare(QChar c) const noexcept
102 { return isEmpty() ? -1 : front() == c ? int(size() > 1) : uchar(m_data[0]) - c.unicode(); }
103 [[nodiscard]] int compare(QChar c, Qt::CaseSensitivity cs) const noexcept
104 { return QtPrivate::compareStrings(*this, QStringView(&c, 1), cs); }
105
106 [[nodiscard]] bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
107 { return QtPrivate::startsWith(*this, s, cs); }
108 [[nodiscard]] bool startsWith(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
109 { return QtPrivate::startsWith(*this, s, cs); }
110 [[nodiscard]] constexpr bool startsWith(QChar c) const noexcept
111 { return !isEmpty() && front() == c; }
112 [[nodiscard]] bool startsWith(QChar c, Qt::CaseSensitivity cs) const noexcept
113 { return QtPrivate::startsWith(*this, QStringView(&c, 1), cs); }
114
115 [[nodiscard]] bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
116 { return QtPrivate::endsWith(*this, s, cs); }
117 [[nodiscard]] bool endsWith(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
118 { return QtPrivate::endsWith(*this, s, cs); }
119 [[nodiscard]] constexpr bool endsWith(QChar c) const noexcept
120 { return !isEmpty() && back() == c; }
121 [[nodiscard]] bool endsWith(QChar c, Qt::CaseSensitivity cs) const noexcept
122 { return QtPrivate::endsWith(*this, QStringView(&c, 1), cs); }
123
124 [[nodiscard]] qsizetype indexOf(QStringView s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
125 { return QtPrivate::findString(*this, from, s, cs); }
126 [[nodiscard]] qsizetype indexOf(QLatin1StringView s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
127 { return QtPrivate::findString(*this, from, s, cs); }
128 [[nodiscard]] qsizetype indexOf(QChar c, qsizetype from = 0) const noexcept
129 { return c.unicode() <= 0xff ? QByteArrayView(*this).indexOf(char(c.unicode()), from) : -1; }
130 [[nodiscard]] qsizetype indexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs) const noexcept
131 {
132 if (cs == Qt::CaseInsensitive)
133 return QtPrivate::findString(*this, from, QStringView(&c, 1), cs);
134 return indexOf(c, from);
135 }
136
137 [[nodiscard]] bool contains(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
138 { return indexOf(s, 0, cs) != -1; }
139 [[nodiscard]] bool contains(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
140 { return indexOf(s, 0, cs) != -1; }
141 [[nodiscard]] bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
142 { return indexOf(c, 0, cs) != -1; }
143
144 [[nodiscard]] qsizetype lastIndexOf(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
145 { return lastIndexOf(s, size(), cs); }
146 [[nodiscard]] qsizetype lastIndexOf(QStringView s, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
147 { return QtPrivate::lastIndexOf(*this, from, s, cs); }
148 [[nodiscard]] qsizetype lastIndexOf(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
149 { return lastIndexOf(s, size(), cs); }
150 [[nodiscard]] qsizetype lastIndexOf(QLatin1StringView s, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
151 { return QtPrivate::lastIndexOf(*this, from, s, cs); }
152 [[nodiscard]] qsizetype lastIndexOf(QChar c) const noexcept
153 { return lastIndexOf(c, -1); }
154 [[nodiscard]] qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs) const noexcept
155 { return lastIndexOf(c, -1, cs); }
156 [[nodiscard]] qsizetype lastIndexOf(QChar c, qsizetype from) const noexcept
157 { return c.unicode() <= 0xff ? QByteArrayView(*this).lastIndexOf(char(c.unicode()), from) : -1; }
158 [[nodiscard]] qsizetype lastIndexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs) const noexcept
159 {
160 if (cs == Qt::CaseInsensitive)
161 return QtPrivate::lastIndexOf(*this, from, QStringView(&c, 1), cs);
162 return lastIndexOf(c, from);
163 }
164
165 [[nodiscard]] qsizetype count(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
166 { return QtPrivate::count(*this, str, cs); }
167 [[nodiscard]] qsizetype count(QLatin1StringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
168 { return QtPrivate::count(*this, str, cs); }
169 [[nodiscard]] qsizetype count(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
170 { return QtPrivate::count(*this, ch, cs); }
171
172 [[nodiscard]] short toShort(bool *ok = nullptr, int base = 10) const
173 { return QtPrivate::toIntegral<short>(QByteArrayView(*this), ok, base); }
174 [[nodiscard]] ushort toUShort(bool *ok = nullptr, int base = 10) const
175 { return QtPrivate::toIntegral<ushort>(QByteArrayView(*this), ok, base); }
176 [[nodiscard]] int toInt(bool *ok = nullptr, int base = 10) const
177 { return QtPrivate::toIntegral<int>(QByteArrayView(*this), ok, base); }
178 [[nodiscard]] uint toUInt(bool *ok = nullptr, int base = 10) const
179 { return QtPrivate::toIntegral<uint>(QByteArrayView(*this), ok, base); }
180 [[nodiscard]] long toLong(bool *ok = nullptr, int base = 10) const
181 { return QtPrivate::toIntegral<long>(QByteArrayView(*this), ok, base); }
182 [[nodiscard]] ulong toULong(bool *ok = nullptr, int base = 10) const
183 { return QtPrivate::toIntegral<ulong>(QByteArrayView(*this), ok, base); }
184 [[nodiscard]] qlonglong toLongLong(bool *ok = nullptr, int base = 10) const
185 { return QtPrivate::toIntegral<qlonglong>(QByteArrayView(*this), ok, base); }
186 [[nodiscard]] qulonglong toULongLong(bool *ok = nullptr, int base = 10) const
187 { return QtPrivate::toIntegral<qulonglong>(QByteArrayView(*this), ok, base); }
188 [[nodiscard]] float toFloat(bool *ok = nullptr) const
189 {
190 const auto r = QtPrivate::toFloat(*this);
191 if (ok)
192 *ok = bool(r);
193 return r.value_or(0.0f);
194 }
195 [[nodiscard]] double toDouble(bool *ok = nullptr) const
196 {
197 const auto r = QtPrivate::toDouble(*this);
198 if (ok)
199 *ok = bool(r);
200 return r.value_or(0.0);
201 }
202
203 using value_type = const char;
210 using difference_type = qsizetype; // violates Container concept requirements
211 using size_type = qsizetype; // violates Container concept requirements
212
213 constexpr const_iterator begin() const noexcept { return data(); }
214 constexpr const_iterator cbegin() const noexcept { return data(); }
215 constexpr const_iterator end() const noexcept { return data() + size(); }
216 constexpr const_iterator cend() const noexcept { return data() + size(); }
217
220
221 const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); }
222 const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); }
223 const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); }
224 const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); }
225
226 [[nodiscard]] constexpr qsizetype max_size() const noexcept { return maxSize(); }
227
228 [[nodiscard]] static constexpr qsizetype maxSize() noexcept
229 {
230 // -1 to deal with the pointer one-past-the-end;
231 return QtPrivate::MaxAllocSize - 1;
232 }
233
234 [[nodiscard]] constexpr QLatin1StringView mid(qsizetype pos, qsizetype n = -1) const
235 {
236 using namespace QtPrivate;
237 auto result = QContainerImplHelper::mid(size(), &pos, &n);
238 return result == QContainerImplHelper::Null ? QLatin1StringView()
239 : QLatin1StringView(m_data + pos, n);
240 }
241 [[nodiscard]] constexpr QLatin1StringView left(qsizetype n) const
242 {
243 if (size_t(n) >= size_t(size()))
244 n = size();
245 return {m_data, n};
246 }
247 [[nodiscard]] constexpr QLatin1StringView right(qsizetype n) const
248 {
249 if (size_t(n) >= size_t(size()))
250 n = size();
251 return {m_data + m_size - n, n};
252 }
253
254 [[nodiscard]] constexpr QLatin1StringView sliced(qsizetype pos) const
255 { verify(pos, 0); return {m_data + pos, m_size - pos}; }
256 [[nodiscard]] constexpr QLatin1StringView sliced(qsizetype pos, qsizetype n) const
257 { verify(pos, n); return {m_data + pos, n}; }
258 [[nodiscard]] constexpr QLatin1StringView first(qsizetype n) const
259 { verify(0, n); return sliced(0, n); }
260 [[nodiscard]] constexpr QLatin1StringView last(qsizetype n) const
261 { verify(0, n); return sliced(size() - n, n); }
262 [[nodiscard]] constexpr QLatin1StringView chopped(qsizetype n) const
263 { verify(0, n); return sliced(0, size() - n); }
264
265 constexpr QLatin1StringView &slice(qsizetype pos)
266 { *this = sliced(pos); return *this; }
267 constexpr QLatin1StringView &slice(qsizetype pos, qsizetype n)
268 { *this = sliced(pos, n); return *this; }
269
270 constexpr void chop(qsizetype n)
271 { verify(0, n); m_size -= n; }
272 constexpr void truncate(qsizetype n)
273 { verify(0, n); m_size = n; }
274
275 [[nodiscard]] QLatin1StringView trimmed() const noexcept { return QtPrivate::trimmed(*this); }
276
277 template <typename Needle, typename...Flags>
278 [[nodiscard]] constexpr auto tokenize(Needle &&needle, Flags...flags) const
279 noexcept(noexcept(qTokenize(std::declval<const QLatin1StringView &>(),
280 std::forward<Needle>(needle), flags...)))
281 -> decltype(qTokenize(*this, std::forward<Needle>(needle), flags...))
282 { return qTokenize(*this, std::forward<Needle>(needle), flags...); }
283
284 friend bool comparesEqual(const QLatin1StringView &s1, const QLatin1StringView &s2) noexcept
285 { return s1.size() == s2.size() && QtPrivate::equalStrings(s1, s2); }
286 friend Qt::strong_ordering
287 compareThreeWay(const QLatin1StringView &s1, const QLatin1StringView &s2) noexcept
288 {
289 const int res = QtPrivate::compareStrings(s1, s2);
290 return Qt::compareThreeWay(res, 0);
291 }
292 Q_DECLARE_STRONGLY_ORDERED(QLatin1StringView)
293
294 // QChar <> QLatin1StringView
295 friend bool comparesEqual(const QLatin1StringView &lhs, QChar rhs) noexcept
296 { return lhs.size() == 1 && rhs == lhs.front(); }
297 friend Qt::strong_ordering
299 {
300 // negate, as the helper function expects QChar as lhs
301 const int res = -compare_helper(&rhs, 1, lhs);
302 return Qt::compareThreeWay(res, 0);
303 }
305
306 // QStringView <> QLatin1StringView
307 friend bool comparesEqual(const QLatin1StringView &lhs, const QStringView &rhs) noexcept
308 { return lhs.size() == rhs.size() && QtPrivate::equalStrings(lhs, rhs); }
309 friend Qt::strong_ordering
311 {
312 const int res = QtPrivate::compareStrings(lhs, rhs);
313 return Qt::compareThreeWay(res, 0);
314 }
316
317 // Reversed helper methods for QStringView <> QLatin1StringView comparison.
318 // If we do not provide them explicitly, QStringView <> QByteArrayView
319 // overloads will be selected, which will provide wrong results, because
320 // they will convert from utf-8
321 friend bool comparesEqual(const QStringView &lhs, const QLatin1StringView &rhs) noexcept
322 { return comparesEqual(rhs, lhs); }
323 friend Qt::strong_ordering
326
327private:
328 friend bool comparesEqual(const QLatin1StringView &lhs, const QByteArrayView &rhs) noexcept
329 { return equal_helper(lhs, rhs.data(), rhs.size()); }
330 friend Qt::strong_ordering
332 {
333 const int res = compare_helper(lhs, rhs.data(), rhs.size());
334 return Qt::compareThreeWay(res, 0);
335 }
336
337 // Reversed helper methods for QByteArrayView <> QLatin1StringView comparison.
338 // If we do not provide them explicitly, QByteArrayView <> QByteArrayView
339 // overloads will be selected, which will provide wrong results
340 friend bool comparesEqual(const QByteArrayView &lhs, const QLatin1StringView &rhs) noexcept
341 { return comparesEqual(rhs, lhs); }
342 friend Qt::strong_ordering
345
346public:
347#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
351#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
352
353private:
355 [[maybe_unused]] qsizetype n = 1) const
356 {
357 Q_ASSERT(pos >= 0);
358 Q_ASSERT(pos <= size());
359 Q_ASSERT(n >= 0);
360 Q_ASSERT(n <= size() - pos);
361 }
362 static int compare_helper(const QLatin1StringView &s1, const char *s2) noexcept
363 { return compare_helper(s1, s2, qstrlen(s2)); }
364 Q_CORE_EXPORT static bool equal_helper(QLatin1StringView s1, const char *s2, qsizetype len) noexcept;
365 Q_CORE_EXPORT static int compare_helper(const QLatin1StringView &s1, const char *s2, qsizetype len) noexcept;
366 Q_CORE_EXPORT static int compare_helper(const QChar *data1, qsizetype length1,
367 QLatin1StringView s2,
368 Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept;
369#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED)
370 const char *m_data = nullptr;
371 qsizetype m_size = 0;
372#else
373 qsizetype m_size;
374 const char *m_data;
375#endif
376
377 friend class QStringView;
378};
379#ifdef Q_L1S_VIEW_IS_PRIMARY
380Q_DECLARE_TYPEINFO(QLatin1StringView, Q_RELOCATABLE_TYPE);
381#else
383#endif
384
385namespace Qt {
386inline namespace Literals {
387inline namespace StringLiterals {
388
389constexpr inline QLatin1StringView operator""_L1(const char *str, size_t size) noexcept
390{
391 return {str, qsizetype(size)};
392}
393
394} // StringLiterals
395} // Literals
396} // Qt
397
398QT_END_NAMESPACE
399
400#ifdef Q_L1S_VIEW_IS_PRIMARY
401# undef Q_L1S_VIEW_IS_PRIMARY
402#endif
403
404#endif // QLATIN1STRINGVIEW_H
const_reverse_iterator rend() const noexcept
long toLong(bool *ok=nullptr, int base=10) const
constexpr QLatin1String(const char *s, qsizetype sz) noexcept
constexpr int compare(QChar c) const noexcept
qulonglong toULongLong(bool *ok=nullptr, int base=10) const
constexpr const_iterator cbegin() const noexcept
qsizetype indexOf(QStringView s, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
constexpr QLatin1StringView mid(qsizetype pos, qsizetype n=-1) const
constexpr bool startsWith(QChar c) const noexcept
constexpr QLatin1StringView & slice(qsizetype pos, qsizetype n)
bool endsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
constexpr QLatin1Char back() const
constexpr void truncate(qsizetype n)
constexpr QLatin1Char at(qsizetype i) const
constexpr const char * constBegin() const noexcept
value_type * pointer
constexpr bool isNull() const noexcept
QLatin1StringView trimmed() const noexcept
constexpr QLatin1String() noexcept
constexpr qsizetype size() const noexcept
const_reverse_iterator crbegin() const noexcept
int compare(QStringView other, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
ulong toULong(bool *ok=nullptr, int base=10) const
double toDouble(bool *ok=nullptr) const
ushort toUShort(bool *ok=nullptr, int base=10) const
const_reverse_iterator rbegin() const noexcept
constexpr QLatin1StringView last(qsizetype n) const
QString toString() const
constexpr const char * latin1() const noexcept
QLatin1String(const QByteArray &s) noexcept
constexpr const_iterator cend() const noexcept
const char value_type
constexpr QLatin1String(const char *f, const char *l)
QByteArray toUtf8() const
constexpr QLatin1Char operator[](qsizetype i) const
qlonglong toLongLong(bool *ok=nullptr, int base=10) const
constexpr QLatin1String(QByteArrayView s) noexcept
value_type & reference
constexpr const char * constData() const noexcept
constexpr QLatin1StringView & slice(qsizetype pos)
short toShort(bool *ok=nullptr, int base=10) const
constexpr QLatin1StringView right(qsizetype n) const
const_reverse_iterator crend() const noexcept
uint toUInt(bool *ok=nullptr, int base=10) const
float toFloat(bool *ok=nullptr) const
qsizetype indexOf(QChar c, qsizetype from=0) const noexcept
qsizetype lastIndexOf(QStringView s, qsizetype from, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
static constexpr qsizetype maxSize() noexcept
QString arg(Args &&...args) const
constexpr QLatin1Char last() const
constexpr bool isEmpty() const noexcept
constexpr qsizetype max_size() const noexcept
constexpr QLatin1String(const char *s) noexcept
constexpr QLatin1StringView left(qsizetype n) const
constexpr auto tokenize(Needle &&needle, Flags...flags) const noexcept(noexcept(qTokenize(std::declval< const QLatin1StringView & >(), std::forward< Needle >(needle), flags...))) -> decltype(qTokenize(*this, std::forward< Needle >(needle), flags...))
bool contains(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
constexpr void chop(qsizetype n)
constexpr const_iterator begin() const noexcept
constexpr const_iterator end() const noexcept
constexpr QLatin1StringView chopped(qsizetype n) const
constexpr bool endsWith(QChar c) const noexcept
constexpr QLatin1StringView first(qsizetype n) const
constexpr const char * data() const noexcept
constexpr QLatin1StringView sliced(qsizetype pos, qsizetype n) const
qsizetype lastIndexOf(QChar c) const noexcept
constexpr QLatin1StringView sliced(qsizetype pos) const
int toInt(bool *ok=nullptr, int base=10) const
constexpr qsizetype length() const noexcept
bool startsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
constexpr bool empty() const noexcept
reference const_reference
constexpr const char * constEnd() const noexcept
value_type * iterator
constexpr QLatin1Char front() const
qsizetype count(QStringView str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
qsizetype lastIndexOf(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
constexpr QLatin1Char first() const
\inmodule QtCore
Definition qstringview.h:77
constexpr QLatin1StringView operator""_L1(const char *str, size_t size) noexcept
Definition qcompare.h:76
bool comparesEqual(const QFileInfo &lhs, const QFileInfo &rhs)
Q_DECLARE_TYPEINFO(QLatin1String, Q_RELOCATABLE_TYPE)
Qt::strong_ordering compareThreeWay(const QByteArrayView &lhs, const QChar &rhs) noexcept
Definition qstring.cpp:6722