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 {
00021    FileFd Fd;
00022    pkgTagFile Tags;
00023    pkgTagSection Sect;
00024    char *StaticBinList[400];
00025    unsigned long iOffset;
00026    char *Buffer;
00027    unsigned int BufSize;
00028    
00029    public:
00030 
00031    virtual bool Restart() {return Tags.Jump(Sect,0);};
00032    virtual bool Step() {iOffset = Tags.Offset(); return Tags.Step(Sect);};
00033    virtual bool Jump(unsigned long const &Off) {iOffset = Off; return Tags.Jump(Sect,Off);};
00034 
00035    virtual string Package() const {return Sect.FindS("Package");};
00036    virtual string Version() const {return Sect.FindS("Version");};
00037    virtual string Maintainer() const {return Sect.FindS("Maintainer");};
00038    virtual string Section() const {return Sect.FindS("Section");};
00039    virtual const char **Binaries();
00040    virtual bool BuildDepends(vector<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true);
00041    virtual unsigned long Offset() {return iOffset;};
00042    virtual string AsStr() 
00043    {
00044       const char *Start=0,*Stop=0;
00045       Sect.GetSection(Start,Stop);
00046       return string(Start,Stop);
00047    };
00048    virtual bool Files(vector<pkgSrcRecords::File> &F);
00049 
00050    debSrcRecordParser(string const &File,pkgIndexFile const *Index) 
00051       : Parser(Index), Fd(File,FileFd::ReadOnlyGzip), Tags(&Fd,102400), 
00052         Buffer(0), BufSize(0) {}
00053    ~debSrcRecordParser();
00054 };
00055 
00056 #endif