File indexing completed on 2022-10-04 17:30:17

0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 // SPDX-FileCopyrightText: 2010 Dominik Seichter <domseichter@web.de>
0003 
0004 #ifndef KRENAMETOKENSORTER_H
0005 #define KRENAMETOKENSORTER_H
0006 
0007 #include "krenamefile.h"
0008 
0009 #include <QMap>
0010 #include <QString>
0011 
0012 #include <QUrl>
0013 
0014 class BatchRenamer;
0015 class Plugin;
0016 
0017 bool ascendingKRenameFileLessThan(const KRenameFile &file1, const KRenameFile &file2);
0018 bool descendingKRenameFileLessThan(const KRenameFile &file1, const KRenameFile &file2);
0019 bool numericKRenameFileLessThan(const KRenameFile &file1, const KRenameFile &file2);
0020 bool randomKRenameFileLessThan(const KRenameFile &, const KRenameFile &);
0021 
0022 class KRenameTokenSorter
0023 {
0024 public:
0025 
0026     enum ESimpleSortMode {
0027         eSimpleSortMode_Ascending,
0028         eSimpleSortMode_Descending,
0029         eSimpleSortMode_Numeric
0030     };
0031 
0032     KRenameTokenSorter(BatchRenamer *renamer, const QString &token, const KRenameFile::List &list, ESimpleSortMode eSortMode);
0033 
0034     bool operator()(const KRenameFile &file1, const KRenameFile &file2);
0035 
0036 private:
0037     QString processString(int index) const;
0038 
0039 private:
0040     BatchRenamer *m_renamer;
0041     const QString &m_token;
0042     const KRenameFile::List &m_list;
0043     ESimpleSortMode m_eSortMode;
0044     Plugin *m_plugin;
0045     QMap<QUrl, QString> m_values;
0046 };
0047 
0048 #endif // KRENAMETOKENSORTER_H