]> git.saurik.com Git - apt.git/blame - apt-pkg/deb/debsrcrecords.h
Merge branch 'debian/sid' into debian/experimental
[apt.git] / apt-pkg / deb / debsrcrecords.h
CommitLineData
11e7af84
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
c33b707e 3// $Id: debsrcrecords.h,v 1.8 2004/03/17 05:58:54 mdz Exp $
11e7af84
AL
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
11e7af84
AL
14#include <apt-pkg/srcrecords.h>
15#include <apt-pkg/tagfile.h>
b2e465d6 16#include <apt-pkg/fileutl.h>
11e7af84 17
453b82a3
DK
18#include <stddef.h>
19#include <string>
20#include <vector>
21
22class pkgIndexFile;
23
11e7af84
AL
24class debSrcRecordParser : public pkgSrcRecords::Parser
25{
ff72bd0d
MV
26 /** \brief dpointer placeholder (for later in case we need it) */
27 void *d;
28
feab34c5 29 protected:
b2e465d6 30 FileFd Fd;
11e7af84
AL
31 pkgTagFile Tags;
32 pkgTagSection Sect;
39fb1e24 33 std::vector<const char*> StaticBinList;
11e7af84 34 unsigned long iOffset;
4ab24e53 35 char *Buffer;
11e7af84
AL
36
37 public:
38
6a9c9d63 39 virtual bool Restart() {return Jump(0);};
11e7af84 40 virtual bool Step() {iOffset = Tags.Offset(); return Tags.Step(Sect);};
41c81fd8 41 virtual bool Jump(unsigned long const &Off) {iOffset = Off; return Tags.Jump(Sect,Off);};
11e7af84 42
8f3ba4e8
DK
43 virtual std::string Package() const {return Sect.FindS("Package");};
44 virtual std::string Version() const {return Sect.FindS("Version");};
45 virtual std::string Maintainer() const {return Sect.FindS("Maintainer");};
46 virtual std::string Section() const {return Sect.FindS("Section");};
11e7af84 47 virtual const char **Binaries();
8f3ba4e8 48 virtual bool BuildDepends(std::vector<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true);
11e7af84 49 virtual unsigned long Offset() {return iOffset;};
8f3ba4e8 50 virtual std::string AsStr()
f8f410f5 51 {
aaee8293 52 const char *Start=0,*Stop=0;
f8f410f5 53 Sect.GetSection(Start,Stop);
8f3ba4e8 54 return std::string(Start,Stop);
f8f410f5 55 };
8f3ba4e8 56 virtual bool Files(std::vector<pkgSrcRecords::File> &F);
b2e465d6 57
8f3ba4e8 58 debSrcRecordParser(std::string const &File,pkgIndexFile const *Index)
6a9c9d63
DK
59 : Parser(Index), Fd(File,FileFd::ReadOnly, FileFd::Extension), Tags(&Fd,102400),
60 iOffset(0), Buffer(NULL) {}
ff72bd0d 61 virtual ~debSrcRecordParser();
11e7af84
AL
62};
63
feab34c5
MV
64class debDscRecordParser : public debSrcRecordParser
65{
66 public:
a49e7948 67 debDscRecordParser(std::string const &DscFile, pkgIndexFile const *Index);
feab34c5
MV
68};
69
11e7af84 70#endif