]> git.saurik.com Git - apt.git/blob - apt-pkg/indexfile.h
fail early (again) on gpg sig failures
[apt.git] / apt-pkg / indexfile.h
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 4 primary sorts of index files, all represented by this
9 class:
10
11 Binary index files
12 Binary translation files
13 Binary index files describing 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 access the underlying representation.
19
20 ##################################################################### */
21 /*}}}*/
22 #ifndef PKGLIB_INDEXFILE_H
23 #define PKGLIB_INDEXFILE_H
24
25 #include <apt-pkg/srcrecords.h>
26 #include <apt-pkg/pkgrecords.h>
27 #include <apt-pkg/pkgcache.h>
28 #include <apt-pkg/cacheiterators.h>
29 #include <apt-pkg/macros.h>
30
31 #include <string>
32
33 #ifndef APT_8_CLEANER_HEADERS
34 using std::string;
35 #endif
36 #ifndef APT_10_CLEANER_HEADERS
37 class pkgAcquire;
38 #endif
39
40 class pkgCacheGenerator;
41 class OpProgress;
42
43 class pkgIndexFile
44 {
45 protected:
46 bool Trusted;
47
48 public:
49
50 class Type
51 {
52 public:
53
54 // Global list of Items supported
55 static Type **GlobalList;
56 static unsigned long GlobalListLen;
57 static Type *GetType(const char *Type) APT_PURE;
58
59 const char *Label;
60
61 virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator /*File*/) const {return 0;};
62 virtual pkgSrcRecords::Parser *CreateSrcPkgParser(std::string /*File*/) const {return 0;};
63 Type();
64 virtual ~Type() {};
65 };
66
67 virtual const Type *GetType() const = 0;
68
69 // Return descriptive strings of various sorts
70 virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const;
71 virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
72 pkgSrcRecords::File const &File) const;
73 virtual std::string Describe(bool Short = false) const = 0;
74
75 // Interface for acquire
76 virtual std::string ArchiveURI(std::string /*File*/) const {return std::string();};
77
78 // Interface for the record parsers
79 virtual pkgSrcRecords::Parser *CreateSrcParser() const {return 0;};
80
81 // Interface for the Cache Generator
82 virtual bool Exists() const = 0;
83 virtual bool HasPackages() const = 0;
84 virtual unsigned long Size() const = 0;
85 virtual bool Merge(pkgCacheGenerator &/*Gen*/, OpProgress* /*Prog*/) const { return false; };
86 APT_DEPRECATED virtual bool Merge(pkgCacheGenerator &Gen, OpProgress &Prog) const
87 { return Merge(Gen, &Prog); };
88 virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const {return true;};
89 APT_DEPRECATED virtual bool MergeFileProvides(pkgCacheGenerator &Gen, OpProgress &Prog) const
90 {return MergeFileProvides(Gen, &Prog);};
91 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
92
93 static bool TranslationsAvailable();
94 static bool CheckLanguageCode(const char *Lang);
95 static std::string LanguageCode();
96
97 bool IsTrusted() const { return Trusted; };
98
99 pkgIndexFile(bool Trusted): Trusted(Trusted) {};
100 virtual ~pkgIndexFile() {};
101 };
102
103 #endif