]> cygwin.com Git - cygwin-apps/setup.git/blame - package_meta.h
2001-11-30 Robert Collins <rbtcollins@hotmail.com>
[cygwin-apps/setup.git] / package_meta.h
CommitLineData
7939f6d1
RC
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
fa0c0d10 19class packageversion;
bb849dbd 20class packagemeta;
4fe323f9 21class category;
7939f6d1 22
bb849dbd 23/* Required to parse this completely */
bb849dbd
RC
24#include "list.h"
25#include "strings.h"
4fe323f9 26#include "category.h"
bb849dbd
RC
27
28/*
29 For cleanliness this may need to be put in its own file later. */
30class CategoryPackage
31{
32public:
4fe323f9 33 CategoryPackage (Category & cat):key (cat), pkg (0)
bb849dbd 34 {
4fe323f9
RC
35 next = cat.packages;
36 cat.packages = this;
bb849dbd 37 };
4fe323f9 38 Category & key;
bb849dbd 39 CategoryPackage *next; /* The next package pointer in the list */
4fe323f9 40 packagemeta *pkg;
bb849dbd
RC
41};
42
43
44/* NOTE: A packagemeta without 1 packageversion is invalid! */
7939f6d1
RC
45class packagemeta
46{
47public:
bb849dbd
RC
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)
7939f6d1
RC
53 {
54 name = new char[strlen (pkgname) + 1];
55 strcpy (name, pkgname);
56 };
fa0c0d10
RC
57
58 packagemeta (char const *pkgname,
bb849dbd
RC
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)
fa0c0d10
RC
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
7939f6d1
RC
72 ~packagemeta ()
73 {
74 delete name;
fa0c0d10
RC
75 if (installed_from)
76 delete installed_from;
7939f6d1
RC
77 };
78
fa0c0d10
RC
79 void add_version (packageversion &);
80 void set_installed (packageversion &);
81 void uninstall ();
7939f6d1 82
bb849dbd 83 char *name; /* package name, like "cygwin" */
fa0c0d10
RC
84 /* legacy variable used to output data for installed.db versions <= 2 */
85 char *installed_from;
bb849dbd
RC
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 */
bb849dbd 92 void add_category (Category &);
4fe323f9 93 list < CategoryPackage, Category &, Categorycmp > Categories;
fa0c0d10 94
bb849dbd 95 list < packageversion, char const *, strcasecmp > versions;
7939f6d1 96 /* which one is installed. */
fa0c0d10 97 packageversion *installed;
7939f6d1 98 /* which one is listed as "prev" in our available packages db */
fa0c0d10 99 packageversion *prev;
bb849dbd
RC
100 /* And what was the timestamp of the ini it was found from */
101 unsigned int prevtimestamp;
7939f6d1 102 /* ditto for current - stable */
fa0c0d10 103 packageversion *curr;
bb849dbd 104 unsigned int currtimestamp;
7939f6d1 105 /* and finally the experimental version */
fa0c0d10 106 packageversion *exp;
bb849dbd
RC
107 unsigned int exptimestamp;
108 /* Now for the user stuff :] */
109 /* What version does the user want ? */
110 packageversion *desired;
7939f6d1
RC
111};
112
113#endif /* _PACKAGE_META_H_ */
This page took 0.087729 seconds and 5 git commands to generate.