]> git.saurik.com Git - apt.git/blame - apt-pkg/indexfile.h
Merge remote-tracking branch 'upstream/debian/sid' into debian/experimental
[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
1e3f4083 13 Binary index files describing the local system
b2e465d6
AL
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
1e3f4083 18 to access the underlying representation.
b2e465d6
AL
19
20 ##################################################################### */
21 /*}}}*/
22#ifndef PKGLIB_INDEXFILE_H
23#define PKGLIB_INDEXFILE_H
24
b2e465d6
AL
25#include <apt-pkg/srcrecords.h>
26#include <apt-pkg/pkgrecords.h>
453b82a3
DK
27#include <apt-pkg/pkgcache.h>
28#include <apt-pkg/cacheiterators.h>
472ff00e 29#include <apt-pkg/macros.h>
0a843901 30
453b82a3
DK
31#include <string>
32
a4f6bdc8
DK
33#ifndef APT_8_CLEANER_HEADERS
34using std::string;
35#endif
453b82a3 36#ifndef APT_10_CLEANER_HEADERS
b2e465d6 37class pkgAcquire;
453b82a3
DK
38#endif
39
b2e465d6
AL
40class pkgCacheGenerator;
41class OpProgress;
472ff00e 42
b2e465d6
AL
43class pkgIndexFile
44{
7db98ffc
MZ
45 protected:
46 bool Trusted;
47
b2e465d6
AL
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;
a02db58f 57 static Type *GetType(const char *Type) APT_PURE;
b2e465d6
AL
58
59 const char *Label;
60
db5c1b54 61 virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator /*File*/) const {return 0;};
a49e7948 62 virtual pkgSrcRecords::Parser *CreateSrcPkgParser(std::string /*File*/) const {return 0;};
b2e465d6 63 Type();
0432d731 64 virtual ~Type() {};
b2e465d6
AL
65 };
66
67 virtual const Type *GetType() const = 0;
68
69 // Return descriptive strings of various sorts
8f3ba4e8
DK
70 virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const;
71 virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
b2e465d6 72 pkgSrcRecords::File const &File) const;
8f3ba4e8 73 virtual std::string Describe(bool Short = false) const = 0;
b2e465d6
AL
74
75 // Interface for acquire
8f3ba4e8 76 virtual std::string ArchiveURI(std::string /*File*/) const {return std::string();};
b2e465d6
AL
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;
65512241 85 virtual bool Merge(pkgCacheGenerator &/*Gen*/, OpProgress* /*Prog*/) const { return false; };
453b82a3 86 APT_DEPRECATED virtual bool Merge(pkgCacheGenerator &Gen, OpProgress &Prog) const
2e5f4e45 87 { return Merge(Gen, &Prog); };
65512241 88 virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const {return true;};
453b82a3 89 APT_DEPRECATED virtual bool MergeFileProvides(pkgCacheGenerator &Gen, OpProgress &Prog) const
2e5f4e45 90 {return MergeFileProvides(Gen, &Prog);};
b2e465d6 91 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
7db98ffc 92
770c32ec 93 static bool TranslationsAvailable();
a52f938b 94 static bool CheckLanguageCode(const char *Lang);
8f3ba4e8 95 static std::string LanguageCode();
a52f938b 96
7db98ffc 97 bool IsTrusted() const { return Trusted; };
b2e465d6 98
7db98ffc 99 pkgIndexFile(bool Trusted): Trusted(Trusted) {};
b2e465d6
AL
100 virtual ~pkgIndexFile() {};
101};
102
103#endif