]> git.saurik.com Git - apt.git/blame - apt-pkg/indexfile.h
* merged with bubulle
[apt.git] / apt-pkg / indexfile.h
CommitLineData
b2e465d6
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
b3d44315 3// $Id: indexfile.h,v 1.6.2.1 2003/12/24 23:09:17 mdz Exp $
b2e465d6
AL
4/* ######################################################################
5
6 Index File - Abstraction for an index of archive/source file.
7
8 There are 3 primary sorts of index files, all represented by this
9 class:
10
11 Binary index files
12 Bianry index files decribing the local system
13 Source index files
14
15 They are all bundled together here, and the interfaces for
16 sources.list, acquire, cache gen and record parsing all use this class
17 to acess the underlying representation.
18
19 ##################################################################### */
20 /*}}}*/
21#ifndef PKGLIB_INDEXFILE_H
22#define PKGLIB_INDEXFILE_H
23
24#ifdef __GNUG__
25#pragma interface "apt-pkg/indexfile.h"
26#endif
27
28#include <string>
29#include <apt-pkg/pkgcache.h>
30#include <apt-pkg/srcrecords.h>
31#include <apt-pkg/pkgrecords.h>
32
0a843901
AL
33using std::string;
34
b2e465d6
AL
35class pkgAcquire;
36class pkgCacheGenerator;
37class OpProgress;
38class pkgIndexFile
39{
b3d44315
MV
40 protected:
41 bool Trusted;
42
b2e465d6
AL
43 public:
44
45 class Type
46 {
47 public:
48
49 // Global list of Items supported
50 static Type **GlobalList;
51 static unsigned long GlobalListLen;
52 static Type *GetType(const char *Type);
53
54 const char *Label;
55
db5c1b54 56 virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator /*File*/) const {return 0;};
b2e465d6 57 Type();
42ab8223 58 virtual ~Type() {};
b2e465d6
AL
59 };
60
61 virtual const Type *GetType() const = 0;
62
63 // Return descriptive strings of various sorts
64 virtual string ArchiveInfo(pkgCache::VerIterator Ver) const;
65 virtual string SourceInfo(pkgSrcRecords::Parser const &Record,
66 pkgSrcRecords::File const &File) const;
af87ab54 67 virtual string Describe(bool Short = false) const = 0;
b2e465d6
AL
68
69 // Interface for acquire
db5c1b54 70 virtual string ArchiveURI(string /*File*/) const {return string();};
b2e465d6
AL
71
72 // Interface for the record parsers
73 virtual pkgSrcRecords::Parser *CreateSrcParser() const {return 0;};
74
75 // Interface for the Cache Generator
76 virtual bool Exists() const = 0;
77 virtual bool HasPackages() const = 0;
78 virtual unsigned long Size() const = 0;
db5c1b54 79 virtual bool Merge(pkgCacheGenerator &/*Gen*/,OpProgress &/*Prog*/) const {return false;};
45415543 80 virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress &/*Prog*/) const {return true;};
b2e465d6 81 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
b3d44315
MV
82
83 bool IsTrusted() const { return Trusted; };
b2e465d6 84
b3d44315 85 pkgIndexFile(bool Trusted): Trusted(Trusted) {};
b2e465d6
AL
86 virtual ~pkgIndexFile() {};
87};
88
89#endif