]> git.saurik.com Git - apt.git/blob - apt-pkg/pkgrecords.h
Sync
[apt.git] / apt-pkg / pkgrecords.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: pkgrecords.h,v 1.2 1998/10/08 04:55:00 jgg Exp $
4 /* ######################################################################
5
6 Package Records - Allows access to complete package description records
7 directly from the file.
8
9 The package record system abstracts the actual parsing of the
10 package files. This is different than the generators parser in that
11 it is used to access information not generate information. No
12 information touched by the generator should be parable from here as
13 it can always be retreived directly from the cache.
14
15 ##################################################################### */
16 /*}}}*/
17 // Header section: pkglib
18 #ifndef PKGLIB_PKGRECORDS_H
19 #define PKGLIB_PKGRECORDS_H
20
21 #ifdef __GNUG__
22 #pragma interface "apt-pkg/pkgrecords.h"
23 #endif
24
25 #include <apt-pkg/pkgcache.h>
26 #include <apt-pkg/fileutl.h>
27
28 class pkgRecords
29 {
30 public:
31 class Parser;
32
33 private:
34
35 pkgCache &Cache;
36
37 // List of package files
38 struct PkgFile
39 {
40 FileFd *File;
41 Parser *Parse;
42
43 PkgFile() : File(0), Parse(0) {};
44 ~PkgFile();
45 };
46 PkgFile *Files;
47
48 public:
49
50 // Lookup function
51 Parser &Lookup(pkgCache::VerFileIterator &Ver);
52
53 // Construct destruct
54 pkgRecords(pkgCache &Cache);
55 ~pkgRecords();
56 };
57
58 class pkgRecords::Parser
59 {
60 protected:
61
62 virtual bool Jump(pkgCache::VerFileIterator &Ver) = 0;
63
64 public:
65 friend pkgRecords;
66
67 // These refer to the archive file for the Version
68 virtual string FileName() {return string();};
69 virtual string MD5Hash() {return string();};
70
71 // These are some general stats about the package
72 virtual string Maintainer() {return string();};
73 virtual string ShortDesc() {return string();};
74 virtual string LongDesc() {return string();};
75
76 virtual ~Parser() {};
77 };
78
79 #endif