]> cygwin.com Git - cygwin-apps/setup.git/blob - package_db.h
2003-03-16 Robert Collins <rbtcollins@hotmail.com>
[cygwin-apps/setup.git] / package_db.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_DB_H_
17 #define _PACKAGE_DB_H_
18
19 /* required to parse this file */
20 #include <String++.h>
21 #include <vector>
22 #include <map>
23 #include "category.h"
24 class packagemeta;
25 class io_stream;
26 class PackageSpecification;
27
28 typedef enum {
29 PackageDB_Install,
30 PackageDB_Download
31 } PackageDBActions;
32
33
34 class packagedb;
35 typedef std::vector <packagemeta *>::iterator PackageDBConnectedIterator;
36
37 /*TODO: add mutexs */
38 class packagedb
39 {
40 public:
41 packagedb ();
42 /* 0 on success */
43 int flush ();
44 packagemeta * findBinary (PackageSpecification const &) const;
45 packagemeta * findSource (PackageSpecification const &) const;
46 PackageDBConnectedIterator connectedBegin();
47 PackageDBConnectedIterator connectedEnd();
48 /* all seen binary packages */
49 static std::vector < packagemeta *> packages;
50 /* all seen source packages */
51 static std::vector <packagemeta *> sourcePackages;
52 /* all seen categories */
53 typedef std::map <String, std::vector <packagemeta *>, String::caseless > categoriesType;
54 static categoriesType categories;
55 static PackageDBActions task;
56 private:
57 static int installeddbread; /* do we have to reread this */
58 friend class ConnectedLoopFinder;
59 static std::vector <packagemeta *> dependencyOrderedPackages;
60 };
61
62 #endif /* _PACKAGE_DB_H_ */
This page took 0.034664 seconds and 5 git commands to generate.