playlist editor: hold MPD::PlaylistS instead of std::stringS

This commit is contained in:
Andrzej Rybczak
2014-11-01 23:16:06 +01:00
parent fabd24c6a5
commit 30d57afcac
8 changed files with 57 additions and 46 deletions

View File

@@ -35,8 +35,15 @@ class LocaleStringComparison
public:
LocaleStringComparison(const std::locale &loc, bool ignore_the)
: m_locale(loc), m_ignore_the(ignore_the) { }
int operator()(const std::string &a, const std::string &b) const;
int operator()(const char *a, const char *b) const {
return compare(a, strlen(a), b, strlen(b));
}
int operator()(const std::string &a, const std::string &b) const {
return compare(a.c_str(), a.length(), b.c_str(), b.length());
}
int compare(const char *a, size_t a_len, const char *b, size_t b_len) const;
};
class LocaleBasedSorting
@@ -50,6 +57,10 @@ public:
return m_cmp(a, b) < 0;
}
bool operator()(const MPD::Playlist &a, const MPD::Playlist &b) const {
return m_cmp(a.path(), b.path()) < 0;
}
bool operator()(const MPD::Song &a, const MPD::Song &b) const {
return m_cmp(a.getName(), b.getName()) < 0;
}