]> git.saurik.com Git - apt.git/blame_incremental - apt-pkg/indexfile.h
* remove all the remaining #pragma implementation
[apt.git] / apt-pkg / indexfile.h
... / ...
CommitLineData
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3// $Id: indexfile.h,v 1.6.2.1 2003/12/24 23:09:17 mdz Exp $
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
25#include <string>
26#include <apt-pkg/pkgcache.h>
27#include <apt-pkg/srcrecords.h>
28#include <apt-pkg/pkgrecords.h>
29
30using std::string;
31
32class pkgAcquire;
33class pkgCacheGenerator;
34class OpProgress;
35class pkgIndexFile
36{
37 protected:
38 bool Trusted;
39
40 public:
41
42 class Type
43 {
44 public:
45
46 // Global list of Items supported
47 static Type **GlobalList;
48 static unsigned long GlobalListLen;
49 static Type *GetType(const char *Type);
50
51 const char *Label;
52
53 virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator /*File*/) const {return 0;};
54 Type();
55 virtual ~Type() {};
56 };
57
58 virtual const Type *GetType() const = 0;
59
60 // Return descriptive strings of various sorts
61 virtual string ArchiveInfo(pkgCache::VerIterator Ver) const;
62 virtual string SourceInfo(pkgSrcRecords::Parser const &Record,
63 pkgSrcRecords::File const &File) const;
64 virtual string Describe(bool Short = false) const = 0;
65
66 // Interface for acquire
67 virtual string ArchiveURI(string /*File*/) const {return string();};
68
69 // Interface for the record parsers
70 virtual pkgSrcRecords::Parser *CreateSrcParser() const {return 0;};
71
72 // Interface for the Cache Generator
73 virtual bool Exists() const = 0;
74 virtual bool HasPackages() const = 0;
75 virtual unsigned long Size() const = 0;
76 virtual bool Merge(pkgCacheGenerator &/*Gen*/,OpProgress &/*Prog*/) const {return false;};
77 virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress &/*Prog*/) const {return true;};
78 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
79
80 bool IsTrusted() const { return Trusted; };
81
82 pkgIndexFile(bool Trusted): Trusted(Trusted) {};
83 virtual ~pkgIndexFile() {};
84};
85
86#endif