]>
Commit | Line | Data |
---|---|---|
da6ee469 JF |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
3 | // $Id: pkgrecords.h,v 1.6 2001/03/13 06:51:46 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 | #ifndef PKGLIB_PKGRECORDS_H | |
18 | #define PKGLIB_PKGRECORDS_H | |
19 | ||
da6ee469 JF |
20 | |
21 | #include <apt-pkg/pkgcache.h> | |
22 | #include <apt-pkg/fileutl.h> | |
00ec24d0 | 23 | #include <vector> |
da6ee469 | 24 | |
0e5943eb | 25 | class pkgRecords /*{{{*/ |
da6ee469 JF |
26 | { |
27 | public: | |
28 | class Parser; | |
29 | ||
30 | private: | |
31 | ||
32 | pkgCache &Cache; | |
00ec24d0 JF |
33 | std::vector<Parser *>Files; |
34 | ||
da6ee469 JF |
35 | public: |
36 | ||
37 | // Lookup function | |
38 | Parser &Lookup(pkgCache::VerFileIterator const &Ver); | |
00ec24d0 | 39 | Parser &Lookup(pkgCache::DescFileIterator const &Desc); |
da6ee469 JF |
40 | |
41 | // Construct destruct | |
42 | pkgRecords(pkgCache &Cache); | |
43 | ~pkgRecords(); | |
44 | }; | |
0e5943eb JF |
45 | /*}}}*/ |
46 | class pkgRecords::Parser /*{{{*/ | |
da6ee469 JF |
47 | { |
48 | protected: | |
49 | ||
50 | virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0; | |
00ec24d0 | 51 | virtual bool Jump(pkgCache::DescFileIterator const &Desc) = 0; |
da6ee469 JF |
52 | |
53 | public: | |
54 | friend class pkgRecords; | |
55 | ||
56 | // These refer to the archive file for the Version | |
57 | virtual string FileName() {return string();}; | |
58 | virtual string MD5Hash() {return string();}; | |
59 | virtual string SHA1Hash() {return string();}; | |
00ec24d0 | 60 | virtual string SHA256Hash() {return string();}; |
da6ee469 | 61 | virtual string SourcePkg() {return string();}; |
00ec24d0 | 62 | virtual string SourceVer() {return string();}; |
da6ee469 | 63 | |
acdafb44 JF |
64 | virtual bool ShortDesc(const char *&Start,const char *&End) {return false;} |
65 | virtual bool LongDesc(const char *&Start,const char *&End) {return false;} | |
66 | ||
da6ee469 JF |
67 | // These are some general stats about the package |
68 | virtual string Maintainer() {return string();}; | |
69 | virtual string ShortDesc() {return string();}; | |
70 | virtual string LongDesc() {return string();}; | |
71 | virtual string Name() {return string();}; | |
00ec24d0 | 72 | virtual string Homepage() {return string();} |
da6ee469 JF |
73 | |
74 | // The record in binary form | |
75 | virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;}; | |
acdafb44 | 76 | virtual bool Find(const char *Tag,const char *&Start, const char *&End) {Start = End = 0; return false;}; |
da6ee469 JF |
77 | |
78 | virtual ~Parser() {}; | |
79 | }; | |
0e5943eb | 80 | /*}}}*/ |
da6ee469 | 81 | #endif |