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