]> git.saurik.com Git - apt.git/blob - apt-pkg/indexfile.h
BSD testing fixes
[apt.git] / apt-pkg / indexfile.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: indexfile.h,v 1.2 2001/02/20 07:03:17 jgg Exp $
4 /* ######################################################################
5
6 Index File - Abstraction for an index of archive/source file.
7
8 There are 3 primary sorts of index files, all represented by this
9 class:
10
11 Binary index files
12 Bianry index files decribing the local system
13 Source index files
14
15 They are all bundled together here, and the interfaces for
16 sources.list, acquire, cache gen and record parsing all use this class
17 to acess the underlying representation.
18
19 ##################################################################### */
20 /*}}}*/
21 #ifndef PKGLIB_INDEXFILE_H
22 #define PKGLIB_INDEXFILE_H
23
24 #ifdef __GNUG__
25 #pragma interface "apt-pkg/indexfile.h"
26 #endif
27
28 #include <string>
29 #include <apt-pkg/pkgcache.h>
30 #include <apt-pkg/srcrecords.h>
31 #include <apt-pkg/pkgrecords.h>
32
33 class pkgAcquire;
34 class pkgCacheGenerator;
35 class OpProgress;
36 class pkgIndexFile
37 {
38 public:
39
40 class Type
41 {
42 public:
43
44 // Global list of Items supported
45 static Type **GlobalList;
46 static unsigned long GlobalListLen;
47 static Type *GetType(const char *Type);
48
49 const char *Label;
50
51 virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator File) const {return 0;};
52 Type();
53 };
54
55 virtual const Type *GetType() const = 0;
56
57 // Return descriptive strings of various sorts
58 virtual string ArchiveInfo(pkgCache::VerIterator Ver) const;
59 virtual string SourceInfo(pkgSrcRecords::Parser const &Record,
60 pkgSrcRecords::File const &File) const;
61 virtual string Describe() const = 0;
62
63 // Interface for acquire
64 virtual string ArchiveURI(string File) const {return string();};
65 virtual bool GetIndexes(pkgAcquire *Owner) const;
66
67 // Interface for the record parsers
68 virtual pkgSrcRecords::Parser *CreateSrcParser() const {return 0;};
69
70 // Interface for the Cache Generator
71 virtual bool Exists() const = 0;
72 virtual bool HasPackages() const = 0;
73 virtual unsigned long Size() const = 0;
74 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const {return false;};
75 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
76
77 virtual ~pkgIndexFile() {};
78 };
79
80 #endif