diff options
| author | Michiel Van Der Kolk <not.valid@email.address> | 2005-05-10 23:44:22 +0000 |
|---|---|---|
| committer | Michiel Van Der Kolk <not.valid@email.address> | 2005-05-10 23:44:22 +0000 |
| commit | f5eae08361c4b1c9d7c846c7b4b54fabf7467e31 (patch) | |
| tree | ca9d05970a00e34d93f6651c2e8d27a9fe3caacd /apps/plugins/databox | |
| parent | 09d82dbed8ebbefb2dfb248cd2d6191e917e9797 (diff) | |
| download | rockbox-f5eae08361c4b1c9d7c846c7b4b54fabf7467e31.zip rockbox-f5eae08361c4b1c9d7c846c7b4b54fabf7467e31.tar.gz rockbox-f5eae08361c4b1c9d7c846c7b4b54fabf7467e31.tar.bz2 rockbox-f5eae08361c4b1c9d7c846c7b4b54fabf7467e31.tar.xz | |
Starts with and ends with support (for strings), as requested.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6454 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/databox')
| -rw-r--r-- | apps/plugins/databox/databox.c | 2 | ||||
| -rw-r--r-- | apps/plugins/databox/editparser.c | 2 | ||||
| -rw-r--r-- | apps/plugins/databox/edittoken.c | 9 | ||||
| -rw-r--r-- | apps/plugins/databox/edittoken.h | 98 |
4 files changed, 66 insertions, 45 deletions
diff --git a/apps/plugins/databox/databox.c b/apps/plugins/databox/databox.c index af2bdda..58f949e 100644 --- a/apps/plugins/databox/databox.c +++ b/apps/plugins/databox/databox.c @@ -145,6 +145,8 @@ void buildchoices(int mask) { if(mask&ACCEPT_STROP) { editing.selection_candidates[i++]=TOKEN_CONTAINS; editing.selection_candidates[i++]=TOKEN_EQUALS; + editing.selection_candidates[i++]=TOKEN_STARTSWITH; + editing.selection_candidates[i++]=TOKEN_ENDSWITH; } if(mask&ACCEPT_LPAREN) { editing.selection_candidates[i++]=TOKEN_LPAREN; diff --git a/apps/plugins/databox/editparser.c b/apps/plugins/databox/editparser.c index d2fcbc4..5ee9ffb 100644 --- a/apps/plugins/databox/editparser.c +++ b/apps/plugins/databox/editparser.c @@ -100,6 +100,8 @@ void parse_checktoken() { break; case TOKEN_EQUALS: case TOKEN_CONTAINS: + case TOKEN_STARTSWITH: + case TOKEN_ENDSWITH: ok=acceptedmask&ACCEPT_STROP; break; case TOKEN_STRING: diff --git a/apps/plugins/databox/edittoken.c b/apps/plugins/databox/edittoken.c index f5b8697..71548d6 100644 --- a/apps/plugins/databox/edittoken.c +++ b/apps/plugins/databox/edittoken.c @@ -35,6 +35,8 @@ char *tokentypetostring(int tokentype) { case TOKEN_RPAREN: return ")"; case TOKEN_CONTAINS: return "contains"; case TOKEN_EQUALS: return "equals"; + case TOKEN_STARTSWITH: return "starts with"; + case TOKEN_ENDSWITH: return "ends with"; case TOKEN_NUM: return "<number>"; case TOKEN_NUMIDENTIFIER: return "<numberproperty>"; case TOKEN_STRING: return "<string>"; @@ -58,6 +60,7 @@ char *numidtostring(int numid) { case INTVALUE_YEAR: return "<year>"; case INTVALUE_RATING: return "<rating>"; case INTVALUE_PLAYCOUNT: return "<playcount>"; + case INTVALUE_AUTORATING: return "<autorating>"; } return "numiderror"; } @@ -100,6 +103,10 @@ void buildtoken(int tokentype,struct token *token) { token->kind=TOKEN_NUMIDENTIFIER; token->intvalue=INTVALUE_PLAYCOUNT; break; + case TOKEN_AUTORATING: + token->kind=TOKEN_NUMIDENTIFIER; + token->intvalue=INTVALUE_AUTORATING; + break; case TOKEN_TITLE: token->kind=TOKEN_STRINGIDENTIFIER; token->intvalue=INTVALUE_TITLE; @@ -172,6 +179,8 @@ char *tokentostring(struct token *token) { case TOKEN_RPAREN: case TOKEN_CONTAINS: case TOKEN_EQUALS: + case TOKEN_STARTSWITH: + case TOKEN_ENDSWITH: return tokentypetostring(token->kind); case TOKEN_NUM: rb->snprintf(bufbla,40,"%d",token->intvalue); return bufbla; diff --git a/apps/plugins/databox/edittoken.h b/apps/plugins/databox/edittoken.h index a5c8d47..4c9f535 100644 --- a/apps/plugins/databox/edittoken.h +++ b/apps/plugins/databox/edittoken.h @@ -19,54 +19,62 @@ #ifndef EDITTOKEN_H #define EDITTOKEN_H -#define TOKEN_INVALID -1 -#define TOKEN_EOF 0 // EOF -#define TOKEN_NOT 1 // "not" -#define TOKEN_AND 2 // "and" -#define TOKEN_OR 3 // "or" -#define TOKEN_GT 4 // '>' -#define TOKEN_GTE 5 // '>=' -#define TOKEN_LT 6 // '<' -#define TOKEN_LTE 7 // '<=' -#define TOKEN_EQ 8 // '==' -#define TOKEN_NE 9 // '!=' -#define TOKEN_CONTAINS 10 // "contains" -#define TOKEN_EQUALS 11 // "equals" -#define TOKEN_LPAREN 12 // '(' -#define TOKEN_RPAREN 13 // ')' -#define TOKEN_NUM 14 // (0..9)+ -#define TOKEN_NUMIDENTIFIER 15 // year, trackid, bpm, etc. -#define TOKEN_STRING 16 // (?)+ -#define TOKEN_STRINGIDENTIFIER 17 // album, artist, title, genre ... -#define TOKEN_YEAR 18 -#define TOKEN_RATING 19 -#define TOKEN_PLAYCOUNT 20 -#define TOKEN_TITLE 21 -#define TOKEN_ARTIST 22 -#define TOKEN_ALBUM 23 -#define TOKEN_GENRE 24 -#define TOKEN_FILENAME 25 -#define TOKEN_EDIT 26 +#define TOKEN_INVALID -1 +#define TOKEN_EOF 0 // EOF +#define TOKEN_NOT 1 // "not" +#define TOKEN_AND 2 // "and" +#define TOKEN_OR 3 // "or" +#define TOKEN_GT 4 // '>' +#define TOKEN_GTE 5 // '>=' +#define TOKEN_LT 6 // '<' +#define TOKEN_LTE 7 // '<=' +#define TOKEN_EQ 8 // '==' +#define TOKEN_NE 9 // '!=' +#define TOKEN_CONTAINS 10 // "contains" +#define TOKEN_EQUALS 11 // "equals" +#define TOKEN_STARTSWITH 12 +#define TOKEN_ENDSWITH 13 +#define TOKEN_LPAREN 14 // '(' +#define TOKEN_RPAREN 15 // ')' +#define TOKEN_NUM 16 // (0..9)+ +#define TOKEN_NUMIDENTIFIER 17 // year, trackid, bpm, etc. +#define TOKEN_STRING 18 // (?)+ +#define TOKEN_STRINGIDENTIFIER 19 // album, artist, title, genre ... +#define TOKEN_SHUFFLE 20 +#define TOKEN_PLAYTIMELIMIT 21 -#define ACCEPT_EOF 0x1 -#define ACCEPT_BOOLOP 0x2 -#define ACCEPT_NUMOP 0x4 -#define ACCEPT_STROP 0x8 -#define ACCEPT_LPAREN 0x10 -#define ACCEPT_RPAREN 0x20 -#define ACCEPT_NUMARG 0x40 -#define ACCEPT_STRARG 0x80 -#define ACCEPT_NOT 0x100 -#define ACCEPT_DELETE 0x200 +// pseudotokens.. +#define TOKEN_YEAR 118 +#define TOKEN_RATING 119 +#define TOKEN_PLAYCOUNT 120 +#define TOKEN_TITLE 121 +#define TOKEN_ARTIST 122 +#define TOKEN_ALBUM 123 +#define TOKEN_GENRE 124 +#define TOKEN_FILENAME 125 +#define TOKEN_EDIT 126 +#define TOKEN_AUTORATING 127 -#define INTVALUE_YEAR 1 +#define ACCEPT_EOF 0x1 +#define ACCEPT_BOOLOP 0x2 +#define ACCEPT_NUMOP 0x4 +#define ACCEPT_STROP 0x8 +#define ACCEPT_LPAREN 0x10 +#define ACCEPT_RPAREN 0x20 +#define ACCEPT_NUMARG 0x40 +#define ACCEPT_STRARG 0x80 +#define ACCEPT_NOT 0x100 +#define ACCEPT_DELETE 0x200 + +#define INTVALUE_YEAR 1 #define INTVALUE_RATING 2 -#define INTVALUE_PLAYCOUNT 3 -#define INTVALUE_TITLE 4 -#define INTVALUE_ARTIST 5 -#define INTVALUE_ALBUM 6 -#define INTVALUE_GENRE 7 -#define INTVALUE_FILENAME 8 +#define INTVALUE_PLAYCOUNT 3 +#define INTVALUE_AUTORATING 4 +#define INTVALUE_TITLE 14 +#define INTVALUE_ARTIST 15 +#define INTVALUE_ALBUM 16 +#define INTVALUE_GENRE 17 +#define INTVALUE_FILENAME 18 struct token { char kind; |