diff options
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qcache.h | 6 | ||||
-rw-r--r-- | src/corelib/tools/qeasingcurve.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qflatmap_p.h | 10 | ||||
-rw-r--r-- | src/corelib/tools/qhash.h | 44 | ||||
-rw-r--r-- | src/corelib/tools/qringbuffer_p.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qstack.h | 9 | ||||
-rw-r--r-- | src/corelib/tools/qversionnumber.h | 30 |
7 files changed, 44 insertions, 63 deletions
diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h index 8cf6598f10..ac7760be0b 100644 --- a/src/corelib/tools/qcache.h +++ b/src/corelib/tools/qcache.h @@ -205,11 +205,11 @@ public: inline qsizetype size() const noexcept { return d.size; } inline qsizetype count() const noexcept { return d.size; } inline bool isEmpty() const noexcept { return !d.size; } - inline QVector<Key> keys() const + inline QList<Key> keys() const { - QVector<Key> k; + QList<Key> k; if (d.size) { - k.reserve(typename QVector<Key>::size_type(d.size)); + k.reserve(typename QList<Key>::size_type(d.size)); for (auto it = d.begin(); it != d.end(); ++it) k << it.node()->key; } diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h index 81833a758f..e6ee7b56d5 100644 --- a/src/corelib/tools/qeasingcurve.h +++ b/src/corelib/tools/qeasingcurve.h @@ -44,8 +44,8 @@ QT_REQUIRE_CONFIG(easingcurve); +#include <QtCore/qlist.h> #include <QtCore/qobjectdefs.h> -#include <QtCore/qvector.h> QT_BEGIN_NAMESPACE @@ -100,7 +100,7 @@ public: void addCubicBezierSegment(const QPointF & c1, const QPointF & c2, const QPointF & endPoint); void addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qreal b); - QVector<QPointF> toCubicSpline() const; + QList<QPointF> toCubicSpline() const; Type type() const; void setType(Type type); diff --git a/src/corelib/tools/qflatmap_p.h b/src/corelib/tools/qflatmap_p.h index 82a1068d34..bf0efb2543 100644 --- a/src/corelib/tools/qflatmap_p.h +++ b/src/corelib/tools/qflatmap_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "qvector.h" +#include "qlist.h" #include <algorithm> #include <functional> @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE /* QFlatMap provides an associative container backed by sorted sequential - containers. By default, QVector is used. + containers. By default, QList is used. Keys and values are stored in two separate containers. This provides improved cache locality for key iteration and makes keys() and values() fast @@ -105,10 +105,8 @@ public: } }; -template <class Key, class T, - class Compare = std::less<Key>, - class KeyContainer = QVector<Key>, - class MappedContainer = QVector<T>> +template<class Key, class T, class Compare = std::less<Key>, class KeyContainer = QList<Key>, + class MappedContainer = QList<T>> class QFlatMap : private QFlatMapValueCompare<Key, T, Compare> { using full_map_t = QFlatMap<Key, T, Compare, KeyContainer, MappedContainer>; diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 2c39a9dfc8..2de3989eb2 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -40,12 +40,12 @@ #ifndef QHASH_H #define QHASH_H -#include <QtCore/qiterator.h> -#include <QtCore/qvector.h> -#include <QtCore/qrefcount.h> -#include <QtCore/qhashfunctions.h> #include <QtCore/qcontainertools_impl.h> +#include <QtCore/qhashfunctions.h> +#include <QtCore/qiterator.h> +#include <QtCore/qlist.h> #include <QtCore/qmath.h> +#include <QtCore/qrefcount.h> #include <initializer_list> @@ -897,13 +897,10 @@ public: return value(key); } - QVector<Key> keys() const - { - return QVector<Key>(keyBegin(), keyEnd()); - } - QVector<Key> keys(const T &value) const + QList<Key> keys() const { return QList<Key>(keyBegin(), keyEnd()); } + QList<Key> keys(const T &value) const { - QVector<Key> res; + QList<Key> res; const_iterator i = begin(); while (i != end()) { if (i.value() == value) @@ -912,10 +909,7 @@ public: } return res; } - QVector<T> values() const - { - return QVector<T>(begin(), end()); - } + QList<T> values() const { return QList<T>(begin(), end()); } class const_iterator; @@ -1381,9 +1375,9 @@ public: return value(key); } - QVector<Key> uniqueKeys() const + QList<Key> uniqueKeys() const { - QVector<Key> res; + QList<Key> res; if (d) { auto i = d->begin(); while (i != d->end()) { @@ -1394,13 +1388,10 @@ public: return res; } - QVector<Key> keys() const + QList<Key> keys() const { return QList<Key>(keyBegin(), keyEnd()); } + QList<Key> keys(const T &value) const { - return QVector<Key>(keyBegin(), keyEnd()); - } - QVector<Key> keys(const T &value) const - { - QVector<Key> res; + QList<Key> res; const_iterator i = begin(); while (i != end()) { if (i.value()->contains(value)) @@ -1409,13 +1400,10 @@ public: } return res; } - QVector<T> values() const - { - return QVector<T>(begin(), end()); - } - QVector<T> values(const Key &key) const + QList<T> values() const { return QList<T>(begin(), end()); } + QList<T> values(const Key &key) const { - QVector<T> values; + QList<T> values; if (d) { Node *n = d->findNode(key); if (n) { diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index 838cb31697..85a3882a3c 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -53,7 +53,7 @@ #include <QtCore/private/qglobal_p.h> #include <QtCore/qbytearray.h> -#include <QtCore/qvector.h> +#include <QtCore/qlist.h> QT_BEGIN_NAMESPACE @@ -265,7 +265,7 @@ public: } private: - QVector<QRingChunk> buffers; + QList<QRingChunk> buffers; qint64 bufferSize; int basicBlockSize; }; diff --git a/src/corelib/tools/qstack.h b/src/corelib/tools/qstack.h index e59212aa2a..a0e39f8ece 100644 --- a/src/corelib/tools/qstack.h +++ b/src/corelib/tools/qstack.h @@ -40,18 +40,17 @@ #ifndef QSTACK_H #define QSTACK_H -#include <QtCore/qvector.h> +#include <QtCore/qlist.h> QT_BEGIN_NAMESPACE - template<class T> -class QStack : public QVector<T> +class QStack : public QList<T> { public: // compiler-generated special member functions are fine! - inline void swap(QStack<T> &other) noexcept { QVector<T>::swap(other); } // prevent QVector<->QStack swaps - inline void push(const T &t) { QVector<T>::append(t); } + inline void swap(QStack<T> &other) noexcept { QList<T>::swap(other); } // prevent QList<->QStack swaps + inline void push(const T &t) { QList<T>::append(t); } T pop(); T &top(); const T &top() const; diff --git a/src/corelib/tools/qversionnumber.h b/src/corelib/tools/qversionnumber.h index f4e384c8dc..f8a2d8eae8 100644 --- a/src/corelib/tools/qversionnumber.h +++ b/src/corelib/tools/qversionnumber.h @@ -42,10 +42,10 @@ #ifndef QVERSIONNUMBER_H #define QVERSIONNUMBER_H +#include <QtCore/qlist.h> +#include <QtCore/qmetatype.h> #include <QtCore/qnamespace.h> #include <QtCore/qstring.h> -#include <QtCore/qvector.h> -#include <QtCore/qmetatype.h> #include <QtCore/qtypeinfo.h> #include <limits> @@ -84,24 +84,24 @@ class QVersionNumber union { quintptr dummy; qint8 inline_segments[sizeof(void*)]; - QVector<int> *pointer_segments; + QList<int> *pointer_segments; }; // set the InlineSegmentMarker and set length to zero SegmentStorage() noexcept : dummy(1) {} - SegmentStorage(const QVector<int> &seg) + SegmentStorage(const QList<int> &seg) { if (dataFitsInline(seg.begin(), seg.size())) setInlineData(seg.begin(), seg.size()); else - pointer_segments = new QVector<int>(seg); + pointer_segments = new QList<int>(seg); } SegmentStorage(const SegmentStorage &other) { if (other.isUsingPointer()) - pointer_segments = new QVector<int>(*other.pointer_segments); + pointer_segments = new QList<int>(*other.pointer_segments); else dummy = other.dummy; } @@ -111,7 +111,7 @@ class QVersionNumber if (isUsingPointer() && other.isUsingPointer()) { *pointer_segments = *other.pointer_segments; } else if (other.isUsingPointer()) { - pointer_segments = new QVector<int>(*other.pointer_segments); + pointer_segments = new QList<int>(*other.pointer_segments); } else { if (isUsingPointer()) delete pointer_segments; @@ -132,19 +132,19 @@ class QVersionNumber return *this; } - explicit SegmentStorage(QVector<int> &&seg) + explicit SegmentStorage(QList<int> &&seg) { if (dataFitsInline(seg.begin(), seg.size())) setInlineData(seg.begin(), seg.size()); else - pointer_segments = new QVector<int>(std::move(seg)); + pointer_segments = new QList<int>(std::move(seg)); } SegmentStorage(std::initializer_list<int> args) { if (dataFitsInline(args.begin(), int(args.size()))) { setInlineData(args.begin(), int(args.size())); } else { - pointer_segments = new QVector<int>(args); + pointer_segments = new QList<int>(args); } } @@ -218,15 +218,11 @@ public: inline QVersionNumber() noexcept : m_segments() {} - inline explicit QVersionNumber(const QVector<int> &seg) - : m_segments(seg) - {} + inline explicit QVersionNumber(const QList<int> &seg) : m_segments(seg) { } // compiler-generated copy/move ctor/assignment operators and the destructor are ok - explicit QVersionNumber(QVector<int> &&seg) - : m_segments(std::move(seg)) - {} + explicit QVersionNumber(QList<int> &&seg) : m_segments(std::move(seg)) { } inline QVersionNumber(std::initializer_list<int> args) : m_segments(args) @@ -258,7 +254,7 @@ public: Q_REQUIRED_RESULT Q_CORE_EXPORT QVersionNumber normalized() const; - Q_REQUIRED_RESULT Q_CORE_EXPORT QVector<int> segments() const; + Q_REQUIRED_RESULT Q_CORE_EXPORT QList<int> segments() const; Q_REQUIRED_RESULT inline int segmentAt(int index) const noexcept { return (m_segments.size() > index) ? m_segments.at(index) : 0; } |