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 <vector>
00023 
00024 class pkgRecords                                                        /*{{{*/
00025 {
00026    public:
00027    class Parser;
00028    
00029    private:
00031    void *d;
00032    
00033    pkgCache &Cache;
00034    std::vector<Parser *>Files;
00035 
00036     public:
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 SHA512Hash() {return string();};
00062    virtual string SourcePkg() {return string();};
00063    virtual string SourceVer() {return string();};
00064 
00065    // These are some general stats about the package
00066    virtual string Maintainer() {return string();};
00067    virtual string ShortDesc() {return string();};
00068    virtual string LongDesc() {return string();};
00069    virtual string Name() {return string();};
00070    virtual string Homepage() {return string();}
00071 
00072    // An arbitrary custom field
00073    virtual string RecordField(const char *fieldName) { return string();};
00074 
00075    // The record in binary form
00076    virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};
00077    
00078    virtual ~Parser() {};
00079 };
00080                                                                         /*}}}*/
00081 #endif