]> git.saurik.com Git - apt.git/blame_incremental - apt-pkg/pkgrecords.h
* merged with apt--debian-sid
[apt.git] / apt-pkg / pkgrecords.h
... / ...
CommitLineData
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
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>
26
27class pkgRecords
28{
29 public:
30 class Parser;
31
32 private:
33
34 pkgCache &Cache;
35 Parser **Files;
36
37 public:
38
39 // Lookup function
40 Parser &Lookup(pkgCache::VerFileIterator const &Ver);
41 Parser &Lookup(pkgCache::DescFileIterator const &Desc);
42
43 // Construct destruct
44 pkgRecords(pkgCache &Cache);
45 ~pkgRecords();
46};
47
48class pkgRecords::Parser
49{
50 protected:
51
52 virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0;
53 virtual bool Jump(pkgCache::DescFileIterator const &Desc) = 0;
54
55 public:
56 friend class pkgRecords;
57
58 // These refer to the archive file for the Version
59 virtual string FileName() {return string();};
60 virtual string MD5Hash() {return string();};
61 virtual string SHA1Hash() {return string();};
62 virtual string SourcePkg() {return string();};
63
64 // These are some general stats about the package
65 virtual string Maintainer() {return string();};
66 virtual string ShortDesc() {return string();};
67 virtual string LongDesc() {return string();};
68 virtual string Name() {return string();};
69
70 // The record in binary form
71 virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};
72
73 virtual ~Parser() {};
74};
75
76#endif