Use QList instead of QVector in corelib

Applied to headers only. Source file to be changed separately.
Omitted statemachine for now to avoid conflicts.
Omitted qmetatype.h for now - to be handled later.

Task-number: QTBUG-84469
Change-Id: I317376037a62467c313467d92955ad0b7473aa97
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
bb10
Jarek Kobus 2020-06-22 11:06:12 +02:00
parent e114e580e7
commit 0475460102
50 changed files with 169 additions and 201 deletions

View File

@ -92,7 +92,7 @@ public:
// this is the actual duration of uncontrolled animations
// it helps seeking and even going forward
QVector<int> actualDuration;
QList<int> actualDuration;
void restart();
int lastLoop;

View File

@ -40,11 +40,11 @@
#ifndef QVARIANTANIMATION_H
#define QVARIANTANIMATION_H
#include <QtCore/qeasingcurve.h>
#include <QtCore/qabstractanimation.h>
#include <QtCore/qvector.h>
#include <QtCore/qvariant.h>
#include <QtCore/qeasingcurve.h>
#include <QtCore/qlist.h>
#include <QtCore/qpair.h>
#include <QtCore/qvariant.h>
QT_REQUIRE_CONFIG(animation);
@ -62,7 +62,7 @@ class Q_CORE_EXPORT QVariantAnimation : public QAbstractAnimation
public:
typedef QPair<qreal, QVariant> KeyValue;
typedef QVector<KeyValue> KeyValues;
typedef QList<KeyValue> KeyValues;
QVariantAnimation(QObject *parent = nullptr);
~QVariantAnimation();

View File

@ -54,7 +54,6 @@
#include "qvariantanimation.h"
#include <QtCore/qeasingcurve.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qvector.h>
#include "private/qabstractanimation_p.h"

View File

@ -75,5 +75,4 @@
#include <qstring.h>
#include <qstringlist.h>
#include <qtimer.h>
#include <qvector.h>
#endif

View File

@ -47,7 +47,6 @@
#include <QtCore/qmap.h>
#include <QtCore/qtextstream.h>
#include <QtCore/qstring.h>
#include <QtCore/qvector.h>
#include <QtCore/qset.h>
#include <QtCore/qcontiguouscache.h>
#include <QtCore/qsharedpointer.h>
@ -262,10 +261,10 @@ inline QDebug printAssociativeContainer(QDebug debug, const char *which, const A
} // namespace QtPrivate
template <typename T>
inline QDebug operator<<(QDebug debug, const QVector<T> &vec)
template<typename T>
inline QDebug operator<<(QDebug debug, const QList<T> &vec)
{
return QtPrivate::printSequentialContainer(debug, "QVector", vec);
return QtPrivate::printSequentialContainer(debug, "QList", vec);
}
template <typename T, typename Alloc>

View File

@ -53,11 +53,10 @@
#include "qfilesystemwatcher_p.h"
#include <QtCore/qmutex.h>
#include <QtCore/qhash.h>
#include <QtCore/qthread.h>
#include <QtCore/qvector.h>
#include <QtCore/qmutex.h>
#include <QtCore/qsocketnotifier.h>
#include <QtCore/qthread.h>
#include <dispatch/dispatch.h>
#include <CoreServices/CoreServices.h>

View File

@ -55,9 +55,8 @@
#include <QtCore/qhash.h>
#include <QtCore/qmutex.h>
#include <QtCore/qthread.h>
#include <QtCore/qvector.h>
#include <QtCore/qsocketnotifier.h>
#include <QtCore/qthread.h>
QT_REQUIRE_CONFIG(filesystemwatcher);
struct kevent;

View File

@ -54,12 +54,12 @@
#include "qfilesystemwatcher_p.h"
#include <QtCore/qdatetime.h>
#include <QtCore/qthread.h>
#include <QtCore/qfile.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
#include <QtCore/qmutex.h>
#include <QtCore/qvector.h>
#include <QtCore/qthread.h>
QT_BEGIN_NAMESPACE
@ -157,7 +157,7 @@ public:
void wakeup();
QMutex mutex;
QVector<Qt::HANDLE> handles;
QList<Qt::HANDLE> handles;
int msg;
HandleForDirHash handleForDir;

View File

