apt 3.0.3
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
24class 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 std::string FileName() override;
33 std::string SourcePkg() override;
34 std::string SourceVer() override;
35
36 [[nodiscard]] HashStringList Hashes() const override;
37
38 // These are some general stats about the package
39 std::string Maintainer() override;
40 std::string ShortDesc(std::string const &lang) override;
41 std::string LongDesc(std::string const &lang) override;
42 std::string Name() override;
43 std::string Homepage() override;
44
45 // An arbitrary custom field
46 std::string RecordField(const char *fieldName) override;
47
48 void GetRec(const char *&Start, const char *&Stop) override;
49
51 ~debRecordParserBase() override;
52};
53
54class APT_HIDDEN debRecordParser : public debRecordParserBase
55{
56 void * const d;
57 protected:
58 FileFd File;
59 pkgTagFile Tags;
60
61 bool Jump(pkgCache::VerFileIterator const &Ver) override;
62 bool Jump(pkgCache::DescFileIterator const &Desc) override;
63
64 public:
65 debRecordParser(std::string FileName,pkgCache &Cache);
66 ~debRecordParser() override;
67};
68
69// custom record parser that reads deb files directly
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 &/*Ver*/) override;
80 bool Jump(pkgCache::DescFileIterator const & /*Desc*/) override;
81
82 public:
83 std::string FileName() override;
84
85 explicit debDebFileRecordParser(std::string FileName);
86 ~debDebFileRecordParser() override;
87};
88
89#endif
Definition fileutl.h:43
Definition hashes.h:79
Definition hashes.h:184
Definition debrecords.h:71
Definition debrecords.h:25
Definition debrecords.h:55
Definition cacheiterators.h:47
Definition tagfile.h:186
Definition tagfile.h:46
pkgCache - Structure definitions for the cache file