Syncing up before merging in cpasjuste changes in pxml
[pandora-libraries.git] / include / pnd_pxml.h
1
2 #ifndef h_pnd_pxml_h
3 #define h_pnd_pxml_h
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 // this code is for very basic PXML.xml file parsing
10
11 #define PXML_FILENAME "PXML.xml" /* a specification defined name */
12 #define PXML_TAGHEAD "<PXML>" /* case insensitive */
13 #define PXML_TAGFOOT "</PXML>" /* case insensitive */
14
15 // use this handle to interact with PXML; this hides the mechanics of parsing a PXML file so that
16 // it can be upgraded with impacting applications
17 typedef void* pnd_pxml_handle;
18
19 /* pxml_fetch() will return NULL on fail, otherwise a valid handle which may be further queried
20  */
21 pnd_pxml_handle pnd_pxml_fetch ( char *fullpath );
22 pnd_pxml_handle pnd_pxml_fetch_buffer ( char *filename, char *buffer );
23 void pnd_pxml_delete ( pnd_pxml_handle h );
24
25 /* overrides() allow for customization of a PXML that persists; ie: An application might be sitting
26  * on an SD card and popped out while we need to edit its personalized category; more to point, the
27  * PXML itself could be in a read-only SD or packed into an ISO, or just sitting in a directory.
28  * Rather than have a _second_ PXML in the same place or have to write back to read-only media or
29  * worry about losing customizations when an app is temporarily deleted, we can just keep the
30  * overrides themselves in NAND.
31  */
32 /* merge_override() will attempt to locate an override of the given PXML, and will modify the
33  * PXML in-place to include any overrides found.
34  * Returns >0 if a merge was done, 0 if no merge was done, and <0 on error
35  * NOTE: For searchpath, should query configs for PND_PXML_OVERRIDES_KEY (or use PND_PXML_OVERRIDES_SEARCHPATH)
36  */
37 signed char pnd_pxml_merge_override ( pnd_pxml_handle h, char *searchpath );
38
39 /* these accessor functions will return READ ONLY char*s; do not free them or modify them.
40  */
41 char *pnd_pxml_get_app_name ( pnd_pxml_handle h );
42 char *pnd_pxml_get_icon_path ( pnd_pxml_handle h );
43 char *pnd_pxml_get_unique_id ( pnd_pxml_handle h );
44 char *pnd_pxml_get_primary_category ( pnd_pxml_handle h );
45 char *pnd_pxml_get_exec_path ( pnd_pxml_handle h );
46 char *pnd_pxml_get_clockspeed ( pnd_pxml_handle h );
47
48 // for 'set' functions, pass NULL value to delete existing value without setting new one
49 void pnd_pxml_set_app_name ( pnd_pxml_handle h, char *v );
50
51 /* utilities
52  */
53 unsigned char pnd_is_pxml_valid_app ( pnd_pxml_handle h ); // returns 1 when pxml seems like a valid application
54
55 typedef struct
56 {
57         char *title_en;
58         char *title_de;
59         char *title_it;
60         char *title_fr;
61         char *unique_id;
62         char *standalone;
63         char *icon;
64         char *description_en;
65         char *description_de;
66         char *description_it;
67         char *description_fr;
68         char *previewpic1;
69         char *previewpic2;
70         char *author_name;
71         char *author_website;
72         char *version_major;
73         char *version_minor;
74         char *version_release;
75         char *version_build;
76         char *exec;
77         char *main_category;
78         char *subcategory1;
79         char *subcategory2;
80         char *altcategory;
81         char *altsubcategory1;
82         char *altsubcategory2;
83         char *osversion_major;
84         char *osversion_minor;
85         char *osversion_release;
86         char *osversion_build;
87         char *associationitem1_name;
88         char *associationitem1_filetype;
89         char *associationitem1_parameter;
90         char *associationitem2_name;
91         char *associationitem2_filetype;
92         char *associationitem2_parameter;
93         char *associationitem3_name;
94         char *associationitem3_filetype;
95         char *associationitem3_parameter;
96         char *clockspeed;
97         char *background;
98         char *startdir;
99
100 }  pnd_pxml_t;
101
102 #ifdef __cplusplus
103 } /* "C" */
104 #endif
105
106 #endif