@ -51,12 +51,12 @@
// We mean it.
//
#include "QtCore/qiodevice.h"
#include "QtCore/qbytearray.h"
#include "QtCore/qiodevice.h"
#include "QtCore/qlist.h"
#include "QtCore/qobjectdefs.h"
#include "QtCore/qstring.h"
#include "private/qringbuffer_p.h"
#include "QtCore/qvector.h"
#ifndef QT_NO_QOBJECT
#include "private/qobject_p.h"
#endif
@ -83,8 +83,8 @@ public:
QIODevice::OpenMode openMode;
QString errorString;
QVector<QRingBuffer> readBuffers;
QVector<QRingBuffer> writeBuffers;
QList<QRingBuffer> readBuffers;
QList<QRingBuffer> writeBuffers;
class QRingBufferRef {
QRingBuffer *m_buf;

View File

@ -53,11 +53,11 @@
#include <QtCore/private/qglobal_p.h>
#include <QtCore/qloggingcategory.h>
#include <QtCore/qlist.h>
#include <QtCore/qmap.h>
#include <QtCore/qmutex.h>
#include <QtCore/qstring.h>
#include <QtCore/qtextstream.h>
#include <QtCore/qvector.h>
class tst_QLoggingRegistry;
@ -98,14 +98,14 @@ public:
void setContent(const QString &content);
void setContent(QTextStream &stream);
QVector<QLoggingRule> rules() const { return _rules; }
QList<QLoggingRule> rules() const { return _rules; }
private:
void parseNextLine(QStringView line);
private:
bool m_inRulesSection = false;
QVector<QLoggingRule> _rules;
QList<QLoggingRule> _rules;
};
class Q_AUTOTEST_EXPORT QLoggingRegistry
@ -143,7 +143,7 @@ private:
QMutex registryMutex;
// protected by mutex:
QVector<QLoggingRule> ruleSets[NumRuleSets];
QList<QLoggingRule> ruleSets[NumRuleSets];
QHash<QLoggingCategory*,QtMsgType> categories;
QLoggingCategory::CategoryFilter categoryFilter;

View File

@ -293,7 +293,7 @@ private:
void ensureAllSectionsParsed(QConfFile *confFile) const;
void ensureSectionParsed(QConfFile *confFile, const QSettingsKey &key) const;
QVector<QConfFile *> confFiles;
QList<QConfFile *> confFiles;
QSettings::ReadFunc readFunc;
QSettings::WriteFunc writeFunc;
QString extension;

View File

@ -40,10 +40,10 @@
#ifndef QABSTRACTITEMMODEL_H
#define QABSTRACTITEMMODEL_H
#include <QtCore/qvariant.h>
#include <QtCore/qobject.h>
#include <QtCore/qhash.h>
#include <QtCore/qvector.h>
#include <QtCore/qlist.h>
#include <QtCore/qobject.h>
#include <QtCore/qvariant.h>
QT_REQUIRE_CONFIG(itemmodel);
@ -257,7 +257,8 @@ public:
Q_REQUIRED_RESULT bool checkIndex(const QModelIndex &index, CheckIndexOptions options = CheckIndexOption::NoOption) const;
Q_SIGNALS:
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>());
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
const QList<int> &roles = QList<int>());
void headerDataChanged(Qt::Orientation orientation, int first, int last);
void layoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint);
void layoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint);

View File

@ -82,7 +82,8 @@ public:
~QAbstractItemModelPrivate();
void removePersistentIndexData(QPersistentModelIndexData *data);
void movePersistentIndexes(const QVector<QPersistentModelIndexData *> &indexes, int change, const QModelIndex &parent, Qt::Orientation orientation);
void movePersistentIndexes(const QList<QPersistentModelIndexData *> &indexes, int change, const QModelIndex &parent,
Qt::Orientation orientation);
void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last);
void rowsInserted(const QModelIndex &parent, int first, int last);
void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last);
@ -142,8 +143,8 @@ public:
struct Persistent {
Persistent() {}
QMultiHash<QModelIndex, QPersistentModelIndexData *> indexes;
QStack<QVector<QPersistentModelIndexData *> > moved;
QStack<QVector<QPersistentModelIndexData *> > invalidated;
QStack<QList<QPersistentModelIndexData *>> moved;
QStack<QList<QPersistentModelIndexData *>> invalidated;
void insertMultiAtEnd(const QModelIndex& key, QPersistentModelIndexData *data);
} persistent;

View File

