OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
naturalsort.cpp File Reference
#include "naturalsort.hpp"
Include dependency graph for naturalsort.cpp:

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)
 

Function Documentation

static QChar getNextChar ( const QString &  s,
int  location 
)
inlinestatic

Here is the caller graph for this function:

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)

Here is the call graph for this function:

Here is the caller graph for this function:

bool naturalSortGreaterThanCI ( const QString &  left,
const QString &  right 
)

Here is the call graph for this function:

bool naturalSortGreaterThanCS ( const QString &  left,
const QString &  right 
)

Here is the call graph for this function:

bool naturalSortLessThanCI ( const QString &  left,
const QString &  right 
)

Here is the call graph for this function:

bool naturalSortLessThanCS ( const QString &  left,
const QString &  right 
)

Here is the call graph for this function: