⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qstringlist.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    \printuntil }    \sa contains()*/QStringList QtPrivate::QStringList_filter(const QStringList *that, const QString &str,                                          Qt::CaseSensitivity cs){    QStringMatcher matcher(str, cs);    QStringList res;    for (int i = 0; i < that->size(); ++i)        if (matcher.indexIn(that->at(i)) != -1)            res << that->at(i);    return res;}/*!    \fn QBool QStringList::contains(const QString &str, Qt::CaseSensitivity cs) const    Returns true if the list contains the string \a str; otherwise    returns false. The search is case insensitive if \a cs is    Qt::CaseInsensitive; the search is case sensitive by default.    \sa indexOf(), lastIndexOf(), QString::contains() */QBool QtPrivate::QStringList_contains(const QStringList *that, const QString &str,                                      Qt::CaseSensitivity cs){    QStringMatcher matcher(str, cs);    for (int i = 0; i < that->size(); ++i) {        QString string(that->at(i));        if (string.length() == str.length() && matcher.indexIn(string) == 0)            return QBool(true);    }    return QBool(false);}#ifndef QT_NO_REGEXP/*!    \fn QStringList QStringList::filter(const QRegExp &rx) const    \overload    Returns a list of all the strings that match the regular    expression \a rx.*/QStringList QtPrivate::QStringList_filter(const QStringList *that, const QRegExp &rx){    QStringList res;    for (int i = 0; i < that->size(); ++i)        if (that->at(i).contains(rx))            res << that->at(i);    return res;}#endif/*!    \fn QStringList &QStringList::replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs)    Returns a string list where every string has had the \a before    text replaced with the \a after text wherever the \a before text    is found. The \a before text is matched case-sensitively or not    depending on the \a cs flag.    For example:    \quotefromfile snippets/qstringlist/main.cpp    \skipto QStringList list;    \printline QStringList list;    \skipto list << "alpha"    \printuntil  // list    \sa QString::replace()*/void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QString &before,                                             const QString &after, Qt::CaseSensitivity cs){    for (int i = 0; i < that->size(); ++i)        (*that)[i].replace(before, after, cs);}#ifndef QT_NO_REGEXP/*!    \fn QStringList &QStringList::replaceInStrings(const QRegExp &rx, const QString &after)    \overload    Replaces every occurrence of the regexp \a rx, in each of the    string lists's strings, with \a after. Returns a reference to the    string list.    For example:    \quotefromfile snippets/qstringlist/main.cpp    \skipto QStringList list;    \printline QStringList list;    \skipto list << "alpha"    \skipto list.clear()    \skipto list << "alpha"    \printuntil  // list    For regular expressions that contain \l{capturing parentheses},    occurrences of \bold{\\1}, \bold{\\2}, ..., in \a after are    replaced with \a{rx}.cap(1), \a{rx}.cap(2), ...    For example:    \quotefromfile snippets/qstringlist/main.cpp    \skipto QStringList list;    \printline QStringList list;    \skipto list << "Bill Clinton" << "Murray, Bill"    \printuntil  // list*/void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegExp &rx, const QString &after){    for (int i = 0; i < that->size(); ++i)        (*that)[i].replace(rx, after);}#endif/*!    \fn QString QStringList::join(const QString &separator) const    Joins all the string list's strings into a single string with each    element separated by the the given \a separator (which can be an    empty string).    \sa QString::split()*/QString QtPrivate::QStringList_join(const QStringList *that, const QString &sep){    QString res;    for (int i = 0; i < that->size(); ++i) {        if (i)            res += sep;        res += that->at(i);    }    return res;}/*!    \fn QStringList QStringList::operator+(const QStringList &other) const    Returns a string list that is the concatenation of this string    list with the \a other string list.    \sa append()*//*!    \fn QStringList &QStringList::operator<<(const QString &str)    Appends the given string, \a str, to this string list and returns    a reference to the string list.    \sa append()*//*!    \fn QStringList &QStringList::operator<<(const QStringList &other)    \overload    Appends the \a other string list to the string list and returns a reference to    the latter string list.*/#ifndef QT_NO_DATASTREAM/*!    \fn QDataStream &operator>>(QDataStream &in, QStringList &list)    \relates QStringList    Reads a string list from the given \a in stream into the specified    \a list.    \sa {Format of the QDataStream Operators}*//*!    \fn QDataStream &operator<<(QDataStream &out, const QStringList &list)    \relates QStringList    Writes the given string \a list to the specified \a out stream.    \sa {Format of the QDataStream Operators}*/#endif // QT_NO_DATASTREAM/*!    \fn QStringList QStringList::grep(const QString &str, bool cs = true) const    Use filter() instead.*//*!    \fn QStringList QStringList::grep(const QRegExp &rx) const    Use filter() instead.*//*!    \fn QStringList &QStringList::gres(const QString &before, const QString &after, bool cs = true)    Use replaceInStrings() instead.*//*!    \fn QStringList &QStringList::gres(const QRegExp &rx, const QString &after)    Use replaceInStrings() instead.*//*!    \fn Iterator QStringList::fromLast()    Use end() instead.    \oldcode    QStringList::Iterator i = list.fromLast();    \newcode    QStringList::Iterator i = list.isEmpty() ? list.end() : --list.end();    \endcode*//*!    \fn ConstIterator QStringList::fromLast() const    Use end() instead.    \oldcode    QStringList::ConstIterator i = list.fromLast();    \newcode    QStringList::ConstIterator i = list.isEmpty() ? list.end() : --list.end();    \endcode*/#ifndef QT_NO_REGEXP/*!    \fn int QStringList::indexOf(const QRegExp &rx, int from) const    Returns the index position of the first exact match of \a rx in    the list, searching forward from index position \a from. Returns    -1 if no item matched.    \sa lastIndexOf(), contains(), QRegExp::exactMatch()*/int QtPrivate::QStringList_indexOf(const QStringList *that, const QRegExp &rx, int from){   if (from < 0)       from = qMax(from + that->size(), 0);   for (int i = from; i < that->size(); ++i) {        if (rx.exactMatch(that->at(i)))            return i;    }    return -1;}/*!    \fn int QStringList::lastIndexOf(const QRegExp &rx, int from) const    Returns the index position of the last exact match of \a rx in    the list, searching backward from index position \a from. If \a    from is -1 (the default), the search starts at the last item.    Returns -1 if no item matched.    \sa indexOf(), contains(), QRegExp::exactMatch()*/int QtPrivate::QStringList_lastIndexOf(const QStringList *that, const QRegExp &rx, int from){    if (from < 0)        from += that->size();    else if (from >= that->size())        from = that->size() - 1;    for (int i = from; i >= 0; --i) {        if (rx.exactMatch(that->at(i)))            return i;        }    return -1;}#endif/*!    \fn int QStringList::indexOf(const QString &value, int from = 0) const    Returns the index position of the first occurrence of \a value in    the list, searching forward from index position \a from. Returns    -1 if no item matched.    \sa lastIndexOf(), contains(), QList::indexOf()*//*!    \fn int QStringList::lastIndexOf(const QString &value, int from = -1) const    Returns the index position of the last occurrence of \a value in    the list, searching backward from index position \a from. If \a    from is -1 (the default), the search starts at the last item.    Returns -1 if no item matched.    \sa indexOf(), QList::lastIndexOf()*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -