Rev 5728 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5728 | Rev 5809 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include "tinyxml/tinyxml.h" |
1 | #include "tinyxml/tinyxml.h" |
2 | #include "package.h" |
2 | #include "package.h" |
Line -... | Line 3... | ||
- | 3 | ||
3 | 4 | // *INDENT-OFF* |
|
4 | const char *key_collection = "collection"; |
5 | const char *key_collection = "collection"; |
5 | const char *key_package = "package"; |
6 | const char *key_package = "package"; |
6 | const char *key_name = "name"; |
7 | const char *key_name = "name"; |
- | 8 | const char *key_version = "version"; |
|
7 | const char *key_version = "version"; |
9 | const char *key_group = "group"; |
8 | const char *key_description = "description"; |
10 | const char *key_description = "description"; |
9 | const char *key_title = "title"; |
11 | const char *key_title = "title"; |
10 | const char *key_release = "release"; |
12 | const char *key_release = "release"; |
- | 13 | const char *key_file = "file"; |
|
Line 11... | Line 14... | ||
11 | const char *key_file = "file"; |
14 | // *INDENT-ON* |
Line -... | Line 15... | ||
- | 15 | ||
12 | 16 | int package_id; |
|
13 | int package_id; |
17 | |
14 | 18 | collection_t * |
|
15 | void parse_group(pkg_group_t* gr, TiXmlElement *xmlgroup) |
19 | load_collection_file(const char *name) |
- | 20 | { |
|
Line -... | Line 21... | ||
- | 21 | TiXmlDocument doc; |
|
16 | { |
22 | TiXmlElement *col; |
17 | TiXmlElement *xmlpkg; |
23 | collection_t *collection = NULL; |
18 | TiXmlElement *xmle; |
24 | |
19 | 25 | doc.LoadFile(name); |
|
- | 26 | col = doc.FirstChildElement(key_collection); |
|
Line 20... | Line 27... | ||
20 | xmlpkg = xmlgroup->FirstChildElement(key_package); |
27 | if (col) |
- | 28 | { |
|
Line 21... | Line -... | ||
21 | while (xmlpkg) |
- | |
22 | { |
- | |
23 | package_t *pkg; |
29 | TiXmlElement *xmlpkg; |
24 | - | ||
Line 25... | Line 30... | ||
25 | pkg = (package_t*)malloc(sizeof(package_t)); |
30 | TiXmlElement *xmle; |
- | 31 | ||
26 | 32 | collection = (collection_t *) malloc(sizeof(collection_t)); |
|
Line 27... | Line 33... | ||
27 | INIT_LIST_HEAD(&pkg->file_list); |
33 | INIT_LIST_HEAD(&collection->packages); |
28 | pkg->id = package_id++; |
- | |
Line 29... | Line -... | ||
29 | pkg->name = strdup(xmlpkg->Attribute(key_name)); |
- | |
30 | pkg->version = strdup(xmlpkg->Attribute(key_version)); |
34 | |
31 | - | ||
32 | xmle = xmlpkg->FirstChildElement(key_description); |
- | |
Line -... | Line 35... | ||
- | 35 | xmlpkg = col->FirstChildElement(key_package); |
|
- | 36 | ||
- | 37 | while (xmlpkg) |
|
- | 38 | { |
|
Line 33... | Line 39... | ||
33 | pkg->description = strdup(xmle->Attribute(key_title)); |
39 | package_t *pkg; |
34 | - | ||
35 | xmle = xmlpkg->FirstChildElement(key_release); |
- | |
36 | pkg->filename = strdup(xmle->Attribute(key_file)); |
- | |
37 | 40 | ||
Line 38... | Line -... | ||
38 | list_add_tail(&pkg->list, &gr->packages); |
- | |
39 | xmlpkg = xmlpkg->NextSiblingElement(); |
41 | pkg = (package_t *) malloc(sizeof(package_t)); |
40 | }; |
- | |
41 | }; |
- | |
42 | - | ||
43 | - | ||
44 | collection_t* load_collection_file(const char *name) |
- | |
45 | { |
42 | |
46 | TiXmlDocument doc; |
- | |
47 | TiXmlElement *col; |
- | |
48 | collection_t *collection = NULL; |
- | |
Line 49... | Line -... | ||
49 | - | ||
50 | doc.LoadFile(name); |
- | |
51 | col = doc.FirstChildElement(key_collection); |
- | |
52 | if (col) |
- | |
53 | { |
- | |
54 | collection = (collection_t*)malloc(sizeof(collection_t)); |
43 | INIT_LIST_HEAD(&pkg->file_list); |
55 | INIT_LIST_HEAD(&collection->groups); |
44 | |
56 | 45 | pkg->id = package_id++; |
|
57 | TiXmlElement* xmlgroup = col->FirstChildElement(); |
46 | pkg->name = strdup(xmlpkg->Attribute(key_name)); |
58 | if (xmlgroup) |
- | |
59 | { |
- | |
60 | pkg_group_t *gr; |
- | |
61 | - | ||
Line -... | Line 47... | ||
- | 47 | pkg->version = strdup(xmlpkg->Attribute(key_version)); |
|
- | 48 | pkg->group = strdup(xmlpkg->Attribute(key_group)); |