apt: apt-pkg/deb/debrecords.h Source File

apt 2.9.8 commandline package manager

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