1 /*
2  * DQt - D bindings for the Qt Toolkit
3  *
4  * GNU Lesser General Public License Usage
5  * This file may be used under the terms of the GNU Lesser
6  * General Public License version 3 as published by the Free Software
7  * Foundation and appearing in the file LICENSE.LGPL3 included in the
8  * packaging of this file. Please review the following information to
9  * ensure the GNU Lesser General Public License version 3 requirements
10  * will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
11  */
12 module qt.core..string;
13 extern(C++):
14 
15 import core.stdc.config;
16 import core.stdc.stddef;
17 import core.vararg;
18 import qt.config;
19 import qt.core.arraydata;
20 import qt.core.bytearray;
21 import qt.core.bytearrayview;
22 import qt.core.flags;
23 import qt.core.global;
24 import qt.core.list;
25 import qt.core.namespace;
26 import qt.core.qchar;
27 import qt.core.regularexpression;
28 import qt.core.stringlist;
29 import qt.core.stringliteral;
30 import qt.core.stringview;
31 import qt.core.typeinfo;
32 import qt.helpers;
33 
34 /+ #if defined(QT_NO_CAST_FROM_ASCII) && defined(QT_RESTRICTED_CAST_FROM_ASCII)
35 #error QT_NO_CAST_FROM_ASCII and QT_RESTRICTED_CAST_FROM_ASCII must not be defined at the same time
36 #endif
37 
38 #ifdef truncate
39 #error qstring.h must be included before any header file that defines truncate
40 #endif
41 
42 #if defined(Q_OS_DARWIN) || defined(Q_QDOC)
43 Q_FORWARD_DECLARE_CF_TYPE(CFString);
44 Q_FORWARD_DECLARE_OBJC_CLASS(NSString);
45 #endif
46 
47 
48 
49 namespace QtPrivate {
50 template <bool...B> class BoolList;
51 } +/
52 
53 /// Binding for C++ class [QLatin1String](https://doc.qt.io/qt-6/qlatin1string.html).
54 @Q_RELOCATABLE_TYPE extern(C++, class) struct QLatin1String
55 {
56 public:
57     @disable this();
58     /+pragma(inline, true) this()/+ noexcept+/
59     {
60         this.m_size = 0;
61         this.m_data = null;
62     }+/
63     /+ explicit +/pragma(inline, true) this(const(char)* s)/+ noexcept+/
64     {
65         import core.stdc.string;
66         this.m_size = s ? qsizetype(strlen(s)) : 0;
67         this.m_data = s;
68     }
69     /+ explicit +/this(const(char)* f, const(char)* l)
70     {
71         this(f, qsizetype(l - f));
72     }
73     /+ explicit +/pragma(inline, true) this(const(char)* s, qsizetype sz)/+ noexcept+/
74     {
75         this.m_size = sz;
76         this.m_data = s;
77     }
78     /+ explicit +/this(ref const(QByteArray) s)/+ noexcept+/
79     {
80         import qt.core.bytearrayalgorithms;
81         this.m_size = qsizetype(qstrnlen(s.constData(), s.size()));
82         this.m_data = s.constData();
83     }
84 
85 //    pragma(inline, true) QString toString() const { return this; }
86 
87     const(char)* latin1() const/+ noexcept+/ { return m_data; }
88     qsizetype size() const/+ noexcept+/ { return m_size; }
89     const(char)* data() const/+ noexcept+/ { return m_data; }
90 
91     bool isNull() const/+ noexcept+/ { return !data(); }
92     bool isEmpty() const/+ noexcept+/ { return !size(); }
93 
94     /+ template <typename...Args> +/
95     /+ [[nodiscard]] inline QString arg(Args &&...args) const; +/
96 
97     /+ [[nodiscard]] +/ QLatin1Char at(qsizetype i) const
98     { return (){(){ (mixin(Q_ASSERT(q{i >= 0})));
99 return /+ Q_ASSERT(i < size()) +/ mixin(Q_ASSERT(q{i < QLatin1String.size()}));
100 }();
101 return QLatin1Char(m_data[i]);
102 }(); }
103     /+ [[nodiscard]] +/ QLatin1Char opIndex(qsizetype i) const { return at(i); }
104 
105     /+ [[nodiscard]] +/ QLatin1Char front() const { return at(0); }
106     /+ [[nodiscard]] +/ QLatin1Char back() const { return at(size() - 1); }
107 
108     /+ [[nodiscard]] +/ int compare(QStringView other, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
109     {
110         import qt.core.stringalgorithms;
111         return /+ QtPrivate:: +/qt.core.stringalgorithms.compareStrings(this, other, cs);
112     }
113     /+ [[nodiscard]] +/ int compare(QLatin1String other, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
114     {
115         import qt.core.stringalgorithms;
116         return /+ QtPrivate:: +/qt.core.stringalgorithms.compareStrings(this, other, cs);
117     }
118 /+    /+ [[nodiscard]] +/ int compare(QChar c) const/+ noexcept+/
119     { return isEmpty() || front().unicode == c.unicode ? size() - 1 : uchar(m_data[0]) - c.unicode() ; }
120     /+ [[nodiscard]] +/ int compare(QChar c, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs) const/+ noexcept+/
121     {
122         import qt.core.stringalgorithms;
123         return /+ QtPrivate:: +/qt.core.stringalgorithms.compareStrings(this, QStringView(&c, 1), cs);
124     }+/
125 
126     /+ [[nodiscard]] +/ bool startsWith(QStringView s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
127     {
128         import qt.core.stringalgorithms;
129         return /+ QtPrivate:: +/qt.core.stringalgorithms.startsWith(this, s, cs);
130     }
131     /+ [[nodiscard]] +/ bool startsWith(QLatin1String s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
132     {
133         import qt.core.stringalgorithms;
134         return /+ QtPrivate:: +/qt.core.stringalgorithms.startsWith(this, s, cs);
135     }
136     /+ [[nodiscard]] +/ bool startsWith(QChar c) const/+ noexcept+/
137     { return !isEmpty() && front().unicode == c.unicode; }
138     /+ [[nodiscard]] +/ pragma(inline, true) bool startsWith(QChar c, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs) const/+ noexcept+/
139     {
140         import qt.core.stringalgorithms;
141         return /+ QtPrivate:: +/qt.core.stringalgorithms.startsWith(this, QStringView(&c, 1), cs);
142     }
143 
144     /+ [[nodiscard]] +/ bool endsWith(QStringView s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
145     {
146         import qt.core.stringalgorithms;
147         return /+ QtPrivate:: +/qt.core.stringalgorithms.endsWith(this, s, cs);
148     }
149     /+ [[nodiscard]] +/ bool endsWith(QLatin1String s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
150     {
151         import qt.core.stringalgorithms;
152         return /+ QtPrivate:: +/qt.core.stringalgorithms.endsWith(this, s, cs);
153     }
154     /+ [[nodiscard]] +/ bool endsWith(QChar c) const/+ noexcept+/
155     { return !isEmpty() && back().unicode == c.unicode; }
156     /+ [[nodiscard]] +/ pragma(inline, true) bool endsWith(QChar c, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs) const/+ noexcept+/
157     {
158         import qt.core.stringalgorithms;
159         return /+ QtPrivate:: +/qt.core.stringalgorithms.endsWith(this, QStringView(&c, 1), cs);
160     }
161 
162     /+ [[nodiscard]] +/ qsizetype indexOf(QStringView s, qsizetype from = 0, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
163     {
164         import qt.core.stringalgorithms;
165         return /+ QtPrivate:: +/qt.core.stringalgorithms.findString(this, from, s, cs);
166     }
167     /+ [[nodiscard]] +/ qsizetype indexOf(QLatin1String s, qsizetype from = 0, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
168     {
169         import qt.core.stringalgorithms;
170         return /+ QtPrivate:: +/qt.core.stringalgorithms.findString(this, from, s, cs);
171     }
172     /+ [[nodiscard]] +/ qsizetype indexOf(QChar c, qsizetype from = 0, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
173     {
174         import qt.core.stringalgorithms;
175         return /+ QtPrivate:: +/qt.core.stringalgorithms.findString(this, from, QStringView(&c, 1), cs);
176     }
177 
178     /+ [[nodiscard]] +/ bool contains(QStringView s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
179     { return indexOf(s, 0, cs) != -1; }
180     /+ [[nodiscard]] +/ bool contains(QLatin1String s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
181     { return indexOf(s, 0, cs) != -1; }
182     /+ [[nodiscard]] +/ pragma(inline, true) bool contains(QChar c, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
183     { return indexOf(QStringView(&c, 1), 0, cs) != -1; }
184 
185     /+ [[nodiscard]] +/ qsizetype lastIndexOf(QStringView s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
186     { return lastIndexOf(s, size(), cs); }
187     /+ [[nodiscard]] +/ qsizetype lastIndexOf(QStringView s, qsizetype from, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
188     {
189         import qt.core.bytearrayalgorithms;
190         import qt.core.stringalgorithms;
191         return /+ QtPrivate:: +/qt.core.stringalgorithms.lastIndexOf(this, from, s, cs);
192     }
193     /+ [[nodiscard]] +/ qsizetype lastIndexOf(QLatin1String s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
194     { return lastIndexOf(s, size(), cs); }
195     /+ [[nodiscard]] +/ qsizetype lastIndexOf(QLatin1String s, qsizetype from, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
196     {
197         import qt.core.bytearrayalgorithms;
198         import qt.core.stringalgorithms;
199         return /+ QtPrivate:: +/qt.core.stringalgorithms.lastIndexOf(this, from, s, cs);
200     }
201     /+ [[nodiscard]] +/ qsizetype lastIndexOf(QChar c, qsizetype from = -1, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
202     {
203         import qt.core.bytearrayalgorithms;
204         import qt.core.stringalgorithms;
205         return /+ QtPrivate:: +/qt.core.stringalgorithms.lastIndexOf(this, from, QStringView(&c, 1), cs);
206     }
207 
208     alias value_type = const(char);
209     /+ using reference = value_type&; +/
210     /+ using const_reference = reference; +/
211     alias iterator = value_type*;
212     alias const_iterator = iterator;
213     alias difference_type = qsizetype; // violates Container concept requirements
214     alias size_type = qsizetype;       // violates Container concept requirements
215 
216     const_iterator begin() const/+ noexcept+/ { return data(); }
217     const_iterator cbegin() const/+ noexcept+/ { return data(); }
218     const_iterator end() const/+ noexcept+/ { return data() + size(); }
219     const_iterator cend() const/+ noexcept+/ { return data() + size(); }
220 
221     /+ using reverse_iterator = std::reverse_iterator<iterator>; +/
222     /+ using const_reverse_iterator = reverse_iterator; +/
223 
224     /+ const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } +/
225     /+ const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } +/
226     /+ const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } +/
227     /+ const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } +/
228 
229 /+    /+ [[nodiscard]] +/ QLatin1String mid(qsizetype pos, qsizetype n = -1) const
230     {
231         //using namespace QtPrivate;
232         auto result = QContainerImplHelper.mid(size(), &pos, &n);
233         return result == QContainerImplHelper.Null ? QLatin1String() : QLatin1String(m_data + pos, n);
234     }
235     /+ [[nodiscard]] +/ QLatin1String left(qsizetype n) const
236     {
237         if (size_t(n) >= size_t(size()))
238             n = size();
239         return QLatin1String(m_data, n);
240     }
241     /+ [[nodiscard]] +/ QLatin1String right(qsizetype n) const
242     {
243         if (size_t(n) >= size_t(size()))
244             n = size();
245         return QLatin1String(m_data + m_size - n, n);
246     }+/
247 
248     /+ [[nodiscard]] +/ QLatin1String sliced(qsizetype pos) const
249     { verify(pos); return QLatin1String(m_data + pos, m_size - pos); }
250     /+ [[nodiscard]] +/ QLatin1String sliced(qsizetype pos, qsizetype n) const
251     { verify(pos, n); return QLatin1String(m_data + pos, n); }
252     /+ [[nodiscard]] +/ QLatin1String first(qsizetype n) const
253     { verify(n); return QLatin1String(m_data, n); }
254     /+ [[nodiscard]] +/ QLatin1String last(qsizetype n) const
255     { verify(n); return QLatin1String(m_data + size() - n, n); }
256     /+ [[nodiscard]] +/ QLatin1String chopped(qsizetype n) const
257     { verify(n); return QLatin1String(m_data, size() - n); }
258 
259     void chop(qsizetype n)
260     { verify(n); m_size -= n; }
261     void truncate(qsizetype n)
262     { verify(n); m_size = n; }
263 
264     /+ [[nodiscard]] +/ QLatin1String trimmed() const/+ noexcept+/ {
265         import qt.core.stringalgorithms;
266         return /+ QtPrivate:: +/qt.core.stringalgorithms.trimmed(this);
267     }
268 
269     /+ template <typename Needle, typename...Flags> +/
270     /+ [[nodiscard]] inline constexpr auto tokenize(Needle &&needle, Flags...flags) const
271         noexcept(noexcept(qTokenize(std::declval<const QLatin1String &>(), std::forward<Needle>(needle), flags...)))
272             -> decltype(qTokenize(*this, std::forward<Needle>(needle), flags...))
273     { return qTokenize(*this, std::forward<Needle>(needle), flags...); } +/
274 
275     /+ friend inline bool operator==(QLatin1String s1, QLatin1String s2) noexcept
276     { return s1.size() == s2.size() && (!s1.size() || !memcmp(s1.latin1(), s2.latin1(), s1.size())); } +/
277     /+ friend inline bool operator!=(QLatin1String s1, QLatin1String s2) noexcept
278     { return !(s1 == s2); } +/
279     /+ friend inline bool operator<(QLatin1String s1, QLatin1String s2) noexcept
280     {
281         const qsizetype len = qMin(s1.size(), s2.size());
282         const int r = len ? memcmp(s1.latin1(), s2.latin1(), len) : 0;
283         return r < 0 || (r == 0 && s1.size() < s2.size());
284     } +/
285     /+ friend inline bool operator>(QLatin1String s1, QLatin1String s2) noexcept
286     { return s2 < s1; } +/
287     /+ friend inline bool operator<=(QLatin1String s1, QLatin1String s2) noexcept
288     { return !(s1 > s2); } +/
289     /+ friend inline bool operator>=(QLatin1String s1, QLatin1String s2) noexcept
290     { return !(s1 < s2); } +/
291 
292     // QChar <> QLatin1String
293     /+ friend inline bool operator==(QChar lhs, QLatin1String rhs) noexcept { return rhs.size() == 1 && lhs == rhs.front(); } +/
294     /+ friend inline bool operator< (QChar lhs, QLatin1String rhs) noexcept { return compare_helper(&lhs, 1, rhs) < 0; } +/
295     /+ friend inline bool operator> (QChar lhs, QLatin1String rhs) noexcept { return compare_helper(&lhs, 1, rhs) > 0; } +/
296     /+ friend inline bool operator!=(QChar lhs, QLatin1String rhs) noexcept { return !(lhs == rhs); } +/
297     /+ friend inline bool operator<=(QChar lhs, QLatin1String rhs) noexcept { return !(lhs >  rhs); } +/
298     /+ friend inline bool operator>=(QChar lhs, QLatin1String rhs) noexcept { return !(lhs <  rhs); } +/
299 
300     /+ friend inline bool operator==(QLatin1String lhs, QChar rhs) noexcept { return   rhs == lhs; } +/
301     /+ friend inline bool operator!=(QLatin1String lhs, QChar rhs) noexcept { return !(rhs == lhs); } +/
302     /+ friend inline bool operator< (QLatin1String lhs, QChar rhs) noexcept { return   rhs >  lhs; } +/
303     /+ friend inline bool operator> (QLatin1String lhs, QChar rhs) noexcept { return   rhs <  lhs; } +/
304     /+ friend inline bool operator<=(QLatin1String lhs, QChar rhs) noexcept { return !(rhs <  lhs); } +/
305     /+ friend inline bool operator>=(QLatin1String lhs, QChar rhs) noexcept { return !(rhs >  lhs); } +/
306 
307     // QStringView <> QLatin1String
308     /+ friend inline bool operator==(QStringView lhs, QLatin1String rhs) noexcept
309     { return lhs.size() == rhs.size() && QtPrivate::equalStrings(lhs, rhs); } +/
310     /+ friend inline bool operator!=(QStringView lhs, QLatin1String rhs) noexcept { return !(lhs == rhs); } +/
311     /+ friend inline bool operator< (QStringView lhs, QLatin1String rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) <  0; } +/
312     /+ friend inline bool operator<=(QStringView lhs, QLatin1String rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) <= 0; } +/
313     /+ friend inline bool operator> (QStringView lhs, QLatin1String rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) >  0; } +/
314     /+ friend inline bool operator>=(QStringView lhs, QLatin1String rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) >= 0; } +/
315 
316     /+ friend inline bool operator==(QLatin1String lhs, QStringView rhs) noexcept
317     { return lhs.size() == rhs.size() && QtPrivate::equalStrings(lhs, rhs); } +/
318     /+ friend inline bool operator!=(QLatin1String lhs, QStringView rhs) noexcept { return !(lhs == rhs); } +/
319     /+ friend inline bool operator< (QLatin1String lhs, QStringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) <  0; } +/
320     /+ friend inline bool operator<=(QLatin1String lhs, QStringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) <= 0; } +/
321     /+ friend inline bool operator> (QLatin1String lhs, QStringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) >  0; } +/
322     /+ friend inline bool operator>=(QLatin1String lhs, QStringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) >= 0; } +/
323 
324 
325 /+ #if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
326     QT_ASCII_CAST_WARN inline bool operator==(const char *s) const;
327     QT_ASCII_CAST_WARN inline bool operator!=(const char *s) const;
328     QT_ASCII_CAST_WARN inline bool operator<(const char *s) const;
329     QT_ASCII_CAST_WARN inline bool operator>(const char *s) const;
330     QT_ASCII_CAST_WARN inline bool operator<=(const char *s) const;
331     QT_ASCII_CAST_WARN inline bool operator>=(const char *s) const;
332 
333     QT_ASCII_CAST_WARN inline bool operator==(const QByteArray &s) const;
334     QT_ASCII_CAST_WARN inline bool operator!=(const QByteArray &s) const;
335     QT_ASCII_CAST_WARN inline bool operator<(const QByteArray &s) const;
336     QT_ASCII_CAST_WARN inline bool operator>(const QByteArray &s) const;
337     QT_ASCII_CAST_WARN inline bool operator<=(const QByteArray &s) const;
338     QT_ASCII_CAST_WARN inline bool operator>=(const QByteArray &s) const;
339 
340     QT_ASCII_CAST_WARN friend bool operator==(const char *s1, QLatin1String s2) { return compare_helper(s2, s1) == 0; }
341     QT_ASCII_CAST_WARN friend bool operator!=(const char *s1, QLatin1String s2) { return compare_helper(s2, s1) != 0; }
342     QT_ASCII_CAST_WARN friend bool operator< (const char *s1, QLatin1String s2) { return compare_helper(s2, s1) >  0; }
343     QT_ASCII_CAST_WARN friend bool operator> (const char *s1, QLatin1String s2) { return compare_helper(s2, s1) <  0; }
344     QT_ASCII_CAST_WARN friend bool operator<=(const char *s1, QLatin1String s2) { return compare_helper(s2, s1) >= 0; }
345     QT_ASCII_CAST_WARN friend bool operator>=(const char *s1, QLatin1String s2) { return compare_helper(s2, s1) <= 0; }
346 #endif +/ // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
347 
348 private:
349 /+ #if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
350     static inline int compare_helper(const QLatin1String &s1, const char *s2);
351 #endif +/
352     /+ Q_ALWAYS_INLINE +/ pragma(inline, true) void verify(qsizetype pos, qsizetype n = 0) const
353     {
354         (mixin(Q_ASSERT(q{pos >= 0})));
355         (mixin(Q_ASSERT(q{pos <= QLatin1String.size()})));
356         (mixin(Q_ASSERT(q{n >= 0})));
357         (mixin(Q_ASSERT(q{n <= QLatin1String.size() - pos})));
358     }
359     /+ Q_CORE_EXPORT +/ static int compare_helper(const(QChar)* data1, qsizetype length1,
360                                                 QLatin1String s2,
361                                                 /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive)/+ noexcept+/;
362     qsizetype m_size = 0;
363     const(char)* m_data = null;
364     mixin(CREATE_CONVENIENCE_WRAPPERS);
365 }
366 /+ Q_DECLARE_TYPEINFO(QLatin1String, Q_RELOCATABLE_TYPE); +/
367 
368 // Qt 4.x compatibility
369 
370 //
371 // QLatin1String inline implementations
372 //
373 bool isLatin1(QLatin1String)/+ noexcept+/
374 { return true; }
375 
376 //
377 // QAnyStringView members that require QLatin1String
378 //
379 
380 /+ template <typename Visitor>
381 constexpr decltype(auto) QAnyStringView::visit(Visitor &&v) const
382 {
383     if (isUtf16())
384         return std::forward<Visitor>(v)(asStringView());
385     else if (isLatin1())
386         return std::forward<Visitor>(v)(asLatin1StringView());
387     else
388         return std::forward<Visitor>(v)(asUtf8StringView());
389 } +/
390 
391 //
392 // QAnyStringView members that require QAnyStringView::visit()
393 //
394 
395 
396 /// Binding for C++ class [QString](https://doc.qt.io/qt-6/qstring.html).
397 @Q_RELOCATABLE_TYPE extern(C++, class) struct /+ Q_CORE_EXPORT +/ QString
398 {
399 private:
400     alias Data = QTypedArrayData!(wchar);
401 public:
402     alias DataPointer = QStringPrivate;
403 
404     //pragma(inline, true) void this()/+ noexcept+/ {}
405     static typeof(this) create()
406     {
407         return typeof(this).init;
408     }
409 
410     /+ explicit +/this(const(QChar)* unicode, qsizetype size = -1);
411     this(QChar c);
412     this(qsizetype size, QChar c);
413 
414     extern(D) this(const(wchar)[] unicode)
415     {
416         this(cast(const(QChar)*) unicode.ptr, unicode.length);
417     }
418 
419     extern(D) this(const(char)[] unicode)
420     {
421         QString s = fromUtf8(QByteArrayView(unicode.ptr, unicode.length));
422         this.d = s.d;
423     }
424 
425     extern(D) this(const(dchar)[] unicode)
426     {
427         QString s = fromUcs4(unicode.ptr, unicode.length);
428         this.d = s.d;
429     }
430 
431     //
432     // QString inline members
433     //
434     pragma(inline, true) this(QLatin1String latin1)
435     { this = QString.fromLatin1(latin1.data(), latin1.size()); }
436 /+ #if defined(__cpp_char8_t) || defined(Q_CLANG_QDOC) +/
437     /+ Q_WEAK_OVERLOAD +/
438     /+ pragma(inline, true) this(const(char)* str)
439     {
440         this(fromUtf8(str));
441     } +/
442 /+ #endif +/
443     pragma(inline, true) ~this() {}
444     /+ref QString operator =(QChar c);+/
445     /+ref QString operator =(ref const(QString) )/+ noexcept+/;+/
446     /+ref QString operator =(QLatin1String latin1);+/
447     /+ inline QString(QString &&other) noexcept
448     { qSwap(d, other.d); } +/
449     /+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QString) +/
450     /+ inline void swap(QString &other) noexcept { qSwap(d, other.d); } +/
451     pragma(inline, true) qsizetype size() const { return d.size; }
452     pragma(inline, true) qsizetype count() const { return d.size; }
453     pragma(inline, true) qsizetype length() const { return d.size; }
454     pragma(inline, true) bool isEmpty() const
455     { return d.size == 0; }
456     void resize(qsizetype size);
457     void resize(qsizetype size, QChar fillChar);
458 
459     ref QString fill(QChar c, qsizetype size = -1);
460     void truncate(qsizetype pos);
461     void chop(qsizetype n);
462 
463     pragma(inline, true) qsizetype capacity() const { return qsizetype(d.constAllocatedCapacity()); }
464     pragma(inline, true) void reserve(qsizetype asize)
465     {
466         if (d.needsDetach() || asize >= capacity() - d.freeSpaceAtBegin())
467             reallocData(qMax(asize, size()), QArrayData.AllocationOption.KeepSize);
468         if (d.constAllocatedCapacity())
469             d.setFlag(Data.ArrayOptions.CapacityReserved);
470     }
471     pragma(inline, true) void squeeze()
472     {
473         if (!d.isMutable())
474             return;
475         if (d.needsDetach() || size() < capacity())
476             reallocData(d.size, QArrayData.AllocationOption.KeepSize);
477         if (d.constAllocatedCapacity())
478             d.clearFlag(Data.ArrayOptions.CapacityReserved);
479     }
480 
481     pragma(inline, true) const(QChar)* unicode() const
482     { return data(); }
483     pragma(inline, true) QChar* data()
484     {
485         detach();
486         (mixin(Q_ASSERT(q{QString.d.data()})));
487         return reinterpret_cast!(QChar*)(d.data());
488     }
489     pragma(inline, true) const(QChar)* data() const
490     {
491         static if((configValue!"QT5_NULL_STRINGS" == 1 || !defined!"QT5_NULL_STRINGS"))
492         {
493             return reinterpret_cast!(const(QChar)*)(d.data() ? d.data() : &_empty);
494         }
495         else
496         {
497             return reinterpret_cast!(const(QChar)*)(d.data());
498         }
499     }
500     pragma(inline, true) const(QChar)* constData() const
501     { return data(); }
502 
503     extern(D) const(wchar)[] toConstWString()
504     {
505         return (cast(const(wchar)*)constData())[0..length];
506     }
507 
508     pragma(inline, true) void detach()
509     { if (d.needsDetach()) reallocData(d.size, QArrayData.AllocationOption.KeepSize); }
510     pragma(inline, true) bool isDetached() const
511     { return !d.isShared(); }
512     pragma(inline, true) bool isSharedWith(ref const(QString) other) const { return d.isSharedWith(other.d); }
513     pragma(inline, true) void clear()
514     { if (!isNull()) this = QString.create(); }
515 
516     pragma(inline, true) const(QChar) at(qsizetype i) const
517     { (mixin(Q_ASSERT(q{size_t(i) < size_t(QString.size())}))); return QChar(d.data()[i]); }
518     pragma(inline, true) const(QChar) opIndex(qsizetype i) const
519     { (mixin(Q_ASSERT(q{size_t(i) < size_t(QString.size())}))); return QChar(d.data()[i]); }
520     /+ [[nodiscard]] +/ pragma(inline, true) ref QChar opIndex(qsizetype i)
521     { (mixin(Q_ASSERT(q{i >= 0 && i < QString.size()}))); return data()[i]; }
522 
523     /+ [[nodiscard]] +/ pragma(inline, true) QChar front() const { return at(0); }
524     /+ [[nodiscard]] +/ pragma(inline, true) ref QChar front() { return opIndex(0); }
525     /+ [[nodiscard]] +/ pragma(inline, true) QChar back() const { return at(size() - 1); }
526     /+ [[nodiscard]] +/ pragma(inline, true) ref QChar back() { return opIndex(size() - 1); }
527 
528     /+ [[nodiscard]] +/ QString arg(qlonglong a, int fieldwidth=0, int base=10,
529                     QChar fillChar = QChar(QLatin1Char(' '))) const;
530     /+ [[nodiscard]] +/ QString arg(qulonglong a, int fieldwidth=0, int base=10,
531                     QChar fillChar = QLatin1Char(' ')) const;
532     /+ [[nodiscard]] +/ pragma(inline, true) QString arg(cpp_long a, int fieldWidth=0, int base=10,
533                     QChar fillChar = QLatin1Char(' ')) const
534     { return arg(qlonglong(a), fieldWidth, base, fillChar); }
535     /+ [[nodiscard]] +/ pragma(inline, true) QString arg(cpp_ulong a, int fieldWidth=0, int base=10,
536                     QChar fillChar = QLatin1Char(' ')) const
537     { return arg(qulonglong(a), fieldWidth, base, fillChar); }
538     /+ [[nodiscard]] +/ pragma(inline, true) QString arg(int a, int fieldWidth = 0, int base = 10,
539                     QChar fillChar = QLatin1Char(' ')) const
540     { return arg(qlonglong(a), fieldWidth, base, fillChar); }
541     /+ [[nodiscard]] +/ pragma(inline, true) QString arg(uint a, int fieldWidth = 0, int base = 10,
542                     QChar fillChar = QLatin1Char(' ')) const
543     { return arg(qulonglong(a), fieldWidth, base, fillChar); }
544     /+ [[nodiscard]] +/ pragma(inline, true) QString arg(short a, int fieldWidth = 0, int base = 10,
545                     QChar fillChar = QLatin1Char(' ')) const
546     { return arg(qlonglong(a), fieldWidth, base, fillChar); }
547     /+ [[nodiscard]] +/ pragma(inline, true) QString arg(ushort a, int fieldWidth = 0, int base = 10,
548                     QChar fillChar = QLatin1Char(' ')) const
549     { return arg(qulonglong(a), fieldWidth, base, fillChar); }
550     /+ [[nodiscard]] +/ QString arg(double a, int fieldWidth = 0, char format = 'g', int precision = -1,
551                     QChar fillChar = QLatin1Char(' ')) const;
552     /+ [[nodiscard]] +/ QString arg(char a, int fieldWidth = 0,
553                     QChar fillChar = QLatin1Char(' ')) const;
554     /+ [[nodiscard]] +/ QString arg(QChar a, int fieldWidth = 0,
555                     QChar fillChar = QLatin1Char(' ')) const;
556     static if(QT_STRINGVIEW_LEVEL < 2)
557     {
558         /+ [[nodiscard]] +/ QString arg(ref const(QString) a, int fieldWidth = 0,
559                         QChar fillChar = QLatin1Char(' ')) const;
560     }
561     /+ [[nodiscard]] +/ QString arg(QStringView a, int fieldWidth = 0,
562                     QChar fillChar = QLatin1Char(' ')) const;
563     /+ [[nodiscard]] +/ QString arg(QLatin1String a, int fieldWidth = 0,
564                     QChar fillChar = QLatin1Char(' ')) const;
565 private:
566     /+ template <typename T> +/
567     /+ struct is_convertible_to_view_or_qstring_helper
568         : std::integral_constant<bool,
569             std::is_convertible<T, QString>::value ||
570             std::is_convertible<T, QStringView>::value ||
571             std::is_convertible<T, QLatin1String>::value> {}; +/
572     /+ template <typename T> +/
573     struct is_convertible_to_view_or_qstring(T)
574  {
575         is_convertible_to_view_or_qstring_helper!(/+ std:: +/decay!(T).type) base0;
576         alias base0 this;
577 }/+ ; +/
578 public:
579     /+ template <typename...Args> +/
580     /+ [[nodiscard]]
581 #ifdef Q_CLANG_QDOC
582     QString
583 #else
584     typename std::enable_if<
585         sizeof...(Args) >= 2 && std::is_same<
586             QtPrivate::BoolList<is_convertible_to_view_or_qstring<Args>::value..., true>,
587             QtPrivate::BoolList<true, is_convertible_to_view_or_qstring<Args>::value...>
588         >::value,
589         QString
590     >::type
591 #endif
592     arg(Args &&...args) const
593     { return qToStringViewIgnoringNull(*this).arg(std::forward<Args>(args)...); } +/
594 
595     static QString vasprintf(const(char)* format, va_list ap) /+ Q_ATTRIBUTE_FORMAT_PRINTF(1, 0) +/;
596     static QString asprintf(const(char)* format, ...) /+ Q_ATTRIBUTE_FORMAT_PRINTF(1, 2) +/;
597 
598     /+ [[nodiscard]] +/ qsizetype indexOf(QChar c, qsizetype from = 0, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
599     /+ [[nodiscard]] +/ qsizetype indexOf(QLatin1String s, qsizetype from = 0, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
600     static if(QT_STRINGVIEW_LEVEL < 2)
601     {
602         /+ [[nodiscard]] +/ qsizetype indexOf(ref const(QString) s, qsizetype from = 0, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
603     }
604     /+ [[nodiscard]] +/ qsizetype indexOf(QStringView s, qsizetype from = 0, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
605     {
606         import qt.core.stringalgorithms;
607         return /+ QtPrivate:: +/qt.core.stringalgorithms.findString(QStringView(this), from, s, cs);
608     }
609     /+ [[nodiscard]] +/ qsizetype lastIndexOf(QChar c, qsizetype from = -1, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
610     /+ [[nodiscard]] +/ qsizetype lastIndexOf(QLatin1String s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const
611     { return lastIndexOf(s, size(), cs); }
612     /+ [[nodiscard]] +/ qsizetype lastIndexOf(QLatin1String s, qsizetype from, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
613     static if(QT_STRINGVIEW_LEVEL < 2)
614     {
615         /+ [[nodiscard]] +/ qsizetype lastIndexOf(ref const(QString) s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const
616         { return lastIndexOf(s, size(), cs); }
617         /+ [[nodiscard]] +/ qsizetype lastIndexOf(ref const(QString) s, qsizetype from, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
618     }
619 
620     /+ [[nodiscard]] +/ qsizetype lastIndexOf(QStringView s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
621     { return lastIndexOf(s, size(), cs); }
622     /+ [[nodiscard]] +/ qsizetype lastIndexOf(QStringView s, qsizetype from, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
623     {
624         import qt.core.bytearrayalgorithms;
625         import qt.core.stringalgorithms;
626         return /+ QtPrivate:: +/qt.core.stringalgorithms.lastIndexOf(QStringView(this), from, s, cs);
627     }
628 
629     /+ [[nodiscard]] +/ pragma(inline, true) bool contains(QChar c, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const
630     { return indexOf(c, 0, cs) != -1; }
631     static if(QT_STRINGVIEW_LEVEL < 2)
632     {
633         /+ [[nodiscard]] +/ pragma(inline, true) bool contains(ref const(QString) s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const
634         { return indexOf(s, 0, cs) != -1; }
635     }
636     /+ [[nodiscard]] +/ pragma(inline, true) bool contains(QLatin1String s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const
637     { return indexOf(s, 0, cs) != -1; }
638     /+ [[nodiscard]] +/ pragma(inline, true) bool contains(QStringView s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
639     { return indexOf(s, 0, cs) != -1; }
640     /+ [[nodiscard]] +/ qsizetype count(QChar c, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
641     /+ [[nodiscard]] +/ qsizetype count(ref const(QString) s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
642     /+ [[nodiscard]] +/ qsizetype count(QStringView s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
643 
644 /+ #if QT_CONFIG(regularexpression) +/
645     /+ [[nodiscard]] +/ qsizetype indexOf(ref const(QRegularExpression) re, qsizetype from = 0,
646                                         QRegularExpressionMatch* rmatch = null) const;
647 /+ #ifdef Q_QDOC
648     [[nodiscard]] qsizetype lastIndexOf(const QRegularExpression &re, QRegularExpressionMatch *rmatch = nullptr) const;
649 #else +/
650     // prevent an ambiguity when called like this: lastIndexOf(re, 0)
651     /+ template <typename T = QRegularExpressionMatch, std::enable_if_t<std::is_same_v<T, QRegularExpressionMatch>, bool> = false> +/
652     /+ [[nodiscard]] +/ qsizetype lastIndexOf(T,)(ref const(QRegularExpression) re, T* rmatch = null) const
653     { return lastIndexOf(re, size(), rmatch); }
654 /+ #endif +/
655     /+ [[nodiscard]] +/ qsizetype lastIndexOf(ref const(QRegularExpression) re, qsizetype from,
656                                             QRegularExpressionMatch* rmatch = null) const;
657     /+ [[nodiscard]] +/ bool contains(ref const(QRegularExpression) re, QRegularExpressionMatch* rmatch = null) const;
658     /+ [[nodiscard]] +/ qsizetype count(ref const(QRegularExpression) re) const;
659 /+ #endif +/
660 
661     enum SectionFlag {
662         SectionDefault             = 0x00,
663         SectionSkipEmpty           = 0x01,
664         SectionIncludeLeadingSep   = 0x02,
665         SectionIncludeTrailingSep  = 0x04,
666         SectionCaseInsensitiveSeps = 0x08
667     }
668     /+ Q_DECLARE_FLAGS(SectionFlags, SectionFlag) +/
669 alias SectionFlags = QFlags!(SectionFlag);
670     /+ [[nodiscard]] +/ pragma(inline, true) QString section(QChar asep, qsizetype astart, qsizetype aend = -1, SectionFlags aflags = SectionFlag.SectionDefault) const
671     { auto tmp = QString(asep); return section(tmp, astart, aend, aflags); }
672     /+ [[nodiscard]] +/ QString section(ref const(QString) in_sep, qsizetype start, qsizetype end = -1, SectionFlags flags = SectionFlag.SectionDefault) const;
673 /+ #if QT_CONFIG(regularexpression) +/
674     /+ [[nodiscard]] +/ QString section(ref const(QRegularExpression) re, qsizetype start, qsizetype end = -1, SectionFlags flags = SectionFlag.SectionDefault) const;
675 /+ #endif +/
676     /+ [[nodiscard]] +/ QString left(qsizetype n) const;
677     /+ [[nodiscard]] +/ QString right(qsizetype n) const;
678     /+ [[nodiscard]] +/ QString mid(qsizetype position, qsizetype n = -1) const;
679 
680     /+ [[nodiscard]] +/ QString first(qsizetype n) const
681     { (mixin(Q_ASSERT(q{n >= 0}))); (mixin(Q_ASSERT(q{n <= QString.size()}))); return QString(data(), n); }
682     /+ [[nodiscard]] +/ QString last(qsizetype n) const
683     { (mixin(Q_ASSERT(q{n >= 0}))); (mixin(Q_ASSERT(q{n <= QString.size()}))); return QString(data() + size() - n, n); }
684     /+ [[nodiscard]] +/ QString sliced(qsizetype pos) const
685     { (mixin(Q_ASSERT(q{pos >= 0}))); (mixin(Q_ASSERT(q{pos <= QString.size()}))); return QString(data() + pos, size() - pos); }
686     /+ [[nodiscard]] +/ QString sliced(qsizetype pos, qsizetype n) const
687     { (mixin(Q_ASSERT(q{pos >= 0}))); (mixin(Q_ASSERT(q{n >= 0}))); (mixin(Q_ASSERT(q{size_t(pos) + size_t(n) <= size_t(QString.size())}))); return QString(data() + pos, n); }
688     /+ [[nodiscard]] +/ QString chopped(qsizetype n) const
689     { (mixin(Q_ASSERT(q{n >= 0}))); (mixin(Q_ASSERT(q{n <= QString.size()}))); return first(size() - n); }
690 
691 
692     static if(QT_STRINGVIEW_LEVEL < 2)
693     {
694         bool startsWith(ref const(QString) s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
695     }
696     /+ [[nodiscard]] +/ bool startsWith(QStringView s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
697     {
698         import qt.core.stringalgorithms;
699         return /+ QtPrivate:: +/qt.core.stringalgorithms.startsWith(QStringView(this), s, cs);
700     }
701     bool startsWith(QLatin1String s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
702     bool startsWith(QChar c, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
703 
704     static if(QT_STRINGVIEW_LEVEL < 2)
705     {
706         bool endsWith(ref const(QString) s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
707     }
708     /+ [[nodiscard]] +/ bool endsWith(QStringView s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
709     {
710         import qt.core.stringalgorithms;
711         return /+ QtPrivate:: +/qt.core.stringalgorithms.endsWith(QStringView(this), s, cs);
712     }
713     bool endsWith(QLatin1String s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
714     bool endsWith(QChar c, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
715 
716     bool isUpper() const;
717     bool isLower() const;
718 
719     /+ [[nodiscard]] +/ QString leftJustified(qsizetype width, QChar fill = QLatin1Char(' '), bool trunc = false) const;
720     /+ [[nodiscard]] +/ QString rightJustified(qsizetype width, QChar fill = QLatin1Char(' '), bool trunc = false) const;
721 
722 /+ #if !defined(Q_CLANG_QDOC) +/
723     /+ [[nodiscard]] +/ QString toLower() const/+ &+/
724     { return toLower_helper(this); }
725     /+ [[nodiscard]] QString toLower() &&
726     { return toLower_helper(*this); } +/
727     /+ [[nodiscard]] +/ QString toUpper() const/+ &+/
728     { return toUpper_helper(this); }
729     /+ [[nodiscard]] QString toUpper() &&
730     { return toUpper_helper(*this); } +/
731     /+ [[nodiscard]] +/ QString toCaseFolded() const/+ &+/
732     { return toCaseFolded_helper(this); }
733     /+ [[nodiscard]] QString toCaseFolded() &&
734     { return toCaseFolded_helper(*this); } +/
735     /+ [[nodiscard]] +/ QString trimmed() const/+ &+/
736     { return trimmed_helper(this); }
737     /+ [[nodiscard]] QString trimmed() &&
738     { return trimmed_helper(*this); } +/
739     /+ [[nodiscard]] +/ QString simplified() const/+ &+/
740     { return simplified_helper(this); }
741     /+ [[nodiscard]] QString simplified() &&
742     { return simplified_helper(*this); } +/
743 /+ #else
744     [[nodiscard]] QString toLower() const;
745     [[nodiscard]] QString toUpper() const;
746     [[nodiscard]] QString toCaseFolded() const;
747     [[nodiscard]] QString trimmed() const;
748     [[nodiscard]] QString simplified() const;
749 #endif +/
750     /+ [[nodiscard]] +/ QString toHtmlEscaped() const;
751 
752     ref QString insert(qsizetype i, QChar c);
753     ref QString insert(qsizetype i, const(QChar)* uc, qsizetype len);
754     static if(QT_STRINGVIEW_LEVEL < 2)
755     {
756         pragma(inline, true) ref QString insert(qsizetype i, ref const(QString) s) { return insert(i, s.constData(), s.length()); }
757     }
758     pragma(inline, true) ref QString insert(qsizetype i, QStringView v) { return insert(i, v.data(), v.length()); }
759     ref QString insert(qsizetype i, QLatin1String s);
760 
761     ref QString append(QChar c);
762     ref QString append(const(QChar)* uc, qsizetype len);
763     static if(QT_STRINGVIEW_LEVEL < 2)
764     {
765         ref QString append(ref const(QString) s);
766     }
767     pragma(inline, true) ref QString append(QStringView v) { return append(v.data(), v.length()); }
768     ref QString append(QLatin1String s);
769 
770     pragma(inline, true) ref QString prepend(QChar c) { return insert(0, c); }
771     pragma(inline, true) ref QString prepend(const(QChar)* uc, qsizetype len) { return insert(0, uc, len); }
772     static if(QT_STRINGVIEW_LEVEL < 2)
773     {
774         pragma(inline, true) ref QString prepend(ref const(QString) s) { return insert(0, s); }
775     }
776     pragma(inline, true) ref QString prepend(QStringView v) { return prepend(v.data(), v.length()); }
777     pragma(inline, true) ref QString prepend(QLatin1String s) { return insert(0, s); }
778 
779     extern(D) pragma(inline, true) ref QString opOpAssign(string op)(QChar c) if(op == "~") { return append(c); }
780 
781     static if(QT_STRINGVIEW_LEVEL < 2)
782     {
783         /+pragma(inline, true) ref QString operator +=(ref const(QString) s) { return append(s); }+/
784     }
785     extern(D) pragma(inline, true) ref QString opOpAssign(string op)(QStringView v) if(op == "~") { return append(v); }
786     extern(D) pragma(inline, true) ref QString opOpAssign(string op)(const QString s) if(op == "~") { return append(s); }
787     extern(D) pragma(inline, true) ref QString opOpAssign(string op)(QLatin1String s) if(op == "~") { return append(s); }
788 
789     ref QString remove(qsizetype i, qsizetype len);
790     ref QString remove(QChar c, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive);
791     ref QString remove(QLatin1String s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive);
792     ref QString remove(ref const(QString) s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive);
793     /+ template <typename Predicate> +/
794     ref QString removeIf(Predicate)(Predicate pred)
795     {
796         import qt.core.containertools_impl;
797 
798         /+ QtPrivate:: +/qt.core.containertools_impl.sequential_erase_if(this, pred);
799         return this;
800     }
801     ref QString replace(qsizetype i, qsizetype len, QChar after);
802     ref QString replace(qsizetype i, qsizetype len, const(QChar)* s, qsizetype slen);
803     ref QString replace(qsizetype i, qsizetype len, ref const(QString) after);
804     ref QString replace(QChar before, QChar after, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive);
805     ref QString replace(const(QChar)* before, qsizetype blen, const(QChar)* after, qsizetype alen, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive);
806     ref QString replace(QLatin1String before, QLatin1String after, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive);
807     ref QString replace(QLatin1String before, ref const(QString) after, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive);
808     ref QString replace(ref const(QString) before, QLatin1String after, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive);
809     ref QString replace(ref const(QString) before, ref const(QString) after,
810                          /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive);
811     ref QString replace(QChar c, ref const(QString) after, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive);
812     ref QString replace(QChar c, QLatin1String after, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive);
813 /+ #if QT_CONFIG(regularexpression) +/
814     ref QString replace(ref const(QRegularExpression) re, ref const(QString)  after);
815     pragma(inline, true) ref QString remove(ref const(QRegularExpression) re)
816     { auto tmp = QString(); return replace(re, tmp); }
817 /+ #endif +/
818 
819 public:
820     /+ [[nodiscard]] +/
821         QStringList split(ref const(QString) sep, /+ Qt:: +/qt.core.namespace.SplitBehavior behavior = /+ Qt:: +/qt.core.namespace.SplitBehaviorFlags.KeepEmptyParts,
822                           /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
823     /+ [[nodiscard]] +/
824         QStringList split(QChar sep, /+ Qt:: +/qt.core.namespace.SplitBehavior behavior = /+ Qt:: +/qt.core.namespace.SplitBehaviorFlags.KeepEmptyParts,
825                           /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const;
826     version(QT_NO_REGULAREXPRESSION){}else
827     {
828         /+ [[nodiscard]] +/
829             QStringList split(ref const(QRegularExpression) sep,
830                               /+ Qt:: +/qt.core.namespace.SplitBehavior behavior = /+ Qt:: +/qt.core.namespace.SplitBehaviorFlags.KeepEmptyParts) const;
831     }
832 
833     /+ template <typename Needle, typename...Flags> +/
834     /+ [[nodiscard]] inline auto tokenize(Needle &&needle, Flags...flags) const &
835         noexcept(noexcept(qTokenize(std::declval<const QString &>(), std::forward<Needle>(needle), flags...)))
836             -> decltype(qTokenize(*this, std::forward<Needle>(needle), flags...))
837     { return qTokenize(qToStringViewIgnoringNull(*this), std::forward<Needle>(needle), flags...); } +/
838 
839     /+ template <typename Needle, typename...Flags> +/
840     /+ [[nodiscard]] inline auto tokenize(Needle &&needle, Flags...flags) const &&
841         noexcept(noexcept(qTokenize(std::declval<const QString>(), std::forward<Needle>(needle), flags...)))
842             -> decltype(qTokenize(std::move(*this), std::forward<Needle>(needle), flags...))
843     { return qTokenize(std::move(*this), std::forward<Needle>(needle), flags...); } +/
844 
845     /+ template <typename Needle, typename...Flags> +/
846     /+ [[nodiscard]] inline auto tokenize(Needle &&needle, Flags...flags) &&
847         noexcept(noexcept(qTokenize(std::declval<QString>(), std::forward<Needle>(needle), flags...)))
848             -> decltype(qTokenize(std::move(*this), std::forward<Needle>(needle), flags...))
849     { return qTokenize(std::move(*this), std::forward<Needle>(needle), flags...); } +/
850 
851 
852     enum NormalizationForm {
853         NormalizationForm_D,
854         NormalizationForm_C,
855         NormalizationForm_KD,
856         NormalizationForm_KC
857     }
858     /+ [[nodiscard]] +/ QString normalized(NormalizationForm mode, QChar.UnicodeVersion version_ = QChar.UnicodeVersion.Unicode_Unassigned) const;
859 
860     /+ [[nodiscard]] +/ QString repeated(qsizetype times) const;
861 
862     const(ushort)* utf16() const; // ### Qt 7 char16_t
863 
864 /+ #if !defined(Q_CLANG_QDOC) +/
865     /+ [[nodiscard]] +/ QByteArray toLatin1() const/+ &+/
866     { return toLatin1_helper(this); }
867     /+ [[nodiscard]] QByteArray toLatin1() &&
868     { return toLatin1_helper_inplace(*this); } +/
869     /+ [[nodiscard]] +/ QByteArray toUtf8() const/+ &+/
870     { return toUtf8_helper(this); }
871     /+ [[nodiscard]] QByteArray toUtf8() &&
872     { return toUtf8_helper(*this); } +/
873     /+ [[nodiscard]] +/ QByteArray toLocal8Bit() const/+ &+/
874     { return toLocal8Bit_helper(isNull() ? null : constData(), size()); }
875     /+ [[nodiscard]] QByteArray toLocal8Bit() &&
876     { return toLocal8Bit_helper(isNull() ? nullptr : constData(), size()); } +/
877 /+ #else
878     [[nodiscard]] QByteArray toLatin1() const;
879     [[nodiscard]] QByteArray toUtf8() const;
880     [[nodiscard]] QByteArray toLocal8Bit() const;
881 #endif +/
882     /+ [[nodiscard]] +/ QList!(uint) toUcs4() const; // ### Qt 7 char32_t
883 
884     // note - this are all inline so we can benefit from strlen() compile time optimizations
885     static QString fromLatin1(QByteArrayView ba);
886     /+ Q_WEAK_OVERLOAD +/
887     pragma(inline, true) static QString fromLatin1(ref const(QByteArray) ba) { return fromLatin1(QByteArrayView(ba)); }
888     pragma(inline, true) static QString fromLatin1(const(char)* str, qsizetype size)
889     {
890         import qt.core.bytearrayalgorithms;
891 
892         return fromLatin1(QByteArrayView(str, !str || size < 0 ? qstrlen(str) : size));
893     }
894     static QString fromUtf8(QByteArrayView utf8);
895     /+ Q_WEAK_OVERLOAD +/
896     pragma(inline, true) static QString fromUtf8(ref const(QByteArray) ba) { return fromUtf8(QByteArrayView(ba)); }
897     pragma(inline, true) static QString fromUtf8(const(char)* utf8, qsizetype size = -1)
898     {
899         import qt.core.bytearrayalgorithms;
900 
901         return fromUtf8(QByteArrayView(utf8, !utf8 || size < 0 ? qstrlen(utf8) : size));
902     }
903 /+ #if defined(__cpp_char8_t) || defined(Q_CLANG_QDOC) +/
904     /+ Q_WEAK_OVERLOAD +/
905     /+pragma(inline, true) static QString fromUtf8(const(char)* str)
906     { return fromUtf8(reinterpret_cast!(const(char)*)(str)); }+/
907     /+ Q_WEAK_OVERLOAD +/
908     /+ pragma(inline, true) static QString fromUtf8(const(char)* str, qsizetype size)
909     { return fromUtf8(reinterpret_cast!(const(char)*)(str), size); } +/
910 /+ #endif +/
911     static QString fromLocal8Bit(QByteArrayView ba);
912     /+ Q_WEAK_OVERLOAD +/
913     pragma(inline, true) static QString fromLocal8Bit(ref const(QByteArray) ba) { return fromLocal8Bit(QByteArrayView(ba)); }
914     pragma(inline, true) static QString fromLocal8Bit(const(char)* str, qsizetype size)
915     {
916         import qt.core.bytearrayalgorithms;
917 
918         return fromLocal8Bit(QByteArrayView(str, !str || size < 0 ? qstrlen(str) : size));
919     }
920     static QString fromUtf16(const(wchar)* , qsizetype size = -1);
921     static QString fromUcs4(const(dchar)* , qsizetype size = -1);
922     static QString fromRawData(const(QChar)* , qsizetype size);
923 
924 /+ #if QT_DEPRECATED_SINCE(6, 0) +/
925     /+ QT_DEPRECATED_VERSION_X_6_0("Use char16_t* overload.") +/
926         static QString fromUtf16(const(ushort)* str, qsizetype size = -1)
927     { return fromUtf16(reinterpret_cast!(const(wchar)*)(str), size); }
928     /+ QT_DEPRECATED_VERSION_X_6_0("Use char32_t* overload.") +/
929         static QString fromUcs4(const(uint)* str, qsizetype size = -1)
930     { return fromUcs4(reinterpret_cast!(const(dchar)*)(str), size); }
931 /+ #endif +/
932 
933 /+    pragma(inline, true) qsizetype toWCharArray(wchar_t* array) const
934     {
935         return qToStringViewIgnoringNull(this).toWCharArray(array);
936     }+/
937     /+ [[nodiscard]] +/ pragma(inline, true) static QString fromWCharArray(const(wchar_t)* string, qsizetype size = -1)
938     {
939         return wchar_t.sizeof == QChar.sizeof ? fromUtf16(reinterpret_cast!(const(wchar)*)(string), size)
940                                                 : fromUcs4(reinterpret_cast!(const(dchar)*)(string), size);
941     }
942 
943     ref QString setRawData(const(QChar)* unicode, qsizetype size);
944     ref QString setUnicode(const(QChar)* unicode, qsizetype size);
945     pragma(inline, true) ref QString setUtf16(const(ushort)* autf16, qsizetype asize)
946     { return setUnicode(reinterpret_cast!(const(QChar)*)(autf16), asize); } // ### Qt 7 char16_t
947 
948     static if(QT_STRINGVIEW_LEVEL < 2)
949     {
950         int compare(ref const(QString) s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/;
951     }
952     int compare(QLatin1String other, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/;
953     pragma(inline, true) int compare(QStringView s, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
954     { return -s.compare(QStringView(this), cs); }
955     int compare(QChar ch, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive) const/+ noexcept+/
956     { return compare(QStringView(&ch, 1), cs); }
957 
958     pragma(inline, true) static int compare(ref const(QString) s1, ref const(QString) s2,
959                                   /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive)/+ noexcept+/
960     { return s1.compare(s2, cs); }
961 
962     pragma(inline, true) static int compare(ref const(QString) s1, QLatin1String s2,
963                                   /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive)/+ noexcept+/
964     { return s1.compare(s2, cs); }
965     pragma(inline, true) static int compare(QLatin1String s1, ref const(QString) s2,
966                                   /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive)/+ noexcept+/
967     { return -s2.compare(s1, cs); }
968     static int compare(ref const(QString) s1, QStringView s2, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive)/+ noexcept+/
969     { return s1.compare(s2, cs); }
970     static int compare(QStringView s1, ref const(QString) s2, /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive)/+ noexcept+/
971     { return -s2.compare(s1, cs); }
972 
973     int localeAwareCompare(ref const(QString) s) const;
974     pragma(inline, true) int localeAwareCompare(QStringView s) const
975     { return localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); }
976     static int localeAwareCompare(ref const(QString) s1, ref const(QString) s2)
977     { return s1.localeAwareCompare(s2); }
978 
979     pragma(inline, true) static int localeAwareCompare(QStringView s1, QStringView s2)
980     { return localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); }
981 
982     short toShort(bool* ok=null, int base=10) const
983     { return toIntegral_helper!(short)(QStringView(this), ok, base); }
984     ushort toUShort(bool* ok=null, int base=10) const
985     { return toIntegral_helper!(ushort)(QStringView(this), ok, base); }
986     int toInt(bool* ok=null, int base=10) const
987     { return toIntegral_helper!(int)(QStringView(this), ok, base); }
988     uint toUInt(bool* ok=null, int base=10) const
989     { return toIntegral_helper!(uint)(QStringView(this), ok, base); }
990     cpp_long toLong(bool* ok=null, int base=10) const
991     { return toIntegral_helper!(cpp_long)(QStringView(this), ok, base); }
992     cpp_ulong toULong(bool* ok=null, int base=10) const
993     { return toIntegral_helper!(cpp_ulong)(QStringView(this), ok, base); }
994     qlonglong toLongLong(bool* ok=null, int base=10) const;
995     qulonglong toULongLong(bool* ok=null, int base=10) const;
996     float toFloat(bool* ok=null) const;
997     double toDouble(bool* ok=null) const;
998 
999     pragma(inline, true) ref QString setNum(short n, int base=10)
1000     { return setNum(qlonglong(n), base); }
1001     pragma(inline, true) ref QString setNum(ushort n, int base=10)
1002     { return setNum(qulonglong(n), base); }
1003     pragma(inline, true) ref QString setNum(int n, int base=10)
1004     { return setNum(qlonglong(n), base); }
1005     pragma(inline, true) ref QString setNum(uint n, int base=10)
1006     { return setNum(qulonglong(n), base); }
1007     pragma(inline, true) ref QString setNum(cpp_long n, int base=10)
1008     { return setNum(qlonglong(n), base); }
1009     pragma(inline, true) ref QString setNum(cpp_ulong n, int base=10)
1010     { return setNum(qulonglong(n), base); }
1011     ref QString setNum(qlonglong, int base=10);
1012     ref QString setNum(qulonglong, int base=10);
1013     pragma(inline, true) ref QString setNum(float n, char f='g', int prec=6)
1014     { return setNum(double(n),f,prec); }
1015     ref QString setNum(double, char format='g', int precision=6);
1016 
1017     static QString number(int, int base=10);
1018     static QString number(uint, int base=10);
1019     static QString number(cpp_long, int base=10);
1020     static QString number(cpp_ulong, int base=10);
1021     static QString number(qlonglong, int base=10);
1022     static QString number(qulonglong, int base=10);
1023     static QString number(double, char format='g', int precision=6);
1024 
1025     /+ friend bool operator==(const QString &s1, const QString &s2) noexcept
1026     { return (s1.size() == s2.size()) && QtPrivate::compareStrings(s1, s2, Qt::CaseSensitive) == 0; } +/
1027     /+ friend bool operator< (const QString &s1, const QString &s2) noexcept
1028     { return QtPrivate::compareStrings(s1, s2, Qt::CaseSensitive) < 0; } +/
1029     /+ friend bool operator> (const QString &s1, const QString &s2) noexcept { return s2 < s1; } +/
1030     /+ friend bool operator!=(const QString &s1, const QString &s2) noexcept { return !(s1 == s2); } +/
1031     /+ friend bool operator<=(const QString &s1, const QString &s2) noexcept { return !(s1 > s2); } +/
1032     /+ friend bool operator>=(const QString &s1, const QString &s2) noexcept { return !(s1 < s2); } +/
1033 
1034     /+ friend bool operator==(const QString &s1, QLatin1String s2) noexcept
1035     { return (s1.size() == s2.size()) && QtPrivate::compareStrings(s1, s2, Qt::CaseSensitive) == 0; } +/
1036     /+ friend bool operator< (const QString &s1, QLatin1String s2) noexcept
1037     { return QtPrivate::compareStrings(s1, s2, Qt::CaseSensitive) < 0; } +/
1038     /+ friend bool operator> (const QString &s1, QLatin1String s2) noexcept
1039     { return QtPrivate::compareStrings(s1, s2, Qt::CaseSensitive) > 0; } +/
1040     /+ friend bool operator!=(const QString &s1, QLatin1String s2) noexcept { return !(s1 == s2); } +/
1041     /+ friend bool operator<=(const QString &s1, QLatin1String s2) noexcept { return !(s1 > s2); } +/
1042     /+ friend bool operator>=(const QString &s1, QLatin1String s2) noexcept { return !(s1 < s2); } +/
1043 
1044     /+ friend bool operator==(QLatin1String s1, const QString &s2) noexcept { return s2 == s1; } +/
1045     /+ friend bool operator< (QLatin1String s1, const QString &s2) noexcept { return s2 > s1; } +/
1046     /+ friend bool operator> (QLatin1String s1, const QString &s2) noexcept { return s2 < s1; } +/
1047     /+ friend bool operator!=(QLatin1String s1, const QString &s2) noexcept { return s2 != s1; } +/
1048     /+ friend bool operator<=(QLatin1String s1, const QString &s2) noexcept { return s2 >= s1; } +/
1049     /+ friend bool operator>=(QLatin1String s1, const QString &s2) noexcept { return s2 <= s1; } +/
1050 
1051     // Check isEmpty() instead of isNull() for backwards compatibility.
1052     /+ friend bool operator==(const QString &s1, std::nullptr_t) noexcept { return s1.isEmpty(); } +/
1053     /+ friend bool operator!=(const QString &s1, std::nullptr_t) noexcept { return !s1.isEmpty(); } +/
1054     /+ friend bool operator< (const QString &  , std::nullptr_t) noexcept { return false; } +/
1055     /+ friend bool operator> (const QString &s1, std::nullptr_t) noexcept { return !s1.isEmpty(); } +/
1056     /+ friend bool operator<=(const QString &s1, std::nullptr_t) noexcept { return s1.isEmpty(); } +/
1057     /+ friend bool operator>=(const QString &  , std::nullptr_t) noexcept { return true; } +/
1058     /+ friend bool operator==(std::nullptr_t, const QString &s2) noexcept { return s2 == nullptr; } +/
1059     /+ friend bool operator!=(std::nullptr_t, const QString &s2) noexcept { return s2 != nullptr; } +/
1060     /+ friend bool operator< (std::nullptr_t, const QString &s2) noexcept { return s2 >  nullptr; } +/
1061     /+ friend bool operator> (std::nullptr_t, const QString &s2) noexcept { return s2 <  nullptr; } +/
1062     /+ friend bool operator<=(std::nullptr_t, const QString &s2) noexcept { return s2 >= nullptr; } +/
1063     /+ friend bool operator>=(std::nullptr_t, const QString &s2) noexcept { return s2 <= nullptr; } +/
1064 
1065     /+ friend bool operator==(const QString &s1, const char16_t *s2) noexcept { return s1 == QStringView(s2); } +/
1066     /+ friend bool operator!=(const QString &s1, const char16_t *s2) noexcept { return s1 != QStringView(s2); } +/
1067     /+ friend bool operator< (const QString &s1, const char16_t *s2) noexcept { return s1 <  QStringView(s2); } +/
1068     /+ friend bool operator> (const QString &s1, const char16_t *s2) noexcept { return s1 >  QStringView(s2); } +/
1069     /+ friend bool operator<=(const QString &s1, const char16_t *s2) noexcept { return s1 <= QStringView(s2); } +/
1070     /+ friend bool operator>=(const QString &s1, const char16_t *s2) noexcept { return s1 >= QStringView(s2); } +/
1071 
1072     /+ friend bool operator==(const char16_t *s1, const QString &s2) noexcept { return s2 == s1; } +/
1073     /+ friend bool operator!=(const char16_t *s1, const QString &s2) noexcept { return s2 != s1; } +/
1074     /+ friend bool operator< (const char16_t *s1, const QString &s2) noexcept { return s2 >  s1; } +/
1075     /+ friend bool operator> (const char16_t *s1, const QString &s2) noexcept { return s2 <  s1; } +/
1076     /+ friend bool operator<=(const char16_t *s1, const QString &s2) noexcept { return s2 >= s1; } +/
1077     /+ friend bool operator>=(const char16_t *s1, const QString &s2) noexcept { return s2 <= s1; } +/
1078 
1079     // QChar <> QString
1080     /+ friend inline bool operator==(QChar lhs, const QString &rhs) noexcept
1081     { return rhs.size() == 1 && lhs == rhs.front(); } +/
1082     /+ friend inline bool operator< (QChar lhs, const QString &rhs) noexcept
1083     { return compare_helper(&lhs, 1, rhs.data(), rhs.size()) < 0; } +/
1084     /+ friend inline bool operator> (QChar lhs, const QString &rhs) noexcept
1085     { return compare_helper(&lhs, 1, rhs.data(), rhs.size()) > 0; } +/
1086 
1087     /+ friend inline bool operator!=(QChar lhs, const QString &rhs) noexcept { return !(lhs == rhs); } +/
1088     /+ friend inline bool operator<=(QChar lhs, const QString &rhs) noexcept { return !(lhs >  rhs); } +/
1089     /+ friend inline bool operator>=(QChar lhs, const QString &rhs) noexcept { return !(lhs <  rhs); } +/
1090 
1091     /+ friend inline bool operator==(const QString &lhs, QChar rhs) noexcept { return   rhs == lhs; } +/
1092     /+ friend inline bool operator!=(const QString &lhs, QChar rhs) noexcept { return !(rhs == lhs); } +/
1093     /+ friend inline bool operator< (const QString &lhs, QChar rhs) noexcept { return   rhs >  lhs; } +/
1094     /+ friend inline bool operator> (const QString &lhs, QChar rhs) noexcept { return   rhs <  lhs; } +/
1095     /+ friend inline bool operator<=(const QString &lhs, QChar rhs) noexcept { return !(rhs <  lhs); } +/
1096     /+ friend inline bool operator>=(const QString &lhs, QChar rhs) noexcept { return !(rhs >  lhs); } +/
1097 
1098     // ASCII compatibility
1099 /+ #if defined(QT_RESTRICTED_CAST_FROM_ASCII) +/
1100     version(QT_RESTRICTED_CAST_FROM_ASCII)
1101     {
1102         /+ template <qsizetype N> +/
1103         pragma(inline, true) this(qsizetype N)(ref const(char)[N] ch)
1104         {
1105             this(fromUtf8(ch));
1106         }
1107         /+ template <qsizetype N> +/
1108         this(qsizetype N)(ref char[N] ) /+ = delete +/;
1109         /+ template <qsizetype N> +/
1110         /+pragma(inline, true) ref QString operator =(qsizetype N)(ref const(char)[N] ch)
1111         { return ((){return this = fromUtf8(ch.ptr, N - 1);
1112     }()); }+/
1113         /+ template <qsizetype N> +/
1114         /+ref QString operator =(qsizetype N)(ref char[N] ) /+ = delete +/;+/
1115     }
1116 /+ #endif
1117 #if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
1118     QT_ASCII_CAST_WARN inline QString(const char *ch)
1119         : QString(fromUtf8(ch))
1120     {}
1121     QT_ASCII_CAST_WARN inline QString(const QByteArray &a)
1122         : QString(fromUtf8(a))
1123     {}
1124     QT_ASCII_CAST_WARN inline QString &operator=(const char *ch)
1125     { return (*this = fromUtf8(ch)); }
1126     QT_ASCII_CAST_WARN inline QString &operator=(const QByteArray &a)
1127     { return (*this = fromUtf8(a)); }
1128 
1129     // these are needed, so it compiles with STL support enabled
1130     QT_ASCII_CAST_WARN inline QString &prepend(const char *s)
1131     { return prepend(QString::fromUtf8(s)); }
1132     QT_ASCII_CAST_WARN inline QString &prepend(const QByteArray &s)
1133     { return prepend(QString::fromUtf8(s)); }
1134     QT_ASCII_CAST_WARN inline QString &append(const char *s)
1135     { return append(QString::fromUtf8(s)); }
1136     QT_ASCII_CAST_WARN inline QString &append(const QByteArray &s)
1137     { return append(QString::fromUtf8(s)); }
1138     QT_ASCII_CAST_WARN inline QString &insert(qsizetype i, const char *s)
1139     { return insert(i, QString::fromUtf8(s)); }
1140     QT_ASCII_CAST_WARN inline QString &insert(qsizetype i, const QByteArray &s)
1141     { return insert(i, QString::fromUtf8(s)); }
1142     QT_ASCII_CAST_WARN inline QString &operator+=(const char *s)
1143     { return append(QString::fromUtf8(s)); }
1144     QT_ASCII_CAST_WARN inline QString &operator+=(const QByteArray &s)
1145     { return append(QString::fromUtf8(s)); }
1146 
1147     QT_ASCII_CAST_WARN inline bool operator==(const char *s) const;
1148     QT_ASCII_CAST_WARN inline bool operator!=(const char *s) const;
1149     QT_ASCII_CAST_WARN inline bool operator<(const char *s) const;
1150     QT_ASCII_CAST_WARN inline bool operator<=(const char *s) const;
1151     QT_ASCII_CAST_WARN inline bool operator>(const char *s) const;
1152     QT_ASCII_CAST_WARN inline bool operator>=(const char *s) const;
1153 
1154     QT_ASCII_CAST_WARN inline bool operator==(const QByteArray &s) const;
1155     QT_ASCII_CAST_WARN inline bool operator!=(const QByteArray &s) const;
1156     QT_ASCII_CAST_WARN inline bool operator<(const QByteArray &s) const;
1157     QT_ASCII_CAST_WARN inline bool operator>(const QByteArray &s) const;
1158     QT_ASCII_CAST_WARN inline bool operator<=(const QByteArray &s) const;
1159     QT_ASCII_CAST_WARN inline bool operator>=(const QByteArray &s) const;
1160 
1161     QT_ASCII_CAST_WARN friend bool operator==(const char *s1, const QString &s2)
1162     { return QString::compare_helper(s2.constData(), s2.size(), s1, -1) == 0; }
1163     QT_ASCII_CAST_WARN friend bool operator!=(const char *s1, const QString &s2)
1164     { return QString::compare_helper(s2.constData(), s2.size(), s1, -1) != 0; }
1165     QT_ASCII_CAST_WARN friend bool operator< (const char *s1, const QString &s2)
1166     { return QString::compare_helper(s2.constData(), s2.size(), s1, -1) > 0; }
1167     QT_ASCII_CAST_WARN friend bool operator> (const char *s1, const QString &s2)
1168     { return QString::compare_helper(s2.constData(), s2.size(), s1, -1) < 0; }
1169     QT_ASCII_CAST_WARN friend bool operator<=(const char *s1, const QString &s2)
1170     { return QString::compare_helper(s2.constData(), s2.size(), s1, -1) >= 0; }
1171     QT_ASCII_CAST_WARN friend bool operator>=(const char *s1, const QString &s2)
1172     { return QString::compare_helper(s2.constData(), s2.size(), s1, -1) <= 0; }
1173 #endif +/
1174 
1175     /*extern(D) bool opEquals(const char *s) const
1176     {
1177         auto r = compare_helper(constData(), size(), s, -1);
1178         return r == 0;
1179     }*/
1180     extern(D) bool opEquals(const(char)[] s) const
1181     {
1182         auto r = compare_helper(constData(), size(), s.ptr, cast(int)s.length);
1183         return r == 0;
1184     }
1185     extern(D) bool opEquals(const(wchar)[] s) const
1186     {
1187         return (cast(wchar*)constData())[0..size()] == s;
1188     }
1189     extern(D) bool opEquals(const ref QString s) const
1190     {
1191         return compare_helper(constData(), size(), s.constData, s.size()) == 0;
1192     }
1193 
1194     alias iterator = QChar*;
1195     alias const_iterator = const(QChar)*;
1196     alias Iterator = iterator;
1197     alias ConstIterator = const_iterator;
1198     /+ typedef std::reverse_iterator<iterator> reverse_iterator; +/
1199     /+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator; +/
1200     pragma(inline, true) iterator begin()
1201     { detach(); return reinterpret_cast!(QChar*)(d.data()); }
1202     pragma(inline, true) const_iterator begin() const
1203     { return reinterpret_cast!(const(QChar)*)(d.data()); }
1204     pragma(inline, true) const_iterator cbegin() const
1205     { return reinterpret_cast!(const(QChar)*)(d.data()); }
1206     pragma(inline, true) const_iterator constBegin() const
1207     { return reinterpret_cast!(const(QChar)*)(d.data()); }
1208     pragma(inline, true) iterator end()
1209     { detach(); return reinterpret_cast!(QChar*)(d.data() + d.size); }
1210     pragma(inline, true) const_iterator end() const
1211     { return reinterpret_cast!(const(QChar)*)(d.data() + d.size); }
1212     pragma(inline, true) const_iterator cend() const
1213     { return reinterpret_cast!(const(QChar)*)(d.data() + d.size); }
1214     pragma(inline, true) const_iterator constEnd() const
1215     { return reinterpret_cast!(const(QChar)*)(d.data() + d.size); }
1216     /+ reverse_iterator rbegin() { return reverse_iterator(end()); } +/
1217     /+ reverse_iterator rend() { return reverse_iterator(begin()); } +/
1218     /+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } +/
1219     /+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } +/
1220     /+ const_reverse_iterator crbegin() const { return const_reverse_iterator(end()); } +/
1221     /+ const_reverse_iterator crend() const { return const_reverse_iterator(begin()); } +/
1222 
1223     // STL compatibility
1224     alias size_type = qsizetype;
1225     alias difference_type = qptrdiff;
1226     /+ typedef const QChar & const_reference; +/
1227     /+ typedef QChar & reference; +/
1228     alias pointer = QChar*;
1229     alias const_pointer = const(QChar)*;
1230     alias value_type = QChar;
1231     pragma(inline, true) void push_back(QChar c) { append(c); }
1232     pragma(inline, true) void push_back(ref const(QString) s) { append(s); }
1233     pragma(inline, true) void push_front(QChar c) { prepend(c); }
1234     pragma(inline, true) void push_front(ref const(QString) s) { prepend(s); }
1235     void shrink_to_fit() { squeeze(); }
1236     iterator erase(const_iterator first, const_iterator last);
1237 
1238     /+ static inline QString fromStdString(const std::string &s); +/
1239     /+ inline std::string toStdString() const; +/
1240     /+ static inline QString fromStdWString(const std::wstring &s); +/
1241     /+ inline std::wstring toStdWString() const; +/
1242 
1243     /+ static inline QString fromStdU16String(const std::u16string &s); +/
1244     /+ inline std::u16string toStdU16String() const; +/
1245     /+ static inline QString fromStdU32String(const std::u32string &s); +/
1246     /+ inline std::u32string toStdU32String() const; +/
1247 
1248     static if((versionIsSet!("OSX") || versionIsSet!("iOS") || versionIsSet!("TVOS") || versionIsSet!("WatchOS")))
1249     {
1250         /+ static QString fromCFString(CFStringRef string); +/
1251         /+ CFStringRef toCFString() const Q_DECL_CF_RETURNS_RETAINED; +/
1252         /+ static QString fromNSString(const NSString *string); +/
1253         /+ NSString *toNSString() const Q_DECL_NS_RETURNS_AUTORELEASED; +/
1254     }
1255 
1256     pragma(inline, true) bool isNull() const { return d.isNull(); }
1257 
1258 
1259     bool isSimpleText() const;
1260     bool isRightToLeft() const;
1261     /+ [[nodiscard]] +/ bool isValidUtf16() const/+ noexcept+/
1262     { return QStringView(this).isValidUtf16(); }
1263 
1264     this(qsizetype size, /+ Qt:: +/qt.core.namespace.Initialization);
1265     /+ explicit QString(DataPointer &&dd) : d(std::move(dd)) {} +/
1266 
1267     extern(D) QString opBinary(string op)(const ref QString s2) const if(op == "~")
1268     {
1269         QString t = *cast(QString*)&this; t ~= s2; return t;
1270     }
1271     extern(D) QString opBinary(string op)(const QString s2) const if(op == "~")
1272     {
1273         QString t = *cast(QString*)&this; t ~= s2; return t;
1274     }
1275     extern(D) QString opBinary(string op)(const char *s2) const if(op == "~")
1276     {
1277         QString t = *cast(QString*)&this; auto tmp = QString.fromUtf8(s2, -1); t ~= tmp; return t;
1278     }
1279     extern(D) QString opBinaryRight(string op)(const char *s1) const if(op == "~")
1280     {
1281         QString t = QString.fromUtf8(s1, -1); t ~= this; return t;
1282     }
1283 
1284     pragma(inline, true) bool opEquals(QStringView rhs)/+ noexcept+/ {
1285         import qt.core.stringalgorithms;
1286         return this.size() == rhs.size() && /+ QtPrivate:: +/qt.core.stringalgorithms.compareStrings(QStringView(this), rhs) == 0;
1287     }
1288 
1289     pragma(inline, true) bool opEquals(QLatin1String rhs)/+ noexcept+/ {
1290         import qt.core.stringalgorithms;
1291         return this.size() == rhs.size() && /+ QtPrivate:: +/qt.core.stringalgorithms.compareStrings(QStringView(this), rhs) == 0;
1292     }
1293 
1294 
1295 private:
1296 /+ #if defined(QT_NO_CAST_FROM_ASCII) +/
1297     extern(D) ref QString opOpAssign(string op)(const(char)* s) if(op == "~");
1298     extern(D) ref QString opOpAssign(string op)(ref const(QByteArray) s) if(op == "~");
1299     //this(const(char)* ch);
1300     //this(ref const(QByteArray) a);
1301     /+ref QString operator =(const(char)*  ch);+/
1302     /+ref QString operator =(ref const(QByteArray) a);+/
1303 /+ #endif +/
1304 
1305     DataPointer d;
1306     mixin(mangleWindows("?_empty@QString@@0_SB", exportOnWindows ~ q{
1307     extern static __gshared const(wchar) _empty;
1308     }));
1309 
1310     void reallocData(qsizetype alloc, QArrayData.AllocationOption option);
1311     void reallocGrowData(qsizetype n);
1312     static int compare_helper(const(QChar)* data1, qsizetype length1,
1313                                   const(QChar)* data2, qsizetype length2,
1314                                   /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive)/+ noexcept+/;
1315     static int compare_helper(const(QChar)* data1, qsizetype length1,
1316                                   const(char)* data2, qsizetype length2,
1317                                   /+ Qt:: +/qt.core.namespace.CaseSensitivity cs = /+ Qt:: +/qt.core.namespace.CaseSensitivity.CaseSensitive);
1318     static int localeAwareCompare_helper(const(QChar)* data1, qsizetype length1,
1319                                              const(QChar)* data2, qsizetype length2);
1320     static QString toLower_helper(ref const(QString) str);
1321     static QString toLower_helper(ref QString str);
1322     static QString toUpper_helper(ref const(QString) str);
1323     static QString toUpper_helper(ref QString str);
1324     static QString toCaseFolded_helper(ref const(QString) str);
1325     static QString toCaseFolded_helper(ref QString str);
1326     static QString trimmed_helper(ref const(QString) str);
1327     static QString trimmed_helper(ref QString str);
1328     static QString simplified_helper(ref const(QString) str);
1329     static QString simplified_helper(ref QString str);
1330     static QByteArray toLatin1_helper(ref const(QString) );
1331     static QByteArray toLatin1_helper_inplace(ref QString );
1332     static QByteArray toUtf8_helper(ref const(QString) );
1333     static QByteArray toLocal8Bit_helper(const(QChar)* data, qsizetype size);
1334     static qsizetype toUcs4_helper(const(ushort)* uc, qsizetype length, uint* out_); // ### Qt 7 char16_t
1335     version(Windows)
1336     {
1337     pragma(mangle, "?toIntegral_helper@QString@@CA_JVQStringView@@PEA_NH@Z")
1338     package static qlonglong toIntegral_helper(QStringView string, bool* ok, int base);
1339     pragma(mangle, "?toIntegral_helper@QString@@CA_KVQStringView@@PEA_NI@Z")
1340     package static qulonglong toIntegral_helper(QStringView string, bool* ok, uint base);
1341     }
1342     else
1343     {
1344     package static qlonglong toIntegral_helper(QStringView string, bool* ok, int base);
1345     package static qulonglong toIntegral_helper(QStringView string, bool* ok, uint base);
1346     }
1347     void replace_helper(size_t* indices, qsizetype nIndices, qsizetype blen, const(QChar)* after, qsizetype alen);
1348     /+ friend class QStringView; +/
1349     /+ friend class QByteArray; +/
1350     /+ friend class QCollator; +/
1351     /+ friend struct QAbstractConcatenable; +/
1352 
1353     /+ template <typename T> +/ 
1354         static T toIntegral_helper(T)(QStringView string, bool* ok, int base)
1355     {
1356         import std.traits;
1357         static if(isUnsigned!T)
1358         {
1359             alias Int64 = qulonglong;
1360             alias Int32 = uint;
1361         }
1362         else
1363         {
1364             alias Int64 = qlonglong;
1365             alias Int32 = int;
1366         }
1367 
1368         // we select the right overload by casting base to int or uint
1369         Int64 val = toIntegral_helper(string, ok, Int32(base));
1370         if (cast(T)(val) != val) {
1371             if (ok)
1372                 *ok = false;
1373             val = 0;
1374         }
1375         return cast(T)(val);
1376     }
1377 
1378 public:
1379     pragma(inline, true) ref DataPointer data_ptr() return { return d; }
1380     pragma(inline, true) ref const(DataPointer) data_ptr() const return { return d; }
1381     mixin(CREATE_CONVENIENCE_WRAPPERS);
1382 }
1383 
1384 /+ QT_WARNING_PUSH
1385 QT_WARNING_DISABLE_MSVC(4127)   // "conditional expression is constant"
1386 QT_WARNING_DISABLE_INTEL(111)   // "statement is unreachable"
1387 
1388 QT_WARNING_POP +/
1389 
1390 //
1391 // QUtf8StringView inline members that require QString:
1392 //
1393 
1394 //
1395 // QAnyStringView inline members that require QString:
1396 //
1397 
1398 /+ QT_WARNING_PUSH
1399 QT_WARNING_DISABLE_MSVC(4127)   // "conditional expression is constant"
1400 QT_WARNING_DISABLE_INTEL(111)   // "statement is unreachable"
1401 
1402 QT_WARNING_POP
1403 #if QT_STRINGVIEW_LEVEL < 2
1404 #endif
1405 
1406 #if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
1407 inline bool QString::operator==(const char *s) const
1408 { return QString::compare_helper(constData(), size(), s, -1) == 0; }
1409 inline bool QString::operator!=(const char *s) const
1410 { return QString::compare_helper(constData(), size(), s, -1) != 0; }
1411 inline bool QString::operator<(const char *s) const
1412 { return QString::compare_helper(constData(), size(), s, -1) < 0; }
1413 inline bool QString::operator>(const char *s) const
1414 { return QString::compare_helper(constData(), size(), s, -1) > 0; }
1415 inline bool QString::operator<=(const char *s) const
1416 { return QString::compare_helper(constData(), size(), s, -1) <= 0; }
1417 inline bool QString::operator>=(const char *s) const
1418 { return QString::compare_helper(constData(), size(), s, -1) >= 0; }
1419 
1420 QT_ASCII_CAST_WARN inline bool QLatin1String::operator==(const char *s) const
1421 { return QString::fromUtf8(s) == *this; }
1422 QT_ASCII_CAST_WARN inline bool QLatin1String::operator!=(const char *s) const
1423 { return QString::fromUtf8(s) != *this; }
1424 QT_ASCII_CAST_WARN inline bool QLatin1String::operator<(const char *s) const
1425 { return QString::fromUtf8(s) > *this; }
1426 QT_ASCII_CAST_WARN inline bool QLatin1String::operator>(const char *s) const
1427 { return QString::fromUtf8(s) < *this; }
1428 QT_ASCII_CAST_WARN inline bool QLatin1String::operator<=(const char *s) const
1429 { return QString::fromUtf8(s) >= *this; }
1430 QT_ASCII_CAST_WARN inline bool QLatin1String::operator>=(const char *s) const
1431 { return QString::fromUtf8(s) <= *this; }
1432 
1433 QT_ASCII_CAST_WARN inline bool QLatin1String::operator==(const QByteArray &s) const
1434 { return QString::fromUtf8(s) == *this; }
1435 QT_ASCII_CAST_WARN inline bool QLatin1String::operator!=(const QByteArray &s) const
1436 { return QString::fromUtf8(s) != *this; }
1437 QT_ASCII_CAST_WARN inline bool QLatin1String::operator<(const QByteArray &s) const
1438 { return QString::fromUtf8(s) > *this; }
1439 QT_ASCII_CAST_WARN inline bool QLatin1String::operator>(const QByteArray &s) const
1440 { return QString::fromUtf8(s) < *this; }
1441 QT_ASCII_CAST_WARN inline bool QLatin1String::operator<=(const QByteArray &s) const
1442 { return QString::fromUtf8(s) >= *this; }
1443 QT_ASCII_CAST_WARN inline bool QLatin1String::operator>=(const QByteArray &s) const
1444 { return QString::fromUtf8(s) <= *this; }
1445 
1446 inline int QLatin1String::compare_helper(const QLatin1String &s1, const char *s2)
1447 {
1448     return QString::compare(s1, QString::fromUtf8(s2));
1449 }
1450 
1451 QT_ASCII_CAST_WARN inline bool QString::operator==(const QByteArray &s) const
1452 { return QString::compare_helper(constData(), size(), s.constData(), s.size()) == 0; }
1453 QT_ASCII_CAST_WARN inline bool QString::operator!=(const QByteArray &s) const
1454 { return QString::compare_helper(constData(), size(), s.constData(), s.size()) != 0; }
1455 QT_ASCII_CAST_WARN inline bool QString::operator<(const QByteArray &s) const
1456 { return QString::compare_helper(constData(), size(), s.constData(), s.size()) < 0; }
1457 QT_ASCII_CAST_WARN inline bool QString::operator>(const QByteArray &s) const
1458 { return QString::compare_helper(constData(), size(), s.constData(), s.size()) > 0; }
1459 QT_ASCII_CAST_WARN inline bool QString::operator<=(const QByteArray &s) const
1460 { return QString::compare_helper(constData(), size(), s.constData(), s.size()) <= 0; }
1461 QT_ASCII_CAST_WARN inline bool QString::operator>=(const QByteArray &s) const
1462 { return QString::compare_helper(constData(), size(), s.constData(), s.size()) >= 0; }
1463 
1464 inline bool QByteArray::operator==(const QString &s) const
1465 { return QString::compare_helper(s.constData(), s.size(), constData(), qstrnlen(constData(), size())) == 0; }
1466 inline bool QByteArray::operator!=(const QString &s) const
1467 { return QString::compare_helper(s.constData(), s.size(), constData(), qstrnlen(constData(), size())) != 0; }
1468 inline bool QByteArray::operator<(const QString &s) const
1469 { return QString::compare_helper(s.constData(), s.size(), constData(), size()) > 0; }
1470 inline bool QByteArray::operator>(const QString &s) const
1471 { return QString::compare_helper(s.constData(), s.size(), constData(), size()) < 0; }
1472 inline bool QByteArray::operator<=(const QString &s) const
1473 { return QString::compare_helper(s.constData(), s.size(), constData(), size()) >= 0; }
1474 inline bool QByteArray::operator>=(const QString &s) const
1475 { return QString::compare_helper(s.constData(), s.size(), constData(), size()) <= 0; }
1476 #endif +/ // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
1477 
1478 version(QT_USE_FAST_OPERATOR_PLUS){}else
1479 version(QT_USE_QSTRINGBUILDER){}else
1480 {
1481 /+pragma(inline, true) const(QString) operator +(ref const(QString) s1, ref const(QString) s2)
1482 { auto t = QString(s1); t ~= s2; return t; }+/
1483 /+pragma(inline, true) const(QString) operator +(ref const(QString) s1, QChar s2)
1484 { auto t = QString(s1); t ~= s2; return t; }+/
1485 /+pragma(inline, true) const(QString) operator +(QChar s1, ref const(QString) s2)
1486 { auto t = QString(s1); t ~= s2; return t; }+/
1487 /+ #  if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
1488 QT_ASCII_CAST_WARN inline const QString operator+(const QString &s1, const char *s2)
1489 { QString t(s1); t += QString::fromUtf8(s2); return t; }
1490 QT_ASCII_CAST_WARN inline const QString operator+(const char *s1, const QString &s2)
1491 { QString t = QString::fromUtf8(s1); t += s2; return t; }
1492 QT_ASCII_CAST_WARN inline const QString operator+(const QByteArray &ba, const QString &s)
1493 { QString t = QString::fromUtf8(ba); t += s; return t; }
1494 QT_ASCII_CAST_WARN inline const QString operator+(const QString &s, const QByteArray &ba)
1495 { QString t(s); t += QString::fromUtf8(ba); return t; }
1496 #  endif +/ // QT_NO_CAST_FROM_ASCII
1497 }
1498 
1499 /+ inline std::string QString::toStdString() const
1500 { return toUtf8().toStdString(); }
1501 
1502 inline QString QString::fromStdString(const std::string &s)
1503 { return fromUtf8(s.data(), int(s.size())); }
1504 
1505 inline std::wstring QString::toStdWString() const
1506 {
1507     std::wstring str;
1508     str.resize(length());
1509 #if __cplusplus >= 201703L
1510     str.resize(toWCharArray(str.data()));
1511 #else
1512     if (length())
1513         str.resize(toWCharArray(&str.front()));
1514 #endif
1515     return str;
1516 }
1517 
1518 inline QString QString::fromStdWString(const std::wstring &s)
1519 { return fromWCharArray(s.data(), int(s.size())); }
1520 
1521 inline QString QString::fromStdU16String(const std::u16string &s)
1522 { return fromUtf16(s.data(), int(s.size())); }
1523 
1524 inline std::u16string QString::toStdU16String() const
1525 { return std::u16string(reinterpret_cast<const char16_t*>(utf16()), length()); }
1526 
1527 inline QString QString::fromStdU32String(const std::u32string &s)
1528 { return fromUcs4(s.data(), int(s.size())); }
1529 
1530 inline std::u32string QString::toStdU32String() const
1531 {
1532     std::u32string u32str(length(), char32_t(0));
1533     qsizetype len = toUcs4_helper(reinterpret_cast<const ushort *>(constData()),
1534                                   length(), reinterpret_cast<uint*>(&u32str[0]));
1535     u32str.resize(len);
1536     return u32str;
1537 }
1538 
1539 #if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED)
1540 Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QString &);
1541 Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QString &);
1542 #endif +/
1543 /+pragma(inline, true) QFlags!(QString.SectionFlags.enum_type) operator |(QString.SectionFlags.enum_type f1, QString.SectionFlags.enum_type f2)/+noexcept+/{return QFlags!(QString.SectionFlags.enum_type)(f1)|f2;}+/
1544 /+pragma(inline, true) QFlags!(QString.SectionFlags.enum_type) operator |(QString.SectionFlags.enum_type f1, QFlags!(QString.SectionFlags.enum_type) f2)/+noexcept+/{return f2|f1;}+/
1545 /+pragma(inline, true) QFlags!(QString.SectionFlags.enum_type) operator &(QString.SectionFlags.enum_type f1, QString.SectionFlags.enum_type f2)/+noexcept+/{return QFlags!(QString.SectionFlags.enum_type)(f1)&f2;}+/
1546 /+pragma(inline, true) QFlags!(QString.SectionFlags.enum_type) operator &(QString.SectionFlags.enum_type f1, QFlags!(QString.SectionFlags.enum_type) f2)/+noexcept+/{return f2&f1;}+/
1547 /+pragma(inline, true) void operator +(QString.SectionFlags.enum_type f1, QString.SectionFlags.enum_type f2)/+noexcept+/;+/
1548 /+pragma(inline, true) void operator +(QString.SectionFlags.enum_type f1, QFlags!(QString.SectionFlags.enum_type) f2)/+noexcept+/;+/
1549 /+pragma(inline, true) void operator +(int f1, QFlags!(QString.SectionFlags.enum_type) f2)/+noexcept+/;+/
1550 /+pragma(inline, true) void operator -(QString.SectionFlags.enum_type f1, QString.SectionFlags.enum_type f2)/+noexcept+/;+/
1551 /+pragma(inline, true) void operator -(QString.SectionFlags.enum_type f1, QFlags!(QString.SectionFlags.enum_type) f2)/+noexcept+/;+/
1552 /+pragma(inline, true) void operator -(int f1, QFlags!(QString.SectionFlags.enum_type) f2)/+noexcept+/;+/
1553 /+pragma(inline, true) QIncompatibleFlag operator |(QString.SectionFlags.enum_type f1, int f2)/+noexcept+/{return QIncompatibleFlag(int(f1)|f2);}+/
1554 /+pragma(inline, true) void operator +(int f1, QString.SectionFlags.enum_type f2)/+noexcept+/;+/
1555 /+pragma(inline, true) void operator +(QString.SectionFlags.enum_type f1, int f2)/+noexcept+/;+/
1556 /+pragma(inline, true) void operator -(int f1, QString.SectionFlags.enum_type f2)/+noexcept+/;+/
1557 /+pragma(inline, true) void operator -(QString.SectionFlags.enum_type f1, int f2)/+noexcept+/;+/
1558 
1559 /+ Q_DECLARE_SHARED(QString)
1560 Q_DECLARE_OPERATORS_FOR_FLAGS(QString::SectionFlags) +/
1561 extern(C++, "QtPrivate") {
1562 // used by qPrintable() and qUtf8Printable() macros
1563 // pragma(inline, true) ref const(QString) asString(ref const(QString) s)    { return s; }
1564 /+ inline QString &&asString(QString &&s)              { return std::move(s); } +/
1565 }
1566 
1567 //
1568 // QStringView::arg() implementation
1569 //
1570 
1571 extern(C++, "QtPrivate") {
1572 
1573 struct ArgBase {
1574     enum Tag : uchar { L1, U8, U16 }Tag tag;
1575 }
1576 
1577 /+struct QStringViewArg {
1578     ArgBase base0;
1579     alias base0 this;
1580     QStringView string;
1581     /+ QStringViewArg() = default; +/
1582     /+ explicit +/this(QStringView v)/+ noexcept+/
1583     {
1584         this.base0 = ArgBase(ArgBase(Tag.U16));
1585         this.string = typeof(this.string)(QStringView(v));
1586     }
1587 }+/
1588 
1589 /+struct QLatin1StringArg {
1590     ArgBase base0;
1591     alias base0 this;
1592     QLatin1String string;
1593     /+ QLatin1StringArg() = default; +/
1594     /+ explicit +/this(QLatin1String v)/+ noexcept+/
1595     {
1596         this.base0 = ArgBase(ArgBase(Tag.L1));
1597         this.string = typeof(this.string)(QLatin1String(v));
1598     }
1599 }+/
1600 
1601 /+ [[nodiscard]] +/ /+ Q_CORE_EXPORT +/ QString argToQString(QStringView pattern, size_t n, const(ArgBase)** args);
1602 /+ [[nodiscard]] +/ /+ Q_CORE_EXPORT +/ QString argToQString(QLatin1String pattern, size_t n, const(ArgBase)** args);
1603 
1604 /+
1605 /+ [[nodiscard]] +/ /+ Q_ALWAYS_INLINE +/ pragma(inline, true) QString argToQStringDispatch(StringView, Args)(StringView pattern, ref const(Args) args)
1606 {
1607     /+ const(ArgBase)*[0]  +/ auto argBases = mixin(buildStaticArray!(q{const(ArgBase)*}, q{&args..., /* avoid zero-sized array */ null}));
1608     return /+ QtPrivate:: +/argToQString(pattern, sizeof...(Args), argBases.ptr);
1609 }+/
1610 
1611 /+
1612           pragma(inline, true) QStringViewArg   qStringLikeToArg(ref const(QString) s)/+ noexcept+/ { return QStringViewArg{qToStringViewIgnoringNull(s)}; }
1613 pragma(inline, true) QStringViewArg   qStringLikeToArg(QStringView s)/+ noexcept+/ { return QStringViewArg{s}; }
1614           pragma(inline, true) QStringViewArg   qStringLikeToArg(ref const(QChar) c)/+ noexcept+/ { return QStringViewArg{QStringView{&c, 1}}; }
1615 pragma(inline, true) QLatin1StringArg qStringLikeToArg(QLatin1String s)/+ noexcept+/ { return QLatin1StringArg{s}; }
1616 +/
1617 } // namespace QtPrivate
1618 
1619 /+ template <typename...Args>
1620 Q_ALWAYS_INLINE
1621 QString QStringView::arg(Args &&...args) const
1622 {
1623     return QtPrivate::argToQStringDispatch(*this, QtPrivate::qStringLikeToArg(args)...);
1624 }
1625 
1626 template <typename...Args>
1627 Q_ALWAYS_INLINE
1628 QString QLatin1String::arg(Args &&...args) const
1629 {
1630     return QtPrivate::argToQStringDispatch(*this, QtPrivate::qStringLikeToArg(args)...);
1631 } +/
1632 
1633 qsizetype erase(T)(ref QString s, ref const(T) t)
1634 {
1635     import qt.core.containertools_impl;
1636 
1637     return /+ QtPrivate:: +/qt.core.containertools_impl.sequential_erase(s, t);
1638 }
1639 
1640 qsizetype erase_if(Predicate)(ref QString s, Predicate pred)
1641 {
1642     import qt.core.containertools_impl;
1643 
1644     return /+ QtPrivate:: +/qt.core.containertools_impl.sequential_erase_if(s, pred);
1645 }
1646 
1647 /+ inline namespace QtLiterals {
1648 } // QtLiterals
1649 
1650 
1651 #if defined(QT_USE_FAST_OPERATOR_PLUS) || defined(QT_USE_QSTRINGBUILDER)
1652 #endif +/
1653