equal
deleted
inserted
replaced
71 |
71 |
72 #ifdef truncate |
72 #ifdef truncate |
73 #error qstring.h must be included before any header file that defines truncate |
73 #error qstring.h must be included before any header file that defines truncate |
74 #endif |
74 #endif |
75 |
75 |
|
76 #if defined(Q_CC_GNU) && (__GNUC__ == 4 && __GNUC_MINOR__ == 0) |
|
77 //There is a bug in GCC 4.0 that tries to instantiate template of annonymous enum |
|
78 # ifdef QT_USE_FAST_OPERATOR_PLUS |
|
79 # undef QT_USE_FAST_OPERATOR_PLUS |
|
80 # endif |
|
81 # ifdef QT_USE_FAST_CONCATENATION |
|
82 # undef QT_USE_FAST_CONCATENATION |
|
83 # endif |
|
84 #endif |
|
85 |
76 QT_BEGIN_HEADER |
86 QT_BEGIN_HEADER |
77 |
87 |
78 QT_BEGIN_NAMESPACE |
88 QT_BEGIN_NAMESPACE |
79 |
89 |
80 QT_MODULE(Core) |
90 QT_MODULE(Core) |
89 |
99 |
90 class Q_CORE_EXPORT QString |
100 class Q_CORE_EXPORT QString |
91 { |
101 { |
92 public: |
102 public: |
93 inline QString(); |
103 inline QString(); |
94 QString(const QChar *unicode, int size); |
104 QString(const QChar *unicode, int size); // Qt5: don't cap size < 0 |
|
105 #ifdef QT_QCHAR_CONSTRUCTOR |
|
106 explicit QString(const QChar *unicode); // Qt5: merge with the above |
|
107 #endif |
95 QString(QChar c); |
108 QString(QChar c); |
96 QString(int size, QChar c); |
109 QString(int size, QChar c); |
97 inline QString(const QLatin1String &latin1); |
110 inline QString(const QLatin1String &latin1); |
98 inline QString(const QString &); |
111 inline QString(const QString &); |
99 inline ~QString(); |
112 inline ~QString(); |
120 inline const QChar *data() const; |
133 inline const QChar *data() const; |
121 inline const QChar *constData() const; |
134 inline const QChar *constData() const; |
122 |
135 |
123 inline void detach(); |
136 inline void detach(); |
124 inline bool isDetached() const; |
137 inline bool isDetached() const; |
|
138 inline bool isSharedWith(const QString &other) const { return d == other.d; } |
125 void clear(); |
139 void clear(); |
126 |
140 |
127 inline const QChar at(int i) const; |
141 inline const QChar at(int i) const; |
128 const QChar operator[](int i) const; |
142 const QChar operator[](int i) const; |
129 QCharRef operator[](int i); |
143 QCharRef operator[](int i); |
329 static QString fromRawData(const QChar *, int size); |
343 static QString fromRawData(const QChar *, int size); |
330 |
344 |
331 int toWCharArray(wchar_t *array) const; |
345 int toWCharArray(wchar_t *array) const; |
332 static QString fromWCharArray(const wchar_t *, int size = -1); |
346 static QString fromWCharArray(const wchar_t *, int size = -1); |
333 |
347 |
|
348 QString &setRawData(const QChar *unicode, int size); |
334 QString &setUnicode(const QChar *unicode, int size); |
349 QString &setUnicode(const QChar *unicode, int size); |
335 inline QString &setUtf16(const ushort *utf16, int size); |
350 inline QString &setUtf16(const ushort *utf16, int size); |
336 |
351 |
337 // ### Qt 5: merge these two functions |
352 // ### Qt 5: merge these two functions |
338 int compare(const QString &s) const; |
353 int compare(const QString &s) const; |
592 #endif |
607 #endif |
593 |
608 |
594 struct Data { |
609 struct Data { |
595 QBasicAtomicInt ref; |
610 QBasicAtomicInt ref; |
596 int alloc, size; |
611 int alloc, size; |
597 ushort *data; |
612 ushort *data; // QT5: put that after the bit field to fill alignment gap; don't use sizeof any more then |
598 ushort clean : 1; |
613 ushort clean : 1; |
599 ushort simpletext : 1; |
614 ushort simpletext : 1; |
600 ushort righttoleft : 1; |
615 ushort righttoleft : 1; |
601 ushort asciiCache : 1; |
616 ushort asciiCache : 1; |
602 ushort capacity : 1; |
617 ushort capacity : 1; |
1082 |
1097 |
1083 Q_DECLARE_TYPEINFO(QString, Q_MOVABLE_TYPE); |
1098 Q_DECLARE_TYPEINFO(QString, Q_MOVABLE_TYPE); |
1084 Q_DECLARE_SHARED(QString) |
1099 Q_DECLARE_SHARED(QString) |
1085 Q_DECLARE_OPERATORS_FOR_FLAGS(QString::SectionFlags) |
1100 Q_DECLARE_OPERATORS_FOR_FLAGS(QString::SectionFlags) |
1086 |
1101 |
1087 #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) |
|
1088 extern Q_CORE_EXPORT QByteArray qt_winQString2MB(const QString& s, int len=-1); |
|
1089 extern Q_CORE_EXPORT QByteArray qt_winQString2MB(const QChar *ch, int len); |
|
1090 extern Q_CORE_EXPORT QString qt_winMB2QString(const char* mb, int len=-1); |
|
1091 #endif |
|
1092 |
|
1093 |
1102 |
1094 class Q_CORE_EXPORT QStringRef { |
1103 class Q_CORE_EXPORT QStringRef { |
1095 const QString *m_string; |
1104 const QString *m_string; |
1096 int m_position; |
1105 int m_position; |
1097 int m_size; |
1106 int m_size; |