@ -91,7 +91,8 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_slotColumnsInserted(const QModelIndex &parent, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_slotColumnsAboutToBeRemoved(const QModelIndex &parent, int start, int end))
Q_PRIVATE_SLOT(d_func(), void _q_slotColumnsRemoved(const QModelIndex &parent, int, int))
Q_PRIVATE_SLOT(d_func(), void _q_slotDataChanged(const QModelIndex &from, const QModelIndex &to, const QVector<int> &roles))
Q_PRIVATE_SLOT(d_func(),
void _q_slotDataChanged(const QModelIndex &from, const QModelIndex &to, const QList<int> &roles))
Q_PRIVATE_SLOT(d_func(), void _q_slotSourceLayoutAboutToBeChanged(QList<QPersistentModelIndex>, QAbstractItemModel::LayoutChangeHint))
Q_PRIVATE_SLOT(d_func(), void _q_slotSourceLayoutChanged(const QList<QPersistentModelIndex> &, QAbstractItemModel::LayoutChangeHint))
Q_PRIVATE_SLOT(d_func(), void _q_slotModelAboutToBeReset())

View File

@ -101,7 +101,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))
Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsMoved(QModelIndex,int,int,QModelIndex,int))
Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(QModelIndex,QModelIndex,QVector<int>))
Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(QModelIndex, QModelIndex, QList<int>))
Q_PRIVATE_SLOT(d_func(), void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last))
Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint))

View File

@ -42,10 +42,9 @@
#include <QtCore/qglobal.h>
#include <QtCore/qset.h>
#include <QtCore/qvector.h>
#include <QtCore/qlist.h>
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qlist.h>
#include <QtCore/qset.h>
QT_REQUIRE_CONFIG(itemmodel);

View File

@ -97,10 +97,10 @@ public:
QItemSelection currentSelection;
QPersistentModelIndex currentIndex;
QItemSelectionModel::SelectionFlags currentCommand;
QVector<QPersistentModelIndex> savedPersistentIndexes;
QVector<QPersistentModelIndex> savedPersistentCurrentIndexes;
QVector<QPair<QPersistentModelIndex, uint> > savedPersistentRowLengths;
QVector<QPair<QPersistentModelIndex, uint> > savedPersistentCurrentRowLengths;
QList<QPersistentModelIndex> savedPersistentIndexes;
QList<QPersistentModelIndex> savedPersistentCurrentIndexes;
QList<QPair<QPersistentModelIndex, uint>> savedPersistentRowLengths;
QList<QPair<QPersistentModelIndex, uint>> savedPersistentCurrentRowLengths;
// optimization when all indexes are selected
bool tableSelected;
QPersistentModelIndex tableParent;

View File

@ -194,7 +194,9 @@ private:
Q_DECLARE_PRIVATE(QSortFilterProxyModel)
Q_DISABLE_COPY(QSortFilterProxyModel)
Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(const QModelIndex &source_top_left, const QModelIndex &source_bottom_right, const QVector<int> &roles))
Q_PRIVATE_SLOT(d_func(),
void _q_sourceDataChanged(const QModelIndex &source_top_left, const QModelIndex &source_bottom_right,
const QList<int> &roles))
Q_PRIVATE_SLOT(d_func(), void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int start, int end))
Q_PRIVATE_SLOT(d_func(), void _q_sourceAboutToBeReset())
Q_PRIVATE_SLOT(d_func(), void _q_sourceReset())

View File

@ -62,14 +62,14 @@ class QTransposeProxyModelPrivate : public QAbstractProxyModelPrivate
Q_DISABLE_COPY(QTransposeProxyModelPrivate)
private:
QTransposeProxyModelPrivate() = default;
QVector<QMetaObject::Connection> sourceConnections;
QVector<QPersistentModelIndex> layoutChangePersistentIndexes;
QList<QMetaObject::Connection> sourceConnections;
QList<QPersistentModelIndex> layoutChangePersistentIndexes;
QModelIndexList layoutChangeProxyIndexes;
QModelIndex uncheckedMapToSource(const QModelIndex &proxyIndex) const;
QModelIndex uncheckedMapFromSource(const QModelIndex &sourceIndex) const;
void onLayoutChanged(const QList<QPersistentModelIndex> &parents, QAbstractItemModel::LayoutChangeHint hint);
void onLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents, QAbstractItemModel::LayoutChangeHint hint);
void onDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector<int>& roles);
void onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList<int> &roles);
void onHeaderDataChanged(Qt::Orientation orientation, int first, int last);
void onColumnsAboutToBeInserted(const QModelIndex &parent, int first, int last);
void onColumnsAboutToBeRemoved(const QModelIndex &parent, int first, int last);

View File

@ -60,7 +60,6 @@
# include <qt_windows.h> // first to suppress min, max macros.
# include <shlobj.h>
# else
# include "QtCore/qvector.h"
# include <qt_windows.h>
# endif

View File

