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

apt 3.1.16 commandline package manager

debsrcrecords.h
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3/* ######################################################################
4
5 Debian Source Package Records - Parser implementation for Debian style
6 source indexes
7
8 ##################################################################### */
9 /*}}}*/
10#ifndef PKGLIB_DEBSRCRECORDS_H
11#define PKGLIB_DEBSRCRECORDS_H
12
13#include <apt-pkg/fileutl.h>
14#include <apt-pkg/srcrecords.h>
15#include <apt-pkg/tagfile-keys.h>
16#include <apt-pkg/tagfile.h>
17
18#include <cstddef>
19#include <string>
20#include <vector>
21
22class pkgIndexFile;
23
24 class APT_HIDDEN debSrcRecordParser : public pkgSrcRecords::Parser
25{
27 void * const d;
28
29 protected:
30 FileFd Fd;
31 pkgTagFile Tags;
32 pkgTagSection Sect;
33 std::vector<const char*> StaticBinList;
34 unsigned long iOffset;
35 char *Buffer;
36
37 public:
38 bool Restart() override { return Jump(0); }
39 bool Step() override {iOffset = Tags.Offset(); return Tags.Step(Sect);}
40 bool Jump(unsigned long const &Off) override {iOffset = Off; return Tags.Jump(Sect,Off);}
41
42 [[nodiscard]] std::string Package() const override;
43 [[nodiscard]] std::string Version() const override { return std::string{Sect.Find(pkgTagSection::Key::Version)}; }
44 [[nodiscard]] std::string Maintainer() const override { return std::string{Sect.Find(pkgTagSection::Key::Maintainer)}; }
45 [[nodiscard]] std::string Section() const override { return std::string{Sect.Find(pkgTagSection::Key::Section)}; }
46 const char **Binaries() override;
47 bool BuildDepends(std::vector<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true) override;
48 unsigned long Offset() override { return iOffset; }
49 std::string AsStr() override
50 {
51 const char *Start=0,*Stop=0;
52 Sect.GetSection(Start,Stop);
53 return std::string(Start,Stop);
54 };
55 bool Files(std::vector<pkgSrcRecords::File> &F) override;
56
57 debSrcRecordParser(std::string const &File,pkgIndexFile const *Index);
58 ~debSrcRecordParser() override;
59};
60
61 class APT_HIDDEN debDscRecordParser : public debSrcRecordParser
62{
63 public:
64 debDscRecordParser(std::string const &DscFile, pkgIndexFile const *Index);
65};
66
67#endif
FileFd
Definition fileutl.h:43
pkgIndexFile
Definition indexfile.h:103
pkgSrcRecords::Parser
Definition srcrecords.h:39
pkgSrcRecords::Parser::BuildDepends
virtual bool BuildDepends(std::vector< BuildDepRec > &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch=true)=0
pkgTagFile
Definition tagfile.h:186
pkgTagSection
Definition tagfile.h:46