apt @VERSION@
debsrcrecords.h
00001 // -*- mode: cpp; mode: fold -*-
00002 // Description                                                          /*{{{*/
00003 // $Id: debsrcrecords.h,v 1.8 2004/03/17 05:58:54 mdz Exp $
00004 /* ######################################################################
00005    
00006    Debian Source Package Records - Parser implementation for Debian style
00007                                    source indexes
00008    
00009    ##################################################################### */
00010                                                                         /*}}}*/
00011 #ifndef PKGLIB_DEBSRCRECORDS_H
00012 #define PKGLIB_DEBSRCRECORDS_H
00013 
00014 
00015 #include <apt-pkg/srcrecords.h>
00016 #include <apt-pkg/tagfile.h>
00017 #include <apt-pkg/fileutl.h>
00018 
00019 class debSrcRecordParser : public pkgSrcRecords::Parser
00020 {
00022    void *d;
00023 
00024    FileFd Fd;
00025    pkgTagFile Tags;
00026    pkgTagSection Sect;
00027    char *StaticBinList[400];
00028    unsigned long iOffset;
00029    char *Buffer;
00030    unsigned int BufSize;
00031    
00032    public:
00033 
00034    virtual bool Restart() {return Tags.Jump(Sect,0);};
00035    virtual bool Step() {iOffset = Tags.Offset(); return Tags.Step(Sect);};
00036    virtual bool Jump(unsigned long const &Off) {iOffset = Off; return Tags.Jump(Sect,Off);};
00037 
00038    virtual string Package() const {return Sect.FindS("Package");};
00039    virtual string Version() const {return Sect.FindS("Version");};
00040    virtual string Maintainer() const {return Sect.FindS("Maintainer");};
00041    virtual string Section() const {return Sect.FindS("Section");};
00042    virtual const char **Binaries();
00043    virtual bool BuildDepends(vector<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true);
00044    virtual unsigned long Offset() {return iOffset;};
00045    virtual string AsStr() 
00046    {
00047       const char *Start=0,*Stop=0;
00048       Sect.GetSection(Start,Stop);
00049       return string(Start,Stop);
00050    };
00051    virtual bool Files(vector<pkgSrcRecords::File> &F);
00052 
00053    debSrcRecordParser(string const &File,pkgIndexFile const *Index) 
00054       : Parser(Index), Fd(File,FileFd::ReadOnlyGzip), Tags(&Fd,102400), 
00055         Buffer(0), BufSize(0) {}
00056    virtual ~debSrcRecordParser();
00057 };
00058 
00059 #endif