source: projects/synaptic/trunk/common/rpackagecache.h @ 280

Revision 280, 1.8 KB checked in by yasumichi, 13 years ago (diff)

first import

Line 
1/* rpackagecache.h - package cache wrapper
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 _RPACKAGECACHE_H_
25#define _RPACKAGECACHE_H_
26
27
28
29#include <apt-pkg/depcache.h>
30#include <apt-pkg/sourcelist.h>
31#include <apt-pkg/pkgsystem.h>
32#include <apt-pkg/policy.h>
33
34class OpProgress;
35
36class pkgCache;
37
38
39class RPkgPolicy : public pkgPolicy
40{
41 public:
42   bool IsImportantDep(pkgCache::DepIterator dep);
43     
44   RPkgPolicy(pkgCache *Owner):
45      pkgPolicy(Owner) {};
46
47
48};
49
50class RPackageCache {
51   MMap *_map;
52
53   pkgCache *_cache;
54   RPkgPolicy *_policy;
55
56   pkgDepCache *_dcache;
57   pkgSourceList *_list;
58
59   bool _locked;
60
61 public:
62   inline pkgDepCache *deps() {
63      return _dcache;
64   };
65   inline pkgSourceList *list() {
66      return _list;
67   };
68
69   bool open(OpProgress &progress, bool lock=true);
70
71   vector<string> getPolicyArchives(bool filenames_only);
72
73   bool lock();
74   void releaseLock();
75
76   RPackageCache() 
77     : _map(0), _cache(0), _policy(0), _dcache(0), _locked(false) 
78   {
79      _list = new pkgSourceList();
80   };
81   ~RPackageCache() {
82      delete _list;
83   };
84};
85
86
87#endif
Note: See TracBrowser for help on using the repository browser.