apt @VERSION@

pkgrecords.h

00001 // -*- mode: cpp; mode: fold -*-
00002 // Description                                                          /*{{{*/
00003 // $Id: pkgrecords.h,v 1.6 2001/03/13 06:51:46 jgg Exp $
00004 /* ######################################################################
00005    
00006    Package Records - Allows access to complete package description records
00007                      directly from the file.
00008    
00009    The package record system abstracts the actual parsing of the 
00010    package files. This is different than the generators parser in that
00011    it is used to access information not generate information. No 
00012    information touched by the generator should be parable from here as
00013    it can always be retreived directly from the cache.
00014    
00015    ##################################################################### */
00016                                                                         /*}}}*/
00017 #ifndef PKGLIB_PKGRECORDS_H
00018 #define PKGLIB_PKGRECORDS_H
00019 
00020 
00021 #include <apt-pkg/pkgcache.h>
00022 #include <apt-pkg/fileutl.h>
00023 #include <vector>
00024 
00025 class pkgRecords                                                        /*{{{*/
00026 {
00027    public:
00028    class Parser;
00029    
00030    private:
00031    
00032    pkgCache &Cache;
00033    std::vector<Parser *>Files;
00034 
00035    public:
00036 
00037    // Lookup function
00038    Parser &Lookup(pkgCache::VerFileIterator const &Ver);
00039    Parser &Lookup(pkgCache::DescFileIterator const &Desc);
00040 
00041    // Construct destruct
00042    pkgRecords(pkgCache &Cache);
00043    ~pkgRecords();
00044 };
00045                                                                         /*}}}*/
00046 class pkgRecords::Parser                                                /*{{{*/
00047 {
00048    protected:
00049    
00050    virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0;
00051    virtual bool Jump(pkgCache::DescFileIterator const &Desc) = 0;
00052    
00053    public:
00054    friend class pkgRecords;
00055    
00056    // These refer to the archive file for the Version
00057    virtual string FileName() {return string();};
00058    virtual string MD5Hash() {return string();};
00059    virtual string SHA1Hash() {return string();};
00060    virtual string SHA256Hash() {return string();};
00061    virtual string SourcePkg() {return string();};
00062    virtual string SourceVer() {return string();};
00063 
00064    // These are some general stats about the package
00065    virtual string Maintainer() {return string();};
00066    virtual string ShortDesc() {return string();};
00067    virtual string LongDesc() {return string();};
00068    virtual string Name() {return string();};
00069    virtual string Homepage() {return string();}
00070    
00071    // The record in binary form
00072    virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};
00073    
00074    virtual ~Parser() {};
00075 };
00076                                                                         /*}}}*/
00077 #endif