@ -141,10 +141,10 @@ public:
void setSocketNotifierPending(QSocketNotifier *notifier);
QThreadPipe threadPipe;
QVector<pollfd> pollfds;
QList<pollfd> pollfds;
QHash<int, QSocketNotifierSetUNIX> socketNotifiers;
QVector<QSocketNotifier *> pendingNotifiers;
QList<QSocketNotifier *> pendingNotifiers;
QTimerInfoList timerList;
QAtomicInt interrupt; // bool

View File

@ -53,14 +53,13 @@
//
#include <QtCore/private/qglobal_p.h>
#include "QtCore/qobject.h"
#include "QtCore/qpointer.h"
#include "QtCore/qsharedpointer.h"
#include "QtCore/qcoreevent.h"
#include "QtCore/qlist.h"
#include "QtCore/qvector.h"
#include "QtCore/qvariant.h"
#include "QtCore/qobject.h"
#include "QtCore/qpointer.h"
#include "QtCore/qreadwritelock.h"
#include "QtCore/qsharedpointer.h"
#include "QtCore/qvariant.h"
QT_BEGIN_NAMESPACE
@ -105,8 +104,8 @@ public:
{
ExtraData() {}
QList<QByteArray> propertyNames;
QVector<QVariant> propertyValues;
QVector<int> runningTimers;
QList<QVariant> propertyValues;
QList<int> runningTimers;
QList<QPointer<QObject> > eventFilters;
QString objectName;
};

View File

@ -60,8 +60,8 @@ QT_REQUIRE_CONFIG(mimetype);
#include "qmimeglobpattern_p.h"
#include <QtCore/qelapsedtimer.h>
#include <QtCore/qlist.h>
#include <QtCore/qmutex.h>
#include <QtCore/qvector.h>
#include <vector>
#include <memory>

View File

@ -67,7 +67,7 @@ public:
QJsonObject metaData() const;
static QObjectList staticInstances();
static QVector<QStaticPlugin> staticPlugins();
static QList<QStaticPlugin> staticPlugins();
bool load();
bool unload();
@ -93,7 +93,7 @@ class Q_CORE_EXPORT QPluginLoader
{
public:
static QObjectList staticInstances();
static QVector<QStaticPlugin> staticPlugins();
static QList<QStaticPlugin> staticPlugins();
};
#endif // QT_CONFIG(library)

View File

@ -188,7 +188,7 @@ public:
qsizetype size() const noexcept Q_DECL_PURE_FUNCTION;
bool isEmpty() const { return size() == 0; }
void clear();
QVector<QCborValue> keys() const;
QList<QCborValue> keys() const;
QCborValue value(qint64 key) const
{ const_iterator it = find(key); return it == end() ? QCborValue() : it.value(); }

View File

@ -51,7 +51,6 @@
#include <QtCore/qurl.h>
#include <QtCore/quuid.h>
#include <QtCore/qvariant.h>
#include <QtCore/qvector.h>
// See qcborcommon.h for why we check
#if defined(QT_X11_DEFINES_FOUND)

View File

@ -131,7 +131,7 @@ public:
QByteArray::size_type usedData = 0;
QByteArray data;
QVector<QtCbor::Element> elements;
QList<QtCbor::Element> elements;
void deref() { if (!ref.deref()) delete this; }
void compact(qsizetype reserved);

View File

@ -406,13 +406,13 @@ operator>>(QDataStream &s, T &t)
{ return s >> reinterpret_cast<typename std::underlying_type<T>::type &>(t); }
template<typename T>
inline QDataStream &operator>>(QDataStream &s, QVector<T> &v)
inline QDataStream &operator>>(QDataStream &s, QList<T> &v)
{
return QtPrivate::readArrayBasedContainer(s, v);
}
template<typename T>
inline QDataStream &operator<<(QDataStream &s, const QVector<T> &v)
inline QDataStream &operator<<(QDataStream &s, const QList<T> &v)
{
return QtPrivate::writeSequentialContainer(s, v);
}

View File

@ -113,7 +113,7 @@ struct ObjectIterator
Element m_value;
};
using difference_type = typename QVector<Element>::difference_type;
using difference_type = typename QList<Element>::difference_type;
using iterator_category = std::random_access_iterator_tag;
ObjectIterator() = default;
@ -182,8 +182,8 @@ inline bool operator==(
return a.elementsIterator() == b.elementsIterator();
}
using KeyIterator = ObjectIterator<QtCbor::Element, QVector<QtCbor::Element>::iterator>;
using ConstKeyIterator = ObjectIterator<const QtCbor::Element, QVector<QtCbor::Element>::const_iterator>;
using KeyIterator = ObjectIterator<QtCbor::Element, QList<QtCbor::Element>::iterator>;
using ConstKeyIterator = ObjectIterator<const QtCbor::Element, QList<QtCbor::Element>::const_iterator>;
template<>
inline KeyIterator::reference &KeyIterator::reference::operator=(const KeyIterator::value_type &value)

