]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/debrecords.h
38e0719403f2228ec43687e4ef425fb04c117ee9
[apt.git] / apt-pkg / deb / debrecords.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: debrecords.h,v 1.8 2001/03/13 06:51:46 jgg Exp $
4 /* ######################################################################
5
6 Debian Package Records - Parser for debian package records
7
8 This provides display-type parsing for the Packages file. This is
9 different than the the list parser which provides cache generation
10 services. There should be no overlap between these two.
11
12 ##################################################################### */
13 /*}}}*/
14 #ifndef PKGLIB_DEBRECORDS_H
15 #define PKGLIB_DEBRECORDS_H
16
17 #include <apt-pkg/pkgrecords.h>
18 #include <apt-pkg/tagfile.h>
19 #include <apt-pkg/fileutl.h>
20 #include <apt-pkg/pkgcache.h>
21
22 #include <string>
23
24 #ifndef APT_8_CLEANER_HEADERS
25 #include <apt-pkg/indexfile.h>
26 #endif
27
28 class APT_HIDDEN debRecordParserBase : public pkgRecords::Parser
29 {
30 protected:
31 pkgTagSection Section;
32
33 public:
34 // These refer to the archive file for the Version
35 virtual std::string FileName();
36 virtual std::string SourcePkg();
37 virtual std::string SourceVer();
38
39 virtual HashStringList Hashes() const;
40
41 // These are some general stats about the package
42 virtual std::string Maintainer();
43 virtual std::string ShortDesc(std::string const &lang);
44 virtual std::string LongDesc(std::string const &lang);
45 virtual std::string Name();
46 virtual std::string Homepage();
47
48 // An arbitrary custom field
49 virtual std::string RecordField(const char *fieldName);
50
51 virtual void GetRec(const char *&Start,const char *&Stop);
52
53 debRecordParserBase() : Parser() {}
54 virtual ~debRecordParserBase();
55 };
56
57 class APT_HIDDEN debRecordParser : public debRecordParserBase
58 {
59 protected:
60 FileFd File;
61 pkgTagFile Tags;
62
63 virtual bool Jump(pkgCache::VerFileIterator const &Ver);
64 virtual bool Jump(pkgCache::DescFileIterator const &Desc);
65
66 public:
67 debRecordParser(std::string FileName,pkgCache &Cache);
68 virtual ~debRecordParser();
69 };
70
71 // custom record parser that reads deb files directly
72 class APT_HIDDEN debDebFileRecordParser : public debRecordParserBase
73 {
74 std::string debFileName;
75 std::string controlContent;
76
77 APT_HIDDEN bool LoadContent();
78 protected:
79 // single file files, so no jumping whatsoever
80 bool Jump(pkgCache::VerFileIterator const &) { return LoadContent(); }
81 bool Jump(pkgCache::DescFileIterator const &) { return LoadContent(); }
82
83 public:
84 virtual std::string FileName() { return debFileName; }
85
86 debDebFileRecordParser(std::string FileName)
87 : debRecordParserBase(), debFileName(FileName) {};
88 };
89
90 #endif