* apt-pkg/cdrom.cc:
[ntk/apt.git] / apt-pkg / pkgrecords.h
CommitLineData
f55ece0e
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
a7c835af 3// $Id: pkgrecords.h,v 1.6 2001/03/13 06:51:46 jgg Exp $
f55ece0e
AL
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 /*}}}*/
f55ece0e
AL
17#ifndef PKGLIB_PKGRECORDS_H
18#define PKGLIB_PKGRECORDS_H
19
20#ifdef __GNUG__
21#pragma interface "apt-pkg/pkgrecords.h"
22#endif
23
24#include <apt-pkg/pkgcache.h>
25#include <apt-pkg/fileutl.h>
d715b9c9 26#include <vector>
f55ece0e
AL
27
28class pkgRecords
29{
30 public:
31 class Parser;
32
33 private:
34
35 pkgCache &Cache;
d715b9c9
MV
36 std::vector<Parser *>Files;
37
f55ece0e
AL
38 public:
39
40 // Lookup function
03e39e59 41 Parser &Lookup(pkgCache::VerFileIterator const &Ver);
a52f938b 42 Parser &Lookup(pkgCache::DescFileIterator const &Desc);
03e39e59 43
f55ece0e
AL
44 // Construct destruct
45 pkgRecords(pkgCache &Cache);
46 ~pkgRecords();
47};
48
49class pkgRecords::Parser
50{
7e798dd7 51 protected:
f55ece0e 52
03e39e59 53 virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0;
a52f938b 54 virtual bool Jump(pkgCache::DescFileIterator const &Desc) = 0;
f55ece0e 55
7e798dd7 56 public:
b2e465d6 57 friend class pkgRecords;
7e798dd7
AL
58
59 // These refer to the archive file for the Version
60 virtual string FileName() {return string();};
61 virtual string MD5Hash() {return string();};
a7c835af 62 virtual string SHA1Hash() {return string();};
36375005 63 virtual string SourcePkg() {return string();};
b2e465d6 64
7e798dd7
AL
65 // These are some general stats about the package
66 virtual string Maintainer() {return string();};
67 virtual string ShortDesc() {return string();};
68 virtual string LongDesc() {return string();};
b2e465d6
AL
69 virtual string Name() {return string();};
70
71 // The record in binary form
72 virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};
73
f55ece0e
AL
74 virtual ~Parser() {};
75};
76
77#endif