diff options
Diffstat (limited to 'src/corelib/text/qstringlist.h')
-rw-r--r-- | src/corelib/text/qstringlist.h | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/src/corelib/text/qstringlist.h b/src/corelib/text/qstringlist.h index b94671746b..9c4daedd4b 100644 --- a/src/corelib/text/qstringlist.h +++ b/src/corelib/text/qstringlist.h @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include <QtCore/qvector.h> +#include <QtCore/qlist.h> #ifndef QSTRINGLIST_H #define QSTRINGLIST_H @@ -53,21 +53,21 @@ QT_BEGIN_NAMESPACE class QRegularExpression; #if !defined(QT_NO_JAVA_STYLE_ITERATORS) -typedef QVectorIterator<QString> QStringListIterator; -typedef QMutableVectorIterator<QString> QMutableStringListIterator; +using QStringListIterator = QListIterator<QString>; +using QMutableStringListIterator = QMutableListIterator<QString>; #endif class QStringList; #ifdef Q_QDOC -class QStringList : public QVector<QString> +class QStringList : public QList<QString> #else -template <> struct QVectorSpecialMethods<QString> +template <> struct QListSpecialMethods<QString> #endif { #ifndef Q_QDOC protected: - ~QVectorSpecialMethods() = default; + ~QListSpecialMethods() = default; #endif public: inline void sort(Qt::CaseSensitivity cs = Qt::CaseSensitive); @@ -101,23 +101,23 @@ private: }; // ### Qt6: check if there's a better way -class QStringList : public QVector<QString> +class QStringList : public QList<QString> { #endif public: inline QStringList() noexcept { } inline explicit QStringList(const QString &i) { append(i); } - inline QStringList(const QVector<QString> &l) : QVector<QString>(l) { } - inline QStringList(QVector<QString> &&l) noexcept : QVector<QString>(std::move(l)) { } - inline QStringList(std::initializer_list<QString> args) : QVector<QString>(args) { } + inline QStringList(const QList<QString> &l) : QList<QString>(l) { } + inline QStringList(QList<QString> &&l) noexcept : QList<QString>(std::move(l)) { } + inline QStringList(std::initializer_list<QString> args) : QList<QString>(args) { } template <typename InputIterator, QtPrivate::IfIsInputIterator<InputIterator> = true> inline QStringList(InputIterator first, InputIterator last) - : QVector<QString>(first, last) { } + : QList<QString>(first, last) { } - QStringList &operator=(const QVector<QString> &other) - { QVector<QString>::operator=(other); return *this; } - QStringList &operator=(QVector<QString> &&other) noexcept - { QVector<QString>::operator=(std::move(other)); return *this; } + QStringList &operator=(const QList<QString> &other) + { QList<QString>::operator=(other); return *this; } + QStringList &operator=(QList<QString> &&other) noexcept + { QList<QString>::operator=(std::move(other)); return *this; } #if QT_STRINGVIEW_LEVEL < 2 inline bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; @@ -131,7 +131,7 @@ public: { append(str); return *this; } inline QStringList &operator<<(const QStringList &l) { *this += l; return *this; } - inline QStringList &operator<<(const QVector<QString> &l) + inline QStringList &operator<<(const QList<QString> &l) { *this += l; return *this; } inline int indexOf(QStringView str, int from = 0) const; @@ -145,16 +145,16 @@ public: inline int lastIndexOf(const QRegularExpression &re, int from = -1) const; #endif // QT_CONFIG(regularexpression) - using QVector<QString>::indexOf; - using QVector<QString>::lastIndexOf; + using QList<QString>::indexOf; + using QList<QString>::lastIndexOf; }; Q_DECLARE_TYPEINFO(QStringList, Q_MOVABLE_TYPE); #ifndef Q_QDOC -inline QStringList *QVectorSpecialMethods<QString>::self() +inline QStringList *QListSpecialMethods<QString>::self() { return static_cast<QStringList *>(this); } -inline const QStringList *QVectorSpecialMethods<QString>::self() const +inline const QStringList *QListSpecialMethods<QString>::self() const { return static_cast<const QStringList *>(this); } namespace QtPrivate { @@ -190,45 +190,45 @@ namespace QtPrivate { #endif // QT_CONFIG(regularexpression) } -inline void QVectorSpecialMethods<QString>::sort(Qt::CaseSensitivity cs) +inline void QListSpecialMethods<QString>::sort(Qt::CaseSensitivity cs) { QtPrivate::QStringList_sort(self(), cs); } -inline int QVectorSpecialMethods<QString>::removeDuplicates() +inline int QListSpecialMethods<QString>::removeDuplicates() { return QtPrivate::QStringList_removeDuplicates(self()); } #if QT_STRINGVIEW_LEVEL < 2 -inline QString QVectorSpecialMethods<QString>::join(const QString &sep) const +inline QString QListSpecialMethods<QString>::join(const QString &sep) const { return QtPrivate::QStringList_join(self(), sep.constData(), sep.length()); } #endif -inline QString QVectorSpecialMethods<QString>::join(QStringView sep) const +inline QString QListSpecialMethods<QString>::join(QStringView sep) const { return QtPrivate::QStringList_join(self(), sep); } -QString QVectorSpecialMethods<QString>::join(QLatin1String sep) const +QString QListSpecialMethods<QString>::join(QLatin1String sep) const { return QtPrivate::QStringList_join(*self(), sep); } -inline QString QVectorSpecialMethods<QString>::join(QChar sep) const +inline QString QListSpecialMethods<QString>::join(QChar sep) const { return QtPrivate::QStringList_join(self(), &sep, 1); } -inline QStringList QVectorSpecialMethods<QString>::filter(QStringView str, Qt::CaseSensitivity cs) const +inline QStringList QListSpecialMethods<QString>::filter(QStringView str, Qt::CaseSensitivity cs) const { return QtPrivate::QStringList_filter(self(), str, cs); } #if QT_STRINGVIEW_LEVEL < 2 -inline QStringList QVectorSpecialMethods<QString>::filter(const QString &str, Qt::CaseSensitivity cs) const +inline QStringList QListSpecialMethods<QString>::filter(const QString &str, Qt::CaseSensitivity cs) const { return QtPrivate::QStringList_filter(self(), str, cs); } @@ -251,33 +251,33 @@ inline bool QStringList::contains(QStringView str, Qt::CaseSensitivity cs) const return QtPrivate::QStringList_contains(this, str, cs); } -inline QStringList &QVectorSpecialMethods<QString>::replaceInStrings(QStringView before, QStringView after, Qt::CaseSensitivity cs) +inline QStringList &QListSpecialMethods<QString>::replaceInStrings(QStringView before, QStringView after, Qt::CaseSensitivity cs) { QtPrivate::QStringList_replaceInStrings(self(), before, after, cs); return *self(); } #if QT_STRINGVIEW_LEVEL < 2 -inline QStringList &QVectorSpecialMethods<QString>::replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs) +inline QStringList &QListSpecialMethods<QString>::replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs) { QtPrivate::QStringList_replaceInStrings(self(), before, after, cs); return *self(); } -inline QStringList &QVectorSpecialMethods<QString>::replaceInStrings(QStringView before, const QString &after, Qt::CaseSensitivity cs) +inline QStringList &QListSpecialMethods<QString>::replaceInStrings(QStringView before, const QString &after, Qt::CaseSensitivity cs) { QtPrivate::QStringList_replaceInStrings(self(), before, qToStringViewIgnoringNull(after), cs); return *self(); } -inline QStringList &QVectorSpecialMethods<QString>::replaceInStrings(const QString &before, QStringView after, Qt::CaseSensitivity cs) +inline QStringList &QListSpecialMethods<QString>::replaceInStrings(const QString &before, QStringView after, Qt::CaseSensitivity cs) { QtPrivate::QStringList_replaceInStrings(self(), QStringView(before), after, cs); return *self(); } #endif -inline QStringList operator+(const QVector<QString> &one, const QStringList &other) +inline QStringList operator+(const QList<QString> &one, const QStringList &other) { QStringList n = one; n += other; @@ -305,13 +305,13 @@ inline int QStringList::lastIndexOf(QLatin1String string, int from) const } #if QT_CONFIG(regularexpression) -inline QStringList &QVectorSpecialMethods<QString>::replaceInStrings(const QRegularExpression &rx, const QString &after) +inline QStringList &QListSpecialMethods<QString>::replaceInStrings(const QRegularExpression &rx, const QString &after) { QtPrivate::QStringList_replaceInStrings(self(), rx, after); return *self(); } -inline QStringList QVectorSpecialMethods<QString>::filter(const QRegularExpression &rx) const +inline QStringList QListSpecialMethods<QString>::filter(const QRegularExpression &rx) const { return QtPrivate::QStringList_filter(self(), rx); } |