Commit | Line | Data |
---|---|---|
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> | |
0a843901 | 30 | |
b2e465d6 AL |
31 | class pkgAcquire; |
32 | class pkgCacheGenerator; | |
33 | class OpProgress; | |
34 | class pkgIndexFile | |
35 | { | |
7db98ffc MZ |
36 | protected: |
37 | bool Trusted; | |
38 | ||
b2e465d6 AL |
39 | public: |
40 | ||
41 | class Type | |
42 | { | |
43 | public: | |
44 | ||
45 | // Global list of Items supported | |
46 | static Type **GlobalList; | |
47 | static unsigned long GlobalListLen; | |
48 | static Type *GetType(const char *Type); | |
49 | ||
50 | const char *Label; | |
51 | ||
db5c1b54 | 52 | virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator /*File*/) const {return 0;}; |
b2e465d6 | 53 | Type(); |
0432d731 | 54 | virtual ~Type() {}; |
b2e465d6 AL |
55 | }; |
56 | ||
57 | virtual const Type *GetType() const = 0; | |
58 | ||
59 | // Return descriptive strings of various sorts | |
8f3ba4e8 DK |
60 | virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const; |
61 | virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record, | |
b2e465d6 | 62 | pkgSrcRecords::File const &File) const; |
8f3ba4e8 | 63 | virtual std::string Describe(bool Short = false) const = 0; |
b2e465d6 AL |
64 | |
65 | // Interface for acquire | |
8f3ba4e8 | 66 | virtual std::string ArchiveURI(std::string /*File*/) const {return std::string();}; |
b2e465d6 AL |
67 | |
68 | // Interface for the record parsers | |
69 | virtual pkgSrcRecords::Parser *CreateSrcParser() const {return 0;}; | |
70 | ||
71 | // Interface for the Cache Generator | |
72 | virtual bool Exists() const = 0; | |
73 | virtual bool HasPackages() const = 0; | |
74 | virtual unsigned long Size() const = 0; | |
2e5f4e45 DK |
75 | virtual bool Merge(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const { return false; }; |
76 | __deprecated virtual bool Merge(pkgCacheGenerator &Gen, OpProgress &Prog) const | |
77 | { return Merge(Gen, &Prog); }; | |
78 | virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const {return true;}; | |
79 | __deprecated virtual bool MergeFileProvides(pkgCacheGenerator &Gen, OpProgress &Prog) const | |
80 | {return MergeFileProvides(Gen, &Prog);}; | |
b2e465d6 | 81 | virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; |
7db98ffc | 82 | |
770c32ec | 83 | static bool TranslationsAvailable(); |
a52f938b | 84 | static bool CheckLanguageCode(const char *Lang); |
8f3ba4e8 | 85 | static std::string LanguageCode(); |
a52f938b | 86 | |
7db98ffc | 87 | bool IsTrusted() const { return Trusted; }; |
b2e465d6 | 88 | |
7db98ffc | 89 | pkgIndexFile(bool Trusted): Trusted(Trusted) {}; |
b2e465d6 AL |
90 | virtual ~pkgIndexFile() {}; |
91 | }; | |
92 | ||
93 | #endif |