]> cygwin.com Git - cygwin-apps/setup.git/blob - package_meta.h
8af4390cb09beb9f487f0d30ab5037a45a26feb6
[cygwin-apps/setup.git] / package_meta.h
1 /*
2 * Copyright (c) 2001, Robert Collins.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by Robert Collins <rbtcollins@hotmail.com>
13 *
14 */
15
16 #ifndef _PACKAGE_META_H_
17 #define _PACKAGE_META_H_
18
19 class packageversion;
20 class packagemeta;
21
22 /* Required to parse this completely */
23 #include "category_list.h"
24 #include "list.h"
25 #include "strings.h"
26
27 /*
28 For cleanliness this may need to be put in its own file later. */
29 class CategoryPackage
30 {
31 public:
32 CategoryPackage (packagemeta & package):next (0), pkg (package)
33 {
34 };
35 CategoryPackage *next; /* The next package pointer in the list */
36 packagemeta & pkg;
37 };
38
39
40 /* NOTE: A packagemeta without 1 packageversion is invalid! */
41 class packagemeta
42 {
43 public:
44 packagemeta (char const *pkgname):installed_from (0),
45 //versions (0),
46 // versioncount (0), versionspace (0),
47 installed (0), prev (0), prevtimestamp (0), curr (0), currtimestamp (0),
48 exp (0), exptimestamp (0), desired (0)
49 {
50 name = new char[strlen (pkgname) + 1];
51 strcpy (name, pkgname);
52 };
53
54 packagemeta (char const *pkgname,
55 char const *installedfrom):installed_from (0),
56 //versions (0), versioncount (0), versionspace (0),
57
58 installed (0), prev (0), prevtimestamp (0), curr (0), currtimestamp (0),
59 exp (0), exptimestamp (0), desired (0)
60 {
61 name = new char[strlen (pkgname) + 1];
62 strcpy (name, pkgname);
63 installed_from = new char[strlen (installedfrom) + 1];
64 strcpy (installed_from, installedfrom);
65 };
66
67
68 ~packagemeta ()
69 {
70 delete name;
71 if (installed_from)
72 delete installed_from;
73 };
74
75 void add_version (packageversion &);
76 void set_installed (packageversion &);
77 void uninstall ();
78
79 char *name; /* package name, like "cygwin" */
80 /* legacy variable used to output data for installed.db versions <= 2 */
81 char *installed_from;
82 /* SDesc is global in theory, across all package versions.
83 LDesc is not: it can be different per version */
84 char const *SDesc ();
85 /* what categories does this package belong in. Note that if multiple versions
86 * of a package disagree.... the first one read in will take precedence.
87 */
88 CategoryList & Categories ()
89 {
90 return categories;
91 };
92 /* Add a known category to this objects category list.
93 */
94 void add_category (Category &);
95
96 list < packageversion, char const *, strcasecmp > versions;
97 /* which one is installed. */
98 packageversion *installed;
99 /* which one is listed as "prev" in our available packages db */
100 packageversion *prev;
101 /* And what was the timestamp of the ini it was found from */
102 unsigned int prevtimestamp;
103 /* ditto for current - stable */
104 packageversion *curr;
105 unsigned int currtimestamp;
106 /* and finally the experimental version */
107 packageversion *exp;
108 unsigned int exptimestamp;
109 /* Now for the user stuff :] */
110 /* What version does the user want ? */
111 packageversion *desired;
112 private:
113 CategoryList categories;
114 };
115
116 #endif /* _PACKAGE_META_H_ */
This page took 0.104356 seconds and 4 git commands to generate.