/*********************************************************************** * This file is part of module_misc. * * module_misc is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * module_misc is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with module_misc. If not, see * * Copyright (C) 2015, Dominik Rueß; info@dominik-ruess.de **********************************************************************/ #ifndef FILENAMENUMBERING_PRE_H #define FILENAMENUMBERING_PRE_H #include #include #include #include namespace MiscTools { /** * use this class to avoid unintended use of direct overloaded * operator== in QList for template QVariant */ template class MyFilePartsList : public QVector { public: template Q_OUTOFLINE_TEMPLATE bool operator==(const MyFilePartsList &b) const; }; class FilenameNumberingTests; typedef MyFilePartsList InfoList; class FilenameNumbering_PRE { friend class FilenameNumberingTests; private: FilenameNumbering_PRE(); public: typedef QPair DT; static InfoList splitFileToStringParts(const QString& filename, const bool caseInsensitive = false, const bool withoutExtension = true, InfoList * stringValues = NULL); static QVector getDifferentFile_Patterns( QStringList filenames, const bool caseInsensitive = false, const bool withoutExtension = true); static void getUniqueNumbersAndValues(const QStringList filenames, const bool diffSuffixSameNumbers, QVector >& fileNumberValues, QVector& numbersUnique, QVector& numberingPositions, bool &onePatternFound, const bool caseInsensitive = false, const bool withoutExtension = true); static bool getTagsBackMapAndNumbers( const QStringList& filenames, const QString& taggedFileName, const QVector >& tagsAndDateMap, const QString& tag, QVector& runningFileNumbers, QVector > >& startAndLengthOfRunnNumbers); /** * there might be a non direct renaming graph, try to find it */ static QVector findMoveOrdering( const QList > &moveExisting ); protected: static bool _getTagMap( const QStringList &filenames, const QString &taggedFileName, const QVector > &tagsAndDateMap, // first = tagNo, second = tagOrderPos; QMultiMap &tagPositions, QVector &datePatternsUsed, QString &datePattern, QVector > &filenameNumericValues, QVector > > &tagSourceFNPositionsAndLengths); }; } // namespace MiscTools #endif // FILENAMENUMBERING_PRE_H