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