View File

@ -44,9 +44,9 @@
#ifndef QT_NO_XMLSTREAM
#include <QtCore/qstring.h>
#include <QtCore/qvector.h>
#include <QtCore/qlist.h>
#include <QtCore/qscopedpointer.h>
#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
@ -113,7 +113,7 @@ public:
Q_DECLARE_TYPEINFO(QXmlStreamAttribute, Q_MOVABLE_TYPE);
class Q_CORE_EXPORT QXmlStreamAttributes : public QVector<QXmlStreamAttribute>
class Q_CORE_EXPORT QXmlStreamAttributes : public QList<QXmlStreamAttribute>
{
public:
inline QXmlStreamAttributes() {}
@ -140,7 +140,7 @@ public:
return !value(namespaceUri, name).isNull();
}
using QVector<QXmlStreamAttribute>::append;
using QList<QXmlStreamAttribute>::append;
};
class Q_CORE_EXPORT QXmlStreamNamespaceDeclaration {
@ -164,7 +164,7 @@ public:
};
Q_DECLARE_TYPEINFO(QXmlStreamNamespaceDeclaration, Q_MOVABLE_TYPE);
typedef QVector<QXmlStreamNamespaceDeclaration> QXmlStreamNamespaceDeclarations;
typedef QList<QXmlStreamNamespaceDeclaration> QXmlStreamNamespaceDeclarations;
class Q_CORE_EXPORT QXmlStreamNotationDeclaration {
QXmlStreamStringRef m_name, m_systemId, m_publicId;
@ -188,7 +188,7 @@ public:
};
Q_DECLARE_TYPEINFO(QXmlStreamNotationDeclaration, Q_MOVABLE_TYPE);
typedef QVector<QXmlStreamNotationDeclaration> QXmlStreamNotationDeclarations;
typedef QList<QXmlStreamNotationDeclaration> QXmlStreamNotationDeclarations;
class Q_CORE_EXPORT QXmlStreamEntityDeclaration {
QXmlStreamStringRef m_name, m_notationName, m_systemId, m_publicId, m_value;
@ -217,8 +217,7 @@ public:
};
Q_DECLARE_TYPEINFO(QXmlStreamEntityDeclaration, Q_MOVABLE_TYPE);
typedef QVector<QXmlStreamEntityDeclaration> QXmlStreamEntityDeclarations;
typedef QList<QXmlStreamEntityDeclaration> QXmlStreamEntityDeclarations;
class Q_CORE_EXPORT QXmlStreamEntityResolver
{

View File

@ -54,7 +54,7 @@
#include <QtCore/private/qglobal_p.h>
#include "qcollator.h"
#include <QVector>
#include <QList>
#if QT_CONFIG(icu)
#include <unicode/ucol.h>
#elif defined(Q_OS_MACOS)
@ -72,7 +72,7 @@ const CollatorType NoCollator = nullptr;
#elif defined(Q_OS_MACOS)
typedef CollatorRef CollatorType;
typedef QVector<UCCollationValue> CollatorKeyType;
typedef QList<UCCollationValue> CollatorKeyType;
const CollatorType NoCollator = 0;
#elif defined(Q_OS_WIN)
@ -81,7 +81,7 @@ typedef int CollatorType;
const CollatorType NoCollator = 0;
#else // posix - ignores CollatorType collator, only handles system locale
typedef QVector<wchar_t> CollatorKeyType;
typedef QList<wchar_t> CollatorKeyType;
typedef bool CollatorType;
const CollatorType NoCollator = false;
#endif

View File

@ -580,22 +580,20 @@ public:
QStringList split(const QString &sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT
QVector<QStringRef> splitRef(const QString &sep,
Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
QList<QStringRef> splitRef(const QString &sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT
QStringList split(QChar sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT
QVector<QStringRef> splitRef(QChar sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
QList<QStringRef> splitRef(QChar sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
#ifndef QT_NO_REGULAREXPRESSION
Q_REQUIRED_RESULT
QStringList split(const QRegularExpression &sep,
Qt::SplitBehavior behavior = Qt::KeepEmptyParts) const;
Q_REQUIRED_RESULT
QVector<QStringRef> splitRef(const QRegularExpression &sep,
Qt::SplitBehavior behavior = Qt::KeepEmptyParts) const;
QList<QStringRef> splitRef(const QRegularExpression &sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts) const;
#endif
template <typename Needle, typename...Flags>
@ -647,7 +645,7 @@ public:
Q_REQUIRED_RESULT QByteArray toUtf8() const;
Q_REQUIRED_RESULT QByteArray toLocal8Bit() const;
#endif
Q_REQUIRED_RESULT QVector<uint> toUcs4() const;
Q_REQUIRED_RESULT QList<uint> toUcs4() const;
// note - this are all inline so we can benefit from strlen() compile time optimizations
static inline QString fromLatin1(const char *str, int size = -1)
@ -1414,11 +1412,11 @@ public:
int count(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT
QVector<QStringRef> split(const QString &sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
QList<QStringRef> split(const QString &sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT
QVector<QStringRef> split(QChar sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
QList<QStringRef> split(QChar sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
Q_REQUIRED_RESULT QStringRef left(int n) const;
Q_REQUIRED_RESULT QStringRef right(int n) const;
@ -1480,7 +1478,7 @@ public:
Q_REQUIRED_RESULT QByteArray toLatin1() const;
Q_REQUIRED_RESULT QByteArray toUtf8() const;
Q_REQUIRED_RESULT QByteArray toLocal8Bit() const;
Q_REQUIRED_RESULT QVector<uint> toUcs4() const;
Q_REQUIRED_RESULT QList<uint> toUcs4() const;
inline void clear() { m_string = nullptr; m_position = m_size = 0; }
QString toString() const;

View File

@ -93,7 +93,7 @@ Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype count(QStringView
Q_REQUIRED_RESULT Q_CORE_EXPORT QByteArray convertToLatin1(QStringView str);
Q_REQUIRED_RESULT Q_CORE_EXPORT QByteArray convertToUtf8(QStringView str);
Q_REQUIRED_RESULT Q_CORE_EXPORT QByteArray convertToLocal8Bit(QStringView str);
Q_REQUIRED_RESULT Q_CORE_EXPORT QVector<uint> convertToUcs4(QStringView str);
Q_REQUIRED_RESULT Q_CORE_EXPORT QList<uint> convertToUcs4(QStringView str);
Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isRightToLeft(QStringView string) noexcept;

View File

@ -329,8 +329,7 @@ public:
this->needleView(needle), sb, cs}
{}
template <typename Container = QVector<value_type>,
if_compatible_container<Container> = true>
template<typename Container = QList<value_type>, if_compatible_container<Container> = true>
Container toContainer(Container &&c = {}) const &
{
for (auto e : *this)
@ -338,9 +337,8 @@ public:
return c;
}
template <typename Container = QVector<value_type>,
if_compatible_container<Container> = true,
if_haystack_not_pinned<Container> = true>
template<typename Container = QList<value_type>, if_compatible_container<Container> = true,
if_haystack_not_pinned<Container> = true>
Container toContainer(Container &&c = {}) const &&
{
for (auto e : *this)

View File

@ -253,7 +253,7 @@ public:
Q_REQUIRED_RESULT QByteArray toLatin1() const { return QtPrivate::convertToLatin1(*this); }
Q_REQUIRED_RESULT QByteArray toUtf8() const { return QtPrivate::convertToUtf8(*this); }
Q_REQUIRED_RESULT QByteArray toLocal8Bit() const { return QtPrivate::convertToLocal8Bit(*this); }
Q_REQUIRED_RESULT inline QVector<uint> toUcs4() const; // defined in qvector.h
Q_REQUIRED_RESULT inline QList<uint> toUcs4() const; // defined in qlist.h
Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar at(qsizetype n) const { return (*this)[n]; }

View File

@ -237,7 +237,7 @@ public:
inline void reportAndMoveResult(T &&result, int index = -1);
inline void reportResult(T &&result, int index = -1);
inline void reportResult(const T &result, int index = -1);
inline void reportResults(const QVector<T> &results, int beginIndex = -1, int count = -1);
inline void reportResults(const QList<T> &results, int beginIndex = -1, int count = -1);
inline void reportFinished(const T *result);
void reportFinished()
{
@ -300,8 +300,8 @@ inline void QFutureInterface<T>::reportResult(const T &result, int index)
reportResult(&result, index);
}
template <typename T>
inline void QFutureInterface<T>::reportResults(const QVector<T> &_results, int beginIndex, int count)
template<typename T>
inline void QFutureInterface<T>::reportResults(const QList<T> &_results, int beginIndex, int count)
{
std::lock_guard<QMutex> locker{mutex()};
if (this->queryState(Canceled) || this->queryState(Finished)) {
@ -418,7 +418,7 @@ public:
inline QFuture<void> future(); // implemented in qfuture.h
void reportResult(const void *, int) { }
void reportResults(const QVector<void> &, int) { }
void reportResults(const QList<void> &, int) { }
void reportFinished(const void * = nullptr)
{
QFutureInterfaceBase::reportFinished();

View File

@ -49,16 +49,14 @@ QT_REQUIRE_CONFIG(future);
QT_BEGIN_NAMESPACE
/*
ResultStore stores indexed results. Results can be added and retrieved
either individually batched in a QVector. Retriveing results and checking
either individually batched in a QList. Retriveing results and checking
which indexes are in the store can be done either by iterating or by random
accees. In addition results kan be removed from the front of the store,
either individually or in batches.
*/
namespace QtPrivate {
class ResultItem
@ -116,7 +114,7 @@ public:
const T *pointer() const
{
if (mapIterator.value().isVector())
return &(reinterpret_cast<const QVector<T> *>(mapIterator.value().result)->at(m_vectorIndex));
return &(reinterpret_cast<const QList<T> *>(mapIterator.value().result)->at(m_vectorIndex));
else
return reinterpret_cast<const T *>(mapIterator.value().result);
}
@ -169,19 +167,19 @@ public:
return addResult(index, static_cast<void *>(new T(std::move_if_noexcept(result))));
}
template <typename T>
int addResults(int index, const QVector<T> *results)
template<typename T>
int addResults(int index, const QList<T> *results)
{
return addResults(index, new QVector<T>(*results), results->count(), results->count());
return addResults(index, new QList<T>(*results), results->count(), results->count());
}
template <typename T>
int addResults(int index, const QVector<T> *results, int totalCount)
template<typename T>
int addResults(int index, const QList<T> *results, int totalCount)
{
if (m_filterMode == true && results->count() != totalCount && 0 == results->count())
return addResults(index, nullptr, 0, totalCount);
return addResults(index, new QVector<T>(*results), results->count(), totalCount);
return addResults(index, new QList<T>(*results), results->count(), totalCount);
}
int addCanceledResult(int index)
@ -192,7 +190,7 @@ public:
template <typename T>
int addCanceledResults(int index, int _count)
{
QVector<T> empty;
QList<T> empty;
return addResults(index, &empty, _count);
}
@ -202,7 +200,7 @@ public:
QMap<int, ResultItem>::const_iterator mapIterator = m_results.constBegin();
while (mapIterator != m_results.constEnd()) {
if (mapIterator.value().isVector())
delete reinterpret_cast<const QVector<T> *>(mapIterator.value().result);
delete reinterpret_cast<const QList<T> *>(mapIterator.value().result);
else
delete reinterpret_cast<const T *>(mapIterator.value().result);
++mapIterator;

View File

@ -94,7 +94,7 @@ inline bool operator<(const QPostEvent &first, const QPostEvent &second)
// This class holds the list of posted events.
// The list has to be kept sorted by priority
class QPostEventList : public QVector<QPostEvent>
class QPostEventList : public QList<QPostEvent>
{
public:
// recursion == recursion count for sendPostedEvents()
@ -107,9 +107,7 @@ public:
QMutex mutex;
inline QPostEventList()
: QVector<QPostEvent>(), recursion(0), startOffset(0), insertionOffset(0)
{ }
inline QPostEventList() : QList<QPostEvent>(), recursion(0), startOffset(0), insertionOffset(0) { }
void addEvent(const QPostEvent &ev) {
int priority = ev.priority;
@ -129,8 +127,8 @@ public:
}
private:
//hides because they do not keep that list sorted. addEvent must be used
using QVector<QPostEvent>::append;
using QVector<QPostEvent>::insert;
using QList<QPostEvent>::append;
using QList<QPostEvent>::insert;
};
#if QT_CONFIG(thread)
@ -292,7 +290,7 @@ public:
QAtomicPointer<QThread> thread;
QAtomicPointer<void> threadId;
QAtomicPointer<QAbstractEventDispatcher> eventDispatcher;
QVector<void *> tls;
QList<void *> tls;
FlaggedDebugSignatures flaggedSignatures;
bool quitNow;

View File

@ -174,7 +174,7 @@ public:
QSet<QThreadPoolThread *> allThreads;
QQueue<QThreadPoolThread *> waitingThreads;
QQueue<QThreadPoolThread *> expiredThreads;
QVector<QueuePage*> queue;
QList<QueuePage *> queue;
QWaitCondition noActiveThreads;
int expiryTimeout = 30000;

View File

@ -54,15 +54,15 @@
#include <QtCore/private/qglobal_p.h>
#include "qplatformdefs.h"
#include "QtCore/qatomic.h"
#include "QtCore/qdatetime.h"
#include "QtCore/qstringlist.h"
#include "QtCore/qlocale.h"
#include "QtCore/qcalendar.h"
#include "QtCore/qcoreapplication.h"
#include "QtCore/qdatetime.h"
#include "QtCore/qlist.h"
#include "QtCore/qlocale.h"
#include "QtCore/qstringlist.h"
#ifndef QT_BOOTSTRAPPED
# include "QtCore/qvariant.h"
#endif
#include "QtCore/qvector.h"
#include "QtCore/qcoreapplication.h"
QT_REQUIRE_CONFIG(datetimeparser);
@ -291,7 +291,7 @@ protected: // for the benefit of QDateTimeEditPrivate
*/
mutable int cachedDay;
mutable QString text;
QVector<SectionNode> sectionNodes;
QList<SectionNode> sectionNodes;
SectionNode first, last, none, popup;
QStringList separators;
QString displayFormat;

View File

@ -87,7 +87,7 @@ public:
int standardTimeOffset;
int daylightTimeOffset;
};
typedef QVector<OffsetData> OffsetDataList;
typedef QList<OffsetData> OffsetDataList;
QTimeZone() noexcept;
explicit QTimeZone(const QByteArray &ianaId);

View File

@ -52,9 +52,9 @@
// We mean it.
//
#include "qlist.h"
#include "qtimezone.h"
#include "private/qlocale_p.h"
#include "qvector.h"
#if QT_CONFIG(icu)
#include <unicode/ucal.h>
@ -85,7 +85,7 @@ public:
int standardTimeOffset;
int daylightTimeOffset;
};
typedef QVector<Data> DataList;
typedef QList<Data> DataList;
// Create null time zone
QTimeZonePrivate();
@ -294,8 +294,8 @@ Q_DECL_CONSTEXPR inline bool operator!=(const QTzTransitionRule &lhs, const QTzT
// cached, avoiding the need to re-parse them from disk constantly.
struct QTzTimeZoneCacheEntry
{
QVector<QTzTransitionTime> m_tranTimes;
QVector<QTzTransitionRule> m_tranRules;
QList<QTzTransitionTime> m_tranTimes;
QList<QTzTransitionRule> m_tranRules;
QList<QByteArray> m_abbreviations;
QByteArray m_posixRule;
};
@ -344,14 +344,14 @@ public:
private:
void init(const QByteArray &ianaId);
QVector<QTimeZonePrivate::Data> getPosixTransitions(qint64 msNear) const;
QList<QTimeZonePrivate::Data> getPosixTransitions(qint64 msNear) const;
Data dataForTzTransition(QTzTransitionTime tran) const;
#if QT_CONFIG(icu)
mutable QSharedDataPointer<QTimeZonePrivate> m_icu;
#endif
QTzTimeZoneCacheEntry cached_data;
QVector<QTzTransitionTime> tranCache() const { return cached_data.m_tranTimes; }
QList<QTzTransitionTime> tranCache() const { return cached_data.m_tranTimes; }
};
#endif // Q_OS_UNIX

View File

@ -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;
}

View File

@ -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);

View File

@ -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>;

View File

@ -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
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() == 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
QList<T> values() const { return QList<T>(begin(), end()); }
QList<T> values(const Key &key) const
{
return QVector<T>(begin(), end());
}
QVector<T> values(const Key &key) const
{
QVector<T> values;
QList<T> values;
if (d) {
Node *n = d->findNode(key);
if (n) {

View File

@ -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;
};

View File

@ -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;

View File

@ -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; }

View File

@ -460,7 +460,7 @@ void tst_QObject::connectSlotsByName()
sender.setObjectName("Sender");
QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: No matching signal for on_child_signal()");
QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: Connecting slot on_Sender_signalManyParams() with the first of the following compatible signals: QVector(\"signalManyParams(int,int,int,QString,bool)\", \"signalManyParams(int,int,int,QString,bool,bool)\")");
QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: Connecting slot on_Sender_signalManyParams() with the first of the following compatible signals: QList(\"signalManyParams(int,int,int,QString,bool)\", \"signalManyParams(int,int,int,QString,bool,bool)\")");
QMetaObject::connectSlotsByName(&receiver);
receiver.called_slots.clear();