From b0f9c06a9b199a7474eb94a6292b5824364344b6 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 26 Jun 2020 08:21:15 +0200 Subject: Use QList instead of QVector in corelib implementation Omitting state machine and docs for now. Task-number: QTBUG-84469 Change-Id: Ibfa5e7035515773461f6cdbff35299315ef65737 Reviewed-by: Sona Kurazyan --- src/corelib/tools/qalgorithms.qdoc | 4 ++-- src/corelib/tools/qbitarray.cpp | 2 +- src/corelib/tools/qcommandlineparser.cpp | 4 ++-- src/corelib/tools/qeasingcurve.cpp | 22 +++++++++++----------- src/corelib/tools/qmap.cpp | 2 +- src/corelib/tools/qstack.cpp | 10 +++++----- src/corelib/tools/qvector_msvc.cpp | 6 +++--- src/corelib/tools/qversionnumber.cpp | 16 ++++++++-------- 8 files changed, 33 insertions(+), 33 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc index a4a30cc798..d480f2b487 100644 --- a/src/corelib/tools/qalgorithms.qdoc +++ b/src/corelib/tools/qalgorithms.qdoc @@ -39,7 +39,7 @@ on all items in a given container or in a given range. You can use these algorithms with any \l {container class} that provides STL-style iterators, including Qt's QList, - QVector, QMap, and QHash classes. + QMap, and QHash classes. Most algorithms take \l {STL-style iterators} as parameters. The algorithms are generic in the sense that they aren't bound to a @@ -143,7 +143,7 @@ \row \li \c{i < j} \li returns \c true if iterator \c j comes after iterator \c i \endtable - QList and QVector's non-const iterator types are random access iterators. + QList's non-const iterator type is random access iterator. \section1 Qt and the STL Algorithms diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index 12ad6f4573..9bcd6a9306 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -107,7 +107,7 @@ QT_BEGIN_NAMESPACE QBitArray(0). We recommend that you always use isEmpty() and avoid isNull(). - \sa QByteArray, QVector + \sa QByteArray, QList */ /*! diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp index 9dec2e1474..1b93fb84cf 100644 --- a/src/corelib/tools/qcommandlineparser.cpp +++ b/src/corelib/tools/qcommandlineparser.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) # include @@ -109,7 +109,7 @@ public: QString description; QString syntax; }; - QVector positionalArgumentDefinitions; + QList positionalArgumentDefinitions; //! The parsing mode for "-abc" QCommandLineParser::SingleDashWordOptionMode singleDashWordOptionMode; diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 1207ce0659..b9bde51d21 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -308,7 +308,7 @@ #endif #include -#include +#include QT_BEGIN_NAMESPACE @@ -357,7 +357,7 @@ QDataStream &operator>>(QDataStream &stream, TCBPoint &point) return stream; } -typedef QVector TCBPoints; +typedef QList TCBPoints; class QEasingCurveFunction { @@ -375,7 +375,7 @@ public: qreal _p; qreal _a; qreal _o; - QVector _bezierCurves; + QList _bezierCurves; TCBPoints _tcbPoints; }; @@ -468,8 +468,8 @@ struct BezierEase : public QEasingCurveFunction qreal p3x, p3y; }; - QVector _curves; - QVector _intervals; + QList _curves; + QList _intervals; int _curveCount; bool _init; bool _valid; @@ -1307,10 +1307,10 @@ void QEasingCurve::addCubicBezierSegment(const QPointF & c1, const QPointF & c2, d_ptr->config->_bezierCurves << c1 << c2 << endPoint; } -QVector static inline tcbToBezier(const TCBPoints &tcbPoints) +QList static inline tcbToBezier(const TCBPoints &tcbPoints) { const int count = tcbPoints.count(); - QVector bezierPoints; + QList bezierPoints; bezierPoints.reserve(3 * (count - 1)); for (int i = 1; i < count; i++) { @@ -1388,9 +1388,9 @@ void QEasingCurve::addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qre If the easing curve does not have a custom bezier easing curve the list is empty. */ -QVector QEasingCurve::toCubicSpline() const +QList QEasingCurve::toCubicSpline() const { - return d_ptr->config ? d_ptr->config->_bezierCurves : QVector(); + return d_ptr->config ? d_ptr->config->_bezierCurves : QList(); } /*! @@ -1406,8 +1406,8 @@ void QEasingCurvePrivate::setType_helper(QEasingCurve::Type newType) qreal amp = -1.0; qreal period = -1.0; qreal overshoot = -1.0; - QVector bezierCurves; - QVector tcbPoints; + QList bezierCurves; + QList tcbPoints; if (config) { amp = config->_a; diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index 6c9eba0c66..fd2136c8ef 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -43,7 +43,7 @@ #ifdef QT_QMAP_DEBUG # include -# include +# include #endif QT_BEGIN_NAMESPACE diff --git a/src/corelib/tools/qstack.cpp b/src/corelib/tools/qstack.cpp index af72313a67..849a474d2c 100644 --- a/src/corelib/tools/qstack.cpp +++ b/src/corelib/tools/qstack.cpp @@ -61,10 +61,10 @@ The example will output 3, 2, 1 in that order. - QStack inherits from QVector. All of QVector's functionality also + QStack inherits from QList. All of QList's functionality also applies to QStack. For example, you can use isEmpty() to test whether the stack is empty, and you can traverse a QStack using - QVector's iterator classes (for example, QVectorIterator). But in + QList's iterator classes (for example, QListIterator). But in addition, QStack provides three convenience functions that make it easy to implement LIFO semantics: push(), pop(), and top(). @@ -73,7 +73,7 @@ won't let you, for example, store a QWidget as a value; instead, store a QWidget *. - \sa QVector, QQueue + \sa QList, QQueue */ /*! @@ -89,7 +89,7 @@ Adds element \a t to the top of the stack. - This is the same as QVector::append(). + This is the same as QList::append(). \sa pop(), top() */ @@ -100,7 +100,7 @@ Returns a reference to the stack's top item. This function assumes that the stack isn't empty. - This is the same as QVector::last(). + This is the same as QList::last(). \sa pop(), push(), isEmpty() */ diff --git a/src/corelib/tools/qvector_msvc.cpp b/src/corelib/tools/qvector_msvc.cpp index 7e87467d42..e3815852dc 100644 --- a/src/corelib/tools/qvector_msvc.cpp +++ b/src/corelib/tools/qvector_msvc.cpp @@ -38,7 +38,7 @@ ****************************************************************************/ // ### Qt6: verify if we can remove this, somehow. -// First, try to see if the extern template from qvector.h is necessary. +// First, try to see if the extern template from qlist.h is necessary. // If it still is, check if removing the copy constructors in qarraydata.h // make the calling convention of both sets of begin() and end() functions // match, as it does for the IA-64 C++ ABI. @@ -47,5 +47,5 @@ # error "This file must be compiled with no precompiled headers" #endif -// the Q_TEMPLATE_EXTERN at the bottom of qvector.h will do the trick -#include +// the Q_TEMPLATE_EXTERN at the bottom of qlist.h will do the trick +#include diff --git a/src/corelib/tools/qversionnumber.cpp b/src/corelib/tools/qversionnumber.cpp index 4aed715999..517f026547 100644 --- a/src/corelib/tools/qversionnumber.cpp +++ b/src/corelib/tools/qversionnumber.cpp @@ -96,13 +96,13 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QVersionNumber::QVersionNumber(const QVector &seg) + \fn QVersionNumber::QVersionNumber(const QList &seg) Constructs a version number from the list of numbers contained in \a seg. */ /*! - \fn QVersionNumber::QVersionNumber(QVector &&seg) + \fn QVersionNumber::QVersionNumber(QList &&seg) Move-constructs a version number from the list of numbers contained in \a seg. @@ -168,18 +168,18 @@ QT_BEGIN_NAMESPACE */ /*! - \fn const QVector& QVersionNumber::segments() const + \fn const QList& QVersionNumber::segments() const Returns all of the numerical segments. \sa majorVersion(), minorVersion(), microVersion() */ -QVector QVersionNumber::segments() const +QList QVersionNumber::segments() const { if (m_segments.isUsingPointer()) return *m_segments.pointer_segments; - QVector result; + QList result; result.resize(segmentCount()); for (int i = 0; i < segmentCount(); ++i) result[i] = segmentAt(i); @@ -462,7 +462,7 @@ QVersionNumber QVersionNumber::fromString(QStringView string, int *suffixIndex) */ QVersionNumber QVersionNumber::fromString(QLatin1String string, int *suffixIndex) { - QVector seg; + QList seg; const char *start = string.begin(); const char *end = start; @@ -487,7 +487,7 @@ QVersionNumber QVersionNumber::fromString(QLatin1String string, int *suffixIndex void QVersionNumber::SegmentStorage::setVector(int len, int maj, int min, int mic) { - pointer_segments = new QVector; + pointer_segments = new QList; pointer_segments->resize(len); pointer_segments->data()[0] = maj; if (len > 1) { @@ -525,7 +525,7 @@ QDataStream& operator<<(QDataStream &out, const QVersionNumber &version) QDataStream& operator>>(QDataStream &in, QVersionNumber &version) { if (!version.m_segments.isUsingPointer()) - version.m_segments.pointer_segments = new QVector; + version.m_segments.pointer_segments = new QList; in >> *version.m_segments.pointer_segments; return in; } -- cgit v1.2.3