forked from len0rd/rockbox
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
This commit is contained in:
parent
0a7ded3e29
commit
33d9104078
4 changed files with 21 additions and 4 deletions
|
@ -588,7 +588,12 @@ static bool check_against_clause(long numeric, const char *str,
|
||||||
return numeric == clause->numeric_data;
|
return numeric == clause->numeric_data;
|
||||||
else
|
else
|
||||||
return !strcasecmp(clause->str, str);
|
return !strcasecmp(clause->str, str);
|
||||||
|
case clause_is_not:
|
||||||
|
if (clause->numeric)
|
||||||
|
return numeric != clause->numeric_data;
|
||||||
|
else
|
||||||
|
return strcasecmp(clause->str, str);
|
||||||
|
|
||||||
case clause_gt:
|
case clause_gt:
|
||||||
return numeric > clause->numeric_data;
|
return numeric > clause->numeric_data;
|
||||||
case clause_gteq:
|
case clause_gteq:
|
||||||
|
@ -600,10 +605,16 @@ static bool check_against_clause(long numeric, const char *str,
|
||||||
|
|
||||||
case clause_contains:
|
case clause_contains:
|
||||||
return (strcasestr(str, clause->str) != NULL);
|
return (strcasestr(str, clause->str) != NULL);
|
||||||
|
case clause_not_contains:
|
||||||
|
return (strcasestr(str, clause->str) == NULL);
|
||||||
case clause_begins_with:
|
case clause_begins_with:
|
||||||
return (strcasestr(str, clause->str) == str);
|
return (strcasestr(str, clause->str) == str);
|
||||||
|
case clause_not_begins_with:
|
||||||
|
return (strcasestr(str, clause->str) != str);
|
||||||
case clause_ends_with: /* Not supported yet */
|
case clause_ends_with: /* Not supported yet */
|
||||||
return false;
|
return false;
|
||||||
|
case clause_not_ends_with: /* Not supported yet */
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -71,9 +71,10 @@ enum tag_type { tag_artist = 0, tag_album, tag_genre, tag_title,
|
||||||
#define FLAG_DIRCACHE 0x0002 /* Filename is a dircache pointer */
|
#define FLAG_DIRCACHE 0x0002 /* Filename is a dircache pointer */
|
||||||
#define FLAG_DIRTYNUM 0x0004 /* Numeric data has been modified */
|
#define FLAG_DIRTYNUM 0x0004 /* Numeric data has been modified */
|
||||||
|
|
||||||
enum clause { clause_none, clause_is, clause_gt, clause_gteq, clause_lt,
|
enum clause { clause_none, clause_is, clause_is_not, clause_gt, clause_gteq,
|
||||||
clause_lteq, clause_contains, clause_begins_with, clause_ends_with };
|
clause_lt, clause_lteq, clause_contains, clause_not_contains,
|
||||||
enum modifiers { clause_mod_none, clause_mod_not };
|
clause_begins_with, clause_not_begins_with, clause_ends_with,
|
||||||
|
clause_not_ends_with };
|
||||||
|
|
||||||
struct tagcache_stat {
|
struct tagcache_stat {
|
||||||
bool initialized; /* Is tagcache currently busy? */
|
bool initialized; /* Is tagcache currently busy? */
|
||||||
|
|
|
@ -176,13 +176,17 @@ static int get_clause(int *condition)
|
||||||
|
|
||||||
MATCH(condition, buf, "=", clause_is);
|
MATCH(condition, buf, "=", clause_is);
|
||||||
MATCH(condition, buf, "==", clause_is);
|
MATCH(condition, buf, "==", clause_is);
|
||||||
|
MATCH(condition, buf, "!=", clause_is_not);
|
||||||
MATCH(condition, buf, ">", clause_gt);
|
MATCH(condition, buf, ">", clause_gt);
|
||||||
MATCH(condition, buf, ">=", clause_gteq);
|
MATCH(condition, buf, ">=", clause_gteq);
|
||||||
MATCH(condition, buf, "<", clause_lt);
|
MATCH(condition, buf, "<", clause_lt);
|
||||||
MATCH(condition, buf, "<=", clause_lteq);
|
MATCH(condition, buf, "<=", clause_lteq);
|
||||||
MATCH(condition, buf, "~", clause_contains);
|
MATCH(condition, buf, "~", clause_contains);
|
||||||
|
MATCH(condition, buf, "!~", clause_not_contains);
|
||||||
MATCH(condition, buf, "^", clause_begins_with);
|
MATCH(condition, buf, "^", clause_begins_with);
|
||||||
|
MATCH(condition, buf, "!^", clause_not_begins_with);
|
||||||
MATCH(condition, buf, "$", clause_ends_with);
|
MATCH(condition, buf, "$", clause_ends_with);
|
||||||
|
MATCH(condition, buf, "!$", clause_not_ends_with);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,3 +223,4 @@ Alexander Levin
|
||||||
Barry Wardell
|
Barry Wardell
|
||||||
Lars van de Klomp
|
Lars van de Klomp
|
||||||
Philippe Miossec
|
Philippe Miossec
|
||||||
|
Jochen Kemnade
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue