LCOV - code coverage report
Current view: top level - usr/include/x86_64-linux-gnu/qt5/QtCore - qstringlist.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 5 12 41.7 %
Date: 2016-11-29 15:07:43 Functions: 4 10 40.0 %

          Line data    Source code
       1             : /****************************************************************************
       2             : **
       3             : ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
       4             : ** Contact: http://www.qt-project.org/legal
       5             : **
       6             : ** This file is part of the QtCore module of the Qt Toolkit.
       7             : **
       8             : ** $QT_BEGIN_LICENSE:LGPL$
       9             : ** Commercial License Usage
      10             : ** Licensees holding valid commercial Qt licenses may use this file in
      11             : ** accordance with the commercial license agreement provided with the
      12             : ** Software or, alternatively, in accordance with the terms contained in
      13             : ** a written agreement between you and Digia.  For licensing terms and
      14             : ** conditions see http://qt.digia.com/licensing.  For further information
      15             : ** use the contact form at http://qt.digia.com/contact-us.
      16             : **
      17             : ** GNU Lesser General Public License Usage
      18             : ** Alternatively, this file may be used under the terms of the GNU Lesser
      19             : ** General Public License version 2.1 as published by the Free Software
      20             : ** Foundation and appearing in the file LICENSE.LGPL included in the
      21             : ** packaging of this file.  Please review the following information to
      22             : ** ensure the GNU Lesser General Public License version 2.1 requirements
      23             : ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
      24             : **
      25             : ** In addition, as a special exception, Digia gives you certain additional
      26             : ** rights.  These rights are described in the Digia Qt LGPL Exception
      27             : ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
      28             : **
      29             : ** GNU General Public License Usage
      30             : ** Alternatively, this file may be used under the terms of the GNU
      31             : ** General Public License version 3.0 as published by the Free Software
      32             : ** Foundation and appearing in the file LICENSE.GPL included in the
      33             : ** packaging of this file.  Please review the following information to
      34             : ** ensure the GNU General Public License version 3.0 requirements will be
      35             : ** met: http://www.gnu.org/copyleft/gpl.html.
      36             : **
      37             : **
      38             : ** $QT_END_LICENSE$
      39             : **
      40             : ****************************************************************************/
      41             : 
      42             : #ifndef QSTRINGLIST_H
      43             : #define QSTRINGLIST_H
      44             : 
      45             : #include <QtCore/qalgorithms.h>
      46             : #include <QtCore/qdatastream.h>
      47             : #include <QtCore/qlist.h>
      48             : #include <QtCore/qregexp.h>
      49             : #include <QtCore/qstring.h>
      50             : #include <QtCore/qstringmatcher.h>
      51             : 
      52             : QT_BEGIN_NAMESPACE
      53             : 
      54             : 
      55             : class QRegExp;
      56             : class QRegularExpression;
      57             : 
      58             : typedef QListIterator<QString> QStringListIterator;
      59             : typedef QMutableListIterator<QString> QMutableStringListIterator;
      60             : 
      61          57 : class QStringList : public QList<QString>
      62             : {
      63             : public:
      64          21 :     inline QStringList() { }
      65           0 :     inline explicit QStringList(const QString &i) { append(i); }
      66          36 :     inline QStringList(const QStringList &l) : QList<QString>(l) { }
      67           0 :     inline QStringList(const QList<QString> &l) : QList<QString>(l) { }
      68             : #ifdef Q_COMPILER_INITIALIZER_LISTS
      69           0 :     inline QStringList(std::initializer_list<QString> args) : QList<QString>(args) { }
      70             : #endif
      71             : 
      72             :     inline void sort(Qt::CaseSensitivity cs = Qt::CaseSensitive);
      73             :     inline int removeDuplicates();
      74             : 
      75             :     inline QString join(const QString &sep) const;
      76             :     inline QString join(QChar sep) const;
      77             : 
      78             :     inline QStringList filter(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
      79             :     inline bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
      80             : 
      81             :     inline QStringList &replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
      82             : 
      83             :     inline QStringList operator+(const QStringList &other) const
      84             :     { QStringList n = *this; n += other; return n; }
      85          28 :     inline QStringList &operator<<(const QString &str)
      86          28 :     { append(str); return *this; }
      87             :     inline QStringList &operator<<(const QStringList &l)
      88             :     { *this += l; return *this; }
      89             : 
      90             : #ifndef QT_NO_REGEXP
      91             :     inline QStringList filter(const QRegExp &rx) const;
      92             :     inline QStringList &replaceInStrings(const QRegExp &rx, const QString &after);
      93             :     inline int indexOf(const QRegExp &rx, int from = 0) const;
      94             :     inline int lastIndexOf(const QRegExp &rx, int from = -1) const;
      95             :     inline int indexOf(QRegExp &rx, int from = 0) const;
      96             :     inline int lastIndexOf(QRegExp &rx, int from = -1) const;
      97             : #endif
      98             : 
      99             : #ifndef QT_BOOTSTRAPPED
     100             : #ifndef QT_NO_REGULAREXPRESSION
     101             :     inline QStringList filter(const QRegularExpression &re) const;
     102             :     inline QStringList &replaceInStrings(const QRegularExpression &re, const QString &after);
     103             :     inline int indexOf(const QRegularExpression &re, int from = 0) const;
     104             :     inline int lastIndexOf(const QRegularExpression &re, int from = -1) const;
     105             : #endif // QT_NO_REGULAREXPRESSION
     106             : #endif // QT_BOOTSTRAPPED
     107             : 
     108             : #if !defined(Q_NO_USING_KEYWORD)
     109             :     using QList<QString>::indexOf;
     110             :     using QList<QString>::lastIndexOf;
     111             : #else
     112             :     inline int indexOf(const QString &str, int from = 0) const
     113             :     { return QList<QString>::indexOf(str, from); }
     114             :     inline int lastIndexOf(const QString &str, int from = -1) const
     115             :     { return QList<QString>::lastIndexOf(str, from); }
     116             : #endif
     117             : };
     118             : 
     119             : Q_DECLARE_TYPEINFO(QStringList, Q_MOVABLE_TYPE);
     120             : 
     121             : namespace QtPrivate {
     122             :     void Q_CORE_EXPORT QStringList_sort(QStringList *that, Qt::CaseSensitivity cs);
     123             :     int Q_CORE_EXPORT QStringList_removeDuplicates(QStringList *that);
     124             :     QString Q_CORE_EXPORT QStringList_join(const QStringList *that, const QChar *sep, int seplen);
     125             :     QStringList Q_CORE_EXPORT QStringList_filter(const QStringList *that, const QString &str,
     126             :                                                Qt::CaseSensitivity cs);
     127             : 
     128             :     bool Q_CORE_EXPORT QStringList_contains(const QStringList *that, const QString &str, Qt::CaseSensitivity cs);
     129             :     void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, const QString &before, const QString &after,
     130             :                                       Qt::CaseSensitivity cs);
     131             : 
     132             : #ifndef QT_NO_REGEXP
     133             :     void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, const QRegExp &rx, const QString &after);
     134             :     QStringList Q_CORE_EXPORT QStringList_filter(const QStringList *that, const QRegExp &re);
     135             :     int Q_CORE_EXPORT QStringList_indexOf(const QStringList *that, const QRegExp &rx, int from);
     136             :     int Q_CORE_EXPORT QStringList_lastIndexOf(const QStringList *that, const QRegExp &rx, int from);
     137             :     int Q_CORE_EXPORT QStringList_indexOf(const QStringList *that, QRegExp &rx, int from);
     138             :     int Q_CORE_EXPORT QStringList_lastIndexOf(const QStringList *that, QRegExp &rx, int from);
     139             : #endif
     140             : 
     141             : #ifndef QT_BOOTSTRAPPED
     142             : #ifndef QT_NO_REGULAREXPRESSION
     143             :     void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, const QRegularExpression &rx, const QString &after);
     144             :     QStringList Q_CORE_EXPORT QStringList_filter(const QStringList *that, const QRegularExpression &re);
     145             :     int Q_CORE_EXPORT QStringList_indexOf(const QStringList *that, const QRegularExpression &re, int from);
     146             :     int Q_CORE_EXPORT QStringList_lastIndexOf(const QStringList *that, const QRegularExpression &re, int from);
     147             : #endif // QT_NO_REGULAREXPRESSION
     148             : #endif // QT_BOOTSTRAPPED
     149             : }
     150             : 
     151             : inline void QStringList::sort(Qt::CaseSensitivity cs)
     152             : {
     153             :     QtPrivate::QStringList_sort(this, cs);
     154             : }
     155             : 
     156             : inline int QStringList::removeDuplicates()
     157             : {
     158             :     return QtPrivate::QStringList_removeDuplicates(this);
     159             : }
     160             : 
     161           0 : inline QString QStringList::join(const QString &sep) const
     162             : {
     163           0 :     return QtPrivate::QStringList_join(this, sep.constData(), sep.length());
     164             : }
     165             : 
     166             : inline QString QStringList::join(QChar sep) const
     167             : {
     168             :     return QtPrivate::QStringList_join(this, &sep, 1);
     169             : }
     170             : 
     171             : inline QStringList QStringList::filter(const QString &str, Qt::CaseSensitivity cs) const
     172             : {
     173             :     return QtPrivate::QStringList_filter(this, str, cs);
     174             : }
     175             : 
     176           0 : inline bool QStringList::contains(const QString &str, Qt::CaseSensitivity cs) const
     177             : {
     178           0 :     return QtPrivate::QStringList_contains(this, str, cs);
     179             : }
     180             : 
     181             : inline QStringList &QStringList::replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs)
     182             : {
     183             :     QtPrivate::QStringList_replaceInStrings(this, before, after, cs);
     184             :     return *this;
     185             : }
     186             : 
     187             : #ifndef QT_NO_REGEXP
     188             : inline QStringList &QStringList::replaceInStrings(const QRegExp &rx, const QString &after)
     189             : {
     190             :     QtPrivate::QStringList_replaceInStrings(this, rx, after);
     191             :     return *this;
     192             : }
     193             : 
     194             : inline QStringList QStringList::filter(const QRegExp &rx) const
     195             : {
     196             :     return QtPrivate::QStringList_filter(this, rx);
     197             : }
     198             : 
     199             : inline int QStringList::indexOf(const QRegExp &rx, int from) const
     200             : {
     201             :     return QtPrivate::QStringList_indexOf(this, rx, from);
     202             : }
     203             : 
     204             : inline int QStringList::lastIndexOf(const QRegExp &rx, int from) const
     205             : {
     206             :     return QtPrivate::QStringList_lastIndexOf(this, rx, from);
     207             : }
     208             : 
     209             : inline int QStringList::indexOf(QRegExp &rx, int from) const
     210             : {
     211             :     return QtPrivate::QStringList_indexOf(this, rx, from);
     212             : }
     213             : 
     214             : inline int QStringList::lastIndexOf(QRegExp &rx, int from) const
     215             : {
     216             :     return QtPrivate::QStringList_lastIndexOf(this, rx, from);
     217             : }
     218             : #endif
     219             : 
     220             : #ifndef QT_BOOTSTRAPPED
     221             : #ifndef QT_NO_REGULAREXPRESSION
     222             : inline QStringList &QStringList::replaceInStrings(const QRegularExpression &rx, const QString &after)
     223             : {
     224             :     QtPrivate::QStringList_replaceInStrings(this, rx, after);
     225             :     return *this;
     226             : }
     227             : 
     228             : inline QStringList QStringList::filter(const QRegularExpression &rx) const
     229             : {
     230             :     return QtPrivate::QStringList_filter(this, rx);
     231             : }
     232             : 
     233             : inline int QStringList::indexOf(const QRegularExpression &rx, int from) const
     234             : {
     235             :     return QtPrivate::QStringList_indexOf(this, rx, from);
     236             : }
     237             : 
     238             : inline int QStringList::lastIndexOf(const QRegularExpression &rx, int from) const
     239             : {
     240             :     return QtPrivate::QStringList_lastIndexOf(this, rx, from);
     241             : }
     242             : #endif // QT_NO_REGULAREXPRESSION
     243             : #endif // QT_BOOTSTRAPPED
     244             : 
     245             : #ifndef QT_NO_DATASTREAM
     246             : inline QDataStream &operator>>(QDataStream &in, QStringList &list)
     247             : {
     248             :     return operator>>(in, static_cast<QList<QString> &>(list));
     249             : }
     250             : inline QDataStream &operator<<(QDataStream &out, const QStringList &list)
     251             : {
     252             :     return operator<<(out, static_cast<const QList<QString> &>(list));
     253             : }
     254             : #endif // QT_NO_DATASTREAM
     255             : 
     256             : QT_END_NAMESPACE
     257             : 
     258             : #endif // QSTRINGLIST_H

Generated by: LCOV version 1.11