actions: implement filtering playlist on priorities

This commit is contained in:
Andrzej Rybczak
2012-09-08 00:28:02 +02:00
parent 45a097a45b
commit a26b1f62f9
6 changed files with 42 additions and 7 deletions

View File

@@ -33,13 +33,13 @@ long stringToLongInt(const std::string &s)
return atol(s.c_str());
}
bool isInteger(const char *s)
bool isInteger(const char *s, bool accept_signed)
{
assert(s);
if (*s == '\0')
return false;
for (const char *it = s; *it != '\0'; ++it)
if (!isdigit(*it) && (it != s || *it != '-'))
if (!(isdigit(*it) || (accept_signed && it == s && *it == '-')))
return false;
return true;
}

View File

@@ -54,7 +54,7 @@ template <size_t N> struct print<N, std::wstring> {
int stringToInt(const std::string &s);
long stringToLongInt(const std::string &s);
bool isInteger(const char *s);
bool isInteger(const char *s, bool accept_signed);
std::string ToString(const std::wstring &ws);
std::wstring ToWString(const std::string &s);