|
|
|
@ -50,31 +50,12 @@ struct pathComparer
|
|
|
|
|
private:
|
|
|
|
|
int m_start, m_size;
|
|
|
|
|
|
|
|
|
|
bool comparePortion(const std::string& file1, const std::string& file2, int start, int size) const
|
|
|
|
|
{
|
|
|
|
|
return lexicographical_compare(file1.substr(start,size), file2.substr(start,size), boost::algorithm::is_iless());
|
|
|
|
|
|
|
|
|
|
for(int i = start; i < start+size; i++)
|
|
|
|
|
{
|
|
|
|
|
if (i >= file1.size())
|
|
|
|
|
return true;
|
|
|
|
|
else if (i >= file2.size())
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
char one = tolower(file1.at(i));
|
|
|
|
|
char two = tolower(file2.at(i));
|
|
|
|
|
if(one != two)
|
|
|
|
|
return (one < two);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
pathComparer(int start, int size) : m_start(start), m_size(size) { }
|
|
|
|
|
|
|
|
|
|
bool operator() (const std::string& first, const std::string& other)
|
|
|
|
|
{
|
|
|
|
|
return comparePortion(first, other, m_start, m_size);
|
|
|
|
|
return lexicographical_compare(first.substr(m_start,m_size), other.substr(m_start,m_size), boost::algorithm::is_iless());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|