Qt 4.8
Functions
qstringlist.cpp File Reference
#include <qstringlist.h>
#include <qset.h>

Go to the source code of this file.

Functions

static int indexOfMutating (const QStringList *that, QRegExp &rx, int from)
 
static int lastIndexOfMutating (const QStringList *that, QRegExp &rx, int from)
 

Function Documentation

◆ indexOfMutating()

static int indexOfMutating ( const QStringList that,
QRegExp rx,
int  from 
)
static

Definition at line 607 of file qstringlist.cpp.

Referenced by QtPrivate::QStringList_indexOf().

608 {
609  if (from < 0)
610  from = qMax(from + that->size(), 0);
611  for (int i = from; i < that->size(); ++i) {
612  if (rx.exactMatch(that->at(i)))
613  return i;
614  }
615  return -1;
616 }
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
bool exactMatch(const QString &str) const
Returns true if str is matched exactly by this regular expression; otherwise returns false...
Definition: qregexp.cpp:4094

◆ lastIndexOfMutating()

static int lastIndexOfMutating ( const QStringList that,
QRegExp rx,
int  from 
)
static

Definition at line 618 of file qstringlist.cpp.

Referenced by QtPrivate::QStringList_lastIndexOf().

619 {
620  if (from < 0)
621  from += that->size();
622  else if (from >= that->size())
623  from = that->size() - 1;
624  for (int i = from; i >= 0; --i) {
625  if (rx.exactMatch(that->at(i)))
626  return i;
627  }
628  return -1;
629 }
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
bool exactMatch(const QString &str) const
Returns true if str is matched exactly by this regular expression; otherwise returns false...
Definition: qregexp.cpp:4094