Source record parsing
[ntk/apt.git] / apt-pkg / srcrecords.h
CommitLineData
11e7af84
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3// $Id: srcrecords.h,v 1.1 1999/04/04 01:17:29 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
23class pkgSrcRecords
24{
25 public:
26
27 class Parser
28 {
29 FileFd *File;
30
31 public:
32
33 virtual bool Restart() = 0;
34 virtual bool Step() = 0;
35 virtual bool Jump(unsigned long Off) = 0;
36 virtual unsigned long Offset() = 0;
37
38 virtual string Package() = 0;
39 virtual string Version() = 0;
40 virtual string Maintainer() = 0;
41 virtual string Section() = 0;
42 virtual const char **Binaries() = 0;
43
44 Parser(FileFd *File) : File(File) {};
45 virtual ~Parser() {delete File;};
46 };
47
48 private:
49
50 // The list of files and the current parser pointer
51 Parser **Files;
52 Parser **Current;
53
54 public:
55
56 // Reset the search
57 bool Restart();
58
59 // Locate a package by name
60 Parser *Find(const char *Package,bool SrcOnly = false);
61
62 pkgSrcRecords(pkgSourceList &List);
63 ~pkgSrcRecords();
64};
65
66
67#endif