070dada51e5b0bcbfb0906f916df46d2cc8f6c0f
[wimlib] / src / xml.h
1 #ifndef _WIMLIB_XML_H
2 #define _WIMLIB_XML_H
3
4 #include "util.h"
5
6 /* A struct wim_info structure corresponds to the entire XML data for a WIM file. */
7 struct wim_info {
8         u64 total_bytes;
9         int num_images;
10         /* Array of `struct image_info's, one for each image in the WIM that is
11          * mentioned in the XML data. */
12         struct image_info *images;
13 };
14
15 /* xml.c */
16 extern int
17 xml_export_image(const struct wim_info *old_wim_info, int image,
18                  struct wim_info **new_wim_info_p,
19                  const tchar *dest_image_name,
20                  const tchar *dest_image_description);
21
22 extern size_t
23 xml_get_max_image_name_len(const WIMStruct *w);
24
25 extern void
26 xml_update_image_info(WIMStruct *w, int image);
27
28 extern void
29 xml_delete_image(struct wim_info **wim_info_p, int image);
30
31 extern int
32 xml_add_image(WIMStruct *w, const tchar *name);
33
34 extern void
35 free_wim_info(struct wim_info *info);
36
37 extern void
38 print_image_info(const struct wim_info *wim_info, int image);
39
40 extern int
41 read_xml_data(FILE *fp, const struct resource_entry *res,
42               utf16lechar **xml_data_ret,
43               struct wim_info **info_ret);
44
45 extern int
46 write_xml_data(const struct wim_info *wim_info, int image, FILE *out,
47                u64 total_bytes, struct resource_entry *out_res_entry);
48
49 extern void
50 libxml_global_init();
51
52 extern void
53 libxml_global_cleanup();
54
55 static inline u64
56 wim_info_get_total_bytes(const struct wim_info *info)
57 {
58         return info->total_bytes;
59 }
60
61 static inline unsigned
62 wim_info_get_num_images(const struct wim_info *info)
63 {
64         return info->num_images;
65 }
66
67 #endif