]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/debsrcrecords.h
extend FileFd test behond basic permission tests
[apt.git] / apt-pkg / deb / debsrcrecords.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: debsrcrecords.h,v 1.8 2004/03/17 05:58:54 mdz Exp $
4 /* ######################################################################
5
6 Debian Source Package Records - Parser implementation for Debian style
7 source indexes
8
9 ##################################################################### */
10 /*}}}*/
11 #ifndef PKGLIB_DEBSRCRECORDS_H
12 #define PKGLIB_DEBSRCRECORDS_H
13
14 #include <apt-pkg/srcrecords.h>
15 #include <apt-pkg/tagfile.h>
16 #include <apt-pkg/fileutl.h>
17
18 #include <stddef.h>
19 #include <string>
20 #include <vector>
21
22 class pkgIndexFile;
23
24 class debSrcRecordParser : public pkgSrcRecords::Parser
25 {
26 /** \brief dpointer placeholder (for later in case we need it) */
27 void *d;
28
29 FileFd Fd;
30 pkgTagFile Tags;
31 pkgTagSection Sect;
32 std::vector<const char*> StaticBinList;
33 unsigned long iOffset;
34 char *Buffer;
35
36 public:
37
38 virtual bool Restart() {return Jump(0);};
39 virtual bool Step() {iOffset = Tags.Offset(); return Tags.Step(Sect);};
40 virtual bool Jump(unsigned long const &Off) {iOffset = Off; return Tags.Jump(Sect,Off);};
41
42 virtual std::string Package() const {return Sect.FindS("Package");};
43 virtual std::string Version() const {return Sect.FindS("Version");};
44 virtual std::string Maintainer() const {return Sect.FindS("Maintainer");};
45 virtual std::string Section() const {return Sect.FindS("Section");};
46 virtual const char **Binaries();
47 virtual bool BuildDepends(std::vector<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true);
48 virtual unsigned long Offset() {return iOffset;};
49 virtual std::string AsStr()
50 {
51 const char *Start=0,*Stop=0;
52 Sect.GetSection(Start,Stop);
53 return std::string(Start,Stop);
54 };
55 virtual bool Files(std::vector<pkgSrcRecords::File> &F);
56
57 debSrcRecordParser(std::string const &File,pkgIndexFile const *Index)
58 : Parser(Index), Fd(File,FileFd::ReadOnly, FileFd::Extension), Tags(&Fd,102400),
59 iOffset(0), Buffer(NULL) {}
60 virtual ~debSrcRecordParser();
61 };
62
63 #endif