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