1 | /* raptoptions.h - configuration handling |
---|
2 | * |
---|
3 | * Copyright (c) 2000, 2001 Conectiva S/A |
---|
4 | * |
---|
5 | * Author: Alfredo K. Kojima <kojima@conectiva.com.br> |
---|
6 | * |
---|
7 | * This program is free software; you can redistribute it and/or |
---|
8 | * modify it under the terms of the GNU General Public License as |
---|
9 | * published by the Free Software Foundation; either version 2 of the |
---|
10 | * License, or (at your option) any later version. |
---|
11 | * |
---|
12 | * This program is distributed in the hope that it will be useful, |
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | * GNU General Public License for more details. |
---|
16 | * |
---|
17 | * You should have received a copy of the GNU General Public License |
---|
18 | * along with this program; if not, write to the Free Software |
---|
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
---|
20 | * USA |
---|
21 | */ |
---|
22 | |
---|
23 | |
---|
24 | #ifndef _RAPTOPTIONS_H_ |
---|
25 | #define _RAPTOPTIONS_H_ |
---|
26 | |
---|
27 | #include <map> |
---|
28 | #include <string> |
---|
29 | #include <apt-pkg/configuration.h> |
---|
30 | |
---|
31 | using namespace std; |
---|
32 | |
---|
33 | class RAPTOptions { |
---|
34 | public: |
---|
35 | |
---|
36 | class packageOptions { |
---|
37 | public: |
---|
38 | packageOptions() |
---|
39 | : |
---|
40 | isLocked(false), isOrphaned(false), isNew(false), |
---|
41 | isDebconf(false) { |
---|
42 | }; |
---|
43 | bool isLocked; |
---|
44 | bool isOrphaned; |
---|
45 | bool isNew; |
---|
46 | bool isDebconf; |
---|
47 | }; |
---|
48 | |
---|
49 | bool store(); |
---|
50 | bool restore(); |
---|
51 | |
---|
52 | bool getPackageLock(const char *package); |
---|
53 | void setPackageLock(const char *package, bool lock); |
---|
54 | |
---|
55 | bool getPackageDebconf(const char *package); |
---|
56 | void setPackageDebconf(const char *package, bool flag = true); |
---|
57 | void rereadDebconf(); |
---|
58 | |
---|
59 | bool getPackageOrphaned(const char *package); |
---|
60 | void setPackageOrphaned(const char *package, bool flag = true); |
---|
61 | void rereadOrphaned(); |
---|
62 | |
---|
63 | bool getPackageNew(const char *package); |
---|
64 | void setPackageNew(const char *package, bool flag = true); |
---|
65 | void forgetNewPackages(); |
---|
66 | |
---|
67 | bool getFlag(const char *key); |
---|
68 | string getString(const char *key); |
---|
69 | |
---|
70 | void setFlag(const char *key, bool value); |
---|
71 | void setString(const char *key, string value); |
---|
72 | |
---|
73 | private: |
---|
74 | map<string, packageOptions> _packageOptions; |
---|
75 | map<string, string> _options; |
---|
76 | }; |
---|
77 | |
---|
78 | extern RAPTOptions *_roptions; |
---|
79 | |
---|
80 | typedef map<string, RAPTOptions::packageOptions>::iterator packageOptionsIter; |
---|
81 | |
---|
82 | ostream &operator<<(ostream &os, const RAPTOptions::packageOptions &); |
---|
83 | istream &operator>>(istream &is, RAPTOptions::packageOptions &o); |
---|
84 | |
---|
85 | #endif |
---|