uninline CaseInsensitiveStringComparison::operator()

This commit is contained in:
Andrzej Rybczak
2010-02-17 00:04:59 +01:00
parent d7505ef46f
commit d45e3b382f
2 changed files with 18 additions and 16 deletions

View File

@@ -226,6 +226,23 @@ void ParseArgv(int argc, char **argv)
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)
{
if (a.type == b.type)

View File

@@ -42,22 +42,7 @@ class CaseInsensitiveStringComparison
}
public:
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;
}
int operator()(const std::string &a, const std::string &b);
};
class CaseInsensitiveSorting