diff options
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 7 | ||||
-rw-r--r-- | src/corelib/tools/qbytearray.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 9 | ||||
-rw-r--r-- | src/corelib/tools/qstring.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qvarlengtharray.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qvarlengtharray.qdoc | 6 | ||||
-rw-r--r-- | src/corelib/tools/qvector.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qvector.qdoc | 7 |
8 files changed, 33 insertions, 0 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 6be28fea5f..c728a05f55 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -1134,6 +1134,13 @@ static inline char qToLower(char c) Same as prepend(\a ch). */ +/*! \fn void QByteArray::shrink_to_fit() + \since 5.10 + + This function is provided for STL compatibility. It is equivalent to + squeeze(). +*/ + /*! \fn QByteArray::QByteArray(const QByteArray &other) Constructs a copy of \a other. diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index 76660d9289..3fc6718abb 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -423,6 +423,7 @@ public: inline void push_front(char c); inline void push_front(const char *c); inline void push_front(const QByteArray &a); + void shrink_to_fit() { squeeze(); } static inline QByteArray fromStdString(const std::string &s); inline std::string toStdString() const; diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 4a92a7f424..07d6376b85 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -8469,6 +8469,15 @@ bool QString::isRightToLeft() const Appends the given \a ch character onto the end of this string. */ +/*! \fn void QString::shrink_to_fit() + \since 5.10 + + This function is provided for STL compatibility. It is + equivalent to squeeze(). + + \sa squeeze() +*/ + /*! \fn std::string QString::toStdString() const diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 05d411d138..f65331f7e4 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -805,6 +805,7 @@ public: inline void push_back(const QString &s) { append(s); } inline void push_front(QChar c) { prepend(c); } inline void push_front(const QString &s) { prepend(s); } + void shrink_to_fit() { squeeze(); } static inline QString fromStdString(const std::string &s); inline std::string toStdString() const; diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 9879d55967..90311ac55b 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -231,6 +231,7 @@ public: inline const T &front() const { return first(); } inline T &back() { return last(); } inline const T &back() const { return last(); } + void shrink_to_fit() { squeeze(); } private: void realloc(int size, int alloc); diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index 127afcd069..be2bdeda07 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -190,6 +190,12 @@ \overload */ +/*! \fn void QVarLengthArray::shrink_to_fit() + \since 5.10 + + Same as squeeze(). Provided for STL-compatibility. +*/ + /*! \fn bool QVarLengthArray::isEmpty() const Returns \c true if the array has size 0; otherwise returns \c false. diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index fd124d1d59..121187083b 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -268,6 +268,7 @@ public: inline const_reference front() const { return first(); } inline reference back() { return last(); } inline const_reference back() const { return last(); } + void shrink_to_fit() { squeeze(); } // comfort QVector<T> &operator+=(const QVector<T> &l); diff --git a/src/corelib/tools/qvector.qdoc b/src/corelib/tools/qvector.qdoc index 0ea47b1a1a..61fb3d494d 100644 --- a/src/corelib/tools/qvector.qdoc +++ b/src/corelib/tools/qvector.qdoc @@ -1124,6 +1124,13 @@ \overload */ +/*! \fn void QVector::shrink_to_fit() + \since 5.10 + + This function is provided for STL compatibility. It is equivalent + to squeeze(). +*/ + /*! \fn bool QVector::empty() const This function is provided for STL compatibility. It is equivalent |