File indexing completed on 2022-11-29 20:25:15

0001 /***************************************************************************
0002                        krenametokensorter.h  -  description
0003                              -------------------
0004     begin                : Sat Aug 28 2010
0005     copyright            : (C) 2010 by Dominik Seichter
0006     email                : domseichter@web.de
0007 ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 #ifndef KRENAMETOKENSORTER_H
0019 #define KRENAMETOKENSORTER_H
0020 
0021 #include "krenamefile.h"
0022 
0023 #include <QMap>
0024 #include <QString>
0025 
0026 #include <QUrl>
0027 
0028 class BatchRenamer;
0029 class Plugin;
0030 
0031 bool ascendingKRenameFileLessThan(const KRenameFile &file1, const KRenameFile &file2);
0032 bool descendingKRenameFileLessThan(const KRenameFile &file1, const KRenameFile &file2);
0033 bool numericKRenameFileLessThan(const KRenameFile &file1, const KRenameFile &file2);
0034 bool randomKRenameFileLessThan(const KRenameFile &, const KRenameFile &);
0035 
0036 class KRenameTokenSorter
0037 {
0038 public:
0039 
0040     enum ESimpleSortMode {
0041         eSimpleSortMode_Ascending,
0042         eSimpleSortMode_Descending,
0043         eSimpleSortMode_Numeric
0044     };
0045 
0046     KRenameTokenSorter(BatchRenamer *renamer, const QString &token, const KRenameFile::List &list, ESimpleSortMode eSortMode);
0047 
0048     bool operator()(const KRenameFile &file1, const KRenameFile &file2);
0049 
0050 private:
0051     QString processString(int index) const;
0052 
0053 private:
0054     BatchRenamer *m_renamer;
0055     const QString &m_token;
0056     const KRenameFile::List &m_list;
0057     ESimpleSortMode m_eSortMode;
0058     Plugin *m_plugin;
0059     QMap<QUrl, QString> m_values;
0060 };
0061 
0062 #endif // KRENAMETOKENSORTER_H