summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qbytearray.h47
-rw-r--r--src/corelib/tools/qcache.h9
-rw-r--r--src/corelib/tools/qchar.h27
-rw-r--r--src/corelib/tools/qdatetime.h48
-rw-r--r--src/corelib/tools/qlinkedlist.h15
-rw-r--r--src/corelib/tools/qlist.h14
-rw-r--r--src/corelib/tools/qmap.h36
-rw-r--r--src/corelib/tools/qrect.h30
-rw-r--r--src/corelib/tools/qregexp.h33
-rw-r--r--src/corelib/tools/qscopedpointer.h4
-rw-r--r--src/corelib/tools/qstring.cpp94
-rw-r--r--src/corelib/tools/qstring.h131
-rw-r--r--src/corelib/tools/qstringbuilder.cpp2
-rw-r--r--src/corelib/tools/qstringbuilder.h2
-rw-r--r--src/corelib/tools/qstringlist.cpp36
-rw-r--r--src/corelib/tools/qstringlist.h51
16 files changed, 21 insertions, 558 deletions
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index 2cb79c3f51..9f54f1a831 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -110,19 +110,6 @@ Q_CORE_EXPORT int qstrnicmp(const char *, const char *, uint len);
Q_CORE_EXPORT int qvsnprintf(char *str, size_t n, const char *fmt, va_list ap);
Q_CORE_EXPORT int qsnprintf(char *str, size_t n, const char *fmt, ...);
-#ifdef QT3_SUPPORT
-inline QT3_SUPPORT void *qmemmove(void *dst, const void *src, uint len)
-{ return memmove(dst, src, len); }
-inline QT3_SUPPORT uint cstrlen(const char *str)
-{ return uint(strlen(str)); }
-inline QT3_SUPPORT char *cstrcpy(char *dst, const char *src)
-{ return qstrcpy(dst,src); }
-inline QT3_SUPPORT int cstrcmp(const char *str1, const char *str2)
-{ return strcmp(str1,str2); }
-inline QT3_SUPPORT int cstrncmp(const char *str1, const char *str2, uint len)
-{ return strncmp(str1,str2,len); }
-#endif
-
// qChecksum: Internet checksum
Q_CORE_EXPORT quint16 qChecksum(const char *s, uint len);
@@ -234,13 +221,6 @@ public:
QByteArray leftJustified(int width, char fill = ' ', bool truncate = false) const;
QByteArray rightJustified(int width, char fill = ' ', bool truncate = false) const;
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT QByteArray leftJustify(uint width, char aFill = ' ', bool aTruncate = false) const
- { return leftJustified(int(width), aFill, aTruncate); }
- inline QT3_SUPPORT QByteArray rightJustify(uint width, char aFill = ' ', bool aTruncate = false) const
- { return rightJustified(int(width), aFill, aTruncate); }
-#endif
-
QByteArray &prepend(char c);
QByteArray &prepend(const char *s);
QByteArray &prepend(const char *s, int len);
@@ -356,29 +336,6 @@ public:
int length() const { return d->size; }
bool isNull() const;
- // compatibility
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QByteArray(int size);
- inline QT3_SUPPORT QByteArray& duplicate(const QByteArray& a) { *this = a; return *this; }
- inline QT3_SUPPORT QByteArray& duplicate(const char *a, uint n)
- { *this = QByteArray(a, n); return *this; }
- inline QT3_SUPPORT void resetRawData(const char *, uint) { clear(); }
- inline QT3_SUPPORT QByteArray lower() const { return toLower(); }
- inline QT3_SUPPORT QByteArray upper() const { return toUpper(); }
- inline QT3_SUPPORT QByteArray stripWhiteSpace() const { return trimmed(); }
- inline QT3_SUPPORT QByteArray simplifyWhiteSpace() const { return simplified(); }
- inline QT3_SUPPORT int find(char c, int from = 0) const { return indexOf(c, from); }
- inline QT3_SUPPORT int find(const char *c, int from = 0) const { return indexOf(c, from); }
- inline QT3_SUPPORT int find(const QByteArray &ba, int from = 0) const { return indexOf(ba, from); }
- inline QT3_SUPPORT int findRev(char c, int from = -1) const { return lastIndexOf(c, from); }
- inline QT3_SUPPORT int findRev(const char *c, int from = -1) const { return lastIndexOf(c, from); }
- inline QT3_SUPPORT int findRev(const QByteArray &ba, int from = -1) const { return lastIndexOf(ba, from); }
-#ifndef QT_NO_CAST_TO_ASCII
- QT3_SUPPORT int find(const QString &s, int from = 0) const;
- QT3_SUPPORT int findRev(const QString &s, int from = -1) const;
-#endif
-#endif
-
private:
operator QNoImplicitBoolCast() const;
static Data shared_null;
@@ -438,10 +395,6 @@ inline bool QByteArray::isDetached() const
{ return d->ref == 1; }
inline QByteArray::QByteArray(const QByteArray &a) : d(a.d)
{ d->ref.ref(); }
-#ifdef QT3_SUPPORT
-inline QByteArray::QByteArray(int aSize) : d(&shared_null)
-{ d->ref.ref(); if (aSize > 0) fill('\0', aSize); }
-#endif
inline int QByteArray::capacity() const
{ return d->alloc; }
diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h
index 16861c9869..c42a908f5c 100644
--- a/src/corelib/tools/qcache.h
+++ b/src/corelib/tools/qcache.h
@@ -96,10 +96,6 @@ class QCache
public:
inline explicit QCache(int maxCost = 100);
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT_CONSTRUCTOR QCache(int maxCost, int /* dummy */)
- : f(0), l(0), mx(maxCost), total(0) {}
-#endif
inline ~QCache() { clear(); }
inline int maxCost() const { return mx; }
@@ -123,11 +119,6 @@ public:
private:
void trim(int m);
-
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT T *find(const Key &key) const { return object(key); }
-#endif
-
};
template <class Key, class T>
diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h
index 3ec53bd18e..b7793403bd 100644
--- a/src/corelib/tools/qchar.h
+++ b/src/corelib/tools/qchar.h
@@ -89,13 +89,6 @@ public:
ObjectReplacementCharacter = 0xfffc,
ByteOrderMark = 0xfeff,
ByteOrderSwapped = 0xfffe,
-#ifdef QT3_SUPPORT
- null = Null,
- replacement = ReplacementCharacter,
- byteOrderMark = ByteOrderMark,
- byteOrderSwapped = ByteOrderSwapped,
- nbsp = Nbsp,
-#endif
ParagraphSeparator = 0x2029,
LineSeparator = 0x2028
};
@@ -173,10 +166,6 @@ public:
Square,
Compat,
Fraction
-
-#ifdef QT3_SUPPORT
- , Single = NoDecomposition
-#endif
};
enum Joining
@@ -338,22 +327,6 @@ public:
static QString QT_FASTCALL decomposition(uint ucs4);
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT bool mirrored() const { return hasMirrored(); }
- inline QT3_SUPPORT QChar lower() const { return toLower(); }
- inline QT3_SUPPORT QChar upper() const { return toUpper(); }
- static inline QT3_SUPPORT bool networkOrdered() {
- return QSysInfo::ByteOrder == QSysInfo::BigEndian;
- }
-#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
- inline QT3_SUPPORT const char latin1() const { return toLatin1(); }
- inline QT3_SUPPORT const char ascii() const { return toAscii(); }
-#else
- inline QT3_SUPPORT char latin1() const { return toLatin1(); }
- inline QT3_SUPPORT char ascii() const { return toAscii(); }
-#endif
-#endif
-
private:
#ifdef QT_NO_CAST_FROM_ASCII
QChar(char c);
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index be14df7841..62bdcab7cc 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -76,10 +76,6 @@ public:
int weekNumber(int *yearNum = 0) const;
#ifndef QT_NO_TEXTDATE
-#ifdef QT3_SUPPORT
- static QT3_SUPPORT QString monthName(int month) { return shortMonthName(month); }
- static QT3_SUPPORT QString dayName(int weekday) { return shortDayName(weekday); }
-#endif
// ### Qt 5: merge these functions.
static QString shortMonthName(int month);
static QString shortMonthName(int month, MonthNameType type);
@@ -118,18 +114,11 @@ public:
#endif
static bool isValid(int y, int m, int d);
static bool isLeapYear(int year);
-#ifdef QT3_SUPPORT
- inline static QT3_SUPPORT bool leapYear(int year) { return isLeapYear(year); }
-#endif
// ### Qt 5: remove these two functions
static uint gregorianToJulian(int y, int m, int d);
static void julianToGregorian(uint jd, int &y, int &m, int &d);
-#ifdef QT3_SUPPORT
- static QT3_SUPPORT QDate currentDate(Qt::TimeSpec spec);
-#endif
-
static inline QDate fromJulianDay(int jd) { QDate d; d.jd = jd; return d; }
inline int toJulianDay() const { return jd; }
@@ -187,10 +176,6 @@ public:
#endif
static bool isValid(int h, int m, int s, int ms = 0);
-#ifdef QT3_SUPPORT
- static QT3_SUPPORT QTime currentTime(Qt::TimeSpec spec);
-#endif
-
void start();
int restart();
int elapsed() const;
@@ -273,21 +258,6 @@ public:
static QDateTime fromMSecsSinceEpoch(qint64 msecs);
static qint64 currentMSecsSinceEpoch();
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT void setTime_t(uint secsSince1Jan1970UTC, Qt::TimeSpec spec) {
- setTime_t(secsSince1Jan1970UTC);
- if (spec == Qt::UTC)
- *this = toUTC();
- }
- static inline QT3_SUPPORT QDateTime currentDateTime(Qt::TimeSpec spec) {
- if (spec == Qt::LocalTime)
- return currentDateTime();
- else
- return currentDateTime().toUTC();
- }
-
-#endif
-
private:
friend class QDateTimePrivate;
void detach();
@@ -300,24 +270,6 @@ private:
};
Q_DECLARE_TYPEINFO(QDateTime, Q_MOVABLE_TYPE);
-#ifdef QT3_SUPPORT
-inline QDate QDate::currentDate(Qt::TimeSpec spec)
-{
- if (spec == Qt::LocalTime)
- return currentDate();
- else
- return QDateTime::currentDateTime().toUTC().date();
-}
-
-inline QTime QTime::currentTime(Qt::TimeSpec spec)
-{
- if (spec == Qt::LocalTime)
- return currentTime();
- else
- return QDateTime::currentDateTime().toUTC().time();
-}
-#endif
-
#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDate &);
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDate &);
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index 18afb29e9e..9f2834a7d7 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -227,21 +227,6 @@ public:
{ std::list<T> tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; }
#endif
-#ifdef QT3_SUPPORT
- // compatibility
- inline QT3_SUPPORT iterator remove(iterator pos) { return erase(pos); }
- inline QT3_SUPPORT int findIndex(const T& t) const
- { int i=0; for (const_iterator it = begin(); it != end(); ++it, ++i) if(*it == t) return i; return -1;}
- inline QT3_SUPPORT iterator find(iterator from, const T& t)
- { while (from != end() && !(*from == t)) ++from; return from; }
- inline QT3_SUPPORT iterator find(const T& t)
- { return find(begin(), t); }
- inline QT3_SUPPORT const_iterator find(const_iterator from, const T& t) const
- { while (from != end() && !(*from == t)) ++from; return from; }
- inline QT3_SUPPORT const_iterator find(const T& t) const
- { return find(begin(), t); }
-#endif
-
// comfort
QLinkedList<T> &operator+=(const QLinkedList<T> &l);
QLinkedList<T> operator+(const QLinkedList<T> &l) const;
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 4eb05d63b6..f8f62cc8b2 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -310,20 +310,6 @@ public:
typedef const value_type &const_reference;
typedef qptrdiff difference_type;
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT iterator remove(iterator pos) { return erase(pos); }
- inline QT3_SUPPORT int remove(const T &t) { return removeAll(t); }
- inline QT3_SUPPORT int findIndex(const T& t) const { return indexOf(t); }
- inline QT3_SUPPORT iterator find(const T& t)
- { int i = indexOf(t); return (i == -1 ? end() : (begin()+i)); }
- inline QT3_SUPPORT const_iterator find (const T& t) const
- { int i = indexOf(t); return (i == -1 ? end() : (begin()+i)); }
- inline QT3_SUPPORT iterator find(iterator from, const T& t)
- { int i = indexOf(t, from - begin()); return i == -1 ? end() : begin()+i; }
- inline QT3_SUPPORT const_iterator find(const_iterator from, const T& t) const
- { int i = indexOf(t, from - begin()); return i == -1 ? end() : begin()+i; }
-#endif
-
// comfort
QList<T> &operator+=(const QList<T> &l);
inline QList<T> operator+(const QList<T> &l) const
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index 39b3eb8af1..36d8eefbdb 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -249,9 +249,6 @@ public:
inline const Key &key() const { return concrete(i)->key; }
inline T &value() const { return concrete(i)->value; }
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT T &data() const { return concrete(i)->value; }
-#endif
inline T &operator*() const { return concrete(i)->value; }
inline T *operator->() const { return &concrete(i)->value; }
inline bool operator==(const iterator &o) const { return i == o.i; }
@@ -323,9 +320,6 @@ public:
inline const Key &key() const { return concrete(i)->key; }
inline const T &value() const { return concrete(i)->value; }
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT const T &data() const { return concrete(i)->value; }
-#endif
inline const T &operator*() const { return concrete(i)->value; }
inline const T *operator->() const { return &concrete(i)->value; }
inline bool operator==(const const_iterator &o) const { return i == o.i; }
@@ -379,10 +373,6 @@ public:
inline const_iterator end() const { return const_iterator(e); }
inline const_iterator constEnd() const { return const_iterator(e); }
iterator erase(iterator it);
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT iterator remove(iterator it) { return erase(it); }
- inline QT3_SUPPORT void erase(const Key &aKey) { remove(aKey); }
-#endif
// more Qt
typedef iterator Iterator;
@@ -396,13 +386,7 @@ public:
iterator upperBound(const Key &key);
const_iterator upperBound(const Key &key) const;
iterator insert(const Key &key, const T &value);
-#ifdef QT3_SUPPORT
- QT3_SUPPORT iterator insert(const Key &key, const T &value, bool overwrite);
-#endif
iterator insertMulti(const Key &key, const T &value);
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT iterator replace(const Key &aKey, const T &aValue) { return insert(aKey, aValue); }
-#endif
QMap<Key, T> &unite(const QMap<Key, T> &other);
// STL compatibility
@@ -571,26 +555,6 @@ Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insert(const Key
return iterator(node);
}
-#ifdef QT3_SUPPORT
-template <class Key, class T>
-Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insert(const Key &akey,
- const T &avalue,
- bool aoverwrite)
-{
- detach();
-
- QMapData::Node *update[QMapData::LastLevel + 1];
- QMapData::Node *node = mutableFindNode(update, akey);
- if (node == e) {
- node = node_create(d, update, akey, avalue);
- } else {
- if (aoverwrite)
- concrete(node)->value = avalue;
- }
- return iterator(node);
-}
-#endif
-
template <class Key, class T>
Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const Key &akey,
const T &avalue)
diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h
index cbed04f628..5d6db9867e 100644
--- a/src/corelib/tools/qrect.h
+++ b/src/corelib/tools/qrect.h
@@ -73,15 +73,6 @@ public:
int bottom() const;
QRect normalized() const;
-#ifdef QT3_SUPPORT
- QT3_SUPPORT int &rLeft() { return x1; }
- QT3_SUPPORT int &rTop() { return y1; }
- QT3_SUPPORT int &rRight() { return x2; }
- QT3_SUPPORT int &rBottom() { return y2; }
-
- QT3_SUPPORT QRect normalize() const { return normalized(); }
-#endif
-
int x() const;
int y() const;
void setLeft(int pos);
@@ -120,18 +111,10 @@ public:
void moveTo(int x, int t);
void moveTo(const QPoint &p);
-#ifdef QT3_SUPPORT
- QT3_SUPPORT void moveBy(int dx, int dy) { translate(dx, dy); }
- QT3_SUPPORT void moveBy(const QPoint &p) { translate(p); }
-#endif
-
void setRect(int x, int y, int w, int h);
inline void getRect(int *x, int *y, int *w, int *h) const;
void setCoords(int x1, int y1, int x2, int y2);
-#ifdef QT3_SUPPORT
- QT3_SUPPORT void addCoords(int x1, int y1, int x2, int y2);
-#endif
inline void getCoords(int *x1, int *y1, int *x2, int *y2) const;
inline void adjust(int x1, int y1, int x2, int y2);
@@ -162,12 +145,6 @@ public:
friend Q_CORE_EXPORT_INLINE bool operator==(const QRect &, const QRect &);
friend Q_CORE_EXPORT_INLINE bool operator!=(const QRect &, const QRect &);
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT void rect(int *x, int *y, int *w, int *h) const { getRect(x, y, w, h); }
- inline QT3_SUPPORT void coords(int *ax1, int *ay1, int *ax2, int *ay2) const
- { getCoords(ax1, ay1, ax2, ay2); }
-#endif
-
private:
#if defined(Q_WS_X11)
friend void qt_setCoords(QRect *r, int xp1, int yp1, int xp2, int yp2);
@@ -421,13 +398,6 @@ inline void QRect::setCoords(int xp1, int yp1, int xp2, int yp2)
y2 = yp2;
}
-#ifdef QT3_SUPPORT
-inline void QRect::addCoords(int dx1, int dy1, int dx2, int dy2)
-{
- adjust(dx1, dy1, dx2, dy2);
-}
-#endif
-
inline QRect QRect::adjusted(int xp1, int yp1, int xp2, int yp2) const
{ return QRect(QPoint(x1 + xp1, y1 + yp1), QPoint(x2 + xp2, y2 + yp2)); }
diff --git a/src/corelib/tools/qregexp.h b/src/corelib/tools/qregexp.h
index 12e42a95b7..4ce2f6e0be 100644
--- a/src/corelib/tools/qregexp.h
+++ b/src/corelib/tools/qregexp.h
@@ -45,9 +45,6 @@
#ifndef QT_NO_REGEXP
#include <QtCore/qstring.h>
-#ifdef QT3_SUPPORT
-#include <new>
-#endif
QT_BEGIN_HEADER
@@ -91,37 +88,16 @@ public:
void setPattern(const QString &pattern);
Qt::CaseSensitivity caseSensitivity() const;
void setCaseSensitivity(Qt::CaseSensitivity cs);
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT bool caseSensitive() const { return caseSensitivity() == Qt::CaseSensitive; }
- inline QT3_SUPPORT void setCaseSensitive(bool sensitive)
- { setCaseSensitivity(sensitive ? Qt::CaseSensitive : Qt::CaseInsensitive); }
-#endif
PatternSyntax patternSyntax() const;
void setPatternSyntax(PatternSyntax syntax);
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT bool wildcard() const { return patternSyntax() == Wildcard; }
- inline QT3_SUPPORT void setWildcard(bool aWildcard)
- { setPatternSyntax(aWildcard ? Wildcard : RegExp); }
-#endif
bool isMinimal() const;
void setMinimal(bool minimal);
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT bool minimal() const { return isMinimal(); }
-#endif
bool exactMatch(const QString &str) const;
int indexIn(const QString &str, int offset = 0, CaretMode caretMode = CaretAtZero) const;
int lastIndexIn(const QString &str, int offset = -1, CaretMode caretMode = CaretAtZero) const;
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT int search(const QString &str, int from = 0,
- CaretMode caretMode = CaretAtZero) const
- { return indexIn(str, from, caretMode); }
- inline QT3_SUPPORT int searchRev(const QString &str, int from = -1,
- CaretMode caretMode = CaretAtZero) const
- { return lastIndexIn(str, from, caretMode); }
-#endif
int matchedLength() const;
#ifndef QT_NO_REGEXP_CAPTURE
#ifdef QT_DEPRECATED
@@ -140,15 +116,6 @@ public:
static QString escape(const QString &str);
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT_CONSTRUCTOR QRegExp(const QString &aPattern, bool cs, bool aWildcard = false)
- {
- new (this)
- QRegExp(aPattern, cs ? Qt::CaseSensitive : Qt::CaseInsensitive,
- aWildcard ? Wildcard : RegExp);
- }
-#endif
-
private:
QRegExpPrivate *priv;
};
diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h
index b15bcacd97..a24f62e7ba 100644
--- a/src/corelib/tools/qscopedpointer.h
+++ b/src/corelib/tools/qscopedpointer.h
@@ -208,8 +208,10 @@ template <typename T, typename Cleanup = QScopedPointerArrayDeleter<T> >
class QScopedArrayPointer : public QScopedPointer<T, Cleanup>
{
public:
+ inline QScopedArrayPointer() : QScopedPointer<T, Cleanup>(0) {}
+
template <typename D>
- explicit inline QScopedArrayPointer(D *p = 0, typename QtPrivate::QScopedArrayEnsureSameType<T,D>::Type = 0)
+ explicit inline QScopedArrayPointer(D *p, typename QtPrivate::QScopedArrayEnsureSameType<T,D>::Type = 0)
: QScopedPointer<T, Cleanup>(p)
{
}
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index e27afb8586..afb396ce50 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -102,10 +102,6 @@ QT_BEGIN_NAMESPACE
QTextCodec *QString::codecForCStrings;
#endif
-#ifdef QT3_SUPPORT
-static QHash<void *, QByteArray> *asciiCache = 0;
-#endif
-
#ifdef QT_USE_ICU
// qlocale_icu.cpp
extern bool qt_ucol_strcoll(const QChar *source, int sourceLength, const QChar *target, int targetLength, int *result);
@@ -802,9 +798,9 @@ const QString::Null QString::null = { };
*/
QString::Data QString::shared_null = { Q_BASIC_ATOMIC_INITIALIZER(1),
- 0, 0, shared_null.array, 0, 0, 0, 0, 0, 0, {0} };
+ 0, 0, shared_null.array, 0, 0, 0, 0, 0, {0} };
QString::Data QString::shared_empty = { Q_BASIC_ATOMIC_INITIALIZER(1),
- 0, 0, shared_empty.array, 0, 0, 0, 0, 0, 0, {0} };
+ 0, 0, shared_empty.array, 0, 0, 0, 0, 0, {0} };
int QString::grow(int size)
{
@@ -1058,7 +1054,7 @@ QString::QString(const QChar *unicode, int size)
Q_CHECK_PTR(d);
d->ref = 1;
d->alloc = d->size = size;
- d->clean = d->asciiCache = d->simpletext = d->righttoleft = d->capacity = 0;
+ d->clean = d->simpletext = d->righttoleft = d->capacity = 0;
d->data = d->array;
memcpy(d->array, unicode, size * sizeof(QChar));
d->array[size] = '\0';
@@ -1091,7 +1087,7 @@ QString::QString(const QChar *unicode)
Q_CHECK_PTR(d);
d->ref = 1;
d->alloc = d->size = size;
- d->clean = d->asciiCache = d->simpletext = d->righttoleft = d->capacity = 0;
+ d->clean = d->simpletext = d->righttoleft = d->capacity = 0;
d->data = d->array;
memcpy(d->array, unicode, size * sizeof(QChar));
d->array[size] = '\0';
@@ -1116,7 +1112,7 @@ QString::QString(int size, QChar ch)
Q_CHECK_PTR(d);
d->ref = 1;
d->alloc = d->size = size;
- d->clean = d->asciiCache = d->simpletext = d->righttoleft = d->capacity = 0;
+ d->clean = d->simpletext = d->righttoleft = d->capacity = 0;
d->data = d->array;
d->array[size] = '\0';
ushort *i = d->array + size;
@@ -1139,7 +1135,7 @@ QString::QString(int size, Qt::Initialization)
Q_CHECK_PTR(d);
d->ref = 1;
d->alloc = d->size = size;
- d->clean = d->asciiCache = d->simpletext = d->righttoleft = d->capacity = 0;
+ d->clean = d->simpletext = d->righttoleft = d->capacity = 0;
d->data = d->array;
d->array[size] = '\0';
}
@@ -1161,7 +1157,7 @@ QString::QString(QChar ch)
d = reinterpret_cast<Data *>(buf);
d->ref = 1;
d->alloc = d->size = 1;
- d->clean = d->asciiCache = d->simpletext = d->righttoleft = d->capacity = 0;
+ d->clean = d->simpletext = d->righttoleft = d->capacity = 0;
d->data = d->array;
d->array[0] = ch.unicode();
d->array[1] = '\0';
@@ -1222,12 +1218,6 @@ QString::QString(QChar ch)
// ### Qt 5: rename freeData() to avoid confusion. See task 197625.
void QString::free(Data *d)
{
-#ifdef QT3_SUPPORT
- if (d->asciiCache) {
- Q_ASSERT(asciiCache);
- asciiCache->remove(d);
- }
-#endif
qFree(d);
}
@@ -1344,7 +1334,6 @@ void QString::realloc(int alloc)
x->size = qMin(alloc, d->size);
::memcpy(x->array, d->data, x->size * sizeof(QChar));
x->array[x->size] = 0;
- x->asciiCache = 0;
x->ref = 1;
x->alloc = alloc;
x->clean = d->clean;
@@ -1356,12 +1345,6 @@ void QString::realloc(int alloc)
QString::free(d);
d = x;
} else {
-#ifdef QT3_SUPPORT
- if (d->asciiCache) {
- Q_ASSERT(asciiCache);
- asciiCache->remove(d);
- }
-#endif
Data *p = static_cast<Data *>(qRealloc(d, sizeof(Data) + alloc * sizeof(QChar)));
Q_CHECK_PTR(p);
d = p;
@@ -3794,7 +3777,7 @@ QString::Data *QString::fromLatin1_helper(const char *str, int size)
Q_CHECK_PTR(d);
d->ref = 1;
d->alloc = d->size = size;
- d->clean = d->asciiCache = d->simpletext = d->righttoleft = d->capacity = 0;
+ d->clean = d->simpletext = d->righttoleft = d->capacity = 0;
d->data = d->array;
d->array[size] = '\0';
ushort *dst = d->data;
@@ -3868,44 +3851,6 @@ QString QString::fromLatin1(const char *str, int size)
}
-#ifdef QT3_SUPPORT
-
-/*!
- \internal
-*/
-const char *QString::ascii_helper() const
-{
- if (!asciiCache)
- asciiCache = new QHash<void *, QByteArray>();
-
- d->asciiCache = true;
- QByteArray ascii = toAscii();
- QByteArray old = asciiCache->value(d);
- if (old == ascii)
- return old.constData();
- asciiCache->insert(d, ascii);
- return ascii.constData();
-}
-
-/*!
- \internal
-*/
-const char *QString::latin1_helper() const
-{
- if (!asciiCache)
- asciiCache = new QHash<void *, QByteArray>();
-
- d->asciiCache = true;
- QByteArray ascii = toLatin1();
- QByteArray old = asciiCache->value(d);
- if (old == ascii)
- return old.constData();
- asciiCache->insert(d, ascii);
- return ascii.constData();
-}
-
-#endif
-
/*!
Returns a QString initialized with the first \a size characters
of the 8-bit string \a str.
@@ -4636,25 +4581,16 @@ QString& QString::fill(QChar ch, int size)
sensitivity setting \a cs.
*/
+
/*!
\overload compare()
+ \since 4.2
Lexically compares this string with the \a other string and
returns an integer less than, equal to, or greater than zero if
this string is less than, equal to, or greater than the other
string.
- Equivalent to \c {compare(*this, other)}.
-*/
-int QString::compare(const QString &other) const
-{
- return ucstrcmp(constData(), length(), other.constData(), other.length());
-}
-
-/*!
- \overload compare()
- \since 4.2
-
Same as compare(*this, \a other, \a cs).
*/
int QString::compare(const QString &other, Qt::CaseSensitivity cs) const
@@ -7196,7 +7132,7 @@ QString QString::fromRawData(const QChar *unicode, int size)
x->ref = 1;
x->alloc = x->size = size;
*x->array = '\0';
- x->clean = x->asciiCache = x->simpletext = x->righttoleft = x->capacity = 0;
+ x->clean = x->simpletext = x->righttoleft = x->capacity = 0;
return QString(x, 0);
}
@@ -7219,12 +7155,6 @@ QString &QString::setRawData(const QChar *unicode, int size)
if (d->ref != 1 || (d->data == d->array && d->alloc)) {
*this = fromRawData(unicode, size);
} else {
-#ifdef QT3_SUPPORT
- if (d->asciiCache) {
- Q_ASSERT(asciiCache);
- asciiCache->remove(d);
- }
-#endif
if (unicode) {
d->data = (ushort *)unicode;
} else {
@@ -7233,7 +7163,7 @@ QString &QString::setRawData(const QChar *unicode, int size)
}
d->alloc = d->size = size;
*d->array = '\0';
- d->clean = d->asciiCache = d->simpletext = d->righttoleft = d->capacity = 0;
+ d->clean = d->simpletext = d->righttoleft = d->capacity = 0;
}
return *this;
}
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index c61d09e37d..154012d132 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -46,9 +46,6 @@
#include <QtCore/qbytearray.h>
#include <QtCore/qatomic.h>
#include <QtCore/qnamespace.h>
-#ifdef QT_INCLUDE_COMPAT
-#include <Qt3Support/q3cstring.h>
-#endif
#ifndef QT_NO_STL
# include <string>
@@ -340,16 +337,10 @@ public:
QString &setUnicode(const QChar *unicode, int size);
inline QString &setUtf16(const ushort *utf16, int size);
- // ### Qt 5: merge these two functions
- int compare(const QString &s) const;
- int compare(const QString &s, Qt::CaseSensitivity cs) const;
-
+ int compare(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int compare(const QLatin1String &other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- // ### Qt 5: merge these two functions
- static inline int compare(const QString &s1, const QString &s2)
- { return s1.compare(s2); }
- static inline int compare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs)
+ static inline int compare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs = Qt::CaseSensitive)
{ return s1.compare(s2, cs); }
static inline int compare(const QString& s1, const QLatin1String &s2,
@@ -504,86 +495,6 @@ public:
inline QString &operator=(const Null &) { *this = QString(); return *this; }
inline bool isNull() const { return d == &shared_null; }
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT const char *ascii() const { return ascii_helper(); }
- inline QT3_SUPPORT const char *latin1() const { return latin1_helper(); }
- inline QT3_SUPPORT QByteArray utf8() const { return toUtf8(); }
- inline QT3_SUPPORT QByteArray local8Bit() const{ return toLocal8Bit(); }
- inline QT3_SUPPORT void setLength(int nl) { resize(nl); }
- inline QT3_SUPPORT QString copy() const { return *this; }
- inline QT3_SUPPORT QString &remove(QChar c, bool cs)
- { return remove(c, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
- inline QT3_SUPPORT QString &remove(const QString &s, bool cs)
- { return remove(s, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
- inline QT3_SUPPORT QString &replace(QChar c, const QString &after, bool cs)
- { return replace(c, after, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
- inline QT3_SUPPORT QString &replace(const QString &before, const QString &after, bool cs)
- { return replace(before, after, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
-#ifndef QT_NO_CAST_FROM_ASCII
- inline QT3_SUPPORT QString &replace(char c, const QString &after, bool cs)
- { return replace(QChar::fromAscii(c), after, cs ? Qt::CaseSensitive : Qt::CaseInsensitive); }
- // strange overload, required to avoid GCC 3.3 error
- inline QT3_SUPPORT QString &replace(char c, const QString &after, Qt::CaseSensitivity cs)
- { return replace(QChar::fromAscii(c), after, cs ? Qt::CaseSensitive : Qt::CaseInsensitive); }
-#endif
- inline QT3_SUPPORT int find(QChar c, int i = 0, bool cs = true) const
- { return indexOf(c, i, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
- inline QT3_SUPPORT int find(const QString &s, int i = 0, bool cs = true) const
- { return indexOf(s, i, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
- inline QT3_SUPPORT int findRev(QChar c, int i = -1, bool cs = true) const
- { return lastIndexOf(c, i, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
- inline QT3_SUPPORT int findRev(const QString &s, int i = -1, bool cs = true) const
- { return lastIndexOf(s, i, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
-#ifndef QT_NO_REGEXP
- inline QT3_SUPPORT int find(const QRegExp &rx, int i=0) const
- { return indexOf(rx, i); }
- inline QT3_SUPPORT int findRev(const QRegExp &rx, int i=-1) const
- { return lastIndexOf(rx, i); }
- inline QT3_SUPPORT int find(QRegExp &rx, int i=0) const
- { return indexOf(rx, i); }
- inline QT3_SUPPORT int findRev(QRegExp &rx, int i=-1) const
- { return lastIndexOf(rx, i); }
-#endif
- inline QT3_SUPPORT QBool contains(QChar c, bool cs) const
- { return contains(c, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
- inline QT3_SUPPORT QBool contains(const QString &s, bool cs) const
- { return contains(s, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
- inline QT3_SUPPORT bool startsWith(const QString &s, bool cs) const
- { return startsWith(s, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
- inline QT3_SUPPORT bool endsWith(const QString &s, bool cs) const
- { return endsWith(s, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
- inline QT3_SUPPORT QChar constref(uint i) const
- { return at(i); }
- QT3_SUPPORT QChar &ref(uint i);
- inline QT3_SUPPORT QString leftJustify(int width, QChar aFill = QLatin1Char(' '), bool trunc=false) const
- { return leftJustified(width, aFill, trunc); }
- inline QT3_SUPPORT QString rightJustify(int width, QChar aFill = QLatin1Char(' '), bool trunc=false) const
- { return rightJustified(width, aFill, trunc); }
- inline QT3_SUPPORT QString lower() const { return toLower(); }
- inline QT3_SUPPORT QString upper() const { return toUpper(); }
- inline QT3_SUPPORT QString stripWhiteSpace() const { return trimmed(); }
- inline QT3_SUPPORT QString simplifyWhiteSpace() const { return simplified(); }
- inline QT3_SUPPORT QString &setUnicodeCodes(const ushort *unicode_as_ushorts, int aSize)
- { return setUtf16(unicode_as_ushorts, aSize); }
- inline QT3_SUPPORT const ushort *ucs2() const { return utf16(); }
- inline static QT3_SUPPORT QString fromUcs2(const ushort *unicode, int size = -1)
- { return fromUtf16(unicode, size); }
- inline QT3_SUPPORT QString &setAscii(const char *str, int len = -1)
- { *this = fromAscii(str, len); return *this; }
- inline QT3_SUPPORT QString &setLatin1(const char *str, int len = -1)
- { *this = fromLatin1(str, len); return *this; }
-protected:
- friend class QObject;
- const char *ascii_helper() const;
- const char *latin1_helper() const;
-public:
-#ifndef QT_NO_CAST_TO_ASCII
- inline QT3_SUPPORT operator const char *() const { return ascii_helper(); }
-private:
- QT3_SUPPORT operator QNoImplicitBoolCast() const;
-public:
-#endif
-#endif
bool isSimpleText() const { if (!d->clean) updateProperties(); return d->simpletext; }
bool isRightToLeft() const;
@@ -607,7 +518,6 @@ private:
ushort clean : 1;
ushort simpletext : 1;
ushort righttoleft : 1;
- ushort asciiCache : 1;
ushort capacity : 1;
ushort reserved : 11;
// ### Qt5: try to ensure that "array" is aligned to 16 bytes on both 32- and 64-bit
@@ -857,18 +767,6 @@ public:
#endif
ushort& unicode() { return s.data()[i].unicode(); }
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT bool mirrored() const { return hasMirrored(); }
- inline QT3_SUPPORT QChar lower() const { return QChar(*this).toLower(); }
- inline QT3_SUPPORT QChar upper() const { return QChar(*this).toUpper(); }
-#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
- const QT3_SUPPORT char latin1() const { return QChar(*this).toLatin1(); }
- const QT3_SUPPORT char ascii() const { return QChar(*this).toAscii(); }
-#else
- QT3_SUPPORT char latin1() const { return QChar(*this).toLatin1(); }
- QT3_SUPPORT char ascii() const { return QChar(*this).toAscii(); }
-#endif
-#endif
};
inline void QCharRef::setRow(uchar arow) { QChar(*this).setRow(arow); }
@@ -1008,12 +906,6 @@ inline int QByteArray::indexOf(const QString &s, int from) const
{ return indexOf(s.toAscii(), from); }
inline int QByteArray::lastIndexOf(const QString &s, int from) const
{ return lastIndexOf(s.toAscii(), from); }
-# ifdef QT3_SUPPORT
-inline int QByteArray::find(const QString &s, int from) const
-{ return indexOf(s.toAscii(), from); }
-inline int QByteArray::findRev(const QString &s, int from) const
-{ return lastIndexOf(s.toAscii(), from); }
-# endif // QT3_SUPPORT
#endif // QT_NO_CAST_TO_ASCII
#if !defined(QT_USE_FAST_OPERATOR_PLUS) && !defined(QT_USE_QSTRINGBUILDER)
@@ -1066,30 +958,11 @@ inline QString QString::fromStdWString(const QStdWString &s)
# endif
#endif
-#ifdef QT3_SUPPORT
-inline QChar &QString::ref(uint i)
-{
- if (int(i) > d->size || d->ref != 1)
- resize(qMax(int(i), d->size));
- return reinterpret_cast<QChar&>(d->data[i]);
-}
-#endif
-
#if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE))
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QString &);
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QString &);
#endif
-#ifdef QT3_SUPPORT
-class QConstString : public QString
-{
-public:
- inline QT3_SUPPORT_CONSTRUCTOR QConstString(const QChar *aUnicode, int aSize)
- :QString(aUnicode, aSize){} // cannot use fromRawData() due to changed semantics
- inline QT3_SUPPORT const QString &string() const { return *this; }
-};
-#endif
-
Q_DECLARE_TYPEINFO(QString, Q_MOVABLE_TYPE);
Q_DECLARE_SHARED(QString)
Q_DECLARE_OPERATORS_FOR_FLAGS(QString::SectionFlags)
diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp
index 45de6bc1c3..1cc7e5d2c3 100644
--- a/src/corelib/tools/qstringbuilder.cpp
+++ b/src/corelib/tools/qstringbuilder.cpp
@@ -162,6 +162,8 @@ void QAbstractConcatenable::convertFromAscii(const char *a, int len, QChar *&out
}
#endif
if (len == -1) {
+ if (!a)
+ return;
while (*a)
*out++ = QLatin1Char(*a++);
} else {
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index 709d84a578..594ab2f183 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -352,6 +352,8 @@ template <> struct QConcatenable<const char *> : private QAbstractConcatenable
#endif
static inline void appendTo(const char *a, char *&out)
{
+ if (!a)
+ return;
while (*a)
*out++ = *a++;
}
diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp
index 8b47137fd8..44cc692b2f 100644
--- a/src/corelib/tools/qstringlist.cpp
+++ b/src/corelib/tools/qstringlist.cpp
@@ -234,42 +234,6 @@ void QtPrivate::QStringList_sort(QStringList *that)
}
-#ifdef QT3_SUPPORT
-/*!
- \fn QStringList QStringList::split(const QChar &sep, const QString &str, bool allowEmptyEntries)
-
- \overload
-
- This version of the function uses a QChar as separator.
-
- \sa join() QString::section()
-*/
-
-/*!
- \fn QStringList QStringList::split(const QString &sep, const QString &str, bool allowEmptyEntries)
-
- \overload
-
- This version of the function uses a QString as separator.
-
- \sa join() QString::section()
-*/
-#ifndef QT_NO_REGEXP
-/*!
- \fn QStringList QStringList::split(const QRegExp &sep, const QString &str, bool allowEmptyEntries)
-
- Use QString::split(\a sep, QString::SkipEmptyParts) or
- QString::split(\a sep, QString::KeepEmptyParts) instead.
-
- Be aware that the QString::split()'s return value is a
- QStringList that always contains at least one element, even if \a
- str is empty.
-
- \sa join() QString::section()
-*/
-#endif
-#endif // QT3_SUPPORT
-
/*!
\fn QStringList QStringList::filter(const QString &str, Qt::CaseSensitivity cs) const
diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h
index 2159512b20..efb7f46c9b 100644
--- a/src/corelib/tools/qstringlist.h
+++ b/src/corelib/tools/qstringlist.h
@@ -48,9 +48,6 @@
#include <QtCore/qregexp.h>
#include <QtCore/qstring.h>
#include <QtCore/qstringmatcher.h>
-#ifdef QT_INCLUDE_COMPAT
-#include <Qt3Support/q3valuelist.h>
-#endif
QT_BEGIN_HEADER
@@ -108,24 +105,6 @@ public:
inline int lastIndexOf(const QString &str, int from = -1) const
{ return QList<QString>::lastIndexOf(str, from); }
#endif
-#ifdef QT3_SUPPORT
- static inline QT3_SUPPORT QStringList split(const QString &sep, const QString &str, bool allowEmptyEntries = false);
- static inline QT3_SUPPORT QStringList split(const QChar &sep, const QString &str, bool allowEmptyEntries = false);
- inline QT3_SUPPORT QStringList grep(const QString &str, bool cs = true) const
- { return filter(str, cs ? Qt::CaseSensitive : Qt::CaseInsensitive); }
-
-#ifndef QT_NO_REGEXP
- static inline QT3_SUPPORT QStringList split(const QRegExp &sep, const QString &str, bool allowEmptyEntries = false);
- inline QT3_SUPPORT QStringList grep(const QRegExp &rx) const { return filter(rx); }
- inline QT3_SUPPORT QStringList &gres(const QRegExp &rx, const QString &after)
- { return replaceInStrings(rx, after); }
-#endif
- inline QT3_SUPPORT QStringList &gres(const QString &before, const QString &after, bool cs = true)
- { return replaceInStrings(before, after, cs ? Qt::CaseSensitive : Qt::CaseInsensitive); }
-
- inline Iterator QT3_SUPPORT fromLast() { return (isEmpty() ? end() : --end()); }
- inline ConstIterator QT3_SUPPORT fromLast() const { return (isEmpty() ? end() : --end()); }
-#endif
};
namespace QtPrivate {
@@ -214,36 +193,6 @@ inline int QStringList::lastIndexOf(QRegExp &rx, int from) const
#endif
-#ifdef QT3_SUPPORT
-inline QStringList QStringList::split(const QChar &sep, const QString &str, bool allowEmptyEntries)
-{
- if (str.isEmpty())
- return QStringList();
- return str.split(sep, allowEmptyEntries ? QString::KeepEmptyParts
- : QString::SkipEmptyParts);
-}
-
-inline QStringList QStringList::split(const QString &sep, const QString &str, bool allowEmptyEntries)
-{
- if (str.isEmpty())
- return QStringList();
- return str.split(sep, allowEmptyEntries ? QString::KeepEmptyParts
- : QString::SkipEmptyParts);
-}
-
-#ifndef QT_NO_REGEXP
-inline QStringList QStringList::split(const QRegExp &sep, const QString &str, bool allowEmptyEntries)
-{
- if (str.isEmpty())
- return QStringList();
- return str.split(sep, allowEmptyEntries ? QString::KeepEmptyParts
- : QString::SkipEmptyParts);
-}
-#endif // QT_NO_REGEXP
-
-#endif // QT3_SUPPORT
-
-
#ifndef QT_NO_DATASTREAM
inline QDataStream &operator>>(QDataStream &in, QStringList &list)
{