summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2006-08-13 12:33:34 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2006-08-13 12:33:34 +0000
commit33d91040785d679c40a44f3127eee54d6adb2ad3 (patch)
tree26d33c3e8fb21d7a54a2a9dbd001d8da588ddaac /apps
parent0a7ded3e29b302a83b61279128962b829817e4cb (diff)
downloadrockbox-33d91040785d679c40a44f3127eee54d6adb2ad3.tar.gz
rockbox-33d91040785d679c40a44f3127eee54d6adb2ad3.zip
FS#5805 NOT operator for tagnavi.config by Jochen Kemnade.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10558 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/tagcache.c13
-rw-r--r--apps/tagcache.h7
-rw-r--r--apps/tagtree.c4
3 files changed, 20 insertions, 4 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 4c324c8da3..87810da93b 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -588,7 +588,12 @@ static bool check_against_clause(long numeric, const char *str,
588 return numeric == clause->numeric_data; 588 return numeric == clause->numeric_data;
589 else 589 else
590 return !strcasecmp(clause->str, str); 590 return !strcasecmp(clause->str, str);
591 591 case clause_is_not:
592 if (clause->numeric)
593 return numeric != clause->numeric_data;
594 else
595 return strcasecmp(clause->str, str);
596
592 case clause_gt: 597 case clause_gt:
593 return numeric > clause->numeric_data; 598 return numeric > clause->numeric_data;
594 case clause_gteq: 599 case clause_gteq:
@@ -600,10 +605,16 @@ static bool check_against_clause(long numeric, const char *str,
600 605
601 case clause_contains: 606 case clause_contains:
602 return (strcasestr(str, clause->str) != NULL); 607 return (strcasestr(str, clause->str) != NULL);
608 case clause_not_contains:
609 return (strcasestr(str, clause->str) == NULL);
603 case clause_begins_with: 610 case clause_begins_with:
604 return (strcasestr(str, clause->str) == str); 611 return (strcasestr(str, clause->str) == str);
612 case clause_not_begins_with:
613 return (strcasestr(str, clause->str) != str);
605 case clause_ends_with: /* Not supported yet */ 614 case clause_ends_with: /* Not supported yet */
606 return false; 615 return false;
616 case clause_not_ends_with: /* Not supported yet */
617 return false;
607 } 618 }
608 619
609 return false; 620 return false;
diff --git a/apps/tagcache.h b/apps/tagcache.h
index b27d804792..e43414cba5 100644
--- a/apps/tagcache.h
+++ b/apps/tagcache.h
@@ -71,9 +71,10 @@ enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title,
71#define FLAG_DIRCACHE 0x0002 /* Filename is a dircache pointer */ 71#define FLAG_DIRCACHE 0x0002 /* Filename is a dircache pointer */
72#define FLAG_DIRTYNUM 0x0004 /* Numeric data has been modified */ 72#define FLAG_DIRTYNUM 0x0004 /* Numeric data has been modified */
73 73
74enum clause { clause_none, clause_is, clause_gt, clause_gteq, clause_lt, 74enum clause { clause_none, clause_is, clause_is_not, clause_gt, clause_gteq,
75 clause_lteq, clause_contains, clause_begins_with, clause_ends_with }; 75 clause_lt, clause_lteq, clause_contains, clause_not_contains,
76enum modifiers { clause_mod_none, clause_mod_not }; 76 clause_begins_with, clause_not_begins_with, clause_ends_with,
77 clause_not_ends_with };
77 78
78struct tagcache_stat { 79struct tagcache_stat {
79 bool initialized; /* Is tagcache currently busy? */ 80 bool initialized; /* Is tagcache currently busy? */
diff --git a/apps/tagtree.c b/apps/tagtree.c
index daa52646fa..0565b62981 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -176,13 +176,17 @@ static int get_clause(int *condition)
176 176
177 MATCH(condition, buf, "=", clause_is); 177 MATCH(condition, buf, "=", clause_is);
178 MATCH(condition, buf, "==", clause_is); 178 MATCH(condition, buf, "==", clause_is);
179 MATCH(condition, buf, "!=", clause_is_not);
179 MATCH(condition, buf, ">", clause_gt); 180 MATCH(condition, buf, ">", clause_gt);
180 MATCH(condition, buf, ">=", clause_gteq); 181 MATCH(condition, buf, ">=", clause_gteq);
181 MATCH(condition, buf, "<", clause_lt); 182 MATCH(condition, buf, "<", clause_lt);
182 MATCH(condition, buf, "<=", clause_lteq); 183 MATCH(condition, buf, "<=", clause_lteq);
183 MATCH(condition, buf, "~", clause_contains); 184 MATCH(condition, buf, "~", clause_contains);
185 MATCH(condition, buf, "!~", clause_not_contains);
184 MATCH(condition, buf, "^", clause_begins_with); 186 MATCH(condition, buf, "^", clause_begins_with);
187 MATCH(condition, buf, "!^", clause_not_begins_with);
185 MATCH(condition, buf, "$", clause_ends_with); 188 MATCH(condition, buf, "$", clause_ends_with);
189 MATCH(condition, buf, "!$", clause_not_ends_with);
186 190
187 return 0; 191 return 0;
188} 192}