diff options
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qbytearray.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qhash.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qhash.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qlinkedlist.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qlinkedlist.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qlist.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qlist.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 11 | ||||
-rw-r--r-- | src/corelib/tools/qmap.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qmap.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qpoint.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 10 | ||||
-rw-r--r-- | src/corelib/tools/qstring.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qstringlist.cpp | 10 | ||||
-rw-r--r-- | src/corelib/tools/qvector.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qvector.h | 1 |
17 files changed, 65 insertions, 5 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 556093f..a27e488 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -1061,6 +1061,11 @@ QByteArray &QByteArray::operator=(const char *str) \internal */ +/*! \fn bool QByteArray::isSharedWith(const QByteArray &other) const + + \internal +*/ + /*! \fn char QByteArray::at(int i) const Returns the character at index position \a i in the byte array. diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index ef97716..ec592f5f 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -164,6 +164,7 @@ public: inline const char *constData() const; inline void detach(); bool isDetached() const; + inline bool isSharedWith(const QByteArray &other) const { return d == other.d; } void clear(); #ifdef Q_COMPILER_MANGLES_RETURN_TYPE diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 6231471..285f4c9 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -847,6 +847,11 @@ void QHashData::checkSanity() \internal */ +/*! \fn bool QHash::isSharedWith(const QHash<Key, T> &other) const + + \internal +*/ + /*! \fn void QHash::clear() Removes all items from the hash. diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 5e93523..2832ca2 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -299,6 +299,7 @@ public: inline void detach() { if (d->ref != 1) detach_helper(); } inline bool isDetached() const { return d->ref == 1; } inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + inline bool isSharedWith(const QHash<Key, T> &other) const { return d == other.d; } void clear(); diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp index 5a53c32..909d940 100644 --- a/src/corelib/tools/qlinkedlist.cpp +++ b/src/corelib/tools/qlinkedlist.cpp @@ -197,6 +197,11 @@ QLinkedListData QLinkedListData::shared_null = { \internal */ +/*! \fn bool QLinkedList::isSharedWith(const QLinkedList<T> &other) const + + \internal +*/ + /*! \fn bool QLinkedList::isEmpty() const Returns true if the list contains no items; otherwise returns diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h index f6de966..fe586a4 100644 --- a/src/corelib/tools/qlinkedlist.h +++ b/src/corelib/tools/qlinkedlist.h @@ -93,6 +93,7 @@ public: { if (d->ref != 1) detach_helper(); } inline bool isDetached() const { return d->ref == 1; } inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + inline bool isSharedWith(const QLinkedList<T> &other) const { return d == other.d; } inline bool isEmpty() const { return d->size == 0; } diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp index c302857..ce62016 100644 --- a/src/corelib/tools/qlist.cpp +++ b/src/corelib/tools/qlist.cpp @@ -599,6 +599,11 @@ void **QListData::erase(void **xi) \internal */ +/*! \fn bool QList::isSharedWith(const QList<T> &other) const + + \internal +*/ + /*! \fn bool QList::isEmpty() const Returns true if the list contains no items; otherwise returns diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 120442d..1d08c41 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -130,6 +130,7 @@ public: inline bool isDetached() const { return d->ref == 1; } inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + inline bool isSharedWith(const QList<T> &other) const { return d == other.d; } inline bool isEmpty() const { return p.isEmpty(); } diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 8d79cb3..ff10fa1 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -4293,6 +4293,7 @@ bool QLocalePrivate::validateChars(const QString &str, NumberMode numMode, QByte const bool scientific = numMode == DoubleScientificMode; bool lastWasE = false; + bool lastWasDigit = false; int eCnt = 0; int decPointCnt = 0; bool dec = false; @@ -4307,6 +4308,7 @@ bool QLocalePrivate::validateChars(const QString &str, NumberMode numMode, QByte if (dec && decDigits != -1 && decDigits < ++decDigitCnt) return false; } + lastWasDigit = true; } else { switch (c) { case '.': @@ -4344,7 +4346,10 @@ bool QLocalePrivate::validateChars(const QString &str, NumberMode numMode, QByte break; case ',': - return false; + //it can only be placed after a digit which is before the decimal point + if (!lastWasDigit || decPointCnt > 0) + return false; + break; case 'e': if (scientific) { @@ -4362,10 +4367,12 @@ bool QLocalePrivate::validateChars(const QString &str, NumberMode numMode, QByte // If it's not a valid digit, it shall be Invalid. return false; } + lastWasDigit = false; } lastWasE = c == 'e'; - buff->append(c); + if (c != ',') + buff->append(c); } return true; diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index 82cbe78..3143ee4 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -473,6 +473,11 @@ void QMapData::dump() \internal */ +/*! \fn bool QMap::isSharedWith(const QMap<Key, T> &other) const + + \internal +*/ + /*! \fn void QMap::setInsertInOrder(bool sharable) \internal diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index e71064c..9ba9ca5 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -182,6 +182,7 @@ public: inline void detach() { if (d->ref != 1) detach_helper(); } inline bool isDetached() const { return d->ref == 1; } inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + inline bool isSharedWith(const QMap<Key, T> &other) const { return d == other.d; } inline void setInsertInOrder(bool ordered) { d->insertInOrder = ordered; } void clear(); diff --git a/src/corelib/tools/qpoint.cpp b/src/corelib/tools/qpoint.cpp index d60087f..9850ee7 100644 --- a/src/corelib/tools/qpoint.cpp +++ b/src/corelib/tools/qpoint.cpp @@ -374,7 +374,7 @@ QDebug operator<<(QDebug dbg, const QPoint &p) { QDebug operator<<(QDebug d, const QPointF &p) { d.nospace() << "QPointF(" << p.x() << ", " << p.y() << ')'; - return d; + return d.space(); } #endif diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 3ef0e66..dec59b7 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -55,6 +55,7 @@ #include "qtools_p.h" #include "qhash.h" #include "qdebug.h" +#include "qendian.h" #ifdef Q_OS_MAC #include <private/qcore_mac_p.h> @@ -1091,7 +1092,12 @@ QString::QString(QChar ch) \internal */ -/*! \fn void QString::isDetached() const +/*! \fn bool QString::isDetached() const + + \internal +*/ + +/*! \fn bool QString::isSharedWith(const QString &other) const \internal */ @@ -7317,7 +7323,7 @@ QDataStream &operator>>(QDataStream &in, QString &str) != (QSysInfo::ByteOrder == QSysInfo::BigEndian)) { ushort *data = reinterpret_cast<ushort *>(str.data()); while (len--) { - *data = (*data >> 8) | (*data << 8); + *data = qbswap(*data); ++data; } } diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index c1def0f..5e3b0fd 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -122,6 +122,7 @@ public: inline void detach(); inline bool isDetached() const; + inline bool isSharedWith(const QString &other) const { return d == other.d; } void clear(); inline const QChar at(int i) const; diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index 4b0f488..e9bdf57 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -404,7 +404,17 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegExp &r */ QString QtPrivate::QStringList_join(const QStringList *that, const QString &sep) { + int totalLength = 0; + const int size = that->size(); + + for (int i = 0; i < size; ++i) + totalLength += that->at(i).size(); + + if(size > 0) + totalLength += sep.size() * (size - 1); + QString res; + res.reserve(totalLength); for (int i = 0; i < that->size(); ++i) { if (i) res += sep; diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index 48b52d2..3a13540 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -392,6 +392,11 @@ int QVectorData::grow(int sizeofTypedData, int size, int sizeofT, bool excessive \internal */ +/*! \fn bool QVector::isSharedWith(const QVector<T> &other) const + + \internal +*/ + /*! \fn T *QVector::data() Returns a pointer to the data stored in the vector. The pointer diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 90b7442..61b22fd 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -134,6 +134,7 @@ public: inline void detach() { if (d->ref != 1) detach_helper(); } inline bool isDetached() const { return d->ref == 1; } inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + inline bool isSharedWith(const QVector<T> &other) const { return d == other.d; } inline T *data() { detach(); return p->array; } inline const T *data() const { return p->array; } |