Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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/qnamespace.h>
13#include <QtCore/qtversionchecks.h>
14#include <QtCore/qstringview.h>
15
16#if 0
17// Workaround for generating forward headers
18#pragma qt_class(QLatin1String)
19#pragma qt_class(QLatin1StringView)
20#endif
21
23
24class QString;
25
26#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED) || defined(Q_QDOC)
27# define Q_L1S_VIEW_IS_PRIMARY
29#else
30class QLatin1String
31#endif
32{
33public:
34#ifdef Q_L1S_VIEW_IS_PRIMARY
35 constexpr QLatin1StringView() noexcept {}
36 constexpr QLatin1StringView(std::nullptr_t) noexcept : QLatin1StringView() {}
37 constexpr explicit QLatin1StringView(const char *s) noexcept
39 constexpr QLatin1StringView(const char *f, const char *l)
40 : QLatin1StringView(f, qsizetype(l - f)) {}
41 constexpr QLatin1StringView(const char *s, qsizetype sz) noexcept : m_data(s), m_size(sz) {}
42 explicit QLatin1StringView(const QByteArray &s) noexcept
43 : QLatin1StringView(s.constData(), s.size()) {}
44 constexpr explicit QLatin1StringView(QByteArrayView s) noexcept
45 : QLatin1StringView(s.constData(), s.size()) {}
46#else
47 constexpr QLatin1String() noexcept : m_size(0), m_data(nullptr) {}
49 constexpr QLatin1String(std::nullptr_t) noexcept : QLatin1String() {}
50 constexpr explicit QLatin1String(const char *s) noexcept
51 : m_size(s ? qsizetype(QtPrivate::lengthHelperPointer(s)) : 0), m_data(s) {}
52 constexpr QLatin1String(const char *f, const char *l)
53 : QLatin1String(f, qsizetype(l - f)) {}
54 constexpr QLatin1String(const char *s, qsizetype sz) noexcept : m_size(sz), m_data(s) {}
55 explicit QLatin1String(const QByteArray &s) noexcept : m_size(s.size()), m_data(s.constData()) {}
56 constexpr explicit QLatin1String(QByteArrayView s) noexcept : m_size(s.size()), m_data(s.data()) {}
57#endif // !Q_L1S_VIEW_IS_PRIMARY
58
59 inline QString toString() const;
60
61 constexpr const char *latin1() const noexcept { return m_data; }
62 constexpr qsizetype size() const noexcept { return m_size; }
63 constexpr const char *data() const noexcept { return m_data; }
64 [[nodiscard]] constexpr const char *constData() const noexcept { return data(); }
65 [[nodiscard]] constexpr const char *constBegin() const noexcept { return begin(); }
66 [[nodiscard]] constexpr const char *constEnd() const noexcept { return end(); }
67
68 [[nodiscard]] constexpr QLatin1Char first() const { return front(); }
69 [[nodiscard]] constexpr QLatin1Char last() const { return back(); }
70
71 [[nodiscard]] constexpr qsizetype length() const noexcept { return size(); }
72
73 constexpr bool isNull() const noexcept { return !data(); }
74 constexpr bool isEmpty() const noexcept { return !size(); }
75
76 [[nodiscard]] constexpr bool empty() const noexcept { return size() == 0; }
77
78 template <typename...Args>
79 [[nodiscard]] inline QString arg(Args &&...args) const;
80
81 [[nodiscard]] constexpr QLatin1Char at(qsizetype i) const
82 {
83 Q_ASSERT(i >= 0);
84 Q_ASSERT(i < size());
85 return QLatin1Char(m_data[i]);
86 }
87 [[nodiscard]] constexpr QLatin1Char operator[](qsizetype i) const { return at(i); }
88
89 [[nodiscard]] constexpr QLatin1Char front() const { return at(0); }
90 [[nodiscard]] constexpr QLatin1Char back() const { return at(size() - 1); }
91
92 [[nodiscard]] int compare(QStringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
93 { return QtPrivate::compareStrings(*this, other, cs); }
95 { return QtPrivate::compareStrings(*this, other, cs); }
96 [[nodiscard]] inline int compare(QUtf8StringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept;
97 [[nodiscard]] constexpr int compare(QChar c) const noexcept
98 { return isEmpty() ? -1 : front() == c ? int(size() > 1) : uchar(m_data[0]) - c.unicode(); }
99 [[nodiscard]] int compare(QChar c, Qt::CaseSensitivity cs) const noexcept
100 { return QtPrivate::compareStrings(*this, QStringView(&c, 1), cs); }
101
102 [[nodiscard]] bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
103 { return QtPrivate::startsWith(*this, s, cs); }
104 [[nodiscard]] bool startsWith(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
105 { return QtPrivate::startsWith(*this, s, cs); }
106 [[nodiscard]] constexpr bool startsWith(QChar c) const noexcept
107 { return !isEmpty() && front() == c; }
108 [[nodiscard]] bool startsWith(QChar c, Qt::CaseSensitivity cs) const noexcept
109 { return QtPrivate::startsWith(*this, QStringView(&c, 1), cs); }
110
111 [[nodiscard]] bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
112 { return QtPrivate::endsWith(*this, s, cs); }
113 [[nodiscard]] bool endsWith(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
114 { return QtPrivate::endsWith(*this, s, cs); }
115 [[nodiscard]] constexpr bool endsWith(QChar c) const noexcept
116 { return !isEmpty() && back() == c; }
117 [[nodiscard]] bool endsWith(QChar c, Qt::CaseSensitivity cs) const noexcept
118 { return QtPrivate::endsWith(*this, QStringView(&c, 1), cs); }
119
120 [[nodiscard]] qsizetype indexOf(QStringView s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
121 { return QtPrivate::findString(*this, from, s, cs); }
123 { return QtPrivate::findString(*this, from, s, cs); }
124 [[nodiscard]] qsizetype indexOf(QChar c, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
125 { return QtPrivate::findString(*this, from, QStringView(&c, 1), cs); }
126
127 [[nodiscard]] bool contains(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
128 { return indexOf(s, 0, cs) != -1; }
129 [[nodiscard]] bool contains(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
130 { return indexOf(s, 0, cs) != -1; }
131 [[nodiscard]] bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
132 { return indexOf(QStringView(&c, 1), 0, cs) != -1; }
133
135 { return lastIndexOf(s, size(), cs); }
137 { return QtPrivate::lastIndexOf(*this, from, s, cs); }
139 { return lastIndexOf(s, size(), cs); }
141 { return QtPrivate::lastIndexOf(*this, from, s, cs); }
143 { return lastIndexOf(c, -1, cs); }
145 { return QtPrivate::lastIndexOf(*this, from, QStringView(&c, 1), cs); }
146
148 { return QtPrivate::count(*this, str, cs); }
150 { return QtPrivate::count(*this, str, cs); }
151 [[nodiscard]] qsizetype count(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
152 { return QtPrivate::count(*this, ch, cs); }
153
154 [[nodiscard]] short toShort(bool *ok = nullptr, int base = 10) const
155 { return QtPrivate::toIntegral<short>(QByteArrayView(*this), ok, base); }
156 [[nodiscard]] ushort toUShort(bool *ok = nullptr, int base = 10) const
157 { return QtPrivate::toIntegral<ushort>(QByteArrayView(*this), ok, base); }
158 [[nodiscard]] int toInt(bool *ok = nullptr, int base = 10) const
159 { return QtPrivate::toIntegral<int>(QByteArrayView(*this), ok, base); }
160 [[nodiscard]] uint toUInt(bool *ok = nullptr, int base = 10) const
161 { return QtPrivate::toIntegral<uint>(QByteArrayView(*this), ok, base); }
162 [[nodiscard]] long toLong(bool *ok = nullptr, int base = 10) const
163 { return QtPrivate::toIntegral<long>(QByteArrayView(*this), ok, base); }
164 [[nodiscard]] ulong toULong(bool *ok = nullptr, int base = 10) const
165 { return QtPrivate::toIntegral<ulong>(QByteArrayView(*this), ok, base); }
166 [[nodiscard]] qlonglong toLongLong(bool *ok = nullptr, int base = 10) const
167 { return QtPrivate::toIntegral<qlonglong>(QByteArrayView(*this), ok, base); }
168 [[nodiscard]] qulonglong toULongLong(bool *ok = nullptr, int base = 10) const
169 { return QtPrivate::toIntegral<qulonglong>(QByteArrayView(*this), ok, base); }
170 [[nodiscard]] float toFloat(bool *ok = nullptr) const
171 {
172 const auto r = QtPrivate::toFloat(*this);
173 if (ok)
174 *ok = bool(r);
175 return r.value_or(0.0f);
176 }
177 [[nodiscard]] double toDouble(bool *ok = nullptr) const
178 {
179 const auto r = QtPrivate::toDouble(*this);
180 if (ok)
181 *ok = bool(r);
182 return r.value_or(0.0);
183 }
184
185 using value_type = const char;
192 using difference_type = qsizetype; // violates Container concept requirements
193 using size_type = qsizetype; // violates Container concept requirements
194
195 constexpr const_iterator begin() const noexcept { return data(); }
196 constexpr const_iterator cbegin() const noexcept { return data(); }
197 constexpr const_iterator end() const noexcept { return data() + size(); }
198 constexpr const_iterator cend() const noexcept { return data() + size(); }
199
200 using reverse_iterator = std::reverse_iterator<iterator>;
202
207
208 [[nodiscard]] constexpr QLatin1StringView mid(qsizetype pos, qsizetype n = -1) const
209 {
210 using namespace QtPrivate;
211 auto result = QContainerImplHelper::mid(size(), &pos, &n);
212 return result == QContainerImplHelper::Null ? QLatin1StringView()
213 : QLatin1StringView(m_data + pos, n);
214 }
215 [[nodiscard]] constexpr QLatin1StringView left(qsizetype n) const
216 {
217 if (size_t(n) >= size_t(size()))
218 n = size();
219 return {m_data, n};
220 }
221 [[nodiscard]] constexpr QLatin1StringView right(qsizetype n) const
222 {
223 if (size_t(n) >= size_t(size()))
224 n = size();
225 return {m_data + m_size - n, n};
226 }
227
228 [[nodiscard]] constexpr QLatin1StringView sliced(qsizetype pos) const
229 { verify(pos, 0); return {m_data + pos, m_size - pos}; }
230 [[nodiscard]] constexpr QLatin1StringView sliced(qsizetype pos, qsizetype n) const
231 { verify(pos, n); return {m_data + pos, n}; }
232 [[nodiscard]] constexpr QLatin1StringView first(qsizetype n) const
233 { verify(0, n); return sliced(0, n); }
234 [[nodiscard]] constexpr QLatin1StringView last(qsizetype n) const
235 { verify(0, n); return sliced(size() - n, n); }
236 [[nodiscard]] constexpr QLatin1StringView chopped(qsizetype n) const
237 { verify(0, n); return sliced(0, size() - n); }
238
239 constexpr void chop(qsizetype n)
240 { verify(0, n); m_size -= n; }
241 constexpr void truncate(qsizetype n)
242 { verify(0, n); m_size = n; }
243
244 [[nodiscard]] QLatin1StringView trimmed() const noexcept { return QtPrivate::trimmed(*this); }
245
246 template <typename Needle, typename...Flags>
247 [[nodiscard]] constexpr auto tokenize(Needle &&needle, Flags...flags) const
248 noexcept(noexcept(qTokenize(std::declval<const QLatin1StringView &>(),
249 std::forward<Needle>(needle), flags...)))
250 -> decltype(qTokenize(*this, std::forward<Needle>(needle), flags...))
251 { return qTokenize(*this, std::forward<Needle>(needle), flags...); }
252
253 friend bool comparesEqual(const QLatin1StringView &s1, const QLatin1StringView &s2) noexcept
254 { return s1.size() == s2.size() && QtPrivate::equalStrings(s1, s2); }
257 {
258 const int res = QtPrivate::compareStrings(s1, s2);
259 return Qt::compareThreeWay(res, 0);
260 }
262
263 // QChar <> QLatin1StringView
264 friend bool comparesEqual(const QLatin1StringView &lhs, QChar rhs) noexcept
265 { return lhs.size() == 1 && rhs == lhs.front(); }
267 compareThreeWay(const QLatin1StringView &lhs, QChar rhs) noexcept
268 {
269 // negate, as the helper function expects QChar as lhs
270 const int res = -compare_helper(&rhs, 1, lhs);
271 return Qt::compareThreeWay(res, 0);
272 }
274
275 // QStringView <> QLatin1StringView
276 friend bool comparesEqual(const QLatin1StringView &lhs, const QStringView &rhs) noexcept
277 { return lhs.size() == rhs.size() && QtPrivate::equalStrings(lhs, rhs); }
279 compareThreeWay(const QLatin1StringView &lhs, const QStringView &rhs) noexcept
280 {
281 const int res = QtPrivate::compareStrings(lhs, rhs);
282 return Qt::compareThreeWay(res, 0);
283 }
285
286 // Reversed helper methods for QStringView <> QLatin1StringView comparison.
287 // If we do not provide them explicitly, QStringView <> QByteArrayView
288 // overloads will be selected, which will provide wrong results, because
289 // they will convert from utf-8
290 friend bool comparesEqual(const QStringView &lhs, const QLatin1StringView &rhs) noexcept
291 { return comparesEqual(rhs, lhs); }
293 compareThreeWay(const QStringView &lhs, const QLatin1StringView &rhs) noexcept
294 { return QtOrderingPrivate::reversed(compareThreeWay(rhs, lhs)); }
295
296private:
297 friend bool comparesEqual(const QLatin1StringView &lhs, const QByteArrayView &rhs) noexcept
298 { return equal_helper(lhs, rhs.data(), rhs.size()); }
300 compareThreeWay(const QLatin1StringView &lhs, const QByteArrayView &rhs) noexcept
301 {
302 const int res = compare_helper(lhs, rhs.data(), rhs.size());
303 return Qt::compareThreeWay(res, 0);
304 }
305
306 // Reversed helper methods for QByteArrayView <> QLatin1StringView comparison.
307 // If we do not provide them explicitly, QByteArrayView <> QByteArrayView
308 // overloads will be selected, which will provide wrong results
309 friend bool comparesEqual(const QByteArrayView &lhs, const QLatin1StringView &rhs) noexcept
310 { return comparesEqual(rhs, lhs); }
312 compareThreeWay(const QByteArrayView &lhs, const QLatin1StringView &rhs) noexcept
313 { return QtOrderingPrivate::reversed(compareThreeWay(rhs, lhs)); }
314
315public:
316#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
320#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
321
322private:
323 Q_ALWAYS_INLINE constexpr void verify([[maybe_unused]] qsizetype pos,
324 [[maybe_unused]] qsizetype n = 1) const
325 {
326 Q_ASSERT(pos >= 0);
327 Q_ASSERT(pos <= size());
328 Q_ASSERT(n >= 0);
329 Q_ASSERT(n <= size() - pos);
330 }
331 static int compare_helper(const QLatin1StringView &s1, const char *s2) noexcept
332 { return compare_helper(s1, s2, qstrlen(s2)); }
333 Q_CORE_EXPORT static bool equal_helper(QLatin1StringView s1, const char *s2, qsizetype len) noexcept;
334 Q_CORE_EXPORT static int compare_helper(const QLatin1StringView &s1, const char *s2, qsizetype len) noexcept;
335 Q_CORE_EXPORT static int compare_helper(const QChar *data1, qsizetype length1,
338#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED)
339 const char *m_data = nullptr;
340 qsizetype m_size = 0;
341#else
342 qsizetype m_size;
343 const char *m_data;
344#endif
345};
346#ifdef Q_L1S_VIEW_IS_PRIMARY
348#else
350#endif
351
353 : QByteArrayView(v.data(), v.size())
354{}
355
356namespace Qt {
357inline namespace Literals {
358inline namespace StringLiterals {
359
360constexpr inline QLatin1StringView operator""_L1(const char *str, size_t size) noexcept
361{
362 return {str, qsizetype(size)};
363}
364
365} // StringLiterals
366} // Literals
367} // Qt
368
370
371#ifdef Q_L1S_VIEW_IS_PRIMARY
372# undef Q_L1S_VIEW_IS_PRIMARY
373#endif
374
375#endif // QLATIN1STRINGVIEW_H
NSData * m_data
constexpr QByteArrayView() noexcept
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
qsizetype indexOf(QLatin1StringView s, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
constexpr int compare(QChar c) const noexcept
friend Qt::strong_ordering compareThreeWay(const QLatin1StringView &s1, const QLatin1StringView &s2) noexcept
qsizetype count(QChar ch, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
friend Qt::strong_ordering compareThreeWay(const QLatin1StringView &lhs, const QByteArrayView &rhs) noexcept
constexpr QLatin1Char back() const
friend bool comparesEqual(const QLatin1StringView &s1, const QLatin1StringView &s2) noexcept
constexpr const char * data() const noexcept
constexpr const char * constBegin() const noexcept
friend Qt::strong_ordering compareThreeWay(const QStringView &lhs, const QLatin1StringView &rhs) noexcept
qsizetype lastIndexOf(QLatin1StringView s, qsizetype from, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
ulong toULong(bool *ok=nullptr, int base=10) const
const_reverse_iterator rend() const noexcept
constexpr bool isEmpty() const noexcept
friend Qt::strong_ordering compareThreeWay(const QLatin1StringView &lhs, QChar rhs) noexcept
short toShort(bool *ok=nullptr, int base=10) const
std::reverse_iterator< iterator > reverse_iterator
constexpr qsizetype length() const noexcept
constexpr const char * latin1() const noexcept
constexpr QLatin1StringView last(qsizetype n) const
QString toString() const
Definition qstring.h:1108
constexpr const_iterator cbegin() const noexcept
constexpr bool endsWith(QChar c) const noexcept
friend bool comparesEqual(const QLatin1StringView &lhs, const QByteArrayView &rhs) noexcept
constexpr const char * constData() const noexcept
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...))
const_reverse_iterator crend() const noexcept
constexpr QLatin1StringView mid(qsizetype pos, qsizetype n=-1) const
bool contains(QLatin1StringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
constexpr QLatin1StringView(const char *f, const char *l)
constexpr bool isNull() const noexcept
constexpr QLatin1Char front() const
bool endsWith(QChar c, Qt::CaseSensitivity cs) const noexcept
bool endsWith(QLatin1StringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
bool startsWith(QChar c, Qt::CaseSensitivity cs) const noexcept
constexpr QLatin1StringView left(qsizetype n) const
qsizetype count(QStringView str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
int compare(QChar c, Qt::CaseSensitivity cs) const noexcept
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
friend bool comparesEqual(const QByteArrayView &lhs, const QLatin1StringView &rhs) noexcept
constexpr void chop(qsizetype n)
qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
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
qsizetype lastIndexOf(QLatin1StringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) 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(const char *s) noexcept
QLatin1StringView(const QByteArray &s) noexcept
constexpr QLatin1StringView sliced(qsizetype pos) const
constexpr QLatin1Char at(qsizetype i) const
bool contains(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
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
friend Qt::strong_ordering compareThreeWay(const QByteArrayView &lhs, const QLatin1StringView &rhs) noexcept
constexpr QLatin1StringView(const char *s, qsizetype sz) noexcept
bool endsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
qsizetype count(QLatin1StringView str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
constexpr QLatin1Char operator[](qsizetype i) const
constexpr const_iterator begin() const noexcept
constexpr QLatin1StringView first(qsizetype n) const
friend Qt::strong_ordering compareThreeWay(const QLatin1StringView &lhs, const QStringView &rhs) noexcept
const_reverse_iterator rbegin() const noexcept
uint toUInt(bool *ok=nullptr, int base=10) const
QString arg(Args &&...args) const
constexpr qsizetype size() const noexcept
reverse_iterator const_reverse_iterator
qsizetype indexOf(QStringView s, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
constexpr QLatin1StringView(std::nullptr_t) noexcept
constexpr bool startsWith(QChar c) const noexcept
constexpr const char * constEnd() const noexcept
qsizetype lastIndexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
bool startsWith(QLatin1StringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
double toDouble(bool *ok=nullptr) const
bool startsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
constexpr void truncate(qsizetype n)
constexpr QLatin1StringView() noexcept
qulonglong toULongLong(bool *ok=nullptr, int base=10) const
constexpr QLatin1StringView(QByteArrayView s) noexcept
int compare(QLatin1StringView other, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
ushort toUShort(bool *ok=nullptr, int base=10) const
qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
\inmodule QtCore
Definition qstringview.h:78
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore \title Classes and helpers for defining comparison operators \keyword qtcompare
Definition qcompare.h:400
#define this
Definition dialogs.cpp:9
QString str
[2]
Combined button and popup list for selecting options.
constexpr O reversed(O o) noexcept
Definition qcompare.h:53
\macro QT_NO_KEYWORDS >
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype lastIndexOf(QByteArrayView haystack, qsizetype from, char needle) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QByteArrayView haystack, QByteArrayView needle) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION QByteArrayView trimmed(QByteArrayView s) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QByteArrayView haystack, QByteArrayView needle) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype count(QByteArrayView haystack, QByteArrayView needle) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool equalStrings(QStringView lhs, QStringView rhs) noexcept
Definition qstring.cpp:1393
qsizetype findString(QStringView str, qsizetype from, QChar needle, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION ParsedNumber< float > toFloat(QByteArrayView a) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION ParsedNumber< double > toDouble(QByteArrayView a) noexcept
static constexpr qsizetype lengthHelperPointer(const Char *data) noexcept
Definition qcompare.h:63
constexpr Qt::strong_ordering compareThreeWay(LeftInt lhs, RightInt rhs) noexcept
CaseSensitivity
@ CaseSensitive
size_t qstrlen(const char *str)
#define Q_DECLARE_STRONGLY_ORDERED(...)
#define Q_WEAK_OVERLOAD
#define Q_ALWAYS_INLINE
Flags
GLsizei const GLfloat * v
[13]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLboolean r
[2]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
GLfloat GLfloat f
GLbitfield flags
GLfloat n
GLdouble s
[6]
Definition qopenglext.h:235
GLuint res
const GLubyte * c
GLuint64EXT * result
[6]
GLenum GLsizei len
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
QLatin1StringView QLatin1String
Definition qstringfwd.h:31
constexpr auto qTokenize(Haystack &&h, Needle &&n, Flags...flags) noexcept(QtPrivate::Tok::is_nothrow_constructible_from< Haystack, Needle >::value) -> decltype(QtPrivate::Tok::TokenizerResult< Haystack, Needle >{std::forward< Haystack >(h), std::forward< Needle >(n), flags...})
#define s2
#define QT_ASCII_CAST_WARN
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:158
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:180
unsigned char uchar
Definition qtypes.h:32
unsigned long ulong
Definition qtypes.h:35
quint64 qulonglong
Definition qtypes.h:64
ptrdiff_t qsizetype
Definition qtypes.h:165
unsigned int uint
Definition qtypes.h:34
unsigned short ushort
Definition qtypes.h:33
qint64 qlonglong
Definition qtypes.h:63
static const uint base
Definition qurlidna.cpp:20
QSharedPointer< T > other(t)
[5]
QAction * at
QJSValueList args
\inmodule QtCore \reentrant
Definition qchar.h:18