Files
yacreader/common/qnaturalsorting.h
luisangelsm 3709b6e737
Some checks failed
Build / Initialization (push) Has been cancelled
Build / Code Format Validation (push) Has been cancelled
Build / Linux (Qt6) (push) Has been cancelled
Build / Linux (Qt6 + 7zip) (push) Has been cancelled
Build / macOS (Qt6 Universal) (push) Has been cancelled
Build / Windows x64 (Qt6) (push) Has been cancelled
Build / Windows ARM64 (Qt6) (push) Has been cancelled
Build / Docker amd64 Image (push) Has been cancelled
Build / Docker arm64 Image (push) Has been cancelled
Build / Publish Dev Builds (push) Has been cancelled
Build / Publish Release (push) Has been cancelled
Build / Publish YACReader10 Pre-release Builds (push) Has been cancelled
Format includes using clang-format
2026-03-13 18:21:38 +01:00

29 lines
946 B
C

#ifndef __QNATURALSORTING_H
#define __QNATURALSORTING_H
#include "library_item.h"
#include <QFileInfo>
#include <QString>
int naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity caseSensitivity);
bool naturalSortLessThanCS(const QString &left, const QString &right);
bool naturalSortLessThanCI(const QString &left, const QString &right);
bool naturalSortLessThanCIFileInfo(const QFileInfo &left, const QFileInfo &right);
bool naturalSortLessThanCILibraryItem(LibraryItem *left, LibraryItem *right);
/* TODO, update to use the issue number once the iOS client supports it
* see DBHelper::getFolderComicsFromLibraryForReading
* NOTE, use this only in the server side for now, this way of sorting just matchs what's used in the iOS client
**/
struct LibraryItemSorter {
bool operator()(const LibraryItem *a, const LibraryItem *b) const
{
return naturalSortLessThanCI(a->name, b->name);
}
};
#endif