diff options
| author | Miika Pekkarinen <miipekk@ihme.org> | 2006-10-09 10:23:35 +0000 |
|---|---|---|
| committer | Miika Pekkarinen <miipekk@ihme.org> | 2006-10-09 10:23:35 +0000 |
| commit | be2eb02d7a9bba97aeb022174e4abe2cc132d6a3 (patch) | |
| tree | 76e1716b7f17d3879247ac447228d1366e8ba8b9 /apps | |
| parent | 56f50615c0b609654cce3a6faa4a14faf5d715ab (diff) | |
| download | rockbox-be2eb02d7a9bba97aeb022174e4abe2cc132d6a3.zip rockbox-be2eb02d7a9bba97aeb022174e4abe2cc132d6a3.tar.gz rockbox-be2eb02d7a9bba97aeb022174e4abe2cc132d6a3.tar.bz2 rockbox-be2eb02d7a9bba97aeb022174e4abe2cc132d6a3.tar.xz | |
FS#6137: add "oneof" operator to tagnavi.conf syntax.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11157 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/tagcache.c | 19 | ||||
| -rw-r--r-- | apps/tagcache.h | 2 | ||||
| -rw-r--r-- | apps/tagtree.c | 1 |
3 files changed, 21 insertions, 1 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c index 1c180b7..ca24211 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -592,6 +592,23 @@ inline static bool str_ends_with(const char *str1, const char *str2) return !strcasecmp(&str1[str_len - clause_len], str2); } +inline static bool str_oneof(const char *str, const char *list) +{ + const char *sep; + int l, len = strlen(str); + + while (*list) + { + sep = strchr(list, '|'); + l = sep ? (long)sep - (long)list : (int)strlen(list); + if ((l==len) && !strncasecmp(str, list, len)) + return true; + list += sep ? l + 1 : l; + } + + return false; +} + static bool check_against_clause(long numeric, const char *str, const struct tagcache_search_clause *clause) { @@ -643,6 +660,8 @@ static bool check_against_clause(long numeric, const char *str, return str_ends_with(str, clause->str); case clause_not_ends_with: return !str_ends_with(str, clause->str); + case clause_oneof: + return str_oneof(str, clause->str); default: logf("Incorrect tag: %d", clause->type); diff --git a/apps/tagcache.h b/apps/tagcache.h index 23525f8..1a3afca 100644 --- a/apps/tagcache.h +++ b/apps/tagcache.h @@ -77,7 +77,7 @@ enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title, enum clause { clause_none, clause_is, clause_is_not, clause_gt, clause_gteq, clause_lt, clause_lteq, clause_contains, clause_not_contains, clause_begins_with, clause_not_begins_with, clause_ends_with, - clause_not_ends_with }; + clause_not_ends_with, clause_oneof }; struct tagcache_stat { bool initialized; /* Is tagcache currently busy? */ diff --git a/apps/tagtree.c b/apps/tagtree.c index f954282..90fa617 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c @@ -244,6 +244,7 @@ static int get_clause(int *condition) MATCH(condition, buf, "!^", clause_not_begins_with); MATCH(condition, buf, "$", clause_ends_with); MATCH(condition, buf, "!$", clause_not_ends_with); + MATCH(condition, buf, "@", clause_oneof); return 0; } |