OpenMW
|
#include "naturalsort.hpp"
Functions | |
static QChar | getNextChar (const QString &s, int location) |
int | naturalCompare (const QString &s1, const QString &s2, Qt::CaseSensitivity cs) |
bool | naturalSortLessThanCS (const QString &left, const QString &right) |
bool | naturalSortLessThanCI (const QString &left, const QString &right) |
bool | naturalSortGreaterThanCS (const QString &left, const QString &right) |
bool | naturalSortGreaterThanCI (const QString &left, const QString &right) |
static QChar getNextChar | ( | const QString & | s, |
int | location | ||
) | [inline, static] |
int naturalCompare | ( | const QString & | s1, |
const QString & | s2, | ||
Qt::CaseSensitivity | cs | ||
) |
Natural number sort, skips spaces.
Examples: 1, 2, 10, 55, 100 01.jpg, 2.jpg, 10.jpg
Note on the algorithm: Only as many characters as necessary are looked at and at most they all are looked at once.
Slower then QString::compare() (of course)
bool naturalSortGreaterThanCI | ( | const QString & | left, |
const QString & | right | ||
) |
bool naturalSortGreaterThanCS | ( | const QString & | left, |
const QString & | right | ||
) |
bool naturalSortLessThanCI | ( | const QString & | left, |
const QString & | right | ||
) |
bool naturalSortLessThanCS | ( | const QString & | left, |
const QString & | right | ||
) |