]> git.saurik.com Git - apt.git/blob - apt-pkg/srcrecords.h
Source record file list parsing
[apt.git] / apt-pkg / srcrecords.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: srcrecords.h,v 1.2 1999/04/04 08:07:39 jgg Exp $
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:
26
27 // Describes a single file
28 struct File
29 {
30 string MD5Hash;
31 unsigned long Size;
32 string Path;
33 };
34
35 // Abstract parser for each source record
36 class Parser
37 {
38 FileFd *File;
39
40 public:
41
42 virtual bool Restart() = 0;
43 virtual bool Step() = 0;
44 virtual bool Jump(unsigned long Off) = 0;
45 virtual unsigned long Offset() = 0;
46
47 virtual string Package() = 0;
48 virtual string Version() = 0;
49 virtual string Maintainer() = 0;
50 virtual string Section() = 0;
51 virtual const char **Binaries() = 0;
52 virtual bool Files(vector<File> &F) = 0;
53
54 Parser(FileFd *File) : File(File) {};
55 virtual ~Parser() {delete File;};
56 };
57
58 private:
59
60 // The list of files and the current parser pointer
61 Parser **Files;
62 Parser **Current;
63
64 public:
65
66 // Reset the search
67 bool Restart();
68
69 // Locate a package by name
70 Parser *Find(const char *Package,bool SrcOnly = false);
71
72 pkgSrcRecords(pkgSourceList &List);
73 ~pkgSrcRecords();
74 };
75
76
77 #endif