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