]> git.saurik.com Git - apt.git/blob - apt-pkg/pkgrecords.h
merge lp:~mvo/apt/abi-break
[apt.git] / apt-pkg / pkgrecords.h
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
21 #include <apt-pkg/pkgcache.h>
22 #include <apt-pkg/fileutl.h>
23 #include <vector>
24
25 class pkgRecords /*{{{*/
26 {
27 public:
28 class Parser;
29
30 private:
31 /** \brief dpointer placeholder (for later in case we need it) */
32 void *d;
33
34 pkgCache &Cache;
35 std::vector<Parser *>Files;
36
37 public:
38 // Lookup function
39 Parser &Lookup(pkgCache::VerFileIterator const &Ver);
40 Parser &Lookup(pkgCache::DescFileIterator const &Desc);
41
42 // Construct destruct
43 pkgRecords(pkgCache &Cache);
44 ~pkgRecords();
45 };
46 /*}}}*/
47 class pkgRecords::Parser /*{{{*/
48 {
49 protected:
50
51 virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0;
52 virtual bool Jump(pkgCache::DescFileIterator const &Desc) = 0;
53
54 public:
55 friend class pkgRecords;
56
57 // These refer to the archive file for the Version
58 virtual string FileName() {return string();};
59 virtual string MD5Hash() {return string();};
60 virtual string SHA1Hash() {return string();};
61 virtual string SHA256Hash() {return string();};
62 virtual string SHA512Hash() {return string();};
63 virtual string SourcePkg() {return string();};
64 virtual string SourceVer() {return string();};
65
66 // These are some general stats about the package
67 virtual string Maintainer() {return string();};
68 virtual string ShortDesc() {return string();};
69 virtual string LongDesc() {return string();};
70 virtual string Name() {return string();};
71 virtual string Homepage() {return string();}
72
73 // The record in binary form
74 virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};
75
76 virtual ~Parser() {};
77 };
78 /*}}}*/
79 #endif