Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtCore/qstringlist.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (C) 2020 The Qt Company Ltd.
0002 // Copyright (C) 2016 Intel Corporation.
0003 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0004 
0005 #include <QtCore/qlist.h>
0006 
0007 #ifndef QSTRINGLIST_H
0008 #define QSTRINGLIST_H
0009 
0010 #include <QtCore/qalgorithms.h>
0011 #include <QtCore/qcontainertools_impl.h>
0012 #include <QtCore/qstring.h>
0013 #include <QtCore/qstringmatcher.h>
0014 
0015 QT_BEGIN_NAMESPACE
0016 
0017 class QRegularExpression;
0018 
0019 #if !defined(QT_NO_JAVA_STYLE_ITERATORS)
0020 using QStringListIterator = QListIterator<QString>;
0021 using QMutableStringListIterator = QMutableListIterator<QString>;
0022 #endif
0023 
0024 
0025 namespace QtPrivate {
0026     void Q_CORE_EXPORT QStringList_sort(QStringList *that, Qt::CaseSensitivity cs);
0027     qsizetype Q_CORE_EXPORT QStringList_removeDuplicates(QStringList *that);
0028     QString Q_CORE_EXPORT QStringList_join(const QStringList *that, QStringView sep);
0029     QString Q_CORE_EXPORT QStringList_join(const QStringList *that, const QChar *sep, qsizetype seplen);
0030     Q_CORE_EXPORT QString QStringList_join(const QStringList &list, QLatin1StringView sep);
0031     QStringList Q_CORE_EXPORT QStringList_filter(const QStringList *that, QStringView str,
0032                                                Qt::CaseSensitivity cs);
0033     Q_CORE_EXPORT QStringList QStringList_filter(const QStringList &that, QLatin1StringView needle,
0034                                                  Qt::CaseSensitivity cs);
0035     Q_CORE_EXPORT QStringList QStringList_filter(const QStringList &that,
0036                                                  const QStringMatcher &matcher);
0037 
0038     bool Q_CORE_EXPORT QStringList_contains(const QStringList *that, QStringView str, Qt::CaseSensitivity cs);
0039     bool Q_CORE_EXPORT QStringList_contains(const QStringList *that, QLatin1StringView str, Qt::CaseSensitivity cs);
0040     void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, QStringView before, QStringView after,
0041                                       Qt::CaseSensitivity cs);
0042 
0043     qsizetype Q_CORE_EXPORT QStringList_indexOf(const QStringList &that, QStringView str,
0044                                                 qsizetype from, Qt::CaseSensitivity cs);
0045     qsizetype Q_CORE_EXPORT QStringList_indexOf(const QStringList &that, QLatin1StringView str,
0046                                                 qsizetype from, Qt::CaseSensitivity cs);
0047 
0048     Q_CORE_EXPORT qsizetype QStringList_lastIndexOf(const QStringList &that, QStringView str,
0049                                                     qsizetype from, Qt::CaseSensitivity cs);
0050     Q_CORE_EXPORT qsizetype QStringList_lastIndexOf(const QStringList &that, QLatin1StringView str,
0051                                                     qsizetype from, Qt::CaseSensitivity cs);
0052 
0053 #if QT_CONFIG(regularexpression)
0054     void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, const QRegularExpression &rx, const QString &after);
0055     QStringList Q_CORE_EXPORT QStringList_filter(const QStringList *that, const QRegularExpression &re);
0056     qsizetype Q_CORE_EXPORT QStringList_indexOf(const QStringList *that, const QRegularExpression &re, qsizetype from);
0057     qsizetype Q_CORE_EXPORT QStringList_lastIndexOf(const QStringList *that, const QRegularExpression &re, qsizetype from);
0058 #endif // QT_CONFIG(regularexpression)
0059 }
0060 
0061 #ifdef Q_QDOC
0062 class QStringList : public QList<QString>
0063 #else
0064 template <> struct QListSpecialMethods<QString> : QListSpecialMethodsBase<QString>
0065 #endif
0066 {
0067 #ifdef Q_QDOC
0068 public:
0069     using QList<QString>::QList;
0070     QStringList(const QString &str);
0071     QStringList(const QList<QString> &other);
0072     QStringList(QList<QString> &&other);
0073 
0074     QStringList &operator=(const QList<QString> &other);
0075     QStringList &operator=(QList<QString> &&other);
0076     QStringList operator+(const QStringList &other) const;
0077     QStringList &operator<<(const QString &str);
0078     QStringList &operator<<(const QStringList &other);
0079     QStringList &operator<<(const QList<QString> &other);
0080 private:
0081 #endif
0082 
0083 public:
0084     inline void sort(Qt::CaseSensitivity cs = Qt::CaseSensitive)
0085     { QtPrivate::QStringList_sort(self(), cs); }
0086     inline qsizetype removeDuplicates()
0087     { return QtPrivate::QStringList_removeDuplicates(self()); }
0088 
0089     inline QString join(QStringView sep) const
0090     { return QtPrivate::QStringList_join(self(), sep); }
0091     inline QString join(QLatin1StringView sep) const
0092     { return QtPrivate::QStringList_join(*self(), sep); }
0093     inline QString join(QChar sep) const
0094     { return QtPrivate::QStringList_join(self(), &sep, 1); }
0095 
0096     QStringList filter(const QStringMatcher &matcher) const
0097     { return QtPrivate::QStringList_filter(*self(), matcher); }
0098     QStringList filter(QLatin1StringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
0099     { return QtPrivate::QStringList_filter(*self(), needle, cs); }
0100     inline QStringList filter(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
0101     { return QtPrivate::QStringList_filter(self(), str, cs); }
0102     inline QStringList &replaceInStrings(QStringView before, QStringView after, Qt::CaseSensitivity cs = Qt::CaseSensitive)
0103     {
0104         QtPrivate::QStringList_replaceInStrings(self(), before, after, cs);
0105         return *self();
0106     }
0107 
0108     inline QString join(const QString &sep) const
0109     { return QtPrivate::QStringList_join(self(), sep.constData(), sep.size()); }
0110     inline QStringList filter(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
0111     { return QtPrivate::QStringList_filter(self(), str, cs); }
0112     inline QStringList &replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive)
0113     {
0114         QtPrivate::QStringList_replaceInStrings(self(), before, after, cs);
0115         return *self();
0116     }
0117     inline QStringList &replaceInStrings(const QString &before, QStringView after, Qt::CaseSensitivity cs = Qt::CaseSensitive)
0118     {
0119         QtPrivate::QStringList_replaceInStrings(self(), before, after, cs);
0120         return *self();
0121     }
0122     inline QStringList &replaceInStrings(QStringView before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive)
0123     {
0124         QtPrivate::QStringList_replaceInStrings(self(), before, after, cs);
0125         return *self();
0126     }
0127     using QListSpecialMethodsBase<QString>::contains;
0128     using QListSpecialMethodsBase<QString>::indexOf;
0129     using QListSpecialMethodsBase<QString>::lastIndexOf;
0130 
0131     inline bool contains(QLatin1StringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
0132     { return QtPrivate::QStringList_contains(self(), str, cs); }
0133     inline bool contains(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
0134     { return QtPrivate::QStringList_contains(self(), str, cs); }
0135 
0136     inline bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
0137     { return QtPrivate::QStringList_contains(self(), str, cs); }
0138 
0139     qsizetype indexOf(const QString &str, qsizetype from = 0,
0140                       Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
0141     { return indexOf(QStringView(str), from, cs); }
0142     qsizetype indexOf(QStringView needle, qsizetype from = 0,
0143                       Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
0144     { return QtPrivate::QStringList_indexOf(*self(), needle, from, cs); }
0145     qsizetype indexOf(QLatin1StringView needle, qsizetype from = 0,
0146                       Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
0147     { return QtPrivate::QStringList_indexOf(*self(), needle, from, cs); }
0148 
0149     qsizetype lastIndexOf(const QString &str, qsizetype from = -1,
0150                           Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
0151     { return lastIndexOf(QStringView(str), from, cs); }
0152     qsizetype lastIndexOf(QStringView str, qsizetype from = -1,
0153                           Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
0154     { return QtPrivate::QStringList_lastIndexOf(*self(), str, from, cs); }
0155     qsizetype lastIndexOf(QLatin1StringView needle, qsizetype from = -1,
0156                           Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
0157     { return QtPrivate::QStringList_lastIndexOf(*self(), needle, from, cs); }
0158 
0159 #if QT_CONFIG(regularexpression)
0160     inline QStringList filter(const QRegularExpression &re) const
0161     { return QtPrivate::QStringList_filter(self(), re); }
0162     inline QStringList &replaceInStrings(const QRegularExpression &re, const QString &after)
0163     {
0164         QtPrivate::QStringList_replaceInStrings(self(), re, after);
0165         return *self();
0166     }
0167     inline qsizetype indexOf(const QRegularExpression &re, qsizetype from = 0) const
0168     { return QtPrivate::QStringList_indexOf(self(), re, from); }
0169     inline qsizetype lastIndexOf(const QRegularExpression &re, qsizetype from = -1) const
0170     { return QtPrivate::QStringList_lastIndexOf(self(), re, from); }
0171 #endif // QT_CONFIG(regularexpression)
0172 };
0173 
0174 QT_END_NAMESPACE
0175 
0176 #endif // QSTRINGLIST_H