]>
Commit | Line | Data |
---|---|---|
11e7af84 AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
f8f410f5 | 3 | // $Id: srcrecords.h,v 1.5 1999/10/18 03:44:39 jgg Exp $ |
11e7af84 AL |
4 | /* ###################################################################### |
5 | ||
6 | Source Package Records - Allows access to source package records | |
7 | ||
8 | Parses and allows access to the list of source records and searching by | |
9 | source name on that list. | |
10 | ||
11 | ##################################################################### */ | |
12 | /*}}}*/ | |
13 | #ifndef PKGLIB_SRCRECORDS_H | |
14 | #define PKGLIB_SRCRECORDS_H | |
15 | ||
16 | #ifdef __GNUG__ | |
17 | #pragma interface "apt-pkg/srcrecords.h" | |
18 | #endif | |
19 | ||
20 | #include <apt-pkg/fileutl.h> | |
21 | #include <apt-pkg/sourcelist.h> | |
22 | ||
23 | class pkgSrcRecords | |
24 | { | |
25 | public: | |
36f610f1 AL |
26 | |
27 | // Describes a single file | |
28 | struct File | |
29 | { | |
30 | string MD5Hash; | |
31 | unsigned long Size; | |
32 | string Path; | |
33 | }; | |
11e7af84 | 34 | |
36f610f1 | 35 | // Abstract parser for each source record |
11e7af84 AL |
36 | class Parser |
37 | { | |
38 | FileFd *File; | |
36375005 AL |
39 | pkgSourceList::const_iterator SrcItem; |
40 | ||
11e7af84 AL |
41 | public: |
42 | ||
36375005 AL |
43 | inline pkgSourceList::const_iterator Source() const {return SrcItem;}; |
44 | ||
11e7af84 AL |
45 | virtual bool Restart() = 0; |
46 | virtual bool Step() = 0; | |
47 | virtual bool Jump(unsigned long Off) = 0; | |
48 | virtual unsigned long Offset() = 0; | |
f8f410f5 | 49 | virtual string AsStr() = 0; |
11e7af84 AL |
50 | |
51 | virtual string Package() = 0; | |
52 | virtual string Version() = 0; | |
53 | virtual string Maintainer() = 0; | |
54 | virtual string Section() = 0; | |
55 | virtual const char **Binaries() = 0; | |
727f18af | 56 | virtual bool Files(vector<pkgSrcRecords::File> &F) = 0; |
11e7af84 | 57 | |
36375005 AL |
58 | Parser(FileFd *File,pkgSourceList::const_iterator SrcItem) : File(File), |
59 | SrcItem(SrcItem) {}; | |
11e7af84 AL |
60 | virtual ~Parser() {delete File;}; |
61 | }; | |
62 | ||
63 | private: | |
64 | ||
65 | // The list of files and the current parser pointer | |
66 | Parser **Files; | |
67 | Parser **Current; | |
68 | ||
69 | public: | |
70 | ||
71 | // Reset the search | |
72 | bool Restart(); | |
73 | ||
74 | // Locate a package by name | |
75 | Parser *Find(const char *Package,bool SrcOnly = false); | |
76 | ||
77 | pkgSrcRecords(pkgSourceList &List); | |
78 | ~pkgSrcRecords(); | |
79 | }; | |
80 | ||
81 | ||
82 | #endif |