diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:56:14 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:56:14 +0200 |
commit | 1046c195a9bbac24678c06310a4dd56b10347244 (patch) | |
tree | 89ad9f6fe3e538d65ef973b628ed9284b6c99e9f /library/sorting.h | |
parent | 1.14 (diff) | |
download | FreeFileSync-1046c195a9bbac24678c06310a4dd56b10347244.tar.gz FreeFileSync-1046c195a9bbac24678c06310a4dd56b10347244.tar.bz2 FreeFileSync-1046c195a9bbac24678c06310a4dd56b10347244.zip |
1.15
Diffstat (limited to 'library/sorting.h')
-rw-r--r-- | library/sorting.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/library/sorting.h b/library/sorting.h index 560e246a..fabdad1f 100644 --- a/library/sorting.h +++ b/library/sorting.h @@ -5,6 +5,7 @@ #include "resources.h" #include "globalFunctions.h" +using namespace FreeFileSync; enum SideToSort { @@ -115,11 +116,11 @@ bool sortByFileName(const FileCompareLine& a, const FileCompareLine& b) const wxChar* stringB = descrLineB->relativeName.c_str(); size_t pos = descrLineA->relativeName.Find(GlobalResources::FILE_NAME_SEPARATOR, true); //start search beginning from end - if (pos != string::npos) + if (pos != std::string::npos) stringA += pos + 1; pos = descrLineB->relativeName.Find(GlobalResources::FILE_NAME_SEPARATOR, true); //start search beginning from end - if (pos != string::npos) + if (pos != std::string::npos) stringB += pos + 1; return stringSmallerThan<sortAscending>(stringA, stringB); @@ -250,4 +251,20 @@ bool sortByDate(const FileCompareLine& a, const FileCompareLine& b) } +template <bool sortAscending> +inline +bool sortByCmpResult(const FileCompareLine& a, const FileCompareLine& b) +{ + //presort result: equal shall appear at end of list + if (a.cmpResult == FILE_EQUAL) + return false; + if (b.cmpResult == FILE_EQUAL) + return true; + + return sortAscending ? + a.cmpResult < b.cmpResult : + a.cmpResult > b.cmpResult; +} + + #endif // SORTING_H_INCLUDED |