]> cygwin.com Git - cygwin-apps/setup.git/blob - package_meta.h
2001-11-30 Robert Collins <rbtcollins@hotmail.com>
[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 class category;
22
23 /* Required to parse this completely */
24 #include "list.h"
25 #include "strings.h"
26 #include "category.h"
27
28 /*
29 For cleanliness this may need to be put in its own file later. */
30 class CategoryPackage
31 {
32 public:
33 CategoryPackage (Category & cat):key (cat), pkg (0)
34 {
35 next = cat.packages;
36 cat.packages = this;
37 };
38 Category & key;
39 CategoryPackage *next; /* The next package pointer in the list */
40 packagemeta *pkg;
41 };
42
43
44 /* NOTE: A packagemeta without 1 packageversion is invalid! */
45 class packagemeta
46 {
47 public:
48 packagemeta (char const *pkgname):installed_from (0),
49 //versions (0),
50 // versioncount (0), versionspace (0),
51 installed (0), prev (0), prevtimestamp (0), curr (0), currtimestamp (0),
52 exp (0), exptimestamp (0), desired (0)
53 {
54 name = new char[strlen (pkgname) + 1];
55 strcpy (name, pkgname);
56 };
57
58 packagemeta (char const *pkgname,
59 char const *installedfrom):installed_from (0),
60 //versions (0), versioncount (0), versionspace (0),
61
62 installed (0), prev (0), prevtimestamp (0), curr (0), currtimestamp (0),
63 exp (0), exptimestamp (0), desired (0)
64 {
65 name = new char[strlen (pkgname) + 1];
66 strcpy (name, pkgname);
67 installed_from = new char[strlen (installedfrom) + 1];
68 strcpy (installed_from, installedfrom);
69 };
70
71
72 ~packagemeta ()
73 {
74 delete name;
75 if (installed_from)
76 delete installed_from;
77 };
78
79 void add_version (packageversion &);
80 void set_installed (packageversion &);
81 void uninstall ();
82
83 char *name; /* package name, like "cygwin" */
84 /* legacy variable used to output data for installed.db versions <= 2 */
85 char *installed_from;
86 /* SDesc is global in theory, across all package versions.
87 LDesc is not: it can be different per version */
88 char const *SDesc ();
89 /* what categories does this package belong in. Note that if multiple versions
90 * of a package disagree.... the first one read in will take precedence.
91 */
92 void add_category (Category &);
93 list < CategoryPackage, Category &, Categorycmp > Categories;
94
95 list < packageversion, char const *, strcasecmp > versions;
96 /* which one is installed. */
97 packageversion *installed;
98 /* which one is listed as "prev" in our available packages db */
99 packageversion *prev;
100 /* And what was the timestamp of the ini it was found from */
101 unsigned int prevtimestamp;
102 /* ditto for current - stable */
103 packageversion *curr;
104 unsigned int currtimestamp;
105 /* and finally the experimental version */
106 packageversion *exp;
107 unsigned int exptimestamp;
108 /* Now for the user stuff :] */
109 /* What version does the user want ? */
110 packageversion *desired;
111 };
112
113 #endif /* _PACKAGE_META_H_ */
This page took 0.03955 seconds and 5 git commands to generate.