uninline CaseInsensitiveStringComparison::operator()
This commit is contained in:
@@ -226,6 +226,23 @@ void ParseArgv(int argc, char **argv)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CaseInsensitiveStringComparison::operator()(const std::string &a, const std::string &b)
|
||||||
|
{
|
||||||
|
const char *i = a.c_str();
|
||||||
|
const char *j = b.c_str();
|
||||||
|
if (Config.ignore_leading_the)
|
||||||
|
{
|
||||||
|
if (hasTheWord(a))
|
||||||
|
i += 4;
|
||||||
|
if (hasTheWord(b))
|
||||||
|
j += 4;
|
||||||
|
}
|
||||||
|
int dist;
|
||||||
|
while (!(dist = tolower(*i)-tolower(*j)) && *j)
|
||||||
|
++i, ++j;
|
||||||
|
return dist;
|
||||||
|
}
|
||||||
|
|
||||||
bool CaseInsensitiveSorting::operator()(const MPD::Item &a, const MPD::Item &b)
|
bool CaseInsensitiveSorting::operator()(const MPD::Item &a, const MPD::Item &b)
|
||||||
{
|
{
|
||||||
if (a.type == b.type)
|
if (a.type == b.type)
|
||||||
|
|||||||
@@ -42,22 +42,7 @@ class CaseInsensitiveStringComparison
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int operator()(const std::string &a, const std::string &b)
|
int operator()(const std::string &a, const std::string &b);
|
||||||
{
|
|
||||||
const char *i = a.c_str();
|
|
||||||
const char *j = b.c_str();
|
|
||||||
if (Config.ignore_leading_the)
|
|
||||||
{
|
|
||||||
if (hasTheWord(a))
|
|
||||||
i += 4;
|
|
||||||
if (hasTheWord(b))
|
|
||||||
j += 4;
|
|
||||||
}
|
|
||||||
int dist;
|
|
||||||
while (!(dist = tolower(*i)-tolower(*j)) && *j)
|
|
||||||
++i, ++j;
|
|
||||||
return dist;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CaseInsensitiveSorting
|
class CaseInsensitiveSorting
|
||||||
|
|||||||
Reference in New Issue
Block a user