]> git.saurik.com Git - apt.git/blame - apt-pkg/indexfile.h
test Release file handling with expired keys
[apt.git] / apt-pkg / indexfile.h
CommitLineData
b2e465d6
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
7db98ffc 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
a52f938b 8 There are 4 primary sorts of index files, all represented by this
b2e465d6
AL
9 class:
10
11 Binary index files
a52f938b 12 Binary translation files
b2e465d6
AL
13 Bianry index files decribing the local system
14 Source index files
15
16 They are all bundled together here, and the interfaces for
17 sources.list, acquire, cache gen and record parsing all use this class
18 to acess the underlying representation.
19
20 ##################################################################### */
21 /*}}}*/
22#ifndef PKGLIB_INDEXFILE_H
23#define PKGLIB_INDEXFILE_H
24
b2e465d6
AL
25
26#include <string>
27#include <apt-pkg/pkgcache.h>
28#include <apt-pkg/srcrecords.h>
29#include <apt-pkg/pkgrecords.h>
472ff00e 30#include <apt-pkg/macros.h>
0a843901 31
a4f6bdc8
DK
32#ifndef APT_8_CLEANER_HEADERS
33using std::string;
34#endif
35
b2e465d6
AL
36class pkgAcquire;
37class pkgCacheGenerator;
38class OpProgress;
472ff00e 39
b2e465d6
AL
40class pkgIndexFile
41{
7db98ffc
MZ
42 protected:
43 bool Trusted;
44
b2e465d6
AL
45 public:
46
47 class Type
48 {
49 public:
50
51 // Global list of Items supported
52 static Type **GlobalList;
53 static unsigned long GlobalListLen;
54 static Type *GetType(const char *Type);
55
56 const char *Label;
57
db5c1b54 58 virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator /*File*/) const {return 0;};
b2e465d6 59 Type();
0432d731 60 virtual ~Type() {};
b2e465d6
AL
61 };
62
63 virtual const Type *GetType() const = 0;
64
65 // Return descriptive strings of various sorts
8f3ba4e8
DK
66 virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const;
67 virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
b2e465d6 68 pkgSrcRecords::File const &File) const;
8f3ba4e8 69 virtual std::string Describe(bool Short = false) const = 0;
b2e465d6
AL
70
71 // Interface for acquire
8f3ba4e8 72 virtual std::string ArchiveURI(std::string /*File*/) const {return std::string();};
b2e465d6
AL
73
74 // Interface for the record parsers
75 virtual pkgSrcRecords::Parser *CreateSrcParser() const {return 0;};
76
77 // Interface for the Cache Generator
78 virtual bool Exists() const = 0;
79 virtual bool HasPackages() const = 0;
80 virtual unsigned long Size() const = 0;
2e5f4e45
DK
81 virtual bool Merge(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const { return false; };
82 __deprecated virtual bool Merge(pkgCacheGenerator &Gen, OpProgress &Prog) const
83 { return Merge(Gen, &Prog); };
84 virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const {return true;};
85 __deprecated virtual bool MergeFileProvides(pkgCacheGenerator &Gen, OpProgress &Prog) const
86 {return MergeFileProvides(Gen, &Prog);};
b2e465d6 87 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
7db98ffc 88
770c32ec 89 static bool TranslationsAvailable();
a52f938b 90 static bool CheckLanguageCode(const char *Lang);
8f3ba4e8 91 static std::string LanguageCode();
a52f938b 92
7db98ffc 93 bool IsTrusted() const { return Trusted; };
b2e465d6 94
7db98ffc 95 pkgIndexFile(bool Trusted): Trusted(Trusted) {};
b2e465d6
AL
96 virtual ~pkgIndexFile() {};
97};
98
99#endif