Qt 6.x
The Qt SDK
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/qnamespace.h>
12#include <QtCore/qtversionchecks.h>
13#include <QtCore/qstringview.h>
14
15#if 0
16// Workaround for generating forward headers
17#pragma qt_class(QLatin1String)
18#pragma qt_class(QLatin1StringView)
19#endif
20
22
23class QString;
24
25#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED) || defined(Q_QDOC)
26# define Q_L1S_VIEW_IS_PRIMARY
28#else
29class QLatin1String
30#endif
31{
32public:
33#ifdef Q_L1S_VIEW_IS_PRIMARY
34 constexpr QLatin1StringView() noexcept {}
35 constexpr QLatin1StringView(std::nullptr_t) noexcept : QLatin1StringView() {}
36 constexpr explicit QLatin1StringView(const char *s) noexcept
38 constexpr QLatin1StringView(const char *f, const char *l)
39 : QLatin1StringView(f, qsizetype(l - f)) {}
40 constexpr QLatin1StringView(const char *s, qsizetype sz) noexcept : m_data(s), m_size(sz) {}
41 explicit QLatin1StringView(const QByteArray &s) noexcept
42 : QLatin1StringView(s.constData(), s.size()) {}
43 constexpr explicit QLatin1StringView(QByteArrayView s) noexcept
44 : QLatin1StringView(s.constData(), s.size()) {}
45#else
46 constexpr QLatin1String() noexcept : m_size(0), m_data(nullptr) {}
48 constexpr QLatin1String(std::nullptr_t) noexcept : QLatin1String() {}
49 constexpr explicit QLatin1String(const char *s) noexcept
50 : m_size(s ? qsizetype(QtPrivate::lengthHelperPointer(s)) : 0), m_data(s) {}
51 constexpr QLatin1String(const char *f, const char *l)
52 : QLatin1String(f, qsizetype(l - f)) {}
53 constexpr QLatin1String(const char *s, qsizetype sz) noexcept : m_size(sz), m_data(s) {}
54 explicit QLatin1String(const QByteArray &s) noexcept : m_size(s.size()), m_data(s.constData()) {}
55 constexpr explicit QLatin1String(QByteArrayView s) noexcept : m_size(s.size()), m_data(s.data()) {}
56#endif // !Q_L1S_VIEW_IS_PRIMARY
57
58 inline QString toString() const;
59
60 constexpr const char *latin1() const noexcept { return m_data; }
61 constexpr qsizetype size() const noexcept { return m_size; }
62 constexpr const char *data() const noexcept { return m_data; }
63 [[nodiscard]] constexpr const char *constData() const noexcept { return data(); }
64 [[nodiscard]] constexpr const char *constBegin() const noexcept { return begin(); }
65 [[nodiscard]] constexpr const char *constEnd() const noexcept { return end(); }
66
67 [[nodiscard]] constexpr QLatin1Char first() const { return front(); }
68 [[nodiscard]] constexpr QLatin1Char last() const { return back(); }
69
70 [[nodiscard]] constexpr qsizetype length() const noexcept { return size(); }
71
72 constexpr bool isNull() const noexcept { return !data(); }
73 constexpr bool isEmpty() const noexcept { return !size(); }
74
75 [[nodiscard]] constexpr bool empty() const noexcept { return size() == 0; }
76
77 template <typename...Args>
78 [[nodiscard]] inline QString arg(Args &&...args) const;
79
80 [[nodiscard]] constexpr QLatin1Char at(qsizetype i) const
81 {
82 Q_ASSERT(i >= 0);
83 Q_ASSERT(i < size());
84 return QLatin1Char(m_data[i]);
85 }
86 [[nodiscard]] constexpr QLatin1Char operator[](qsizetype i) const { return at(i); }
87
88 [[nodiscard]] constexpr QLatin1Char front() const { return at(0); }
89 [[nodiscard]] constexpr QLatin1Char back() const { return at(size() - 1); }
90
91 [[nodiscard]] int compare(QStringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
92 { return QtPrivate::compareStrings(*this, other, cs); }
94 { return QtPrivate::compareStrings(*this, other, cs); }
95 [[nodiscard]] inline int compare(QUtf8StringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept;
96 [[nodiscard]] constexpr int compare(QChar c) const noexcept
97 { return isEmpty() ? -1 : front() == c ? int(size() > 1) : uchar(m_data[0]) - c.unicode(); }
98 [[nodiscard]] int compare(QChar c, Qt::CaseSensitivity cs) const noexcept
99 { return QtPrivate::compareStrings(*this, QStringView(&c, 1), cs); }
100
101 [[nodiscard]] bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
102 { return QtPrivate::startsWith(*this, s, cs); }
103 [[nodiscard]] bool startsWith(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
104 { return QtPrivate::startsWith(*this, s, cs); }
105 [[nodiscard]] constexpr bool startsWith(QChar c) const noexcept
106 { return !isEmpty() && front() == c; }
107 [[nodiscard]] bool startsWith(QChar c, Qt::CaseSensitivity cs) const noexcept
108 { return QtPrivate::startsWith(*this, QStringView(&c, 1), cs); }
109
110 [[nodiscard]] bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
111 { return QtPrivate::endsWith(*this, s, cs); }
112 [[nodiscard]] bool endsWith(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
113 { return QtPrivate::endsWith(*this, s, cs); }
114 [[nodiscard]] constexpr bool endsWith(QChar c) const noexcept
115 { return !isEmpty() && back() == c; }
116 [[nodiscard]] bool endsWith(QChar c, Qt::CaseSensitivity cs) const noexcept
117 { return QtPrivate::endsWith(*this, QStringView(&c, 1), cs); }
118
119 [[nodiscard]] qsizetype indexOf(QStringView s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
120 { return QtPrivate::findString(*this, from, s, cs); }
122 { return QtPrivate::findString(*this, from, s, cs); }
123 [[nodiscard]] qsizetype indexOf(QChar c, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
124 { return QtPrivate::findString(*this, from, QStringView(&c, 1), cs); }
125
126 [[nodiscard]] bool contains(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
127 { return indexOf(s, 0, cs) != -1; }
128 [[nodiscard]] bool contains(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
129 { return indexOf(s, 0, cs) != -1; }
130 [[nodiscard]] bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
131 { return indexOf(QStringView(&c, 1), 0, cs) != -1; }
132
134 { return lastIndexOf(s, size(), cs); }
136 { return QtPrivate::lastIndexOf(*this, from, s, cs); }
138 { return lastIndexOf(s, size(), cs); }
140 { return QtPrivate::lastIndexOf(*this, from, s, cs); }
142 { return lastIndexOf(c, -1, cs); }
144 { return QtPrivate::lastIndexOf(*this, from, QStringView(&c, 1), cs); }
145
147 { return QtPrivate::count(*this, str, cs); }
149 { return QtPrivate::count(*this, str, cs); }
150 [[nodiscard]] qsizetype count(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
151 { return QtPrivate::count(*this, ch, cs); }
152
153 [[nodiscard]] short toShort(bool *ok = nullptr, int base = 10) const
154 { return QtPrivate::toIntegral<short>(QByteArrayView(*this), ok, base); }
155 [[nodiscard]] ushort toUShort(bool *ok = nullptr, int base = 10) const
156 { return QtPrivate::toIntegral<ushort>(QByteArrayView(*this), ok, base); }
157 [[nodiscard]] int toInt(bool *ok = nullptr, int base = 10) const
158 { return QtPrivate::toIntegral<int>(QByteArrayView(*this), ok, base); }
159 [[nodiscard]] uint toUInt(bool *ok = nullptr, int base = 10) const
160 { return QtPrivate::toIntegral<uint>(QByteArrayView(*this), ok, base); }
161 [[nodiscard]] long toLong(bool *ok = nullptr, int base = 10) const
162 { return QtPrivate::toIntegral<long>(QByteArrayView(*this), ok, base); }
163 [[nodiscard]] ulong toULong(bool *ok = nullptr, int base = 10) const
164 { return QtPrivate::toIntegral<ulong>(QByteArrayView(*this), ok, base); }
165 [[nodiscard]] qlonglong toLongLong(bool *ok = nullptr, int base = 10) const
166 { return QtPrivate::toIntegral<qlonglong>(QByteArrayView(*this), ok, base); }
167 [[nodiscard]] qulonglong toULongLong(bool *ok = nullptr, int base = 10) const
168 { return QtPrivate::toIntegral<qulonglong>(QByteArrayView(*this), ok, base); }
169 [[nodiscard]] float toFloat(bool *ok = nullptr) const
170 {
171 const auto r = QtPrivate::toFloat(*this);
172 if (ok)
173 *ok = bool(r);
174 return r.value_or(0.0f);
175 }
176 [[nodiscard]] double toDouble(bool *ok = nullptr) const
177 {
178 const auto r = QtPrivate::toDouble(*this);
179 if (ok)
180 *ok = bool(r);
181 return r.value_or(0.0);
182 }
183
184 using value_type = const char;
189 using difference_type = qsizetype; // violates Container concept requirements
190 using size_type = qsizetype; // violates Container concept requirements
191
192 constexpr const_iterator begin() const noexcept { return data(); }
193 constexpr const_iterator cbegin() const noexcept { return data(); }
194 constexpr const_iterator end() const noexcept { return data() + size(); }
195 constexpr const_iterator cend() const noexcept { return data() + size(); }
196
197 using reverse_iterator = std::reverse_iterator<iterator>;
199
204
205 [[nodiscard]] constexpr QLatin1StringView mid(qsizetype pos, qsizetype n = -1) const
206 {
207 using namespace QtPrivate;
208 auto result = QContainerImplHelper::mid(size(), &pos, &n);
209 return result == QContainerImplHelper::Null ? QLatin1StringView()
210 : QLatin1StringView(m_data + pos, n);
211 }
212 [[nodiscard]] constexpr QLatin1StringView left(qsizetype n) const
213 {
214 if (size_t(n) >= size_t(size()))
215 n = size();
216 return {m_data, n};
217 }
218 [[nodiscard]] constexpr QLatin1StringView right(qsizetype n) const
219 {
220 if (size_t(n) >= size_t(size()))
221 n = size();
222 return {m_data + m_size - n, n};
223 }
224
225 [[nodiscard]] constexpr QLatin1StringView sliced(qsizetype pos) const
226 { verify(pos); return {m_data + pos, m_size - pos}; }
227 [[nodiscard]] constexpr QLatin1StringView sliced(qsizetype pos, qsizetype n) const
228 { verify(pos, n); return {m_data + pos, n}; }
229 [[nodiscard]] constexpr QLatin1StringView first(qsizetype n) const
230 { verify(n); return {m_data, n}; }
231 [[nodiscard]] constexpr QLatin1StringView last(qsizetype n) const
232 { verify(n); return {m_data + size() - n, n}; }
233 [[nodiscard]] constexpr QLatin1StringView chopped(qsizetype n) const
234 { verify(n); return {m_data, size() - n}; }
235
236 constexpr void chop(qsizetype n)
237 { verify(n); m_size -= n; }
238 constexpr void truncate(qsizetype n)
239 { verify(n); m_size = n; }
240
241 [[nodiscard]] QLatin1StringView trimmed() const noexcept { return QtPrivate::trimmed(*this); }
242
243 template <typename Needle, typename...Flags>
244 [[nodiscard]] constexpr auto tokenize(Needle &&needle, Flags...flags) const
245 noexcept(noexcept(qTokenize(std::declval<const QLatin1StringView &>(),
246 std::forward<Needle>(needle), flags...)))
247 -> decltype(qTokenize(*this, std::forward<Needle>(needle), flags...))
248 { return qTokenize(*this, std::forward<Needle>(needle), flags...); }
249
251 { return QByteArrayView(s1) == QByteArrayView(s2); }
253 { return !(s1 == s2); }
255 {
256 const qsizetype len = qMin(s1.size(), s2.size());
257 const int r = len ? memcmp(s1.latin1(), s2.latin1(), len) : 0;
258 return r < 0 || (r == 0 && s1.size() < s2.size());
259 }
261 { return s2 < s1; }
263 { return !(s1 > s2); }
265 { return !(s1 < s2); }
266
267 // QChar <> QLatin1StringView
268 friend bool operator==(QChar lhs, QLatin1StringView rhs) noexcept { return rhs.size() == 1 && lhs == rhs.front(); }
269 friend bool operator< (QChar lhs, QLatin1StringView rhs) noexcept { return compare_helper(&lhs, 1, rhs) < 0; }
270 friend bool operator> (QChar lhs, QLatin1StringView rhs) noexcept { return compare_helper(&lhs, 1, rhs) > 0; }
271 friend bool operator!=(QChar lhs, QLatin1StringView rhs) noexcept { return !(lhs == rhs); }
272 friend bool operator<=(QChar lhs, QLatin1StringView rhs) noexcept { return !(lhs > rhs); }
273 friend bool operator>=(QChar lhs, QLatin1StringView rhs) noexcept { return !(lhs < rhs); }
274
275 friend bool operator==(QLatin1StringView lhs, QChar rhs) noexcept { return rhs == lhs; }
276 friend bool operator!=(QLatin1StringView lhs, QChar rhs) noexcept { return !(rhs == lhs); }
277 friend bool operator< (QLatin1StringView lhs, QChar rhs) noexcept { return rhs > lhs; }
278 friend bool operator> (QLatin1StringView lhs, QChar rhs) noexcept { return rhs < lhs; }
279 friend bool operator<=(QLatin1StringView lhs, QChar rhs) noexcept { return !(rhs < lhs); }
280 friend bool operator>=(QLatin1StringView lhs, QChar rhs) noexcept { return !(rhs > lhs); }
281
282 // QStringView <> QLatin1StringView
283 friend bool operator==(QStringView lhs, QLatin1StringView rhs) noexcept
284 { return lhs.size() == rhs.size() && QtPrivate::equalStrings(lhs, rhs); }
285 friend bool operator!=(QStringView lhs, QLatin1StringView rhs) noexcept { return !(lhs == rhs); }
286 friend bool operator< (QStringView lhs, QLatin1StringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) < 0; }
287 friend bool operator<=(QStringView lhs, QLatin1StringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) <= 0; }
288 friend bool operator> (QStringView lhs, QLatin1StringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) > 0; }
289 friend bool operator>=(QStringView lhs, QLatin1StringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) >= 0; }
290
291 friend bool operator==(QLatin1StringView lhs, QStringView rhs) noexcept
292 { return lhs.size() == rhs.size() && QtPrivate::equalStrings(lhs, rhs); }
293 friend bool operator!=(QLatin1StringView lhs, QStringView rhs) noexcept { return !(lhs == rhs); }
294 friend bool operator< (QLatin1StringView lhs, QStringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) < 0; }
295 friend bool operator<=(QLatin1StringView lhs, QStringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) <= 0; }
296 friend bool operator> (QLatin1StringView lhs, QStringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) > 0; }
297 friend bool operator>=(QLatin1StringView lhs, QStringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) >= 0; }
298
299
300#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
301 QT_ASCII_CAST_WARN inline bool operator==(const char *s) const;
302 QT_ASCII_CAST_WARN inline bool operator!=(const char *s) const;
303 QT_ASCII_CAST_WARN inline bool operator<(const char *s) const;
304 QT_ASCII_CAST_WARN inline bool operator>(const char *s) const;
305 QT_ASCII_CAST_WARN inline bool operator<=(const char *s) const;
306 QT_ASCII_CAST_WARN inline bool operator>=(const char *s) const;
307
308 QT_ASCII_CAST_WARN inline bool operator==(const QByteArray &s) const;
309 QT_ASCII_CAST_WARN inline bool operator!=(const QByteArray &s) const;
310 QT_ASCII_CAST_WARN inline bool operator<(const QByteArray &s) const;
311 QT_ASCII_CAST_WARN inline bool operator>(const QByteArray &s) const;
312 QT_ASCII_CAST_WARN inline bool operator<=(const QByteArray &s) const;
313 QT_ASCII_CAST_WARN inline bool operator>=(const QByteArray &s) const;
314
315 QT_ASCII_CAST_WARN friend bool operator==(const char *s1, QLatin1StringView s2) { return compare_helper(s2, s1) == 0; }
316 QT_ASCII_CAST_WARN friend bool operator!=(const char *s1, QLatin1StringView s2) { return compare_helper(s2, s1) != 0; }
317 QT_ASCII_CAST_WARN friend bool operator< (const char *s1, QLatin1StringView s2) { return compare_helper(s2, s1) > 0; }
318 QT_ASCII_CAST_WARN friend bool operator> (const char *s1, QLatin1StringView s2) { return compare_helper(s2, s1) < 0; }
319 QT_ASCII_CAST_WARN friend bool operator<=(const char *s1, QLatin1StringView s2) { return compare_helper(s2, s1) >= 0; }
320 QT_ASCII_CAST_WARN friend bool operator>=(const char *s1, QLatin1StringView s2) { return compare_helper(s2, s1) <= 0; }
321#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
322
323private:
324 Q_ALWAYS_INLINE constexpr void verify(qsizetype pos, qsizetype n = 0) 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 int compare_helper(const QLatin1StringView &s1, const char *s2, qsizetype len) noexcept;
334 Q_CORE_EXPORT static int compare_helper(const QChar *data1, qsizetype length1,
337#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED)
338 const char *m_data = nullptr;
339 qsizetype m_size = 0;
340#else
341 qsizetype m_size;
342 const char *m_data;
343#endif
344};
345#ifdef Q_L1S_VIEW_IS_PRIMARY
347#else
349#endif
350
351namespace Qt {
352inline namespace Literals {
353inline namespace StringLiterals {
354
355constexpr inline QLatin1StringView operator"" _L1(const char *str, size_t size) noexcept
356{
357 return {str, qsizetype(size)};
358}
359
360} // StringLiterals
361} // Literals
362} // Qt
363
365
366#ifdef Q_L1S_VIEW_IS_PRIMARY
367# undef Q_L1S_VIEW_IS_PRIMARY
368#endif
369
370#endif // QLATIN1STRINGVIEW_H
NSData * m_data
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
Definition qchar.h:48
qsizetype indexOf(QLatin1StringView s, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
constexpr int compare(QChar c) const noexcept
QT_ASCII_CAST_WARN friend bool operator>=(const char *s1, QLatin1StringView s2)
qsizetype count(QChar ch, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
friend bool operator<=(QLatin1StringView s1, QLatin1StringView s2) noexcept
QT_ASCII_CAST_WARN friend bool operator==(const char *s1, QLatin1StringView s2)
constexpr QLatin1Char back() const
constexpr const char * data() const noexcept
constexpr const char * constBegin() const noexcept
friend bool operator<=(QChar lhs, QLatin1StringView rhs) noexcept
friend bool operator!=(QLatin1StringView lhs, QChar rhs) noexcept
qsizetype lastIndexOf(QLatin1StringView s, qsizetype from, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QT_ASCII_CAST_WARN friend bool operator<=(const char *s1, QLatin1StringView s2)
friend bool operator>=(QLatin1StringView lhs, QStringView rhs) noexcept
friend bool operator==(QChar lhs, QLatin1StringView rhs) noexcept
ulong toULong(bool *ok=nullptr, int base=10) const
const_reverse_iterator rend() const noexcept
constexpr bool isEmpty() const noexcept
friend bool operator>=(QLatin1StringView s1, QLatin1StringView s2) noexcept
short toShort(bool *ok=nullptr, int base=10) const
std::reverse_iterator< iterator > reverse_iterator
friend bool operator<=(QLatin1StringView lhs, QStringView rhs) noexcept
constexpr qsizetype length() const noexcept
constexpr const char * latin1() const noexcept
friend bool operator>=(QChar lhs, QLatin1StringView rhs) noexcept
constexpr QLatin1StringView last(qsizetype n) const
QString toString() const
Definition qstring.h:1001
constexpr const_iterator cbegin() const noexcept
constexpr bool endsWith(QChar c) const 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...))
friend bool operator<=(QStringView lhs, QLatin1StringView rhs) noexcept
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
friend bool operator==(QLatin1StringView lhs, QStringView rhs) 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 operator>(QLatin1StringView s1, QLatin1StringView s2) noexcept
constexpr void chop(qsizetype n)
friend bool operator!=(QStringView lhs, QLatin1StringView rhs) noexcept
qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
friend bool operator>=(QStringView lhs, QLatin1StringView rhs) 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
friend bool operator!=(QChar lhs, QLatin1StringView rhs) noexcept
friend bool operator!=(QLatin1StringView s1, QLatin1StringView s2) noexcept
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
friend bool operator==(QLatin1StringView lhs, QChar rhs) 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 bool operator==(QStringView lhs, QLatin1StringView rhs) noexcept
constexpr QLatin1StringView(const char *s, qsizetype sz) noexcept
friend bool operator!=(QLatin1StringView lhs, QStringView rhs) noexcept
friend bool operator>=(QLatin1StringView lhs, QChar rhs) noexcept
bool endsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
qsizetype count(QLatin1StringView str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
friend bool operator==(QLatin1StringView s1, QLatin1StringView s2) 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
QT_ASCII_CAST_WARN friend bool operator!=(const char *s1, QLatin1StringView s2)
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
friend bool operator<(QLatin1StringView s1, QLatin1StringView s2) 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
friend bool operator<=(QLatin1StringView lhs, QChar rhs) noexcept
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
\inmodule QtCore
Definition qstringview.h:76
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
#define this
Definition dialogs.cpp:9
QString str
[2]
Combined button and popup list for selecting options.
\macro QT_NAMESPACE
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 lastIndexOf(QByteArrayView haystack, qsizetype from, QByteArrayView needle) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype count(QByteArrayView haystack, QByteArrayView needle) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool equalStrings(QStringView lhs, QStringView rhs) noexcept
Definition qstring.cpp:1405
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype findString(QStringView haystack, qsizetype from, QStringView needle, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
Definition qstring.cpp:9631
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
CaseSensitivity
@ CaseSensitive
size_t qstrlen(const char *str)
#define Q_WEAK_OVERLOAD
#define Q_ALWAYS_INLINE
Flags
constexpr const T & qMin(const T &a, const T &b)
Definition qminmax.h:40
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
const GLubyte * c
GLenum GLsizei len
GLuint64EXT * result
[6]
GLdouble s
[6]
Definition qopenglext.h:235
#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 s1
#define QT_ASCII_CAST_WARN
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:145
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:163
unsigned char uchar
Definition qtypes.h:27
unsigned long ulong
Definition qtypes.h:30
quint64 qulonglong
Definition qtypes.h:59
ptrdiff_t qsizetype
Definition qtypes.h:70
unsigned int uint
Definition qtypes.h:29
unsigned short ushort
Definition qtypes.h:28
qint64 qlonglong
Definition qtypes.h:58
QSharedPointer< T > other(t)
[5]
QAction * at
QJSValueList args
\inmodule QtCore \reentrant
Definition qchar.h:17