Qt 4.8
qstring.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtCore module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QSTRING_H
43 #define QSTRING_H
44 
45 #include <QtCore/qchar.h>
46 #include <QtCore/qbytearray.h>
47 #include <QtCore/qatomic.h>
48 #include <QtCore/qnamespace.h>
49 #ifdef QT_INCLUDE_COMPAT
50 #include <Qt3Support/q3cstring.h>
51 #endif
52 
53 #ifndef QT_NO_STL
54 # include <string>
55 
56 # ifndef QT_NO_STL_WCHAR
57 // workaround for some headers not typedef'ing std::wstring
58 typedef std::basic_string<wchar_t> QStdWString;
59 # endif // QT_NO_STL_WCHAR
60 
61 #endif // QT_NO_STL
62 
63 #include <stdarg.h>
64 
65 #ifdef truncate
66 #error qstring.h must be included before any header file that defines truncate
67 #endif
68 
70 
72 
73 QT_MODULE(Core)
74 
75 class QCharRef;
76 class QRegExp;
77 class QStringList;
78 class QTextCodec;
79 class QLatin1String;
80 class QStringRef;
81 template <typename T> class QVector;
82 
84 {
85 public:
86  inline QString();
87  QString(const QChar *unicode, int size); // Qt5: don't cap size < 0
88  explicit QString(const QChar *unicode); // Qt5: merge with the above
89  QString(QChar c);
90  QString(int size, QChar c);
91  inline QString(const QLatin1String &latin1);
92  inline QString(const QString &);
93  inline ~QString();
94  QString &operator=(QChar c);
95  QString &operator=(const QString &);
96  inline QString &operator=(const QLatin1String &);
97 #ifdef Q_COMPILER_RVALUE_REFS
98  inline QString &operator=(QString &&other)
99  { qSwap(d, other.d); return *this; }
100 #endif
101  inline void swap(QString &other) { qSwap(d, other.d); }
102  inline int size() const { return d->size; }
103  inline int count() const { return d->size; }
104  inline int length() const;
105  inline bool isEmpty() const;
106  void resize(int size);
107 
108  QString &fill(QChar c, int size = -1);
109  void truncate(int pos);
110  void chop(int n);
111 
112  int capacity() const;
113  inline void reserve(int size);
114  inline void squeeze() { if (d->size < d->alloc || d->ref != 1) realloc(); d->capacity = 0;}
115 
116  inline const QChar *unicode() const;
117  inline QChar *data();
118  inline const QChar *data() const;
119  inline const QChar *constData() const;
120 
121  inline void detach();
122  inline bool isDetached() const;
123  inline bool isSharedWith(const QString &other) const { return d == other.d; }
124  void clear();
125 
126  inline const QChar at(int i) const;
127  const QChar operator[](int i) const;
128  QCharRef operator[](int i);
129  const QChar operator[](uint i) const;
130  QCharRef operator[](uint i);
131 
132  QString arg(qlonglong a, int fieldwidth=0, int base=10,
133  const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
134  QString arg(qulonglong a, int fieldwidth=0, int base=10,
135  const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
136  QString arg(long a, int fieldwidth=0, int base=10,
137  const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
138  QString arg(ulong a, int fieldwidth=0, int base=10,
139  const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
140  QString arg(int a, int fieldWidth = 0, int base = 10,
141  const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
142  QString arg(uint a, int fieldWidth = 0, int base = 10,
143  const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
144  QString arg(short a, int fieldWidth = 0, int base = 10,
145  const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
146  QString arg(ushort a, int fieldWidth = 0, int base = 10,
147  const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
148  QString arg(double a, int fieldWidth = 0, char fmt = 'g', int prec = -1,
149  const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
150  QString arg(char a, int fieldWidth = 0,
151  const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
152  QString arg(QChar a, int fieldWidth = 0,
153  const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
154  QString arg(const QString &a, int fieldWidth = 0,
155  const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
156  QString arg(const QString &a1, const QString &a2) const Q_REQUIRED_RESULT;
157  QString arg(const QString &a1, const QString &a2, const QString &a3) const Q_REQUIRED_RESULT;
158  QString arg(const QString &a1, const QString &a2, const QString &a3,
159  const QString &a4) const Q_REQUIRED_RESULT;
160  QString arg(const QString &a1, const QString &a2, const QString &a3,
161  const QString &a4, const QString &a5) const Q_REQUIRED_RESULT;
162  QString arg(const QString &a1, const QString &a2, const QString &a3,
163  const QString &a4, const QString &a5, const QString &a6) const Q_REQUIRED_RESULT;
164  QString arg(const QString &a1, const QString &a2, const QString &a3,
165  const QString &a4, const QString &a5, const QString &a6,
166  const QString &a7) const Q_REQUIRED_RESULT;
167  QString arg(const QString &a1, const QString &a2, const QString &a3,
168  const QString &a4, const QString &a5, const QString &a6,
169  const QString &a7, const QString &a8) const Q_REQUIRED_RESULT;
170  QString arg(const QString &a1, const QString &a2, const QString &a3,
171  const QString &a4, const QString &a5, const QString &a6,
172  const QString &a7, const QString &a8, const QString &a9) const Q_REQUIRED_RESULT;
173 
174  QString &vsprintf(const char *format, va_list ap)
175 #if defined(Q_CC_GNU) && !defined(__INSURE__)
176  __attribute__ ((format (printf, 2, 0)))
177 #endif
178  ;
179  QString &sprintf(const char *format, ...)
180 #if defined(Q_CC_GNU) && !defined(__INSURE__)
181  __attribute__ ((format (printf, 2, 3)))
182 #endif
183  ;
184 
185  int indexOf(QChar c, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
186  int indexOf(const QString &s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
187  int indexOf(const QLatin1String &s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
188  int indexOf(const QStringRef &s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
189  int lastIndexOf(QChar c, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
190  int lastIndexOf(const QString &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
191  int lastIndexOf(const QLatin1String &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
192  int lastIndexOf(const QStringRef &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
193 
194  inline QBool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
195  inline QBool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
196  inline QBool contains(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
197  int count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
198  int count(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
199  int count(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
200 
201 #ifndef QT_NO_REGEXP
202  int indexOf(const QRegExp &, int from = 0) const;
203  int lastIndexOf(const QRegExp &, int from = -1) const;
204  inline QBool contains(const QRegExp &rx) const { return QBool(indexOf(rx) != -1); }
205  int count(const QRegExp &) const;
206 
207  int indexOf(QRegExp &, int from = 0) const;
208  int lastIndexOf(QRegExp &, int from = -1) const;
209  inline QBool contains(QRegExp &rx) const { return QBool(indexOf(rx) != -1); }
210 #endif
211 
212  enum SectionFlag {
213  SectionDefault = 0x00,
214  SectionSkipEmpty = 0x01,
215  SectionIncludeLeadingSep = 0x02,
216  SectionIncludeTrailingSep = 0x04,
217  SectionCaseInsensitiveSeps = 0x08
218  };
219  Q_DECLARE_FLAGS(SectionFlags, SectionFlag)
220 
221  QString section(QChar sep, int start, int end = -1, SectionFlags flags = SectionDefault) const;
222  QString section(const QString &in_sep, int start, int end = -1, SectionFlags flags = SectionDefault) const;
223 #ifndef QT_NO_REGEXP
224  QString section(const QRegExp &reg, int start, int end = -1, SectionFlags flags = SectionDefault) const;
225 #endif
226 
227  QString left(int n) const Q_REQUIRED_RESULT;
228  QString right(int n) const Q_REQUIRED_RESULT;
229  QString mid(int position, int n = -1) const Q_REQUIRED_RESULT;
230  QStringRef leftRef(int n) const Q_REQUIRED_RESULT;
231  QStringRef rightRef(int n) const Q_REQUIRED_RESULT;
232  QStringRef midRef(int position, int n = -1) const Q_REQUIRED_RESULT;
233 
234  bool startsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
235  bool startsWith(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
236  bool startsWith(const QLatin1String &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
237  bool startsWith(const QChar &c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
238  bool endsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
239  bool endsWith(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
240  bool endsWith(const QLatin1String &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
241  bool endsWith(const QChar &c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
242 
243  QString leftJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const Q_REQUIRED_RESULT;
244  QString rightJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const Q_REQUIRED_RESULT;
245 
246  QString toLower() const Q_REQUIRED_RESULT;
247  QString toUpper() const Q_REQUIRED_RESULT;
248  QString toCaseFolded() const Q_REQUIRED_RESULT;
249 
250  QString trimmed() const Q_REQUIRED_RESULT;
251  QString simplified() const Q_REQUIRED_RESULT;
252 
253  QString &insert(int i, QChar c);
254  QString &insert(int i, const QChar *uc, int len);
255  inline QString &insert(int i, const QString &s) { return insert(i, s.constData(), s.length()); }
256  QString &insert(int i, const QLatin1String &s);
257  QString &append(QChar c);
258  QString &append(const QString &s);
259  QString &append(const QStringRef &s);
260  QString &append(const QLatin1String &s);
261  inline QString &prepend(QChar c) { return insert(0, c); }
262  inline QString &prepend(const QString &s) { return insert(0, s); }
263  inline QString &prepend(const QLatin1String &s) { return insert(0, s); }
264 
265  inline QString &operator+=(QChar c) {
266  if (d->ref != 1 || d->size + 1 > d->alloc)
267  realloc(grow(d->size + 1));
268  d->data[d->size++] = c.unicode();
269  d->data[d->size] = '\0';
270  return *this;
271  }
272 
273  inline QString &operator+=(QChar::SpecialCharacter c) { return append(QChar(c)); }
274  inline QString &operator+=(const QString &s) { return append(s); }
275  inline QString &operator+=(const QStringRef &s) { return append(s); }
276  inline QString &operator+=(const QLatin1String &s) { return append(s); }
277 
278  QString &remove(int i, int len);
280  QString &remove(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive);
281  QString &replace(int i, int len, QChar after);
282  QString &replace(int i, int len, const QChar *s, int slen);
283  QString &replace(int i, int len, const QString &after);
284  QString &replace(QChar before, QChar after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
285  QString &replace(const QChar *before, int blen, const QChar *after, int alen, Qt::CaseSensitivity cs = Qt::CaseSensitive);
286  QString &replace(const QLatin1String &before, const QLatin1String &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
287  QString &replace(const QLatin1String &before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
288  QString &replace(const QString &before, const QLatin1String &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
289  QString &replace(const QString &before, const QString &after,
291  QString &replace(QChar c, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
292  QString &replace(QChar c, const QLatin1String &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
293 #ifndef QT_NO_REGEXP
294  QString &replace(const QRegExp &rx, const QString &after);
295  inline QString &remove(const QRegExp &rx)
296  { return replace(rx, QString()); }
297 #endif
298 
299  enum SplitBehavior { KeepEmptyParts, SkipEmptyParts };
300 
301  QStringList split(const QString &sep, SplitBehavior behavior = KeepEmptyParts,
303  QStringList split(const QChar &sep, SplitBehavior behavior = KeepEmptyParts,
305 #ifndef QT_NO_REGEXP
306  QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT;
307 #endif
308 
313  NormalizationForm_KC
314  };
315  QString normalized(NormalizationForm mode) const Q_REQUIRED_RESULT;
316  QString normalized(NormalizationForm mode, QChar::UnicodeVersion version) const Q_REQUIRED_RESULT;
317 
318  QString repeated(int times) const;
319 
320  const ushort *utf16() const;
321 
322  QByteArray toAscii() const Q_REQUIRED_RESULT;
323  QByteArray toLatin1() const Q_REQUIRED_RESULT;
324  QByteArray toUtf8() const Q_REQUIRED_RESULT;
325  QByteArray toLocal8Bit() const Q_REQUIRED_RESULT;
326  QVector<uint> toUcs4() const Q_REQUIRED_RESULT;
327 
328  static QString fromAscii(const char *, int size = -1);
329  static QString fromLatin1(const char *, int size = -1);
330  static QString fromUtf8(const char *, int size = -1);
331  static QString fromLocal8Bit(const char *, int size = -1);
332  static QString fromUtf16(const ushort *, int size = -1);
333  static QString fromUcs4(const uint *, int size = -1);
334  static QString fromRawData(const QChar *, int size);
335 
336  int toWCharArray(wchar_t *array) const;
337  static QString fromWCharArray(const wchar_t *, int size = -1);
338 
339  QString &setRawData(const QChar *unicode, int size);
340  QString &setUnicode(const QChar *unicode, int size);
341  inline QString &setUtf16(const ushort *utf16, int size);
342 
343  // ### Qt 5: merge these two functions
344  int compare(const QString &s) const;
345  int compare(const QString &s, Qt::CaseSensitivity cs) const;
346 
347  int compare(const QLatin1String &other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
348 
349  // ### Qt 5: merge these two functions
350  static inline int compare(const QString &s1, const QString &s2)
351  { return s1.compare(s2); }
352  static inline int compare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs)
353  { return s1.compare(s2, cs); }
354 
355  static inline int compare(const QString& s1, const QLatin1String &s2,
357  { return s1.compare(s2, cs); }
358  static inline int compare(const QLatin1String& s1, const QString &s2,
360  { return -s2.compare(s1, cs); }
361 
362  int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
363  static int compare(const QString &s1, const QStringRef &s2,
365 
366  int localeAwareCompare(const QString& s) const;
367  static int localeAwareCompare(const QString& s1, const QString& s2)
368  { return s1.localeAwareCompare(s2); }
369 
370  int localeAwareCompare(const QStringRef &s) const;
371  static int localeAwareCompare(const QString& s1, const QStringRef& s2);
372 
373  short toShort(bool *ok=0, int base=10) const;
374  ushort toUShort(bool *ok=0, int base=10) const;
375  int toInt(bool *ok=0, int base=10) const;
376  uint toUInt(bool *ok=0, int base=10) const;
377  long toLong(bool *ok=0, int base=10) const;
378  ulong toULong(bool *ok=0, int base=10) const;
379  qlonglong toLongLong(bool *ok=0, int base=10) const;
380  qulonglong toULongLong(bool *ok=0, int base=10) const;
381  float toFloat(bool *ok=0) const;
382  double toDouble(bool *ok=0) const;
383 
384  QString &setNum(short, int base=10);
385  QString &setNum(ushort, int base=10);
386  QString &setNum(int, int base=10);
387  QString &setNum(uint, int base=10);
388  QString &setNum(long, int base=10);
389  QString &setNum(ulong, int base=10);
390  QString &setNum(qlonglong, int base=10);
391  QString &setNum(qulonglong, int base=10);
392  QString &setNum(float, char f='g', int prec=6);
393  QString &setNum(double, char f='g', int prec=6);
394 
395  static QString number(int, int base=10);
396  static QString number(uint, int base=10);
397  static QString number(long, int base=10);
398  static QString number(ulong, int base=10);
399  static QString number(qlonglong, int base=10);
400  static QString number(qulonglong, int base=10);
401  static QString number(double, char f='g', int prec=6);
402 
403  bool operator==(const QString &s) const;
404  bool operator<(const QString &s) const;
405  inline bool operator>(const QString &s) const { return s < *this; }
406  inline bool operator!=(const QString &s) const { return !operator==(s); }
407  inline bool operator<=(const QString &s) const { return !operator>(s); }
408  inline bool operator>=(const QString &s) const { return !operator<(s); }
409 
410  bool operator==(const QLatin1String &s) const;
411  bool operator<(const QLatin1String &s) const;
412  bool operator>(const QLatin1String &s) const;
413  inline bool operator!=(const QLatin1String &s) const { return !operator==(s); }
414  inline bool operator<=(const QLatin1String &s) const { return !operator>(s); }
415  inline bool operator>=(const QLatin1String &s) const { return !operator<(s); }
416 
417  // ASCII compatibility
418 #ifndef QT_NO_CAST_FROM_ASCII
419  inline QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const char *ch) : d(fromAscii_helper(ch))
420  {}
422  : d(fromAscii_helper(a.constData(), qstrnlen(a.constData(), a.size())))
423  {}
424  inline QT_ASCII_CAST_WARN QString &operator=(const char *ch)
425  { return (*this = fromAscii(ch)); }
427  { return (*this = fromAscii(a.constData(), qstrnlen(a.constData(), a.size()))); }
429  { return (*this = QChar::fromAscii(c)); }
430 
431  // these are needed, so it compiles with STL support enabled
432  inline QT_ASCII_CAST_WARN QString &prepend(const char *s)
433  { return prepend(QString::fromAscii(s)); }
435  { return prepend(QString::fromAscii(s.constData(), qstrnlen(s.constData(), s.size()))); }
436  inline QT_ASCII_CAST_WARN QString &append(const char *s)
437  { return append(QString::fromAscii(s)); }
439  { return append(QString::fromAscii(s.constData(), qstrnlen(s.constData(), s.size()))); }
440  inline QT_ASCII_CAST_WARN QString &operator+=(const char *s)
441  { return append(QString::fromAscii(s)); }
443  { return append(QString::fromAscii(s.constData(), qstrnlen(s.constData(), s.size()))); }
445  { return append(QChar::fromAscii(c)); }
446 
447  inline QT_ASCII_CAST_WARN bool operator==(const char *s) const;
448  inline QT_ASCII_CAST_WARN bool operator!=(const char *s) const;
449  inline QT_ASCII_CAST_WARN bool operator<(const char *s) const;
450  inline QT_ASCII_CAST_WARN bool operator<=(const char *s2) const;
451  inline QT_ASCII_CAST_WARN bool operator>(const char *s2) const;
452  inline QT_ASCII_CAST_WARN bool operator>=(const char *s2) const;
453 
454  inline QT_ASCII_CAST_WARN bool operator==(const QByteArray &s) const;
455  inline QT_ASCII_CAST_WARN bool operator!=(const QByteArray &s) const;
456  inline QT_ASCII_CAST_WARN bool operator<(const QByteArray &s) const
457  { return *this < QString::fromAscii(s.constData(), s.size()); }
458  inline QT_ASCII_CAST_WARN bool operator>(const QByteArray &s) const
459  { return *this > QString::fromAscii(s.constData(), s.size()); }
460  inline QT_ASCII_CAST_WARN bool operator<=(const QByteArray &s) const
461  { return *this <= QString::fromAscii(s.constData(), s.size()); }
462  inline QT_ASCII_CAST_WARN bool operator>=(const QByteArray &s) const
463  { return *this >= QString::fromAscii(s.constData(), s.size()); }
464 #endif
465 
466  typedef QChar *iterator;
467  typedef const QChar *const_iterator;
468  typedef iterator Iterator;
469  typedef const_iterator ConstIterator;
470  iterator begin();
471  const_iterator begin() const;
472  const_iterator constBegin() const;
473  iterator end();
474  const_iterator end() const;
475  const_iterator constEnd() const;
476 
477  // STL compatibility
478  typedef const QChar & const_reference;
479  typedef QChar & reference;
480  typedef QChar value_type;
481  inline void push_back(QChar c) { append(c); }
482  inline void push_back(const QString &s) { append(s); }
483  inline void push_front(QChar c) { prepend(c); }
484  inline void push_front(const QString &s) { prepend(s); }
485 
486 #ifndef QT_NO_STL
487  static inline QString fromStdString(const std::string &s);
488  inline std::string toStdString() const;
489 # ifdef qdoc
490  static inline QString fromStdWString(const std::wstring &s);
491  inline std::wstring toStdWString() const;
492 # else
493 # ifndef QT_NO_STL_WCHAR
494  static inline QString fromStdWString(const QStdWString &s);
495  inline QStdWString toStdWString() const;
496 # endif // QT_NO_STL_WCHAR
497 # endif // qdoc
498 #endif
499 
500  // compatibility
501  struct Null { };
502  static const Null null;
503  inline QString(const Null &): d(&shared_null) { d->ref.ref(); }
504  inline QString &operator=(const Null &) { *this = QString(); return *this; }
505  inline bool isNull() const { return d == &shared_null; }
506 
507 #ifdef QT3_SUPPORT
508  inline QT3_SUPPORT const char *ascii() const { return ascii_helper(); }
509  inline QT3_SUPPORT const char *latin1() const { return latin1_helper(); }
510  inline QT3_SUPPORT QByteArray utf8() const { return toUtf8(); }
511  inline QT3_SUPPORT QByteArray local8Bit() const{ return toLocal8Bit(); }
512  inline QT3_SUPPORT void setLength(int nl) { resize(nl); }
513  inline QT3_SUPPORT QString copy() const { return *this; }
514  inline QT3_SUPPORT QString &remove(QChar c, bool cs)
515  { return remove(c, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
516  inline QT3_SUPPORT QString &remove(const QString &s, bool cs)
517  { return remove(s, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
518  inline QT3_SUPPORT QString &replace(QChar c, const QString &after, bool cs)
519  { return replace(c, after, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
520  inline QT3_SUPPORT QString &replace(const QString &before, const QString &after, bool cs)
521  { return replace(before, after, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
522 #ifndef QT_NO_CAST_FROM_ASCII
523  inline QT3_SUPPORT QString &replace(char c, const QString &after, bool cs)
524  { return replace(QChar::fromAscii(c), after, cs ? Qt::CaseSensitive : Qt::CaseInsensitive); }
525  // strange overload, required to avoid GCC 3.3 error
526  inline QT3_SUPPORT QString &replace(char c, const QString &after, Qt::CaseSensitivity cs)
527  { return replace(QChar::fromAscii(c), after, cs ? Qt::CaseSensitive : Qt::CaseInsensitive); }
528 #endif
529  inline QT3_SUPPORT int find(QChar c, int i = 0, bool cs = true) const
530  { return indexOf(c, i, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
531  inline QT3_SUPPORT int find(const QString &s, int i = 0, bool cs = true) const
532  { return indexOf(s, i, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
533  inline QT3_SUPPORT int findRev(QChar c, int i = -1, bool cs = true) const
534  { return lastIndexOf(c, i, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
535  inline QT3_SUPPORT int findRev(const QString &s, int i = -1, bool cs = true) const
536  { return lastIndexOf(s, i, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
537 #ifndef QT_NO_REGEXP
538  inline QT3_SUPPORT int find(const QRegExp &rx, int i=0) const
539  { return indexOf(rx, i); }
540  inline QT3_SUPPORT int findRev(const QRegExp &rx, int i=-1) const
541  { return lastIndexOf(rx, i); }
542  inline QT3_SUPPORT int find(QRegExp &rx, int i=0) const
543  { return indexOf(rx, i); }
544  inline QT3_SUPPORT int findRev(QRegExp &rx, int i=-1) const
545  { return lastIndexOf(rx, i); }
546 #endif
547  inline QT3_SUPPORT QBool contains(QChar c, bool cs) const
548  { return contains(c, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
549  inline QT3_SUPPORT QBool contains(const QString &s, bool cs) const
550  { return contains(s, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
551  inline QT3_SUPPORT bool startsWith(const QString &s, bool cs) const
552  { return startsWith(s, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
553  inline QT3_SUPPORT bool endsWith(const QString &s, bool cs) const
554  { return endsWith(s, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
555  inline QT3_SUPPORT QChar constref(uint i) const
556  { return at(i); }
557  QT3_SUPPORT QChar &ref(uint i);
558  inline QT3_SUPPORT QString leftJustify(int width, QChar aFill = QLatin1Char(' '), bool trunc=false) const
559  { return leftJustified(width, aFill, trunc); }
560  inline QT3_SUPPORT QString rightJustify(int width, QChar aFill = QLatin1Char(' '), bool trunc=false) const
561  { return rightJustified(width, aFill, trunc); }
562  inline QT3_SUPPORT QString lower() const { return toLower(); }
563  inline QT3_SUPPORT QString upper() const { return toUpper(); }
564  inline QT3_SUPPORT QString stripWhiteSpace() const { return trimmed(); }
565  inline QT3_SUPPORT QString simplifyWhiteSpace() const { return simplified(); }
566  inline QT3_SUPPORT QString &setUnicodeCodes(const ushort *unicode_as_ushorts, int aSize)
567  { return setUtf16(unicode_as_ushorts, aSize); }
568  inline QT3_SUPPORT const ushort *ucs2() const { return utf16(); }
569  inline static QT3_SUPPORT QString fromUcs2(const ushort *unicode, int size = -1)
570  { return fromUtf16(unicode, size); }
571  inline QT3_SUPPORT QString &setAscii(const char *str, int len = -1)
572  { *this = fromAscii(str, len); return *this; }
573  inline QT3_SUPPORT QString &setLatin1(const char *str, int len = -1)
574  { *this = fromLatin1(str, len); return *this; }
575 protected:
576  friend class QObject;
577  const char *ascii_helper() const;
578  const char *latin1_helper() const;
579 public:
580 #ifndef QT_NO_CAST_TO_ASCII
581  inline QT3_SUPPORT operator const char *() const { return ascii_helper(); }
582 private:
583  QT3_SUPPORT operator QNoImplicitBoolCast() const;
584 public:
585 #endif
586 #endif
587 
588  bool isSimpleText() const { if (!d->clean) updateProperties(); return d->simpletext; }
589  bool isRightToLeft() const;
590 
591  QString(int size, Qt::Initialization);
592 
593 private:
594 #if defined(QT_NO_CAST_FROM_ASCII) && !defined(Q_NO_DECLARED_NOT_DEFINED)
595  QString &operator+=(const char *s);
596  QString &operator+=(const QByteArray &s);
597  QString(const char *ch);
598  QString(const QByteArray &a);
599  QString &operator=(const char *ch);
600  QString &operator=(const QByteArray &a);
601 #endif
602 
603  struct Data {
605  int alloc, size;
606  ushort *data; // QT5: put that after the bit field to fill alignment gap; don't use sizeof any more then
613  // ### Qt5: try to ensure that "array" is aligned to 16 bytes on both 32- and 64-bit
614  ushort array[1];
615  };
618  Data *d;
619  QString(Data *dd, int /*dummy*/) : d(dd) {}
620 #ifndef QT_NO_TEXTCODEC
622 #endif
623  static int grow(int);
624  static void free(Data *);
625  void realloc();
626  void realloc(int alloc);
627  void expand(int i);
628  void updateProperties() const;
629  QString multiArg(int numArgs, const QString **args) const;
630  static int compare_helper(const QChar *data1, int length1,
631  const QChar *data2, int length2,
633  static int compare_helper(const QChar *data1, int length1,
634  QLatin1String s2,
636  static int localeAwareCompare_helper(const QChar *data1, int length1,
637  const QChar *data2, int length2);
638  static Data *fromLatin1_helper(const char *str, int size = -1);
639  static Data *fromAscii_helper(const char *str, int size = -1);
640  void replace_helper(uint *indices, int nIndices, int blen, const QChar *after, int alen);
641  friend class QCharRef;
642  friend class QCFString;
643  friend class QTextCodec;
644  friend class QStringRef;
645  friend struct QAbstractConcatenable;
646  friend inline bool qStringComparisonHelper(const QString &s1, const char *s2);
647  friend inline bool qStringComparisonHelper(const QStringRef &s1, const char *s2);
648 public:
649  typedef Data * DataPtr;
650  inline DataPtr &data_ptr() { return d; }
651 };
652 
653 
655 {
656 public:
657  inline explicit QLatin1String(const char *s) : chars(s) {}
658  inline QLatin1String &operator=(const QLatin1String &other)
659  { chars = other.chars; return *this; }
660 
661  inline const char *latin1() const { return chars; }
662 
663  inline bool operator==(const QString &s) const
664  { return s == *this; }
665  inline bool operator!=(const QString &s) const
666  { return s != *this; }
667  inline bool operator>(const QString &s) const
668  { return s < *this; }
669  inline bool operator<(const QString &s) const
670  { return s > *this; }
671  inline bool operator>=(const QString &s) const
672  { return s <= *this; }
673  inline bool operator<=(const QString &s) const
674  { return s >= *this; }
675 
676  inline QT_ASCII_CAST_WARN bool operator==(const char *s) const
677  { return QString::fromAscii(s) == *this; }
678  inline QT_ASCII_CAST_WARN bool operator!=(const char *s) const
679  { return QString::fromAscii(s) != *this; }
680  inline QT_ASCII_CAST_WARN bool operator<(const char *s) const
681  { return QString::fromAscii(s) > *this; }
682  inline QT_ASCII_CAST_WARN bool operator>(const char *s) const
683  { return QString::fromAscii(s) < *this; }
684  inline QT_ASCII_CAST_WARN bool operator<=(const char *s) const
685  { return QString::fromAscii(s) >= *this; }
686  inline QT_ASCII_CAST_WARN bool operator>=(const char *s) const
687  { return QString::fromAscii(s) <= *this; }
688 private:
689  const char *chars;
690 };
691 
692 
693 
694 inline QString::QString(const QLatin1String &aLatin1) : d(fromLatin1_helper(aLatin1.latin1()))
695 { }
696 inline int QString::length() const
697 { return d->size; }
698 inline const QChar QString::at(int i) const
699 { Q_ASSERT(uint(i) < uint(size())); return d->data[i]; }
700 inline const QChar QString::operator[](int i) const
701 { Q_ASSERT(uint(i) < uint(size())); return d->data[i]; }
702 inline const QChar QString::operator[](uint i) const
703 { Q_ASSERT(i < uint(size())); return d->data[i]; }
704 inline bool QString::isEmpty() const
705 { return d->size == 0; }
706 inline const QChar *QString::unicode() const
707 { return reinterpret_cast<const QChar*>(d->data); }
708 inline const QChar *QString::data() const
709 { return reinterpret_cast<const QChar*>(d->data); }
711 { detach(); return reinterpret_cast<QChar*>(d->data); }
712 inline const QChar *QString::constData() const
713 { return reinterpret_cast<const QChar*>(d->data); }
714 inline void QString::detach()
715 { if (d->ref != 1 || d->data != d->array) realloc(); }
716 inline bool QString::isDetached() const
717 { return d->ref == 1; }
719 {
720  *this = fromLatin1(s.latin1());
721  return *this;
722 }
723 inline void QString::clear()
724 { if (!isNull()) *this = QString(); }
725 inline QString::QString(const QString &other) : d(other.d)
726 { Q_ASSERT(&other != this); d->ref.ref(); }
727 inline int QString::capacity() const
728 { return d->alloc; }
729 inline QString &QString::setNum(short n, int base)
730 { return setNum(qlonglong(n), base); }
732 { return setNum(qulonglong(n), base); }
733 inline QString &QString::setNum(int n, int base)
734 { return setNum(qlonglong(n), base); }
736 { return setNum(qulonglong(n), base); }
737 inline QString &QString::setNum(long n, int base)
738 { return setNum(qlonglong(n), base); }
740 { return setNum(qulonglong(n), base); }
741 inline QString &QString::setNum(float n, char f, int prec)
742 { return setNum(double(n),f,prec); }
743 inline QString QString::arg(int a, int fieldWidth, int base, const QChar &fillChar) const
744 { return arg(qlonglong(a), fieldWidth, base, fillChar); }
745 inline QString QString::arg(uint a, int fieldWidth, int base, const QChar &fillChar) const
746 { return arg(qulonglong(a), fieldWidth, base, fillChar); }
747 inline QString QString::arg(long a, int fieldWidth, int base, const QChar &fillChar) const
748 { return arg(qlonglong(a), fieldWidth, base, fillChar); }
749 inline QString QString::arg(ulong a, int fieldWidth, int base, const QChar &fillChar) const
750 { return arg(qulonglong(a), fieldWidth, base, fillChar); }
751 inline QString QString::arg(short a, int fieldWidth, int base, const QChar &fillChar) const
752 { return arg(qlonglong(a), fieldWidth, base, fillChar); }
753 inline QString QString::arg(ushort a, int fieldWidth, int base, const QChar &fillChar) const
754 { return arg(qulonglong(a), fieldWidth, base, fillChar); }
755 inline QString QString::arg(const QString &a1, const QString &a2) const
756 { const QString *args[2] = { &a1, &a2 }; return multiArg(2, args); }
757 inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3) const
758 { const QString *args[3] = { &a1, &a2, &a3 }; return multiArg(3, args); }
759 inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
760  const QString &a4) const
761 { const QString *args[4] = { &a1, &a2, &a3, &a4 }; return multiArg(4, args); }
762 inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
763  const QString &a4, const QString &a5) const
764 { const QString *args[5] = { &a1, &a2, &a3, &a4, &a5 }; return multiArg(5, args); }
765 inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
766  const QString &a4, const QString &a5, const QString &a6) const
767 { const QString *args[6] = { &a1, &a2, &a3, &a4, &a5, &a6 }; return multiArg(6, args); }
768 inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
769  const QString &a4, const QString &a5, const QString &a6,
770  const QString &a7) const
771 { const QString *args[7] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7 }; return multiArg(7, args); }
772 inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
773  const QString &a4, const QString &a5, const QString &a6,
774  const QString &a7, const QString &a8) const
775 { const QString *args[8] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8 }; return multiArg(8, args); }
776 inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
777  const QString &a4, const QString &a5, const QString &a6,
778  const QString &a7, const QString &a8, const QString &a9) const
779 { const QString *args[9] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9 }; return multiArg(9, args); }
780 
781 inline QString QString::section(QChar asep, int astart, int aend, SectionFlags aflags) const
782 { return section(QString(asep), astart, aend, aflags); }
783 
784 
787  int i;
788  inline QCharRef(QString &str, int idx)
789  : s(str),i(idx) {}
790  friend class QString;
791 public:
792 
793  // most QChar operations repeated here
794 
795  // all this is not documented: We just say "like QChar" and let it be.
796  inline operator QChar() const
797  { return i < s.d->size ? s.d->data[i] : 0; }
798  inline QCharRef &operator=(const QChar &c)
799  { if (i >= s.d->size) s.expand(i); else s.detach();
800  s.d->data[i] = c.unicode(); return *this; }
801 
802  // An operator= for each QChar cast constructors
803 #ifndef QT_NO_CAST_FROM_ASCII
805  { return operator=(QChar::fromAscii(c)); }
807  { return operator=(QChar::fromAscii(c)); }
808 #endif
809  inline QCharRef &operator=(const QCharRef &c) { return operator=(QChar(c)); }
810  inline QCharRef &operator=(ushort rc) { return operator=(QChar(rc)); }
811  inline QCharRef &operator=(short rc) { return operator=(QChar(rc)); }
812  inline QCharRef &operator=(uint rc) { return operator=(QChar(rc)); }
813  inline QCharRef &operator=(int rc) { return operator=(QChar(rc)); }
814 
815  // each function...
816  inline bool isNull() const { return QChar(*this).isNull(); }
817  inline bool isPrint() const { return QChar(*this).isPrint(); }
818  inline bool isPunct() const { return QChar(*this).isPunct(); }
819  inline bool isSpace() const { return QChar(*this).isSpace(); }
820  inline bool isMark() const { return QChar(*this).isMark(); }
821  inline bool isLetter() const { return QChar(*this).isLetter(); }
822  inline bool isNumber() const { return QChar(*this).isNumber(); }
823  inline bool isLetterOrNumber() { return QChar(*this).isLetterOrNumber(); }
824  inline bool isDigit() const { return QChar(*this).isDigit(); }
825  inline bool isLower() const { return QChar(*this).isLower(); }
826  inline bool isUpper() const { return QChar(*this).isUpper(); }
827  inline bool isTitleCase() const { return QChar(*this).isTitleCase(); }
828 
829  inline int digitValue() const { return QChar(*this).digitValue(); }
830  QChar toLower() const { return QChar(*this).toLower(); }
831  QChar toUpper() const { return QChar(*this).toUpper(); }
832  QChar toTitleCase () const { return QChar(*this).toTitleCase(); }
833 
834  QChar::Category category() const { return QChar(*this).category(); }
835  QChar::Direction direction() const { return QChar(*this).direction(); }
836  QChar::Joining joining() const { return QChar(*this).joining(); }
837  bool hasMirrored() const { return QChar(*this).hasMirrored(); }
838  QChar mirroredChar() const { return QChar(*this).mirroredChar(); }
839  QString decomposition() const { return QChar(*this).decomposition(); }
841  uchar combiningClass() const { return QChar(*this).combiningClass(); }
842 
844 
845  inline uchar cell() const { return QChar(*this).cell(); }
846  inline uchar row() const { return QChar(*this).row(); }
847  inline void setCell(uchar cell);
848  inline void setRow(uchar row);
849 
850 #ifdef Q_COMPILER_MANGLES_RETURN_TYPE
851  const char toAscii() const { return QChar(*this).toAscii(); }
852  const char toLatin1() const { return QChar(*this).toLatin1(); }
853  const ushort unicode() const { return QChar(*this).unicode(); }
854 #else
855  char toAscii() const { return QChar(*this).toAscii(); }
856  char toLatin1() const { return QChar(*this).toLatin1(); }
857  ushort unicode() const { return QChar(*this).unicode(); }
858 #endif
859  ushort& unicode() { return s.data()[i].unicode(); }
860 
861 #ifdef QT3_SUPPORT
862  inline QT3_SUPPORT bool mirrored() const { return hasMirrored(); }
863  inline QT3_SUPPORT QChar lower() const { return QChar(*this).toLower(); }
864  inline QT3_SUPPORT QChar upper() const { return QChar(*this).toUpper(); }
865 #ifdef Q_COMPILER_MANGLES_RETURN_TYPE
866  const QT3_SUPPORT char latin1() const { return QChar(*this).toLatin1(); }
867  const QT3_SUPPORT char ascii() const { return QChar(*this).toAscii(); }
868 #else
869  QT3_SUPPORT char latin1() const { return QChar(*this).toLatin1(); }
870  QT3_SUPPORT char ascii() const { return QChar(*this).toAscii(); }
871 #endif
872 #endif
873 };
874 
875 inline void QCharRef::setRow(uchar arow) { QChar(*this).setRow(arow); }
876 inline void QCharRef::setCell(uchar acell) { QChar(*this).setCell(acell); }
877 
878 
879 inline QString::QString() : d(&shared_null) { d->ref.ref(); }
880 inline QString::~QString() { if (!d->ref.deref()) free(d); }
881 inline void QString::reserve(int asize) { if (d->ref != 1 || asize > d->alloc) realloc(asize); d->capacity = 1;}
882 inline QString &QString::setUtf16(const ushort *autf16, int asize)
883 { return setUnicode(reinterpret_cast<const QChar *>(autf16), asize); }
885 { Q_ASSERT(i >= 0); return QCharRef(*this, i); }
887 { return QCharRef(*this, i); }
889 { detach(); return reinterpret_cast<QChar*>(d->data); }
891 { return reinterpret_cast<const QChar*>(d->data); }
893 { return reinterpret_cast<const QChar*>(d->data); }
895 { detach(); return reinterpret_cast<QChar*>(d->data + d->size); }
897 { return reinterpret_cast<const QChar*>(d->data + d->size); }
899 { return reinterpret_cast<const QChar*>(d->data + d->size); }
901 { return QBool(indexOf(s, 0, cs) != -1); }
903 { return QBool(indexOf(s, 0, cs) != -1); }
905 { return QBool(indexOf(c, 0, cs) != -1); }
906 
907 
908 inline bool operator==(QString::Null, QString::Null) { return true; }
909 inline bool operator==(QString::Null, const QString &s) { return s.isNull(); }
910 inline bool operator==(const QString &s, QString::Null) { return s.isNull(); }
911 inline bool operator!=(QString::Null, QString::Null) { return false; }
912 inline bool operator!=(QString::Null, const QString &s) { return !s.isNull(); }
913 inline bool operator!=(const QString &s, QString::Null) { return !s.isNull(); }
914 
915 #ifndef QT_NO_CAST_FROM_ASCII
916 inline bool qStringComparisonHelper(const QString &s1, const char *s2)
917 {
918 # ifndef QT_NO_TEXTCODEC
919  if (QString::codecForCStrings) return (s1 == QString::fromAscii(s2));
920 # endif
921  return (s1 == QLatin1String(s2));
922 }
923 inline bool QString::operator==(const char *s) const
924 { return qStringComparisonHelper(*this, s); }
925 inline bool QString::operator!=(const char *s) const
926 { return !qStringComparisonHelper(*this, s); }
927 inline bool QString::operator<(const char *s) const
928 { return *this < QString::fromAscii(s); }
929 inline bool QString::operator>(const char *s) const
930 { return *this > QString::fromAscii(s); }
931 inline bool QString::operator<=(const char *s) const
932 { return *this <= QString::fromAscii(s); }
933 inline bool QString::operator>=(const char *s) const
934 { return *this >= QString::fromAscii(s); }
935 
936 inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QString &s2)
937 { return qStringComparisonHelper(s2, s1); }
938 inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QString &s2)
939 { return !qStringComparisonHelper(s2, s1); }
940 inline QT_ASCII_CAST_WARN bool operator<(const char *s1, const QString &s2)
941 { return (QString::fromAscii(s1) < s2); }
942 inline QT_ASCII_CAST_WARN bool operator>(const char *s1, const QString &s2)
943 { return (QString::fromAscii(s1) > s2); }
944 inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QString &s2)
945 { return (QString::fromAscii(s1) <= s2); }
946 inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QString &s2)
947 { return (QString::fromAscii(s1) >= s2); }
948 
949 inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QLatin1String &s2)
950 { return QString::fromAscii(s1) == s2; }
951 inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QLatin1String &s2)
952 { return QString::fromAscii(s1) != s2; }
953 inline QT_ASCII_CAST_WARN bool operator<(const char *s1, const QLatin1String &s2)
954 { return (QString::fromAscii(s1) < s2); }
955 inline QT_ASCII_CAST_WARN bool operator>(const char *s1, const QLatin1String &s2)
956 { return (QString::fromAscii(s1) > s2); }
957 inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QLatin1String &s2)
958 { return (QString::fromAscii(s1) <= s2); }
959 inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QLatin1String &s2)
960 { return (QString::fromAscii(s1) >= s2); }
961 
962 inline bool operator==(const QLatin1String &s1, const QLatin1String &s2)
963 { return (qstrcmp(s1.latin1(), s2.latin1()) == 0); }
964 inline bool operator!=(const QLatin1String &s1, const QLatin1String &s2)
965 { return (qstrcmp(s1.latin1(), s2.latin1()) != 0); }
966 inline bool operator<(const QLatin1String &s1, const QLatin1String &s2)
967 { return (qstrcmp(s1.latin1(), s2.latin1()) < 0); }
968 inline bool operator<=(const QLatin1String &s1, const QLatin1String &s2)
969 { return (qstrcmp(s1.latin1(), s2.latin1()) <= 0); }
970 inline bool operator>(const QLatin1String &s1, const QLatin1String &s2)
971 { return (qstrcmp(s1.latin1(), s2.latin1()) > 0); }
972 inline bool operator>=(const QLatin1String &s1, const QLatin1String &s2)
973 { return (qstrcmp(s1.latin1(), s2.latin1()) >= 0); }
974 
975 
976 inline bool QString::operator==(const QByteArray &s) const
977 { return qStringComparisonHelper(*this, s.constData()); }
978 inline bool QString::operator!=(const QByteArray &s) const
979 { return !qStringComparisonHelper(*this, s.constData()); }
980 
981 inline bool QByteArray::operator==(const QString &s) const
982 { return qStringComparisonHelper(s, constData()); }
983 inline bool QByteArray::operator!=(const QString &s) const
984 { return !qStringComparisonHelper(s, constData()); }
985 inline bool QByteArray::operator<(const QString &s) const
986 { return QString::fromAscii(constData(), size()) < s; }
987 inline bool QByteArray::operator>(const QString &s) const
988 { return QString::fromAscii(constData(), size()) > s; }
989 inline bool QByteArray::operator<=(const QString &s) const
990 { return QString::fromAscii(constData(), size()) <= s; }
991 inline bool QByteArray::operator>=(const QString &s) const
992 { return QString::fromAscii(constData(), size()) >= s; }
993 #endif // QT_NO_CAST_FROM_ASCII
994 
995 #ifndef QT_NO_CAST_TO_ASCII
997 { return append(s.toAscii()); }
998 inline QByteArray &QByteArray::insert(int i, const QString &s)
999 { return insert(i, s.toAscii()); }
1000 inline QByteArray &QByteArray::replace(char c, const QString &after)
1001 { return replace(c, after.toAscii()); }
1002 inline QByteArray &QByteArray::replace(const QString &before, const char *after)
1003 { return replace(before.toAscii(), after); }
1004 inline QByteArray &QByteArray::replace(const QString &before, const QByteArray &after)
1005 { return replace(before.toAscii(), after); }
1007 { return operator+=(s.toAscii()); }
1008 inline int QByteArray::indexOf(const QString &s, int from) const
1009 { return indexOf(s.toAscii(), from); }
1010 inline int QByteArray::lastIndexOf(const QString &s, int from) const
1011 { return lastIndexOf(s.toAscii(), from); }
1012 # ifdef QT3_SUPPORT
1013 inline int QByteArray::find(const QString &s, int from) const
1014 { return indexOf(s.toAscii(), from); }
1015 inline int QByteArray::findRev(const QString &s, int from) const
1016 { return lastIndexOf(s.toAscii(), from); }
1017 # endif // QT3_SUPPORT
1018 #endif // QT_NO_CAST_TO_ASCII
1019 
1020 #if !defined(QT_USE_FAST_OPERATOR_PLUS) && !defined(QT_USE_QSTRINGBUILDER)
1021 inline const QString operator+(const QString &s1, const QString &s2)
1022 { QString t(s1); t += s2; return t; }
1023 inline const QString operator+(const QString &s1, QChar s2)
1024 { QString t(s1); t += s2; return t; }
1025 inline const QString operator+(QChar s1, const QString &s2)
1026 { QString t(s1); t += s2; return t; }
1027 # ifndef QT_NO_CAST_FROM_ASCII
1028 inline QT_ASCII_CAST_WARN const QString operator+(const QString &s1, const char *s2)
1029 { QString t(s1); t += QString::fromAscii(s2); return t; }
1030 inline QT_ASCII_CAST_WARN const QString operator+(const char *s1, const QString &s2)
1031 { QString t = QString::fromAscii(s1); t += s2; return t; }
1032 inline QT_ASCII_CAST_WARN const QString operator+(char c, const QString &s)
1033 { QString t = s; t.prepend(QChar::fromAscii(c)); return t; }
1034 inline QT_ASCII_CAST_WARN const QString operator+(const QString &s, char c)
1035 { QString t = s; t += QChar::fromAscii(c); return t; }
1036 inline QT_ASCII_CAST_WARN const QString operator+(const QByteArray &ba, const QString &s)
1037 { QString t = QString::fromAscii(ba.constData(), qstrnlen(ba.constData(), ba.size())); t += s; return t; }
1038 inline QT_ASCII_CAST_WARN const QString operator+(const QString &s, const QByteArray &ba)
1039 { QString t(s); t += QString::fromAscii(ba.constData(), qstrnlen(ba.constData(), ba.size())); return t; }
1040 # endif // QT_NO_CAST_FROM_ASCII
1041 #endif // QT_USE_QSTRINGBUILDER
1042 
1043 #ifndef QT_NO_STL
1044 inline std::string QString::toStdString() const
1045 { const QByteArray asc = toAscii(); return std::string(asc.constData(), asc.length()); }
1046 
1047 inline QString QString::fromStdString(const std::string &s)
1048 { return fromAscii(s.data(), int(s.size())); }
1049 
1050 # ifndef QT_NO_STL_WCHAR
1052 {
1053  QStdWString str;
1054  str.resize(length());
1055 
1056 #if defined(_MSC_VER) && _MSC_VER >= 1400
1057  // VS2005 crashes if the string is empty
1058  if (!length())
1059  return str;
1060 #endif
1061 
1062  str.resize(toWCharArray(&(*str.begin())));
1063  return str;
1064 }
1066 { return fromWCharArray(s.data(), int(s.size())); }
1067 # endif
1068 #endif
1069 
1070 #ifdef QT3_SUPPORT
1071 inline QChar &QString::ref(uint i)
1072 {
1073  if (int(i) > d->size || d->ref != 1)
1074  resize(qMax(int(i), d->size));
1075  return reinterpret_cast<QChar&>(d->data[i]);
1076 }
1077 #endif
1078 
1079 #if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE))
1082 #endif
1083 
1084 #ifdef QT3_SUPPORT
1085 class QConstString : public QString
1086 {
1087 public:
1088  inline QT3_SUPPORT_CONSTRUCTOR QConstString(const QChar *aUnicode, int aSize)
1089  :QString(aUnicode, aSize){} // cannot use fromRawData() due to changed semantics
1090  inline QT3_SUPPORT const QString &string() const { return *this; }
1091 };
1092 #endif
1093 
1096 Q_DECLARE_OPERATORS_FOR_FLAGS(QString::SectionFlags)
1097 
1098 
1102  int m_size;
1103 public:
1104  inline QStringRef():m_string(0), m_position(0), m_size(0){}
1105  inline QStringRef(const QString *string, int position, int size);
1106  inline QStringRef(const QString *string);
1107  inline QStringRef(const QStringRef &other)
1108  :m_string(other.m_string), m_position(other.m_position), m_size(other.m_size)
1109  {}
1110 
1111  inline ~QStringRef(){}
1112  inline const QString *string() const { return m_string; }
1113  inline int position() const { return m_position; }
1114  inline int size() const { return m_size; }
1115  inline int count() const { return m_size; }
1116  inline int length() const { return m_size; }
1117 
1118  inline QStringRef &operator=(const QStringRef &other) {
1119  m_string = other.m_string; m_position = other.m_position;
1120  m_size = other.m_size; return *this;
1121  }
1122 
1123  int indexOf(const QString &str, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1124  int indexOf(QChar ch, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1125  int indexOf(QLatin1String str, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1126  int indexOf(const QStringRef &str, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1127  int lastIndexOf(const QString &str, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1128  int lastIndexOf(QChar ch, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1129  int lastIndexOf(QLatin1String str, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1130  int lastIndexOf(const QStringRef &str, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1131 
1132  inline QBool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1133  inline QBool contains(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1135  inline QBool contains(const QStringRef &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1136 
1137  int count(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1139  int count(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1140 
1141  bool startsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1144  bool startsWith(const QStringRef &c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1145 
1146  bool endsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1149  bool endsWith(const QStringRef &c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1150 
1151  inline QStringRef &operator=(const QString *string);
1152 
1153  inline const QChar *unicode() const {
1154  if (!m_string)
1155  return reinterpret_cast<const QChar *>(QString::shared_null.data);
1156  return m_string->unicode() + m_position;
1157  }
1158  inline const QChar *data() const { return unicode(); }
1159  inline const QChar *constData() const { return unicode(); }
1160 
1166 
1167  inline void clear() { m_string = 0; m_position = m_size = 0; }
1168  QString toString() const;
1169  inline bool isEmpty() const { return m_size == 0; }
1170  inline bool isNull() const { return m_string == 0 || m_string->isNull(); }
1171 
1172  QStringRef appendTo(QString *string) const;
1173 
1174  inline const QChar at(int i) const
1175  { Q_ASSERT(uint(i) < uint(size())); return m_string->at(i + m_position); }
1176 
1177  int compare(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1178  int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
1180  static int compare(const QStringRef &s1, const QString &s2,
1182  static int compare(const QStringRef &s1, const QStringRef &s2,
1184  static int compare(const QStringRef &s1, QLatin1String s2,
1186 
1187  int localeAwareCompare(const QString &s) const;
1188  int localeAwareCompare(const QStringRef &s) const;
1189  static int localeAwareCompare(const QStringRef &s1, const QString &s2);
1190  static int localeAwareCompare(const QStringRef &s1, const QStringRef &s2);
1191 };
1192 
1194 { m_string = aString; m_position = 0; m_size = aString?aString->size():0; return *this; }
1195 
1196 inline QStringRef::QStringRef(const QString *aString, int aPosition, int aSize)
1197  :m_string(aString), m_position(aPosition), m_size(aSize){}
1198 
1199 inline QStringRef::QStringRef(const QString *aString)
1200  :m_string(aString), m_position(0), m_size(aString?aString->size() : 0){}
1201 
1202 Q_CORE_EXPORT bool operator==(const QStringRef &s1,const QStringRef &s2);
1203 inline bool operator!=(const QStringRef &s1,const QStringRef &s2)
1204 { return !(s1 == s2); }
1205 Q_CORE_EXPORT bool operator==(const QString &s1,const QStringRef &s2);
1206 inline bool operator!=(const QString &s1,const QStringRef &s2)
1207 { return !(s1 == s2); }
1208 inline bool operator==(const QStringRef &s1,const QString &s2)
1209 { return s2 == s1; }
1210 inline bool operator!=(const QStringRef &s1,const QString &s2)
1211 { return s2 != s1; }
1212 Q_CORE_EXPORT bool operator==(const QLatin1String &s1, const QStringRef &s2);
1213 inline bool operator!=(const QLatin1String &s1,const QStringRef &s2)
1214 { return !(s1 == s2); }
1215 inline bool operator==(const QStringRef &s1,const QLatin1String &s2)
1216 { return s2 == s1; }
1217 inline bool operator!=(const QStringRef &s1,const QLatin1String &s2)
1218 { return s2 != s1; }
1219 
1220 Q_CORE_EXPORT bool operator<(const QStringRef &s1,const QStringRef &s2);
1221 inline bool operator>(const QStringRef &s1, const QStringRef &s2)
1222 { return s2 < s1; }
1223 inline bool operator<=(const QStringRef &s1, const QStringRef &s2)
1224 { return !(s1 > s2); }
1225 inline bool operator>=(const QStringRef &s1, const QStringRef &s2)
1226 { return !(s1 < s2); }
1227 
1228 inline bool qStringComparisonHelper(const QStringRef &s1, const char *s2)
1229 {
1230 # ifndef QT_NO_TEXTCODEC
1231  if (QString::codecForCStrings) return (s1 == QString::fromAscii(s2));
1232 # endif
1233  return (s1 == QLatin1String(s2));
1234 }
1235 
1236 inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QStringRef &s2)
1237 { return qStringComparisonHelper(s2, s1); }
1238 inline QT_ASCII_CAST_WARN bool operator==(const QStringRef &s1, const char *s2)
1239 { return qStringComparisonHelper(s1, s2); }
1240 inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QStringRef &s2)
1241 { return !qStringComparisonHelper(s2, s1); }
1242 inline QT_ASCII_CAST_WARN bool operator!=(const QStringRef &s1, const char *s2)
1243 { return !qStringComparisonHelper(s1, s2); }
1244 
1245 inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const
1246 { return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
1247 inline int QString::compare(const QString &s1, const QStringRef &s2, Qt::CaseSensitivity cs)
1248 { return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
1249 inline int QStringRef::compare(const QString &s, Qt::CaseSensitivity cs) const
1250 { return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
1252 { return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
1254 { return QString::compare_helper(constData(), length(), s, cs); }
1255 inline int QStringRef::compare(const QStringRef &s1, const QString &s2, Qt::CaseSensitivity cs)
1256 { return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
1257 inline int QStringRef::compare(const QStringRef &s1, const QStringRef &s2, Qt::CaseSensitivity cs)
1258 { return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
1260 { return QString::compare_helper(s1.constData(), s1.length(), s2, cs); }
1261 
1262 inline int QString::localeAwareCompare(const QStringRef &s) const
1263 { return localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); }
1264 inline int QString::localeAwareCompare(const QString& s1, const QStringRef& s2)
1265 { return localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); }
1266 inline int QStringRef::localeAwareCompare(const QString &s) const
1268 inline int QStringRef::localeAwareCompare(const QStringRef &s) const
1270 inline int QStringRef::localeAwareCompare(const QStringRef &s1, const QString &s2)
1271 { return QString::localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); }
1272 inline int QStringRef::localeAwareCompare(const QStringRef &s1, const QStringRef &s2)
1273 { return QString::localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); }
1274 
1276 { return QBool(indexOf(s, 0, cs) != -1); }
1278 { return QBool(indexOf(s, 0, cs) != -1); }
1280 { return QBool(indexOf(c, 0, cs) != -1); }
1282 { return QBool(indexOf(s, 0, cs) != -1); }
1283 
1284 
1285 
1287 
1289 
1290 #if defined(QT_USE_FAST_OPERATOR_PLUS) || defined(QT_USE_QSTRINGBUILDER)
1291 #include <QtCore/qstringbuilder.h>
1292 #endif
1293 
1294 #endif // QSTRING_H
#define QT_ASCII_CAST_WARN
Definition: qglobal.h:1144
static QString fromWCharArray(const wchar_t *, int size=-1)
Returns a copy of the string, where the encoding of string depends on the size of wchar...
Definition: qstring.cpp:1019
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.h:904
double d
Definition: qnumeric_p.h:62
bool isSharedWith(const QString &other) const
Definition: qstring.h:123
QT_ASCII_CAST_WARN bool operator>(const char *s1, const QString &s2)
Definition: qstring.h:942
QString decomposition() const
Definition: qstring.h:839
const char * chars
Definition: qstring.h:689
bool operator>(const QStringRef &s1, const QStringRef &s2)
Definition: qstring.h:1221
QString section(QChar sep, int start, int end=-1, SectionFlags flags=SectionDefault) const
This function returns a section of the string.
Definition: qstring.h:781
iterator end()
Returns an STL-style iterator pointing to the imaginary character after the last character in the str...
Definition: qstring.h:894
void clear()
Clears the contents of the string reference by making it null and empty.
Definition: qstring.h:1167
bool operator!=(const QLatin1String &s) const
Definition: qstring.h:413
QT_ASCII_CAST_WARN QString & prepend(const char *s)
Definition: qstring.h:432
~QStringRef()
Destroys the string reference.
Definition: qstring.h:1111
const QChar * const_iterator
The QString::const_iterator typedef provides an STL-style const iterator for QString.
Definition: qstring.h:467
Joining
This enum type defines the Unicode joining attributes.
Definition: qchar.h:182
The QConstString class is a wrapper for constant Unicode string data.
QStringRef(const QStringRef &other)
Constructs a copy of the other string reference.
Definition: qstring.h:1107
QChar::UnicodeVersion unicodeVersion() const
Definition: qstring.h:843
bool operator==(const QStringRef &s1, const QStringRef &s2)
Returns true if string reference s1 is lexically equal to string reference s2; otherwise returns fals...
Definition: qstring.cpp:8670
QString & operator+=(const QString &s)
Appends the string other onto the end of this string and returns a reference to this string...
Definition: qstring.h:274
void push_front(const QString &s)
This function is provided for STL compatibility, prepending the given other string to the beginning o...
Definition: qstring.h:484
void realloc()
Definition: qstring.cpp:1472
bool isLetter() const
Returns true if the character is a letter (Letter_* categories); otherwise returns false...
Definition: qchar.cpp:653
QChar::Joining joining() const
Definition: qstring.h:836
Category
This enum maps the Unicode character categories.
Definition: qchar.h:106
unsigned char c[8]
Definition: qnumeric_p.h:62
static int localeAwareCompare_helper(const QChar *data1, int length1, const QChar *data2, int length2)
Definition: qstring.cpp:5212
void setRow(uchar row)
Definition: qstring.h:875
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QChar::Decomposition decompositionTag() const
Definition: qstring.h:840
QString & operator=(QChar c)
Definition: qstring.cpp:1582
bool qStringComparisonHelper(const QString &s1, const char *s2)
Definition: qstring.h:916
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
Definition: qstring.cpp:4276
#define QT_MODULE(x)
Definition: qglobal.h:2783
NormalizationForm
This enum describes the various normalized forms of Unicode text.
Definition: qstring.h:309
bool operator<=(const QLatin1String &s) const
Definition: qstring.h:414
int length() const
Returns the number of characters referred to by the string reference.
Definition: qstring.h:1116
int digitValue() const
Returns the numeric value of the digit, or -1 if the character is not a digit.
Definition: qchar.cpp:817
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
int QNoImplicitBoolCast
Definition: qglobal.h:1181
QCharRef(QString &str, int idx)
Definition: qstring.h:788
QT_ASCII_CAST_WARN bool operator==(const QString &s2) const
Returns true if this byte array is equal to string str; otherwise returns false.
Definition: qstring.h:981
The QRegExp class provides pattern matching using regular expressions.
Definition: qregexp.h:61
QChar * iterator
The QString::iterator typedef provides an STL-style non-const iterator for QString.
Definition: qstring.h:466
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
Definition: qglobal.h:2348
bool isNull() const
Returns true if the character is the Unicode character 0x0000 (&#39;\0&#39;); otherwise returns false...
Definition: qchar.h:262
QChar value_type
The QString::const_reference typedef provides an STL-style value type for QString.
Definition: qstring.h:480
QT_ASCII_CAST_WARN bool operator==(const char *s) const
Definition: qstring.h:676
QByteArray & append(char c)
Appends the character ch to this byte array.
bool operator!=(QString::Null, QString::Null)
Definition: qstring.h:911
bool isDetached() const
Definition: qstring.h:716
bool isMark() const
Definition: qstring.h:820
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
Definition: qstring.cpp:4074
const_iterator ConstIterator
Qt-style synonym for QString::const_iterator.
Definition: qstring.h:469
QChar mirroredChar() const
Definition: qstring.h:838
QString & replace(int i, int len, QChar after)
Definition: qstring.cpp:2005
#define at(className, varName)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
ushort capacity
Definition: qstring.h:611
QCharRef & operator=(ushort rc)
Definition: qstring.h:810
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
QString & prepend(QChar c)
Definition: qstring.h:261
bool operator<(const QString &s) const
Returns true if this string is lexically less than the other string; otherwise returns false...
Definition: qstring.h:669
int toWCharArray(wchar_t *array) const
Fills the array with the data contained in this QString object.
Definition: qstring.cpp:1086
Decomposition decompositionTag() const
Returns the tag defining the composition of the character.
Definition: qchar.cpp:1122
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
QT_ASCII_CAST_WARN QCharRef & operator=(char c)
Definition: qstring.h:804
QCharRef & operator=(uint rc)
Definition: qstring.h:812
static void clear(QVariant::Private *d)
Definition: qvariant.cpp:197
ushort clean
Definition: qstring.h:607
QString(Data *dd, int)
Definition: qstring.h:619
bool isSpace() const
Definition: qstring.h:819
Joining joining() const
Returns information about the joining properties of the character (needed for certain languages such ...
Definition: qchar.cpp:924
void push_front(QChar c)
Prepends the given ch character to the beginning of this string.
Definition: qstring.h:483
QString & s
Definition: qstring.h:786
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition: qstring.cpp:3734
static int compare(const QString &s1, const QLatin1String &s2, Qt::CaseSensitivity cs=Qt::CaseSensitive)
Definition: qstring.h:355
ushort unicode() const
Definition: qstring.h:857
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
long ASN1_INTEGER_get ASN1_INTEGER * a
bool isSimpleText() const
Definition: qstring.h:588
std::string toStdString() const
Returns a std::string object with the data contained in this QString.
Definition: qstring.h:1044
char toLatin1() const
Definition: qstring.h:856
bool operator==(QString::Null, QString::Null)
Definition: qstring.h:908
bool operator>=(const QString &s) const
Returns true if this string is lexically greater than or equal to string other; otherwise returns fal...
Definition: qstring.h:671
The QString class provides a Unicode character string.
Definition: qstring.h:83
const QChar * data() const
Same as unicode().
Definition: qstring.h:1158
QString multiArg(int numArgs, const QString **args) const
Definition: qstring.cpp:7434
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QVector class is a template class that provides a dynamic array.
Definition: qdatastream.h:64
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
bool isPrint() const
Returns true if the character is a printable character; otherwise returns false.
Definition: qchar.cpp:598
QChar::Direction direction() const
Definition: qstring.h:835
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if this string reference contains an occurrence of the string str; otherwise returns fal...
Definition: qstring.h:1275
static const uint base
Definition: qurl.cpp:268
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
void push_back(QChar c)
Appends the given ch character onto the end of this string.
Definition: qstring.h:481
QChar * data()
Returns a pointer to the data stored in the QString.
Definition: qstring.h:710
QCharRef & operator=(int rc)
Definition: qstring.h:813
QT_ASCII_CAST_WARN QString & prepend(const QByteArray &s)
Definition: qstring.h:434
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
QBasicAtomicInt ref
Definition: qstring.h:604
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
bool isSpace() const
Returns true if the character is a separator character (Separator_* categories); otherwise returns fa...
Definition: qchar.cpp:609
Category category() const
Returns the character&#39;s category.
Definition: qchar.cpp:853
QT_ASCII_CAST_WARN QString & operator+=(const QByteArray &s)
Definition: qstring.h:442
bool isLower() const
Returns true if the character is a lowercase letter, i.
Definition: qchar.h:272
const QChar & const_reference
The QString::const_reference typedef provides an STL-style const reference for QString.
Definition: qstring.h:478
int m_position
Definition: qstring.h:1101
static QString fromStdWString(const std::wstring &s)
Returns a copy of the str string.
Definition: qstring.h:1065
Data * DataPtr
Definition: qstring.h:649
QChar::Category category() const
Definition: qstring.h:834
#define Q_DECLARE_SHARED(TYPE)
Definition: qglobal.h:2214
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first character in the string. ...
Definition: qstring.h:892
void push_back(const QString &s)
This function is provided for STL compatibility, appending the given other string onto the end of thi...
Definition: qstring.h:482
UnicodeVersion unicodeVersion() const
Returns the Unicode version that introduced this character.
Definition: qchar.cpp:1189
const QChar * constData() const
Same as unicode().
Definition: qstring.h:1159
static void free(Data *)
Definition: qstring.cpp:1311
int localeAwareCompare(const QString &s) const
Compares this string with the other string and returns an integer less than, equal to...
Definition: qstring.h:1266
QT_ASCII_CAST_WARN bool operator>=(const char *s) const
Definition: qstring.h:686
~QString()
Destroys the string.
Definition: qstring.h:880
void reserve(int size)
Attempts to allocate memory for at least size characters.
Definition: qstring.h:881
static Data shared_null
Definition: qstring.h:616
unsigned char uchar
Definition: qglobal.h:994
bool hasMirrored() const
Returns true if the character should be reversed if the text direction is reversed; otherwise returns...
Definition: qchar.cpp:968
static QString toString(Register *reg, int type, bool *ok=0)
QT_ASCII_CAST_WARN bool operator>(const QByteArray &s) const
Definition: qstring.h:458
static int localeAwareCompare(const QString &s1, const QString &s2)
Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less th...
Definition: qstring.h:367
QT_ASCII_CAST_WARN bool operator>=(const QString &s2) const
Returns true if this byte array is greater than or equal to string str; otherwise returns false...
Definition: qstring.h:991
bool operator>=(const QStringRef &s1, const QStringRef &s2)
Definition: qstring.h:1225
bool operator==(const QString &s) const
Returns true if string other is equal to this string; otherwise returns false.
Definition: qstring.cpp:2368
static int compare_helper(const QChar *data1, int length1, const QChar *data2, int length2, Qt::CaseSensitivity cs=Qt::CaseSensitive)
Definition: qstring.cpp:5059
int size() const
Returns the number of characters referred to by the string reference.
Definition: qstring.h:1114
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
const char * latin1() const
Returns the Latin-1 string stored in this object.
Definition: qstring.h:661
QLatin1String(const char *s)
Constructs a QLatin1String object that stores str.
Definition: qstring.h:657
QT_ASCII_CAST_WARN bool operator<=(const char *s) const
Definition: qstring.h:684
static bool compare(const QVariant::Private *a, const QVariant::Private *b)
Compares a to b.
Definition: qvariant.cpp:383
int lastIndexOf(char c, int from=-1) const
Returns the index position of the last occurrence of character ch in the byte array, searching backward from index position from.
static bool isEmpty(const char *str)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
Definition: qglobal.h:2355
bool operator<(const QStringRef &s1, const QStringRef &s2)
Returns true if string reference s1 is lexically less than string reference s2; otherwise returns fal...
Definition: qstring.cpp:8727
ushort & unicode()
Definition: qstring.h:859
bool operator>=(const QString &s) const
Returns true if this string is lexically greater than or equal to string other; otherwise returns fal...
Definition: qstring.h:408
QT_ASCII_CAST_WARN bool operator<(const char *s) const
Definition: qstring.h:680
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
const QChar * unicode() const
Returns a &#39;\0&#39;-terminated Unicode representation of the string.
Definition: qstring.h:706
QString & setNum(short, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.h:729
bool operator<=(const QString &s) const
Returns true if this string is lexically less than or equal to string other; otherwise returns false...
Definition: qstring.h:673
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QString(const Null &)
Definition: qstring.h:503
bool isNull() const
Definition: qstring.h:816
QT_ASCII_CAST_WARN QCharRef & operator=(uchar c)
Definition: qstring.h:806
QT_ASCII_CAST_WARN bool operator!=(const QString &s2) const
Returns true if this byte array is not equal to string str; otherwise returns false.
Definition: qstring.h:983
void expand(int i)
Definition: qstring.cpp:1477
QChar mirroredChar() const
Returns the mirrored character if this character is a mirrored character; otherwise returns the chara...
Definition: qchar.cpp:1016
bool operator!=(const QString &s) const
Returns true if this string is not equal to string other; otherwise returns false.
Definition: qstring.h:665
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
bool operator==(const QString &s) const
Returns true if this string is equal to string other; otherwise returns false.
Definition: qstring.h:663
static int toInt(const QByteArray &str)
Definition: generator.cpp:167
bool isPunct() const
Returns true if the character is a punctuation mark (Punctuation_* categories); otherwise returns fal...
Definition: qchar.cpp:637
Q_DECLARE_TYPEINFO(QString, Q_MOVABLE_TYPE)
bool isEmpty() const
Returns true if the string reference has no characters; otherwise returns false.
Definition: qstring.h:1169
int count() const
Returns the number of characters referred to by the string reference.
Definition: qstring.h:1115
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
int indexOf(const QString &str, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns the index position of the first occurrence of the string str in this string reference...
Definition: qstring.cpp:9132
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
const QChar operator[](int i) const
Definition: qstring.h:700
QString & prepend(const QLatin1String &s)
Definition: qstring.h:263
int i
Definition: qstring.h:787
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qstring.h:898
QChar toUpper() const
Returns the uppercase equivalent if the character is lowercase or titlecase; otherwise returns the ch...
Definition: qchar.cpp:1287
#define QT_ASCII_CAST_WARN_CONSTRUCTOR
Definition: qglobal.h:1145
bool operator>(const QString &s) const
Returns true if this string is lexically greater than string other; otherwise returns false...
Definition: qstring.h:667
static void split(QT_FT_Vector *b)
const QChar * unicode() const
Returns a Unicode representation of the string reference.
Definition: qstring.h:1153
QT_ASCII_CAST_WARN QString & operator=(const char *ch)
Definition: qstring.h:424
SectionFlag
This enum specifies flags that can be used to affect various aspects of the section() function&#39;s beha...
Definition: qstring.h:212
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
QBool contains(const QRegExp &rx) const
Definition: qstring.h:204
unsigned long ulong
Definition: qglobal.h:997
QChar toLower() const
Definition: qstring.h:830
static int compare(const QLatin1String &s1, const QString &s2, Qt::CaseSensitivity cs=Qt::CaseSensitive)
Definition: qstring.h:358
SpecialCharacter
Definition: qchar.h:85
void detach()
Definition: qstring.h:714
QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QString &s2)
Definition: qstring.h:944
int indexOf(char c, int from=0) const
Returns the index position of the first occurrence of the character ch in the byte array...
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
Definition: qstring.cpp:4049
bool operator>(const QString &s) const
Returns true if this string is lexically greater than string other; otherwise returns false...
Definition: qstring.h:405
void squeeze()
Releases any memory not required to store the character data.
Definition: qstring.h:114
QString & operator+=(const QLatin1String &s)
Definition: qstring.h:276
char toAscii() const
Definition: qstring.h:855
static QString fromStdString(const std::string &s)
Returns a copy of the str string.
Definition: qstring.h:1047
UnicodeVersion
Specifies which version of the [Unicode standard](http://www.
Definition: qchar.h:212
bool isDigit() const
Definition: qstring.h:824
int count() const
Definition: qstring.h:103
int localeAwareCompare(const QString &s) const
Definition: qstring.cpp:5197
QT_ASCII_CAST_WARN bool operator>(const QString &s2) const
Returns true if this byte array is lexically greater than string str; otherwise returns false...
Definition: qstring.h:987
The QStringRef class provides a thin wrapper around QString substrings.
Definition: qstring.h:1099
QChar toTitleCase() const
Returns the title case equivalent if the character is lowercase or uppercase; otherwise returns the c...
Definition: qchar.cpp:1335
QT_ASCII_CAST_WARN bool operator<(const QByteArray &s) const
Definition: qstring.h:456
QDataStream & operator<<(QDataStream &stream, const QString &string)
Writes the given string to the specified stream.
Definition: qstring.cpp:8034
void qSwap(T &value1, T &value2)
Definition: qglobal.h:2181
Data * d
Definition: qstring.h:618
QT_ASCII_CAST_WARN bool operator!=(const char *s) const
Definition: qstring.h:678
bool isUpper() const
Returns true if the character is an uppercase letter, i.
Definition: qchar.h:273
char toAscii() const
Returns the character value of the QChar obtained using the current codec used to read C strings...
Definition: qchar.cpp:1490
int length() const
Same as size().
Definition: qbytearray.h:356
ushort reserved
Definition: qstring.h:612
bool operator<=(const QStringRef &s1, const QStringRef &s2)
Definition: qstring.h:1223
void resize(int size)
Sets the size of the string to size characters.
Definition: qstring.cpp:1353
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
QStringRef()
Constructs an empty string reference.
Definition: qstring.h:1104
bool isNull() const
Returns true if this string is null; otherwise returns false.
Definition: qstring.h:505
bool operator<=(const QString &s) const
Returns true if this string is lexically less than or equal to string other; otherwise returns false...
Definition: qstring.h:407
ushort * data
Definition: qstring.h:606
CaseSensitivity
Definition: qnamespace.h:1451
#define Q_REQUIRED_RESULT
Definition: qglobal.h:846
friend bool qStringComparisonHelper(const QString &s1, const char *s2)
Definition: qstring.h:916
int digitValue() const
Definition: qstring.h:829
int position() const
Returns the starting position in the referenced string that is referred to by the string reference...
Definition: qstring.h:1113
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
QT_ASCII_CAST_WARN bool operator<(const char *s1, const QString &s2)
Definition: qstring.h:940
QString & append(QChar c)
Definition: qstring.cpp:1777
int compare(const QString &s) const
Definition: qstring.cpp:5037
Direction
This enum type defines the Unicode direction attributes.
Definition: qchar.h:150
QString trimmed(QString source)
Definition: generator.cpp:233
bool isPunct() const
Definition: qstring.h:818
#define Q_CORE_EXPORT
Definition: qglobal.h:1449
QString & insert(int i, const QString &s)
Inserts the string str at the given index position and returns a reference to this string...
Definition: qstring.h:255
const QString * string() const
Returns a pointer to the string referred to by the string reference, or 0 if it does not reference a ...
Definition: qstring.h:1112
int capacity() const
Returns the maximum number of characters that can be stored in the string without forcing a reallocat...
Definition: qstring.h:727
QT_ASCII_CAST_WARN QString & operator=(const QByteArray &a)
Definition: qstring.h:426
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.h:1249
QDataStream & operator>>(QDataStream &stream, QString &string)
Reads a string from the specified stream into the given string.
Definition: qstring.cpp:8071
void clear()
Clears the contents of the string and makes it empty.
Definition: qstring.h:723
QT_ASCII_CAST_WARN QString & operator=(char c)
Definition: qstring.h:428
unsigned short ushort
Definition: qglobal.h:995
bool isPrint() const
Definition: qstring.h:817
std::basic_string< wchar_t > QStdWString
Definition: qstring.h:58
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:3000
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
void swap(QString &other)
Swaps string other with this string.
Definition: qstring.h:101
uchar cell() const
Definition: qstring.h:845
The QCharRef class is a helper class for QString.
Definition: qstring.h:785
QT_ASCII_CAST_WARN bool operator<=(const QString &s2) const
Returns true if this byte array is lexically less than or equal to string str; otherwise returns fals...
Definition: qstring.h:989
QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const QByteArray &a)
Constructs a string initialized with the byte array ba.
Definition: qstring.h:421
static QTextCodec * codecForCStrings
Definition: qstring.h:621
iterator begin()
Returns an STL-style iterator pointing to the first character in the string.
Definition: qstring.h:888
QByteArray toAscii() const Q_REQUIRED_RESULT
Returns an 8-bit representation of the string as a QByteArray.
Definition: qstring.cpp:4014
uint qstrnlen(const char *str, uint maxlen)
Definition: qbytearray.h:82
ushort array[1]
Definition: qstring.h:614
QStringRef & operator=(const QStringRef &other)
Assigns the other string reference to this string reference, and returns the result.
Definition: qstring.h:1118
uchar cell() const
Returns the cell (least significant byte) of the Unicode character.
Definition: qchar.h:283
bool operator!=(const QString &s) const
Returns true if this string is not equal to string other; otherwise returns false.
Definition: qstring.h:406
Definition: qnamespace.h:54
bool isLower() const
Definition: qstring.h:825
int m_size
Definition: qstring.h:1102
friend class QStringRef
Definition: qstring.h:644
QString & prepend(const QString &s)
Prepends the string str to the beginning of this string and returns a reference to this string...
Definition: qstring.h:262
QT_ASCII_CAST_WARN QString & operator+=(char c)
Definition: qstring.h:444
bool hasMirrored() const
Definition: qstring.h:837
int size() const
Returns the number of bytes in this byte array.
Definition: qbytearray.h:402
char toLatin1() const
Returns the Latin-1 character equivalent to the QChar, or 0.
Definition: qchar.h:376
bool isNumber() const
Definition: qstring.h:822
QChar & reference
The QString::const_reference typedef provides an STL-style reference for QString. ...
Definition: qstring.h:479
QByteArray & operator+=(char c)
Appends the character ch onto the end of this byte array and returns a reference to this byte array...
Definition: qbytearray.h:505
Q_TESTLIB_EXPORT bool compare_helper(bool success, const char *msg, const char *file, int line)
Definition: qtestcase.cpp:2290
QT_ASCII_CAST_WARN bool operator<=(const QByteArray &s) const
Definition: qstring.h:460
QBool contains(QRegExp &rx) const
Definition: qstring.h:209
QChar toUpper() const
Definition: qstring.h:831
QT_ASCII_CAST_WARN bool operator>(const char *s) const
Definition: qstring.h:682
ushort righttoleft
Definition: qstring.h:609
bool operator>=(const QLatin1String &s) const
Definition: qstring.h:415
bool isMark() const
Returns true if the character is a mark (Mark_* categories); otherwise returns false.
Definition: qchar.cpp:625
static qreal toDouble(const QChar *&str)
QByteArray & replace(int index, int len, const char *s)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Initialization
Definition: qnamespace.h:1729
void setCell(uchar cell)
Definition: qstring.h:876
void setRow(uchar row)
Definition: qchar.h:389
QCharRef & operator=(const QCharRef &c)
Definition: qstring.h:809
QCharRef & operator=(const QChar &c)
Definition: qstring.h:798
friend class QCharRef
Definition: qstring.h:641
QString & setUtf16(const ushort *utf16, int size)
Resizes the string to size characters and copies unicode into the string.
Definition: qstring.h:882
int qstrcmp(const QByteArray &str1, const char *str2)
Definition: qbytearray.cpp:336
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:71
quint64 qulonglong
Definition: qglobal.h:952
static const Null null
Definition: qstring.h:502
bool isNull() const
Returns true if string() returns a null pointer or a pointer to a null string; otherwise returns true...
Definition: qstring.h:1170
QString & operator=(const Null &)
Definition: qstring.h:504
static int grow(int size)
Definition: qlist.cpp:62
Direction direction() const
Returns the character&#39;s direction.
Definition: qchar.cpp:889
bool isTitleCase() const
Definition: qstring.h:827
unsigned char combiningClass() const
Returns the combining class for the character as defined in the Unicode standard. ...
Definition: qchar.cpp:1153
QT_ASCII_CAST_WARN QString & append(const char *s)
Definition: qstring.h:436
The QTextCodec class provides conversions between text encodings.
Definition: qtextcodec.h:62
QString & operator+=(QChar c)
Definition: qstring.h:265
timeval & operator+=(timeval &t1, const timeval &t2)
Definition: qcore_unix_p.h:120
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
Definition: qstring.cpp:3796
bool isUpper() const
Definition: qstring.h:826
const QString operator+(const QString &s1, const QString &s2)
Returns a string which is the result of concatenating s1 and s2.
Definition: qstring.h:1021
#define class
static const KeyPair *const end
QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QString &s2)
Definition: qstring.h:946
uchar combiningClass() const
Definition: qstring.h:841
DataPtr & data_ptr()
Definition: qstring.h:650
bool isTitleCase() const
Returns true if the character is a titlecase letter, i.
Definition: qchar.h:274
static QChar fromAscii(char c)
Converts the ASCII character c to its equivalent QChar.
Definition: qchar.cpp:1521
QT_ASCII_CAST_WARN QString & append(const QByteArray &s)
Definition: qstring.h:438
ushort simpletext
Definition: qstring.h:608
QT_ASCII_CAST_WARN bool operator<(const QString &s2) const
Returns true if this byte array is lexically less than string str; otherwise returns false...
Definition: qstring.h:985
qint64 qlonglong
Definition: qglobal.h:951
QVector< uint > toUcs4() const Q_REQUIRED_RESULT
Returns a UCS-4/UTF-32 representation of the string as a QVector<uint>.
Definition: qstring.cpp:4095
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
#define QT_END_HEADER
Definition: qglobal.h:137
QCharRef & operator=(short rc)
Definition: qstring.h:811
ushort asciiCache
Definition: qstring.h:610
QString decomposition() const
Decomposes a character into its parts.
Definition: qchar.cpp:1096
QString & insert(int i, QChar c)
Definition: qstring.cpp:1671
iterator Iterator
Qt-style synonym for QString::iterator.
Definition: qstring.h:468
QChar toLower() const
Returns the lowercase equivalent if the character is uppercase or titlecase; otherwise returns the ch...
Definition: qchar.cpp:1239
uchar row() const
Returns the row (most significant byte) of the Unicode character.
Definition: qchar.h:284
static int compare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs)
Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less th...
Definition: qstring.h:352
QString & operator+=(const QStringRef &s)
Definition: qstring.h:275
SplitBehavior
This enum specifies how the split() function should behave with respect to empty strings.
Definition: qstring.h:299
QChar toTitleCase() const
Definition: qstring.h:832
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
QString & setUnicode(const QChar *unicode, int size)
Resizes the string to size characters and copies unicode into the string.
Definition: qstring.cpp:4377
QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const char *ch)
Constructs a string initialized with the 8-bit string str.
Definition: qstring.h:419
QString & operator+=(QChar::SpecialCharacter c)
Definition: qstring.h:273
const QChar * constData() const
Returns a pointer to the data stored in the QString.
Definition: qstring.h:712
bool isNumber() const
Returns true if the character is a number (Number_* categories, not just 0-9); otherwise returns fals...
Definition: qchar.cpp:669
bool isDigit() const
Returns true if the character is a decimal digit (Number_DecimalDigit); otherwise returns false...
Definition: qchar.cpp:699
const QChar at(int i) const
Returns the character at the given index position in the string reference.
Definition: qstring.h:1174
bool isLetterOrNumber()
Definition: qstring.h:823
QLatin1String & operator=(const QLatin1String &other)
Constructs a copy of other.
Definition: qstring.h:658
bool operator<(const QString &s) const
Returns true if this string is lexically less than string other; otherwise returns false...
Definition: qstring.cpp:2436
bool isLetterOrNumber() const
Returns true if the character is a letter or number (Letter_* or Number_* categories); otherwise retu...
Definition: qchar.cpp:681
QT_ASCII_CAST_WARN bool operator>=(const QByteArray &s) const
Definition: qstring.h:462
const QString * m_string
Definition: qstring.h:1100
QString()
Constructs a null string.
Definition: qstring.h:879
uchar row() const
Definition: qstring.h:846
std::wstring toStdWString() const
Returns a std::wstring object with the data contained in this QString.
Definition: qstring.h:1051
void setCell(uchar cell)
Definition: qchar.h:387
static Data shared_empty
Definition: qstring.h:617
QT_ASCII_CAST_WARN QString & operator+=(const char *s)
Definition: qstring.h:440
QByteArray & insert(int i, char c)
Inserts character ch at index position i in the byte array.
bool isLetter() const
Definition: qstring.h:821
Decomposition
This enum type defines the Unicode decomposition attributes.
Definition: qchar.h:156