Android: no need to keep RockboxPCM_class around
[maemo-rb.git] / lib / skin_parser / tag_table.h
blob31a5ec215f083024a13ef69a6d7925dd13754979
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2010 Robert Bieber
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef TAG_TABLE_H
23 #define TAG_TABLE_H
25 #ifdef __cplusplus
26 extern "C"
28 #endif
30 #define MAX_TAG_PARAMS 12
32 #define NOBREAK 0x1 /* Flag to tell the renderer not to insert a line break */
33 #define FEATURE_TAG 0x2 /* Parse time conditional for feature checks (e.g HAVE_RTC) */
35 /* constants used in line_type and as refresh_mode for wps_refresh */
36 #define SKIN_REFRESH_SHIFT 16
37 #define SKIN_REFRESH_STATIC (1u<<SKIN_REFRESH_SHIFT) /* line doesn't change over time */
38 #define SKIN_REFRESH_DYNAMIC (1u<<(SKIN_REFRESH_SHIFT+1)) /* line may change (e.g. time flag) */
39 #define SKIN_REFRESH_SCROLL (1u<<(SKIN_REFRESH_SHIFT+2)) /* line scrolls */
40 #define SKIN_REFRESH_PLAYER_PROGRESS (1u<<(SKIN_REFRESH_SHIFT+3)) /* line contains a progress bar */
41 #define SKIN_REFRESH_PEAK_METER (1u<<(SKIN_REFRESH_SHIFT+4)) /* line contains a peak meter */
42 #define SKIN_REFRESH_STATUSBAR (1u<<(SKIN_REFRESH_SHIFT+5)) /* refresh statusbar */
43 #define SKIN_RTC_REFRESH (1u<<(SKIN_REFRESH_SHIFT+6)) /* refresh rtc, convert at parse time */
44 #define SKIN_REFRESH_ALL (0xffffu<<SKIN_REFRESH_SHIFT) /* to refresh all line types */
46 /* to refresh only those lines that change over time */
47 #define SKIN_REFRESH_NON_STATIC (SKIN_REFRESH_DYNAMIC| \
48 SKIN_REFRESH_PLAYER_PROGRESS| \
49 SKIN_REFRESH_PEAK_METER)
51 enum skin_token_type {
53 SKIN_TOKEN_NO_TOKEN,
54 SKIN_TOKEN_UNKNOWN,
56 /* Markers */
57 SKIN_TOKEN_CHARACTER,
58 SKIN_TOKEN_STRING,
59 SKIN_TOKEN_TRANSLATEDSTRING,
61 /* Alignment */
62 SKIN_TOKEN_ALIGN_LEFT,
63 SKIN_TOKEN_ALIGN_LEFT_RTL,
64 SKIN_TOKEN_ALIGN_CENTER,
65 SKIN_TOKEN_ALIGN_RIGHT,
66 SKIN_TOKEN_ALIGN_RIGHT_RTL,
67 SKIN_TOKEN_ALIGN_LANGDIRECTION,
70 /* Sublines */
71 SKIN_TOKEN_SUBLINE_TIMEOUT,
72 SKIN_TOKEN_SUBLINE_SCROLL,
74 /* Conditional */
75 SKIN_TOKEN_LOGICAL_IF,
76 SKIN_TOKEN_CONDITIONAL,
77 SKIN_TOKEN_CONDITIONAL_START,
78 SKIN_TOKEN_CONDITIONAL_OPTION,
79 SKIN_TOKEN_CONDITIONAL_END,
81 /* Viewport display */
82 SKIN_TOKEN_VIEWPORT_LOAD,
83 SKIN_TOKEN_VIEWPORT_CONDITIONAL,
84 SKIN_TOKEN_VIEWPORT_ENABLE,
85 SKIN_TOKEN_VIEWPORT_CUSTOMLIST,
86 SKIN_TOKEN_UIVIEWPORT_ENABLE,
87 SKIN_TOKEN_UIVIEWPORT_LOAD,
88 SKIN_TOKEN_VIEWPORT_FGCOLOUR,
89 SKIN_TOKEN_VIEWPORT_BGCOLOUR,
91 /* Battery */
92 SKIN_TOKEN_BATTERY_PERCENT,
93 SKIN_TOKEN_BATTERY_PERCENTBAR,
94 SKIN_TOKEN_BATTERY_VOLTS,
95 SKIN_TOKEN_BATTERY_TIME,
96 SKIN_TOKEN_BATTERY_CHARGER_CONNECTED,
97 SKIN_TOKEN_BATTERY_CHARGING,
98 SKIN_TOKEN_BATTERY_SLEEPTIME,
99 SKIN_TOKEN_USB_POWERED,
101 /* Sound */
102 SKIN_TOKEN_SOUND_PITCH,
103 SKIN_TOKEN_SOUND_SPEED,
104 SKIN_TOKEN_REPLAYGAIN,
105 SKIN_TOKEN_CROSSFADE,
107 /* Time */
108 SKIN_TOKEN_RTC_PRESENT,
110 /* The begin/end values allow us to know if a token is an RTC one.
111 New RTC tokens should be added between the markers. */
113 SKIN_TOKENS_RTC_BEGIN, /* just the start marker, not an actual token */
115 SKIN_TOKEN_RTC_DAY_OF_MONTH,
116 SKIN_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED,
117 SKIN_TOKEN_RTC_12HOUR_CFG,
118 SKIN_TOKEN_RTC_HOUR_24_ZERO_PADDED,
119 SKIN_TOKEN_RTC_HOUR_24,
120 SKIN_TOKEN_RTC_HOUR_12_ZERO_PADDED,
121 SKIN_TOKEN_RTC_HOUR_12,
122 SKIN_TOKEN_RTC_MONTH,
123 SKIN_TOKEN_RTC_MINUTE,
124 SKIN_TOKEN_RTC_SECOND,
125 SKIN_TOKEN_RTC_YEAR_2_DIGITS,
126 SKIN_TOKEN_RTC_YEAR_4_DIGITS,
127 SKIN_TOKEN_RTC_AM_PM_UPPER,
128 SKIN_TOKEN_RTC_AM_PM_LOWER,
129 SKIN_TOKEN_RTC_WEEKDAY_NAME,
130 SKIN_TOKEN_RTC_MONTH_NAME,
131 SKIN_TOKEN_RTC_DAY_OF_WEEK_START_MON,
132 SKIN_TOKEN_RTC_DAY_OF_WEEK_START_SUN,
134 SKIN_TOKENS_RTC_END, /* just the end marker, not an actual token */
136 /* Database */
137 SKIN_TOKEN_DATABASE_PLAYCOUNT,
138 SKIN_TOKEN_DATABASE_RATING,
139 SKIN_TOKEN_DATABASE_AUTOSCORE,
141 /* File */
142 SKIN_TOKEN_FILE_BITRATE,
143 SKIN_TOKEN_FILE_CODEC,
144 SKIN_TOKEN_FILE_FREQUENCY,
145 SKIN_TOKEN_FILE_FREQUENCY_KHZ,
146 SKIN_TOKEN_FILE_NAME,
147 SKIN_TOKEN_FILE_NAME_WITH_EXTENSION,
148 SKIN_TOKEN_FILE_PATH,
149 SKIN_TOKEN_FILE_SIZE,
150 SKIN_TOKEN_FILE_VBR,
151 SKIN_TOKEN_FILE_DIRECTORY,
153 /* Image */
154 SKIN_TOKEN_IMAGE_BACKDROP,
155 SKIN_TOKEN_IMAGE_PROGRESS_BAR,
156 SKIN_TOKEN_IMAGE_PRELOAD,
157 SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY,
158 SKIN_TOKEN_IMAGE_DISPLAY,
159 SKIN_TOKEN_IMAGE_DISPLAY_LISTICON,
161 /* Albumart */
162 SKIN_TOKEN_ALBUMART_LOAD,
163 SKIN_TOKEN_ALBUMART_DISPLAY,
164 SKIN_TOKEN_ALBUMART_FOUND,
166 /* Metadata */
167 SKIN_TOKEN_METADATA_ARTIST,
168 SKIN_TOKEN_METADATA_COMPOSER,
169 SKIN_TOKEN_METADATA_ALBUM_ARTIST,
170 SKIN_TOKEN_METADATA_GROUPING,
171 SKIN_TOKEN_METADATA_ALBUM,
172 SKIN_TOKEN_METADATA_GENRE,
173 SKIN_TOKEN_METADATA_DISC_NUMBER,
174 SKIN_TOKEN_METADATA_TRACK_NUMBER,
175 SKIN_TOKEN_METADATA_TRACK_TITLE,
176 SKIN_TOKEN_METADATA_VERSION,
177 SKIN_TOKEN_METADATA_YEAR,
178 SKIN_TOKEN_METADATA_COMMENT,
180 /* Mode */
181 SKIN_TOKEN_REPEAT_MODE,
182 SKIN_TOKEN_PLAYBACK_STATUS,
183 /* Progressbar */
184 SKIN_TOKEN_PROGRESSBAR,
185 SKIN_TOKEN_PLAYER_PROGRESSBAR,
186 /* Peakmeter */
187 SKIN_TOKEN_PEAKMETER,
188 SKIN_TOKEN_PEAKMETER_LEFT,
189 SKIN_TOKEN_PEAKMETER_LEFTBAR,
190 SKIN_TOKEN_PEAKMETER_RIGHT,
191 SKIN_TOKEN_PEAKMETER_RIGHTBAR,
193 /* Current track */
194 SKIN_TOKEN_TRACK_ELAPSED_PERCENT,
195 SKIN_TOKEN_TRACK_TIME_ELAPSED,
196 SKIN_TOKEN_TRACK_TIME_REMAINING,
197 SKIN_TOKEN_TRACK_LENGTH,
198 SKIN_TOKEN_TRACK_STARTING,
199 SKIN_TOKEN_TRACK_ENDING,
201 /* Playlist */
202 SKIN_TOKEN_PLAYLIST_ENTRIES,
203 SKIN_TOKEN_PLAYLIST_NAME,
204 SKIN_TOKEN_PLAYLIST_POSITION,
205 SKIN_TOKEN_PLAYLIST_SHUFFLE,
208 SKIN_TOKEN_ENABLE_THEME,
209 SKIN_TOKEN_DISABLE_THEME,
210 SKIN_TOKEN_DRAW_INBUILTBAR,
211 SKIN_TOKEN_LIST_TITLE_TEXT,
212 SKIN_TOKEN_LIST_TITLE_ICON,
214 SKIN_TOKEN_LOAD_FONT,
216 /* buttons */
217 SKIN_TOKEN_BUTTON_VOLUME,
218 SKIN_TOKEN_LASTTOUCH,
219 SKIN_TOKEN_TOUCHREGION,
220 SKIN_TOKEN_HAVE_TOUCH,
222 /* Virtual LED */
223 SKIN_TOKEN_VLED_HDD,
224 /* Volume level */
225 SKIN_TOKEN_VOLUME,
226 SKIN_TOKEN_VOLUMEBAR,
227 /* hold */
228 SKIN_TOKEN_MAIN_HOLD,
229 SKIN_TOKEN_REMOTE_HOLD,
231 /* Setting option */
232 SKIN_TOKEN_SETTING,
233 SKIN_TOKEN_CURRENT_SCREEN,
234 SKIN_TOKEN_LANG_IS_RTL,
236 /* Recording Tokens */
237 SKIN_TOKEN_HAVE_RECORDING,
238 SKIN_TOKEN_IS_RECORDING,
239 SKIN_TOKEN_REC_FREQ,
240 SKIN_TOKEN_REC_ENCODER,
241 SKIN_TOKEN_REC_BITRATE, /* SWCODEC: MP3 bitrate, HWCODEC: MP3 "quality" */
242 SKIN_TOKEN_REC_MONO,
243 SKIN_TOKEN_REC_SECONDS,
244 SKIN_TOKEN_REC_MINUTES,
245 SKIN_TOKEN_REC_HOURS,
248 /* Radio Tokens */
249 SKIN_TOKEN_HAVE_TUNER,
250 SKIN_TOKEN_TUNER_TUNED,
251 SKIN_TOKEN_TUNER_SCANMODE,
252 SKIN_TOKEN_TUNER_STEREO,
253 SKIN_TOKEN_TUNER_MINFREQ, /* changes based on "region" */
254 SKIN_TOKEN_TUNER_MAXFREQ, /* changes based on "region" */
255 SKIN_TOKEN_TUNER_CURFREQ,
256 SKIN_TOKEN_TUNER_RSSI,
257 SKIN_TOKEN_TUNER_RSSI_MIN,
258 SKIN_TOKEN_TUNER_RSSI_MAX,
259 SKIN_TOKEN_TUNER_RSSI_BAR,
260 SKIN_TOKEN_PRESET_ID, /* "id" of this preset.. really the array element number */
261 SKIN_TOKEN_PRESET_NAME,
262 SKIN_TOKEN_PRESET_FREQ,
263 SKIN_TOKEN_PRESET_COUNT,
264 /* RDS tokens */
265 SKIN_TOKEN_HAVE_RDS,
266 SKIN_TOKEN_RDS_NAME,
267 SKIN_TOKEN_RDS_TEXT,
272 * Struct for tag parsing information
273 * name - The name of the tag, i.e. V for %V
274 * params - A string specifying all of the tags parameters, each
275 * character representing a single parameter. Valid
276 * characters for parameters are:
277 * I - Required integer
278 * i - Nullable integer
279 * D - Required decimal
280 * d - Nullable decimal
281 * Decimals are stored as (whole*10)+part
282 * S - Required string
283 * s - Nullable string
284 * F - Required file name
285 * f - Nullable file name
286 * C - Required skin code
287 * T - Required single skin tag
288 * N - any amount of strings.. must be the last param in the list
289 * \n - causes the parser to eat everything up to and including the \n
290 * MUST be the last character of the prams string
291 * Any nullable parameter may be replaced in the WPS file
292 * with a '-'. To specify that parameters may be left off
293 * altogether, place a '|' in the parameter string. For
294 * instance, with the parameter string...
295 * Ii|Ss
296 * one integer must be specified, one integer can be
297 * specified or set to default with '-', and the user can
298 * stop providing parameters at any time after that.
299 * To specify multiple instances of the same type, put a
300 * number before the character. For instance, the string...
301 * 2s
302 * will specify two strings. An asterisk (*) at the beginning of the
303 * string will specify that you may choose to omit all arguments
305 * You may also group param types in [] which will tell the parser to
306 * accept any *one* of those types for that param. i.e [IT] will
307 * accept either an integer or tag type. [ITs] will also accept a string or -
310 struct tag_info
312 enum skin_token_type type;
313 char* name;
314 char* params;
315 int flags;
319 * Finds a tag by name and returns its parameter list, or an empty
320 * string if the tag is not found in the table
322 const struct tag_info* find_tag(const char* name);
325 * Determines whether a character is legal to escape or not. If
326 * lookup is not found in the legal escape characters string, returns
327 * false, otherwise returns true
329 int find_escape_character(char lookup);
331 #ifdef __cplusplus
333 #endif
335 #endif /* TAG_TABLE_H */