1 // SortUtils.cpp 2 3 #include "StdAfx.h" 4 5 #include "SortUtils.h" 6 #include "Common/Wildcard.h" 7 8 static int CompareStrings(const int *p1, const int *p2, void *param) 9 { 10 const UStringVector &strings = *(const UStringVector *)param; 11 return CompareFileNames(strings[*p1], strings[*p2]); 12 } 13 14 void SortFileNames(const UStringVector &strings, CIntVector &indices) 15 { 16 indices.Clear(); 17 int numItems = strings.Size(); 18 indices.Reserve(numItems); 19 for(int i = 0; i < numItems; i++) 20 indices.Add(i); 21 indices.Sort(CompareStrings, (void *)&strings); 22 } 23