]>
Commit | Line | Data |
---|---|---|
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 | ||
c93bc6d0 MB |
16 | #ifndef SETUP_PACKAGE_DB_H |
17 | #define SETUP_PACKAGE_DB_H | |
7939f6d1 | 18 | |
4fe323f9 | 19 | /* required to parse this file */ |
3c054baf | 20 | #include <String++.h> |
0cf68afd RC |
21 | #include <vector> |
22 | #include <map> | |
0cf68afd | 23 | #include "category.h" |
7939f6d1 | 24 | class packagemeta; |
7b606ae5 | 25 | class io_stream; |
3c196821 | 26 | class PackageSpecification; |
7939f6d1 | 27 | |
cbfc4215 RC |
28 | typedef enum { |
29 | PackageDB_Install, | |
30 | PackageDB_Download | |
31 | } PackageDBActions; | |
32 | ||
ad646f43 RC |
33 | |
34 | class packagedb; | |
35 | typedef std::vector <packagemeta *>::iterator PackageDBConnectedIterator; | |
36 | ||
7939f6d1 RC |
37 | /*TODO: add mutexs */ |
38 | class packagedb | |
39 | { | |
40 | public: | |
41 | packagedb (); | |
7c7034e8 RC |
42 | /* 0 on success */ |
43 | int flush (); | |
3c196821 RC |
44 | packagemeta * findBinary (PackageSpecification const &) const; |
45 | packagemeta * findSource (PackageSpecification const &) const; | |
ad646f43 RC |
46 | PackageDBConnectedIterator connectedBegin(); |
47 | PackageDBConnectedIterator connectedEnd(); | |
2f18f94d | 48 | void fillMissingCategory(); |
8c242540 | 49 | void markUnVisited(); |
31f0ccce | 50 | void setExistence(); |
08cd08c3 | 51 | /* all seen binary packages */ |
666bf37d | 52 | static std::vector < packagemeta *> packages; |
08cd08c3 | 53 | /* all seen source packages */ |
666bf37d | 54 | static std::vector <packagemeta *> sourcePackages; |
7b606ae5 | 55 | /* all seen categories */ |
666bf37d | 56 | typedef std::map <String, std::vector <packagemeta *>, String::caseless > categoriesType; |
0cf68afd | 57 | static categoriesType categories; |
cbfc4215 | 58 | static PackageDBActions task; |
7939f6d1 | 59 | private: |
7939f6d1 | 60 | static int installeddbread; /* do we have to reread this */ |
ad646f43 RC |
61 | friend class ConnectedLoopFinder; |
62 | static std::vector <packagemeta *> dependencyOrderedPackages; | |
7939f6d1 RC |
63 | }; |
64 | ||
c93bc6d0 | 65 | #endif /* SETUP_PACKAGE_DB_H */ |